effect-browserbase 0.1.0-beta.104 → 0.2.0-beta.0

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 (135) hide show
  1. package/README.md +61 -305
  2. package/dist/Account.d.mts +4 -6
  3. package/dist/Account.mjs +4 -9
  4. package/dist/Account.mjs.map +1 -1
  5. package/dist/{Acquisition-WBafHwXH.mjs → Acquisition-D8o4jtCg.mjs} +22 -68
  6. package/dist/Acquisition-D8o4jtCg.mjs.map +1 -0
  7. package/dist/Agents.d.mts +4 -6
  8. package/dist/Agents.mjs +3 -19
  9. package/dist/Agents.mjs.map +1 -1
  10. package/dist/Allocation.d.mts +9 -11
  11. package/dist/Allocation.mjs +2 -4
  12. package/dist/Allocation.mjs.map +1 -1
  13. package/dist/Browser.d.mts +23 -141
  14. package/dist/Browser.mjs +208 -164
  15. package/dist/Browser.mjs.map +1 -1
  16. package/dist/BrowserBinding.d.mts +7 -34
  17. package/dist/BrowserBinding.mjs +30 -1
  18. package/dist/BrowserBinding.mjs.map +1 -0
  19. package/dist/Certificates.d.mts +3 -5
  20. package/dist/Certificates.mjs +2 -7
  21. package/dist/Certificates.mjs.map +1 -1
  22. package/dist/{Cleanup-G2YpTCuU.d.mts → Cleanup-DMTDBir8.d.mts} +5 -6
  23. package/dist/Cleanup.d.mts +3 -2
  24. package/dist/Cleanup.mjs +1 -6
  25. package/dist/Cleanup.mjs.map +1 -1
  26. package/dist/{Client-D1_xYM9o.mjs → Client-BQteUePT.mjs} +2 -4
  27. package/dist/{Client-D1_xYM9o.mjs.map → Client-BQteUePT.mjs.map} +1 -1
  28. package/dist/Client.d.mts +51 -2
  29. package/dist/Client.mjs +1 -1
  30. package/dist/Connection-DcvJZEdc.mjs +65 -0
  31. package/dist/Connection-DcvJZEdc.mjs.map +1 -0
  32. package/dist/ContextCoordination.d.mts +5 -6
  33. package/dist/ContextCoordination.mjs +1 -8
  34. package/dist/ContextCoordination.mjs.map +1 -1
  35. package/dist/Contexts.d.mts +4 -6
  36. package/dist/Contexts.mjs +2 -8
  37. package/dist/Contexts.mjs.map +1 -1
  38. package/dist/Downloads.d.mts +6 -8
  39. package/dist/Downloads.mjs +3 -8
  40. package/dist/Downloads.mjs.map +1 -1
  41. package/dist/Errors.d.mts +3 -26
  42. package/dist/Errors.mjs +1 -137
  43. package/dist/Errors.mjs.map +1 -1
  44. package/dist/{Extensions-ClZbYb1H.mjs → Extensions-nMNMPGCc.mjs} +3 -9
  45. package/dist/{Extensions-ClZbYb1H.mjs.map → Extensions-nMNMPGCc.mjs.map} +1 -1
  46. package/dist/Extensions.d.mts +4 -6
  47. package/dist/Extensions.mjs +1 -1
  48. package/dist/Functions.d.mts +4 -6
  49. package/dist/Functions.mjs +3 -17
  50. package/dist/Functions.mjs.map +1 -1
  51. package/dist/{Launch-BHcAEq05.mjs → Launch-m0fxzJ49.mjs} +5 -5
  52. package/dist/Launch-m0fxzJ49.mjs.map +1 -0
  53. package/dist/Launch.d.mts +130 -2
  54. package/dist/Launch.mjs +4 -11
  55. package/dist/Launch.mjs.map +1 -1
  56. package/dist/PageFetch.d.mts +3 -5
  57. package/dist/PageFetch.mjs +2 -8
  58. package/dist/PageFetch.mjs.map +1 -1
  59. package/dist/Projects.d.mts +3 -5
  60. package/dist/Projects.mjs +2 -8
  61. package/dist/Projects.mjs.map +1 -1
  62. package/dist/Recordings.d.mts +6 -8
  63. package/dist/Recordings.mjs +3 -5
  64. package/dist/Recordings.mjs.map +1 -1
  65. package/dist/{References-URDAtapt.d.mts → References-DOH3Wu44.d.mts} +5 -6
  66. package/dist/References.d.mts +3 -2
  67. package/dist/References.mjs +10 -18
  68. package/dist/References.mjs.map +1 -1
  69. package/dist/Replays.d.mts +6 -8
  70. package/dist/Replays.mjs +3 -5
  71. package/dist/Replays.mjs.map +1 -1
  72. package/dist/Search.d.mts +3 -5
  73. package/dist/Search.mjs +2 -9
  74. package/dist/Search.mjs.map +1 -1
  75. package/dist/{SessionData-DRKcKCqw.d.mts → SessionData-5xYZDshJ.d.mts} +5 -6
  76. package/dist/SessionData.d.mts +3 -2
  77. package/dist/SessionData.mjs +1 -8
  78. package/dist/SessionData.mjs.map +1 -1
  79. package/dist/{Sessions-CtbseWEh.mjs → Sessions-DoQGg9nB.mjs} +34 -18
  80. package/dist/Sessions-DoQGg9nB.mjs.map +1 -0
  81. package/dist/{Sessions-B8E4kMxo.d.mts → Sessions-tFJYaXFq.d.mts} +8 -8
  82. package/dist/Sessions.d.mts +4 -3
  83. package/dist/Sessions.mjs +1 -1
  84. package/dist/{Transfers-Czv5IZzJ.d.mts → Transfers-GVqzrDWl.d.mts} +22 -9
  85. package/dist/Transfers.d.mts +3 -2
  86. package/dist/Transfers.mjs +12 -28
  87. package/dist/Transfers.mjs.map +1 -1
  88. package/dist/Uploads.d.mts +6 -8
  89. package/dist/Uploads.mjs +3 -5
  90. package/dist/Uploads.mjs.map +1 -1
  91. package/dist/Webhooks.d.mts +3 -5
  92. package/dist/Webhooks.mjs +2 -11
  93. package/dist/Webhooks.mjs.map +1 -1
  94. package/dist/{WriterFacts-osvYAsIx.d.mts → WriterFacts-5CPBGG1P.d.mts} +4 -3
  95. package/dist/index.d.mts +27 -31
  96. package/dist/index.mjs +26 -31
  97. package/package.json +3 -28
  98. package/dist/Acquisition-WBafHwXH.mjs.map +0 -1
  99. package/dist/Association-CEps4hYP.mjs +0 -10
  100. package/dist/Association-CEps4hYP.mjs.map +0 -1
  101. package/dist/Bootstrap-BXuzZojd.mjs +0 -194
  102. package/dist/Bootstrap-BXuzZojd.mjs.map +0 -1
  103. package/dist/Bootstrap-m7lHgj0D.d.mts +0 -177
  104. package/dist/Bootstrap.d.mts +0 -2
  105. package/dist/Bootstrap.mjs +0 -2
  106. package/dist/BrowserBinding-DlJTGYZL.mjs +0 -2508
  107. package/dist/BrowserBinding-DlJTGYZL.mjs.map +0 -1
  108. package/dist/BrowserData-LpcAuAub.d.mts +0 -369
  109. package/dist/BrowserData.d.mts +0 -2
  110. package/dist/BrowserData.mjs +0 -442
  111. package/dist/BrowserData.mjs.map +0 -1
  112. package/dist/Capture-Bc0z9IAi.mjs +0 -571
  113. package/dist/Capture-Bc0z9IAi.mjs.map +0 -1
  114. package/dist/Capture-BvWI-l1A.d.mts +0 -168
  115. package/dist/Capture.d.mts +0 -2
  116. package/dist/Capture.mjs +0 -2
  117. package/dist/Client-Ca0zSg1n.d.mts +0 -53
  118. package/dist/Images-DgscEfSf.mjs +0 -127
  119. package/dist/Images-DgscEfSf.mjs.map +0 -1
  120. package/dist/Launch-BHcAEq05.mjs.map +0 -1
  121. package/dist/Launch-C8CfaYxb.d.mts +0 -132
  122. package/dist/LocalBrowser-BLancJ3R.d.mts +0 -79
  123. package/dist/LocalBrowser-DsQLWNL1.mjs +0 -439
  124. package/dist/LocalBrowser-DsQLWNL1.mjs.map +0 -1
  125. package/dist/LocalBrowser.d.mts +0 -2
  126. package/dist/LocalBrowser.mjs +0 -2
  127. package/dist/PageControl.d.mts +0 -16
  128. package/dist/PageControl.mjs +0 -36
  129. package/dist/PageControl.mjs.map +0 -1
  130. package/dist/PageControlAssociation-DabEg5AR.mjs +0 -10
  131. package/dist/PageControlAssociation-DabEg5AR.mjs.map +0 -1
  132. package/dist/Session-D4nT9hOO.mjs +0 -1379
  133. package/dist/Session-D4nT9hOO.mjs.map +0 -1
  134. package/dist/Sessions-CtbseWEh.mjs.map +0 -1
  135. package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
@@ -1,17 +1,13 @@
1
- import { o as SessionReference } from "./References-URDAtapt.mjs";
1
+ import { a as SessionReference } from "./References-DOH3Wu44.mjs";
2
2
  import { Schema } from "effect";
3
- declare namespace Transfers_d_exports {
4
- export { ArtifactTransferPolicy, DownloadMetadata, DownloadObservation, PositiveInt, RecordingBatch, RecordingPage, RecordingPageReference, RemoteFilePath, ReplayPage, SafeFilename, UploadReceipt };
5
- }
6
- declare const PositiveInt: Schema.Int;
3
+ import { InlineFile, PositiveInt, SafeFilename as SafeFilename$1 } from "effect-browser/browser-data";
4
+ //#region src/Transfers.d.ts
7
5
  /** Shared caller-owned transfer bounds. Omitted timeout retains the 60-second default. */
8
6
  declare const ArtifactTransferPolicy: Schema.Struct<{
9
7
  readonly maxBytes: Schema.Int;
10
8
  readonly timeoutMillis: Schema.optionalKey<Schema.Int>;
11
9
  }>;
12
10
  type ArtifactTransferPolicy = typeof ArtifactTransferPolicy.Type;
13
- /** Portable basename only; never a local or remote filesystem path. */
14
- declare const SafeFilename: Schema.NonEmptyString;
15
11
  /**
16
12
  * A path the provider reported for a file it already holds. It is only ever decoded from a
17
13
  * provider response: no caller, and certainly no model, names a remote filesystem path.
@@ -71,6 +67,23 @@ declare const ReplayPage_base: Schema.Class<ReplayPage, Schema.Struct<{
71
67
  readonly endTimeMs: Schema.Finite;
72
68
  }>, {}>;
73
69
  declare class ReplayPage extends ReplayPage_base {}
70
+ /**
71
+ * The uploaded branch carries receipts, not paths. Attachment authority is the identity of a
72
+ * receipt this package issued for this exact session, so decoding one back into a new value
73
+ * would discard the very evidence being checked.
74
+ */
75
+ type FileSelection = {
76
+ readonly _tag: "Inline";
77
+ readonly files: ReadonlyArray<InlineFile>;
78
+ } | {
79
+ readonly _tag: "Uploaded";
80
+ readonly uploads: ReadonlyArray<UploadReceipt>;
81
+ };
82
+ interface SelectFilesRequest {
83
+ readonly selector: string;
84
+ readonly selection: FileSelection;
85
+ }
74
86
  //#endregion
75
- export { RecordingBatch as a, RemoteFilePath as c, Transfers_d_exports as d, UploadReceipt as f, PositiveInt as i, ReplayPage as l, DownloadMetadata as n, RecordingPage as o, DownloadObservation as r, RecordingPageReference as s, ArtifactTransferPolicy as t, SafeFilename as u };
76
- //# sourceMappingURL=Transfers-Czv5IZzJ.d.mts.map
87
+ export { PositiveInt as a, RecordingPageReference as c, SafeFilename$1 as d, SelectFilesRequest as f, FileSelection as i, RemoteFilePath as l, DownloadMetadata as n, RecordingBatch as o, UploadReceipt as p, DownloadObservation as r, RecordingPage as s, ArtifactTransferPolicy as t, ReplayPage as u };
88
+ export {};
89
+ //# sourceMappingURL=Transfers-GVqzrDWl.d.mts.map
@@ -1,2 +1,3 @@
1
- import { a as RecordingBatch, c as RemoteFilePath, f as UploadReceipt, i as PositiveInt, l as ReplayPage, n as DownloadMetadata, o as RecordingPage, r as DownloadObservation, s as RecordingPageReference, t as ArtifactTransferPolicy, u as SafeFilename } from "./Transfers-Czv5IZzJ.mjs";
2
- export { ArtifactTransferPolicy, DownloadMetadata, DownloadObservation, PositiveInt, RecordingBatch, RecordingPage, RecordingPageReference, RemoteFilePath, ReplayPage, SafeFilename, UploadReceipt };
1
+ import { a as PositiveInt, c as RecordingPageReference, d as SafeFilename, f as SelectFilesRequest, i as FileSelection, l as RemoteFilePath, n as DownloadMetadata, o as RecordingBatch, p as UploadReceipt, r as DownloadObservation, s as RecordingPage, t as ArtifactTransferPolicy, u as ReplayPage } from "./Transfers-GVqzrDWl.mjs";
2
+ export { ArtifactTransferPolicy, DownloadMetadata, DownloadObservation, FileSelection, PositiveInt, RecordingBatch, RecordingPage, RecordingPageReference, RemoteFilePath, ReplayPage, SafeFilename, SelectFilesRequest, UploadReceipt };
3
+ export {};
@@ -1,21 +1,7 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Identifier, SessionReference } from "./References.mjs";
1
+ import { Identifier as Identifier$1, SessionReference } from "./References.mjs";
3
2
  import { Schema } from "effect";
3
+ import { PositiveInt, SafeFilename, SafeFilename as SafeFilename$1 } from "effect-browser/browser-data";
4
4
  //#region src/Transfers.ts
5
- var Transfers_exports = /* @__PURE__ */ __exportAll({
6
- ArtifactTransferPolicy: () => ArtifactTransferPolicy,
7
- DownloadMetadata: () => DownloadMetadata,
8
- DownloadObservation: () => DownloadObservation,
9
- PositiveInt: () => PositiveInt,
10
- RecordingBatch: () => RecordingBatch,
11
- RecordingPage: () => RecordingPage,
12
- RecordingPageReference: () => RecordingPageReference,
13
- RemoteFilePath: () => RemoteFilePath,
14
- ReplayPage: () => ReplayPage,
15
- SafeFilename: () => SafeFilename,
16
- UploadReceipt: () => UploadReceipt
17
- });
18
- const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));
19
5
  /** Shared caller-owned transfer bounds. Omitted timeout retains the 60-second default. */
20
6
  const ArtifactTransferPolicy = Schema.Struct({
21
7
  maxBytes: Schema.Int.check(Schema.isBetween({
@@ -27,8 +13,6 @@ const ArtifactTransferPolicy = Schema.Struct({
27
13
  maximum: 6e5
28
14
  })))
29
15
  });
30
- /** Portable basename only; never a local or remote filesystem path. */
31
- const SafeFilename = Schema.NonEmptyString.check(Schema.isMaxLength(240), Schema.makeFilter((value) => value !== "." && value !== ".." && !/[\x00-\x1f\x7f/\\:]/.test(value) && !/[. ]$/.test(value) && !/^\s/.test(value) && !/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\.|$)/i.test(value), { title: "a portable, non-path download filename" }));
32
16
  /**
33
17
  * A path the provider reported for a file it already holds. It is only ever decoded from a
34
18
  * provider response: no caller, and certainly no model, names a remote filesystem path.
@@ -40,15 +24,15 @@ const RemoteFilePath = Schema.NonEmptyString.check(Schema.isMaxLength(4096), Sch
40
24
  */
41
25
  var UploadReceipt = class extends Schema.Class("BrowserbaseUploadReceipt")({
42
26
  reference: SessionReference,
43
- filename: SafeFilename,
27
+ filename: SafeFilename$1,
44
28
  bytes: Schema.Natural,
45
29
  remotePath: Schema.optionalKey(RemoteFilePath),
46
30
  acknowledgement: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024)))
47
31
  }) {};
48
32
  var DownloadMetadata = class extends Schema.Class("BrowserbaseDownloadMetadata")({
49
- id: Identifier,
50
- sessionId: Identifier,
51
- filename: SafeFilename,
33
+ id: Identifier$1,
34
+ sessionId: Identifier$1,
35
+ filename: SafeFilename$1,
52
36
  mimeType: Schema.NonEmptyString.check(Schema.isMaxLength(128)),
53
37
  size: Schema.Natural,
54
38
  checksum: Schema.String.check(Schema.isPattern(/^[a-fA-F0-9]{64}$/)),
@@ -57,8 +41,8 @@ var DownloadMetadata = class extends Schema.Class("BrowserbaseDownloadMetadata")
57
41
  /** A native event identity is not a provider download ID. Associate provider metadata explicitly. */
58
42
  var DownloadObservation = class extends Schema.Class("BrowserbaseDownloadObservation")({
59
43
  reference: SessionReference,
60
- downloadId: Identifier,
61
- filename: SafeFilename,
44
+ downloadId: Identifier$1,
45
+ filename: SafeFilename$1,
62
46
  state: Schema.Literals([
63
47
  "started",
64
48
  "completed",
@@ -68,10 +52,10 @@ var DownloadObservation = class extends Schema.Class("BrowserbaseDownloadObserva
68
52
  }) {};
69
53
  var RecordingPageReference = class extends Schema.Class("BrowserbaseRecordingPageReference")({
70
54
  session: SessionReference,
71
- pageId: Identifier
55
+ pageId: Identifier$1
72
56
  }) {};
73
57
  var RecordingPage = class extends Schema.Class("BrowserbaseRecordingPage")({
74
- pageId: Identifier,
58
+ pageId: Identifier$1,
75
59
  status: Schema.Literals([
76
60
  "NOT_REQUESTED",
77
61
  "PENDING",
@@ -91,11 +75,11 @@ var RecordingBatch = class extends Schema.Class("BrowserbaseRecordingBatch")({
91
75
  timedOut: Schema.Boolean
92
76
  }) {};
93
77
  var ReplayPage = class extends Schema.Class("BrowserbaseReplayPage")({
94
- pageId: Identifier,
78
+ pageId: Identifier$1,
95
79
  startTimeMs: Schema.Finite,
96
80
  endTimeMs: Schema.Finite
97
81
  }) {};
98
82
  //#endregion
99
- export { ArtifactTransferPolicy, DownloadMetadata, DownloadObservation, PositiveInt, RecordingBatch, RecordingPage, RecordingPageReference, RemoteFilePath, ReplayPage, SafeFilename, UploadReceipt, Transfers_exports as t };
83
+ export { ArtifactTransferPolicy, DownloadMetadata, DownloadObservation, PositiveInt, RecordingBatch, RecordingPage, RecordingPageReference, RemoteFilePath, ReplayPage, SafeFilename, UploadReceipt };
100
84
 
101
85
  //# sourceMappingURL=Transfers.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Transfers.mjs","names":[],"sources":["../src/Transfers.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport { Identifier, SessionReference } from \"./References.ts\";\n\nexport const PositiveInt = Schema.Int.check(Schema.isGreaterThan(0));\n\n/** Shared caller-owned transfer bounds. Omitted timeout retains the 60-second default. */\nexport const ArtifactTransferPolicy = Schema.Struct({\n maxBytes: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 2 ** 31 - 1 })),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\nexport type ArtifactTransferPolicy = typeof ArtifactTransferPolicy.Type;\n\n/** Portable basename only; never a local or remote filesystem path. */\nexport const SafeFilename = Schema.NonEmptyString.check(\n Schema.isMaxLength(240),\n Schema.makeFilter(\n (value) =>\n value !== \".\" &&\n value !== \"..\" &&\n !/[\\x00-\\x1f\\x7f/\\\\:]/.test(value) &&\n !/[. ]$/.test(value) &&\n !/^\\s/.test(value) &&\n !/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(?:\\.|$)/i.test(value),\n { title: \"a portable, non-path download filename\" },\n ),\n);\n\n/**\n * A path the provider reported for a file it already holds. It is only ever decoded from a\n * provider response: no caller, and certainly no model, names a remote filesystem path.\n */\nexport const RemoteFilePath = Schema.NonEmptyString.check(\n Schema.isMaxLength(4096),\n Schema.makeFilter(\n (value) =>\n value.startsWith(\"/\") &&\n !value.includes(\"\\\\\") &&\n !value.includes(\"//\") &&\n ![...value].some((character) => character < \" \" || character === \"\\x7f\") &&\n value.split(\"/\").every((segment) => segment !== \".\" && segment !== \"..\"),\n { title: \"an absolute, traversal-free remote path\" },\n ),\n);\n\n/**\n * Evidence of one accepted upload. `remotePath` exists only when the provider returned one;\n * its absence is reported rather than guessed, and attachment is refused without it.\n */\nexport class UploadReceipt extends Schema.Class<UploadReceipt>(\"BrowserbaseUploadReceipt\")({\n reference: SessionReference,\n filename: SafeFilename,\n bytes: Schema.Natural,\n remotePath: Schema.optionalKey(RemoteFilePath),\n acknowledgement: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n}) {}\n\nexport class DownloadMetadata extends Schema.Class<DownloadMetadata>(\"BrowserbaseDownloadMetadata\")(\n {\n id: Identifier,\n sessionId: Identifier,\n filename: SafeFilename,\n mimeType: Schema.NonEmptyString.check(Schema.isMaxLength(128)),\n size: Schema.Natural,\n checksum: Schema.String.check(Schema.isPattern(/^[a-fA-F0-9]{64}$/)),\n createdAt: Schema.NonEmptyString.check(Schema.isMaxLength(64)),\n },\n) {}\n\n/** A native event identity is not a provider download ID. Associate provider metadata explicitly. */\nexport class DownloadObservation extends Schema.Class<DownloadObservation>(\n \"BrowserbaseDownloadObservation\",\n)({\n reference: SessionReference,\n downloadId: Identifier,\n filename: SafeFilename,\n state: Schema.Literals([\"started\", \"completed\", \"failed\", \"unknown\"]),\n}) {}\n\nexport class RecordingPageReference extends Schema.Class<RecordingPageReference>(\n \"BrowserbaseRecordingPageReference\",\n)({\n session: SessionReference,\n pageId: Identifier,\n}) {}\n\nexport class RecordingPage extends Schema.Class<RecordingPage>(\"BrowserbaseRecordingPage\")({\n pageId: Identifier,\n status: Schema.Literals([\"NOT_REQUESTED\", \"PENDING\", \"COMPLETED\", \"FAILED\"]),\n delivery: Schema.Literals([\"not-ready\", \"download\", \"external-storage\"]),\n completedAt: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))),\n}) {}\n\nexport class RecordingBatch extends Schema.Class<RecordingBatch>(\"BrowserbaseRecordingBatch\")({\n reference: SessionReference,\n pages: Schema.Array(RecordingPage).check(Schema.isMaxLength(256)),\n timedOut: Schema.Boolean,\n}) {}\n\nexport class ReplayPage extends Schema.Class<ReplayPage>(\"BrowserbaseReplayPage\")({\n pageId: Identifier,\n startTimeMs: Schema.Finite,\n endTimeMs: Schema.Finite,\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA,MAAa,cAAc,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;;AAGnE,MAAa,yB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MAAM,OAAO;CACb,UAAU,OAAO,OAAO,MAAM,OAAO,UAAU,mBAAmB,CAAC;CACnE,WAAW,OAAO,eAAe,MAAM,OAAO,YAAY,EAAE,CAAC;AAC/D,CACF,CAAC,CAAC,CAAC;;AAGH,IAAa,sBAAb,cAAyC,OAAO,MAC9C,gCACF,CAAC,CAAC;CACA,WAAW;CACX,YAAY;CACZ,UAAU;CACV,OAAO,OAAO,SAAS;EAAC;EAAW;EAAa;EAAU;CAAS,CAAC;AACtE,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,yBAAb,cAA4C,OAAO,MACjD,mCACF,CAAC,CAAC;CACA,SAAS;CACT,QAAQ;AACV,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,gBAAb,cAAmC,OAAO,MAAqB,0BAA0B,CAAC,CAAC;CACzF,QAAQ;CACR,QAAQ,OAAO,SAAS;EAAC;EAAiB;EAAW;EAAa;CAAQ,CAAC;CAC3E,UAAU,OAAO,SAAS;EAAC;EAAa;EAAY;CAAkB,CAAC;CACvE,aAAa,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,iBAAb,cAAoC,OAAO,MAAsB,2BAA2B,CAAC,CAAC;CAC5F,WAAW;CACX,OAAO,OAAO,MAAM,aAAa,CAAC,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC;CAChE,UAAU,OAAO;AACnB,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,aAAb,cAAgC,OAAO,MAAkB,uBAAuB,CAAC,CAAC;CAChF,QAAQ;CACR,aAAa,OAAO;CACpB,WAAW,OAAO;AACpB,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Transfers.mjs","names":["SafeFilename","Identifier"],"sources":["../src/Transfers.ts"],"sourcesContent":["import { Schema } from \"effect\";\nimport { type InlineFile, SafeFilename } from \"effect-browser/browser-data\";\n\nexport { PositiveInt, SafeFilename } from \"effect-browser/browser-data\";\n\nimport { Identifier, SessionReference } from \"./References.ts\";\n\n/** Shared caller-owned transfer bounds. Omitted timeout retains the 60-second default. */\nexport const ArtifactTransferPolicy = Schema.Struct({\n maxBytes: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 2 ** 31 - 1 })),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\nexport type ArtifactTransferPolicy = typeof ArtifactTransferPolicy.Type;\n\n/**\n * A path the provider reported for a file it already holds. It is only ever decoded from a\n * provider response: no caller, and certainly no model, names a remote filesystem path.\n */\nexport const RemoteFilePath = Schema.NonEmptyString.check(\n Schema.isMaxLength(4096),\n Schema.makeFilter(\n (value) =>\n value.startsWith(\"/\") &&\n !value.includes(\"\\\\\") &&\n !value.includes(\"//\") &&\n ![...value].some((character) => character < \" \" || character === \"\\x7f\") &&\n value.split(\"/\").every((segment) => segment !== \".\" && segment !== \"..\"),\n { title: \"an absolute, traversal-free remote path\" },\n ),\n);\n\n/**\n * Evidence of one accepted upload. `remotePath` exists only when the provider returned one;\n * its absence is reported rather than guessed, and attachment is refused without it.\n */\nexport class UploadReceipt extends Schema.Class<UploadReceipt>(\"BrowserbaseUploadReceipt\")({\n reference: SessionReference,\n filename: SafeFilename,\n bytes: Schema.Natural,\n remotePath: Schema.optionalKey(RemoteFilePath),\n acknowledgement: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n}) {}\n\nexport class DownloadMetadata extends Schema.Class<DownloadMetadata>(\"BrowserbaseDownloadMetadata\")(\n {\n id: Identifier,\n sessionId: Identifier,\n filename: SafeFilename,\n mimeType: Schema.NonEmptyString.check(Schema.isMaxLength(128)),\n size: Schema.Natural,\n checksum: Schema.String.check(Schema.isPattern(/^[a-fA-F0-9]{64}$/)),\n createdAt: Schema.NonEmptyString.check(Schema.isMaxLength(64)),\n },\n) {}\n\n/** A native event identity is not a provider download ID. Associate provider metadata explicitly. */\nexport class DownloadObservation extends Schema.Class<DownloadObservation>(\n \"BrowserbaseDownloadObservation\",\n)({\n reference: SessionReference,\n downloadId: Identifier,\n filename: SafeFilename,\n state: Schema.Literals([\"started\", \"completed\", \"failed\", \"unknown\"]),\n}) {}\n\nexport class RecordingPageReference extends Schema.Class<RecordingPageReference>(\n \"BrowserbaseRecordingPageReference\",\n)({\n session: SessionReference,\n pageId: Identifier,\n}) {}\n\nexport class RecordingPage extends Schema.Class<RecordingPage>(\"BrowserbaseRecordingPage\")({\n pageId: Identifier,\n status: Schema.Literals([\"NOT_REQUESTED\", \"PENDING\", \"COMPLETED\", \"FAILED\"]),\n delivery: Schema.Literals([\"not-ready\", \"download\", \"external-storage\"]),\n completedAt: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))),\n}) {}\n\nexport class RecordingBatch extends Schema.Class<RecordingBatch>(\"BrowserbaseRecordingBatch\")({\n reference: SessionReference,\n pages: Schema.Array(RecordingPage).check(Schema.isMaxLength(256)),\n timedOut: Schema.Boolean,\n}) {}\n\nexport class ReplayPage extends Schema.Class<ReplayPage>(\"BrowserbaseReplayPage\")({\n pageId: Identifier,\n startTimeMs: Schema.Finite,\n endTimeMs: Schema.Finite,\n}) {}\n\n/**\n * The uploaded branch carries receipts, not paths. Attachment authority is the identity of a\n * receipt this package issued for this exact session, so decoding one back into a new value\n * would discard the very evidence being checked.\n */\nexport type FileSelection =\n | { readonly _tag: \"Inline\"; readonly files: ReadonlyArray<InlineFile> }\n | { readonly _tag: \"Uploaded\"; readonly uploads: ReadonlyArray<UploadReceipt> };\n\nexport interface SelectFilesRequest {\n readonly selector: string;\n readonly selection: FileSelection;\n}\n"],"mappings":";;;;;AAQA,MAAa,yBAAyB,OAAO,OAAO;CAClD,UAAU,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS,KAAK,KAAK;CAAE,CAAC,CAAC;CACjF,eAAe,OAAO,YACpB,OAAO,IAAI,MAAM,OAAO,UAAU;EA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C,CAAC,CAAC,CAAC;AAEJ,IAAa,gBAAb,cAAmC,OAAO,MAAqB,0BAA0B,CAAC,CAAC;CACzF,QAAQA;CACR,QAAQ,OAAO,SAAS;EAAC;EAAiB;EAAW;EAAa;CAAQ,CAAC;CAC3E,UAAU,OAAO,SAAS;EAAC;EAAa;EAAY;CAAkB,CAAC;CACvE,aAAa,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,iBAAb,cAAoC,OAAO,MAAsB,2BAA2B,CAAC,CAAC;CAC5F,WAAW;CACX,OAAO,OAAO,MAAM,aAAa,CAAC,CAAC,MAAM,OAAO,YAAY,GAAG,CAAC;CAChE,UAAU,OAAO;AACnB,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,aAAb,cAAgC,OAAO,MAAkB,uBAAuB,CAAC,CAAC;CAChF,QAAQA;CACR,aAAa,OAAO;CACpB,WAAW,OAAO;AACpB,CAAC,CAAC,CAAC,CAAC"}
@@ -1,12 +1,10 @@
1
- import { o as SessionReference } from "./References-URDAtapt.mjs";
1
+ import { a as SessionReference } from "./References-DOH3Wu44.mjs";
2
2
  import { FileError } from "./Errors.mjs";
3
- import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
4
- import { t as BrowserbaseSessions } from "./Sessions-B8E4kMxo.mjs";
5
- import { f as UploadReceipt } from "./Transfers-Czv5IZzJ.mjs";
3
+ import { BrowserbaseClient } from "./Client.mjs";
4
+ import { t as BrowserbaseSessions } from "./Sessions-tFJYaXFq.mjs";
5
+ import { p as UploadReceipt } from "./Transfers-GVqzrDWl.mjs";
6
6
  import { Context, Effect, Layer } from "effect";
7
- declare namespace Uploads_d_exports {
8
- export { BrowserbaseUploads, UploadFile };
9
- }
7
+ //#region src/Uploads.d.ts
10
8
  export interface UploadFile {
11
9
  readonly filename: string;
12
10
  readonly mediaType: string;
@@ -25,5 +23,5 @@ export declare class BrowserbaseUploads extends BrowserbaseUploads_base {
25
23
  static readonly layer: Layer.Layer<BrowserbaseUploads, never, BrowserbaseClient | BrowserbaseSessions>;
26
24
  }
27
25
  //#endregion
28
- export { Uploads_d_exports as t };
26
+ export {};
29
27
  //# sourceMappingURL=Uploads.d.mts.map
package/dist/Uploads.mjs CHANGED
@@ -1,12 +1,10 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
1
  import { FileError } from "./Errors.mjs";
3
2
  import { RemoteFilePath, SafeFilename, UploadReceipt } from "./Transfers.mjs";
4
- import { t as BrowserbaseClient } from "./Client-D1_xYM9o.mjs";
5
- import { t as BrowserbaseSessions } from "./Sessions-CtbseWEh.mjs";
3
+ import { t as BrowserbaseClient } from "./Client-BQteUePT.mjs";
4
+ import { t as BrowserbaseSessions } from "./Sessions-DoQGg9nB.mjs";
6
5
  import { n as recordIssuedUpload } from "./Issued-DejqoMYL.mjs";
7
6
  import { Context, Effect, Layer, Schema } from "effect";
8
7
  //#region src/Uploads.ts
9
- var Uploads_exports = /* @__PURE__ */ __exportAll({ BrowserbaseUploads: () => BrowserbaseUploads });
10
8
  /** The provider's documented per-file ceiling for a session upload. */
11
9
  const MAX_UPLOAD_BYTES = 536870912;
12
10
  const MediaType = Schema.NonEmptyString.check(Schema.isMaxLength(128), Schema.isPattern(/^[a-z0-9][a-z0-9!#$&^_+.-]*\/[a-z0-9][a-z0-9!#$&^_+.-]*$/));
@@ -102,6 +100,6 @@ var BrowserbaseUploads = class BrowserbaseUploads extends Context.Service()("eff
102
100
  }));
103
101
  };
104
102
  //#endregion
105
- export { BrowserbaseUploads, Uploads_exports as t };
103
+ export { BrowserbaseUploads };
106
104
 
107
105
  //# sourceMappingURL=Uploads.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Uploads.mjs","names":[],"sources":["../src/Uploads.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { type ClientError, FileError } from \"./Errors.ts\";\nimport { recordIssuedUpload } from \"./internal/upload/Issued.ts\";\nimport type { SessionReference } from \"./References.ts\";\nimport { BrowserbaseSessions } from \"./Sessions.ts\";\nimport { RemoteFilePath, SafeFilename, UploadReceipt } from \"./Transfers.ts\";\n\n/** The provider's documented per-file ceiling for a session upload. */\nconst MAX_UPLOAD_BYTES = 512 * 1024 * 1024;\n\nconst MediaType = Schema.NonEmptyString.check(\n Schema.isMaxLength(128),\n Schema.isPattern(/^[a-z0-9][a-z0-9!#$&^_+.-]*\\/[a-z0-9][a-z0-9!#$&^_+.-]*$/),\n);\n\nconst UploadOptions = Schema.Struct({\n filename: SafeFilename,\n mediaType: MediaType,\n maxBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_UPLOAD_BYTES })),\n ),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\n/**\n * Only fields this package can validate are carried forward. `path` is the provider's own\n * remote location for the stored file; when the response omits it, the receipt says so\n * instead of inventing one, and attachment by path is refused rather than guessed.\n */\n/**\n * Where the provider places session uploads inside the remote browser. Observed against the\n * provider on 21 September 2026 and documented at\n * https://docs.browserbase.com/platform/browser/files/uploads.md; the create reply does not\n * return it.\n */\nconst UPLOAD_DIRECTORY = \"/tmp/.uploads\";\n\nconst ProviderUpload = Schema.Struct({\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n path: Schema.optionalKey(RemoteFilePath),\n});\n\nexport interface UploadFile {\n readonly filename: string;\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n readonly maxBytes?: number;\n readonly timeoutMillis?: number;\n}\n\nconst failure = (operation: FileError[\"operation\"], reason: FileError[\"reason\"]) =>\n FileError.make({ operation, reason, outcome: \"undispatched\" });\n\nconst fromClient = (operation: FileError[\"operation\"]) => (error: ClientError) =>\n FileError.make({\n operation,\n reason: error.reason,\n ...(error.outcome === undefined ? {} : { outcome: error.outcome }),\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined ? {} : { retryAfterMillis: error.retryAfterMillis }),\n });\n\n/**\n * A session upload places bytes where the remote browser can already reach them. It is the\n * large-file half of file selection; small in-memory selection needs no provisioning at all.\n */\nexport class BrowserbaseUploads extends Context.Service<\n BrowserbaseUploads,\n {\n readonly create: (\n reference: SessionReference,\n file: UploadFile,\n ) => Effect.Effect<UploadReceipt, FileError>;\n }\n>()(\"effect-browserbase/Uploads\") {\n static readonly layer: Layer.Layer<\n BrowserbaseUploads,\n never,\n BrowserbaseClient | BrowserbaseSessions\n > = Layer.effect(\n BrowserbaseUploads,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const sessions = yield* BrowserbaseSessions;\n\n const create = Effect.fn(\"BrowserbaseUploads.create\")(function* (\n reference: SessionReference,\n file: UploadFile,\n ) {\n const { bytes, ...rest } = file;\n\n const value = yield* Schema.decodeEffect(UploadOptions)(rest, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => failure(\"upload\", \"configuration\")));\n\n if (!(bytes instanceof Uint8Array)) return yield* failure(\"upload\", \"configuration\");\n const maxBytes = value.maxBytes ?? MAX_UPLOAD_BYTES;\n\n if (bytes.byteLength < 1 || bytes.byteLength > maxBytes)\n return yield* failure(\"upload\", \"limit\");\n\n // The exact owning session admits the upload; a terminal session cannot receive files.\n const state = yield* sessions\n .retrieve(reference)\n .pipe(\n Effect.mapError((error) =>\n FileError.make({ operation: \"upload\", reason: error.reason }),\n ),\n );\n\n if (state.status !== \"RUNNING\") return yield* failure(\"upload\", \"expired\");\n\n // Send the same immutable bytes that were measured a moment ago.\n const owned = new Uint8Array(bytes);\n\n const raw = yield* client\n .upload(\n `/v1/sessions/${encodeURIComponent(state.reference.sessionId)}/uploads`,\n {\n field: \"file\",\n filename: value.filename,\n mediaType: value.mediaType,\n bytes: owned,\n },\n {\n maxBytes,\n ...(value.timeoutMillis === undefined ? {} : { timeoutMillis: value.timeoutMillis }),\n },\n )\n .pipe(Effect.mapError(fromClient(\"upload\")));\n\n const acknowledged = yield* Schema.decodeUnknownEffect(ProviderUpload)(raw).pipe(\n Effect.mapError(() =>\n FileError.make({ operation: \"upload\", reason: \"malformed\", outcome: \"unknown\" }),\n ),\n );\n\n // The provider's reply carries only a message; its documented upload location is a\n // fixed directory keyed by the part's filename, which was validated above. A path the\n // provider does return still wins, and was checked for traversal when decoded.\n const remotePath = acknowledged.path ?? `${UPLOAD_DIRECTORY}/${value.filename}`;\n\n const receipt = UploadReceipt.make({\n reference: state.reference,\n filename: value.filename,\n bytes: owned.byteLength,\n remotePath,\n ...(acknowledged.message === undefined ? {} : { acknowledgement: acknowledged.message }),\n });\n\n recordIssuedUpload(receipt, { reference: state.reference, remotePath });\n\n return receipt;\n });\n\n return BrowserbaseUploads.of({ create });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAM,mBAAmB;AAEzB,MAAM,YAAY,OAAO,eAAe,MACtC,OAAO,YAAY,GAAG,GACtB,OAAO,UAAU,0DAA0D,CAC7E;AAEA,MAAM,gBAAgB,OAAO,OAAO;CAClC,UAAU;CACV,WAAW;CACX,UAAU,OAAO,YACf,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAiB,CAAC,CAAC,CAC9E;CACA,eAAe,OAAO,YACpB,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAQ,CAAC,CAAC,CACrE;AACF,CAAC;;;;;;;;;;;;AAaD,MAAM,mBAAmB;AAEzB,MAAM,iBAAiB,OAAO,OAAO;CACnC,SAAS,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;CACzE,MAAM,OAAO,YAAY,cAAc;AACzC,CAAC;AAUD,MAAM,WAAW,WAAmC,WAClD,UAAU,KAAK;CAAE;CAAW;CAAQ,SAAS;AAAe,CAAC;AAE/D,MAAM,cAAc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C9D;IACE,OAAO;IACP,UAAU,MAAM;IAChB,WAAW,MAAM;IACjB,OAAO;GACT,GACA;IACE;IACA,GAAI,MAAM,kBAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,eAAe,MAAM,cAAc;GACpF,CACF,CAAC,CACA,KAAK,OAAO,SAAS,WAAW,QAAQ,CAAC,CAAC;GAE7C,MAAM,eAAe,OAAO,OAAO,oBAAoB,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,KAC1E,OAAO,eACL,UAAU,KAAK;IAAE,WAAW;IAAU,QAAQ;IAAa,SAAS;GAAU,CAAC,CACjF,CACF;GAKA,MAAM,aAAa,aAAa,QAAQ,GAAG,iBAAiB,GAAG,MAAM;GAErE,MAAM,UAAU,cAAc,KAAK;IACjC,WAAW,MAAM;IACjB,UAAU,MAAM;IAChB,OAAO,MAAM;IACb;IACA,GAAI,aAAa,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAiB,aAAa,QAAQ;GACxF,CAAC;GAED,mBAAmB,SAAS;IAAE,WAAW,MAAM;IAAW;GAAW,CAAC;GAEtE,OAAO;EACT,CAAC;EAED,OAAO,mBAAmB,GAAG,EAAE,OAAO,CAAC;CACzC,CAAC,CACH;AACF"}
1
+ {"version":3,"file":"Uploads.mjs","names":[],"sources":["../src/Uploads.ts"],"sourcesContent":["import { Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { type ClientError, FileError } from \"./Errors.ts\";\nimport { recordIssuedUpload } from \"./internal/upload/Issued.ts\";\nimport type { SessionReference } from \"./References.ts\";\nimport { BrowserbaseSessions } from \"./Sessions.ts\";\nimport { RemoteFilePath, SafeFilename, UploadReceipt } from \"./Transfers.ts\";\n\n/** The provider's documented per-file ceiling for a session upload. */\nconst MAX_UPLOAD_BYTES = 512 * 1024 * 1024;\n\nconst MediaType = Schema.NonEmptyString.check(\n Schema.isMaxLength(128),\n Schema.isPattern(/^[a-z0-9][a-z0-9!#$&^_+.-]*\\/[a-z0-9][a-z0-9!#$&^_+.-]*$/),\n);\n\nconst UploadOptions = Schema.Struct({\n filename: SafeFilename,\n mediaType: MediaType,\n maxBytes: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: MAX_UPLOAD_BYTES })),\n ),\n timeoutMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 600_000 })),\n ),\n});\n\n/**\n * Only fields this package can validate are carried forward. `path` is the provider's own\n * remote location for the stored file; when the response omits it, the receipt says so\n * instead of inventing one, and attachment by path is refused rather than guessed.\n */\n/**\n * Where the provider places session uploads inside the remote browser. Observed against the\n * provider on 21 September 2026 and documented at\n * https://docs.browserbase.com/platform/browser/files/uploads.md; the create reply does not\n * return it.\n */\nconst UPLOAD_DIRECTORY = \"/tmp/.uploads\";\n\nconst ProviderUpload = Schema.Struct({\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(1024))),\n path: Schema.optionalKey(RemoteFilePath),\n});\n\nexport interface UploadFile {\n readonly filename: string;\n readonly mediaType: string;\n readonly bytes: Uint8Array;\n readonly maxBytes?: number;\n readonly timeoutMillis?: number;\n}\n\nconst failure = (operation: FileError[\"operation\"], reason: FileError[\"reason\"]) =>\n FileError.make({ operation, reason, outcome: \"undispatched\" });\n\nconst fromClient = (operation: FileError[\"operation\"]) => (error: ClientError) =>\n FileError.make({\n operation,\n reason: error.reason,\n ...(error.outcome === undefined ? {} : { outcome: error.outcome }),\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined ? {} : { retryAfterMillis: error.retryAfterMillis }),\n });\n\n/**\n * A session upload places bytes where the remote browser can already reach them. It is the\n * large-file half of file selection; small in-memory selection needs no provisioning at all.\n */\nexport class BrowserbaseUploads extends Context.Service<\n BrowserbaseUploads,\n {\n readonly create: (\n reference: SessionReference,\n file: UploadFile,\n ) => Effect.Effect<UploadReceipt, FileError>;\n }\n>()(\"effect-browserbase/Uploads\") {\n static readonly layer: Layer.Layer<\n BrowserbaseUploads,\n never,\n BrowserbaseClient | BrowserbaseSessions\n > = Layer.effect(\n BrowserbaseUploads,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n const sessions = yield* BrowserbaseSessions;\n\n const create = Effect.fn(\"BrowserbaseUploads.create\")(function* (\n reference: SessionReference,\n file: UploadFile,\n ) {\n const { bytes, ...rest } = file;\n\n const value = yield* Schema.decodeEffect(UploadOptions)(rest, {\n onExcessProperty: \"error\",\n }).pipe(Effect.mapError(() => failure(\"upload\", \"configuration\")));\n\n if (!(bytes instanceof Uint8Array)) return yield* failure(\"upload\", \"configuration\");\n const maxBytes = value.maxBytes ?? MAX_UPLOAD_BYTES;\n\n if (bytes.byteLength < 1 || bytes.byteLength > maxBytes)\n return yield* failure(\"upload\", \"limit\");\n\n // The exact owning session admits the upload; a terminal session cannot receive files.\n const state = yield* sessions\n .retrieve(reference)\n .pipe(\n Effect.mapError((error) =>\n FileError.make({ operation: \"upload\", reason: error.reason }),\n ),\n );\n\n if (state.status !== \"RUNNING\") return yield* failure(\"upload\", \"expired\");\n\n // Send the same immutable bytes that were measured a moment ago.\n const owned = new Uint8Array(bytes);\n\n const raw = yield* client\n .upload(\n `/v1/sessions/${encodeURIComponent(state.reference.sessionId)}/uploads`,\n {\n field: \"file\",\n filename: value.filename,\n mediaType: value.mediaType,\n bytes: owned,\n },\n {\n maxBytes,\n ...(value.timeoutMillis === undefined ? {} : { timeoutMillis: value.timeoutMillis }),\n },\n )\n .pipe(Effect.mapError(fromClient(\"upload\")));\n\n const acknowledged = yield* Schema.decodeUnknownEffect(ProviderUpload)(raw).pipe(\n Effect.mapError(() =>\n FileError.make({ operation: \"upload\", reason: \"malformed\", outcome: \"unknown\" }),\n ),\n );\n\n // The provider's reply carries only a message; its documented upload location is a\n // fixed directory keyed by the part's filename, which was validated above. A path the\n // provider does return still wins, and was checked for traversal when decoded.\n const remotePath = acknowledged.path ?? `${UPLOAD_DIRECTORY}/${value.filename}`;\n\n const receipt = UploadReceipt.make({\n reference: state.reference,\n filename: value.filename,\n bytes: owned.byteLength,\n remotePath,\n ...(acknowledged.message === undefined ? {} : { acknowledgement: acknowledged.message }),\n });\n\n recordIssuedUpload(receipt, { reference: state.reference, remotePath });\n\n return receipt;\n });\n\n return BrowserbaseUploads.of({ create });\n }),\n );\n}\n"],"mappings":";;;;;;;;AAUA,MAAM,mBAAmB;AAEzB,MAAM,YAAY,OAAO,eAAe,MACtC,OAAO,YAAY,GAAG,GACtB,OAAO,UAAU,0DAA0D,CAC7E;AAEA,MAAM,gBAAgB,OAAO,OAAO;CAClC,UAAU;CACV,WAAW;CACX,UAAU,OAAO,YACf,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAiB,CAAC,CAAC,CAC9E;CACA,eAAe,OAAO,YACpB,OAAO,IAAI,MAAM,OAAO,UAAU;EAAE,SAAS;EAAG,SAAS;CAAQ,CAAC,CAAC,CACrE;AACF,CAAC;;;;;;;;;;;;AAaD,MAAM,mBAAmB;AAEzB,MAAM,iBAAiB,OAAO,OAAO;CACnC,SAAS,OAAO,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC,CAAC;CACzE,MAAM,OAAO,YAAY,cAAc;AACzC,CAAC;AAUD,MAAM,WAAW,WAAmC,WAClD,UAAU,KAAK;CAAE;CAAW;CAAQ,SAAS;AAAe,CAAC;AAE/D,MAAM,cAAc,eAAuC,UACzD,UAAU,KAAK;CACb;CACA,QAAQ,MAAM;CACd,GAAI,MAAM,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,MAAM,QAAQ;CAChE,GAAI,MAAM,WAAW,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,MAAM,OAAO;CAC7D,GAAI,MAAM,qBAAqB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAkB,MAAM,iBAAiB;AAC7F,CAAC;;;;;AAMH,IAAa,qBAAb,MAAa,2BAA2B,QAAQ,QAQ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,QAAQ;IAAa,SAAS;GAAU,CAAC,CACjF,CACF;GAKA,MAAM,aAAa,aAAa,QAAQ,GAAG,iBAAiB,GAAG,MAAM;GAErE,MAAM,UAAU,cAAc,KAAK;IACjC,WAAW,MAAM;IACjB,UAAU,MAAM;IAChB,OAAO,MAAM;IACb;IACA,GAAI,aAAa,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,iBAAiB,aAAa,QAAQ;GACxF,CAAC;GAED,mBAAmB,SAAS;IAAE,WAAW,MAAM;IAAW;GAAW,CAAC;GAEtE,OAAO;EACT,CAAC;EAED,OAAO,mBAAmB,GAAG,EAAE,OAAO,CAAC;CACzC,CAAC,CACH;AACF"}
@@ -1,9 +1,7 @@
1
1
  import { PlatformError } from "./Errors.mjs";
2
- import { t as BrowserbaseClient } from "./Client-Ca0zSg1n.mjs";
2
+ import { BrowserbaseClient } from "./Client.mjs";
3
3
  import { Context, Effect, Layer, Redacted, Schema } from "effect";
4
- declare namespace Webhooks_d_exports {
5
- export { BrowserbaseWebhooks, WebhookEventType, WebhookListQuery, WebhookMetadata, WebhookPage, WebhookRegistration, WebhookSettings, WebhookUpdate };
6
- }
4
+ //#region src/Webhooks.d.ts
7
5
  /** Provider event names. Browserbase currently emits Functions events only. */
8
6
  export declare const WebhookEventType: Schema.Literals<readonly ["functions.builds.running", "functions.builds.completed", "functions.builds.failed", "functions.invocations.pending", "functions.invocations.running", "functions.invocations.completed", "functions.invocations.failed"]>;
9
7
  export type WebhookEventType = typeof WebhookEventType.Type;
@@ -56,5 +54,5 @@ export declare class BrowserbaseWebhooks extends BrowserbaseWebhooks_base {
56
54
  static readonly layer: Layer.Layer<BrowserbaseWebhooks, never, BrowserbaseClient>;
57
55
  }
58
56
  //#endregion
59
- export { Webhooks_d_exports as t };
57
+ export {};
60
58
  //# sourceMappingURL=Webhooks.d.mts.map
package/dist/Webhooks.mjs CHANGED
@@ -1,18 +1,9 @@
1
- import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
1
  import { Identifier } from "./References.mjs";
3
2
  import { PlatformError } from "./Errors.mjs";
4
- import { t as BrowserbaseClient } from "./Client-D1_xYM9o.mjs";
3
+ import { t as BrowserbaseClient } from "./Client-BQteUePT.mjs";
5
4
  import { t as resource } from "./Resource-DBksC4zB.mjs";
6
5
  import { Context, Effect, Layer, Redacted, Schema } from "effect";
7
6
  //#region src/Webhooks.ts
8
- var Webhooks_exports = /* @__PURE__ */ __exportAll({
9
- BrowserbaseWebhooks: () => BrowserbaseWebhooks,
10
- WebhookEventType: () => WebhookEventType,
11
- WebhookListQuery: () => WebhookListQuery,
12
- WebhookMetadata: () => WebhookMetadata,
13
- WebhookSettings: () => WebhookSettings,
14
- WebhookUpdate: () => WebhookUpdate
15
- });
16
7
  const Timestamp = Schema.String.check(Schema.isMaxLength(64));
17
8
  /** Provider event names. Browserbase currently emits Functions events only. */
18
9
  const WebhookEventType = Schema.Literals([
@@ -138,6 +129,6 @@ var BrowserbaseWebhooks = class BrowserbaseWebhooks extends Context.Service()("e
138
129
  }));
139
130
  };
140
131
  //#endregion
141
- export { BrowserbaseWebhooks, WebhookEventType, WebhookListQuery, WebhookMetadata, WebhookSettings, WebhookUpdate, Webhooks_exports as t };
132
+ export { BrowserbaseWebhooks, WebhookEventType, WebhookListQuery, WebhookMetadata, WebhookSettings, WebhookUpdate };
142
133
 
143
134
  //# sourceMappingURL=Webhooks.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Webhooks.mjs","names":[],"sources":["../src/Webhooks.ts"],"sourcesContent":["import { Context, Effect, Layer, Redacted, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { PlatformError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport { Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\n/** Provider event names. Browserbase currently emits Functions events only. */\nexport const WebhookEventType = Schema.Literals([\n \"functions.builds.running\",\n \"functions.builds.completed\",\n \"functions.builds.failed\",\n \"functions.invocations.pending\",\n \"functions.invocations.running\",\n \"functions.invocations.completed\",\n \"functions.invocations.failed\",\n]);\n\nexport type WebhookEventType = typeof WebhookEventType.Type;\n\nconst Endpoint = Schema.NonEmptyString.check(\n Schema.isMaxLength(2048),\n Schema.makeFilter((value) => {\n try {\n const url = new URL(value);\n\n return url.protocol === \"https:\" && !url.username && !url.password;\n } catch {\n return false;\n }\n }),\n);\n\nconst EventTypes = Schema.Array(WebhookEventType).check(\n Schema.isMinLength(1),\n Schema.isMaxLength(7),\n Schema.isUnique(),\n);\n\nexport const WebhookSettings = Schema.Struct({ endpoint: Endpoint, eventTypes: EventTypes });\nexport type WebhookSettings = typeof WebhookSettings.Type;\n\nexport const WebhookUpdate = Schema.Struct({\n endpoint: Schema.optionalKey(Endpoint),\n eventTypes: Schema.optionalKey(EventTypes),\n});\n\nexport type WebhookUpdate = typeof WebhookUpdate.Type;\n\nexport class WebhookMetadata extends Schema.Class<WebhookMetadata>(\"BrowserbaseWebhookMetadata\")({\n webhookId: Identifier,\n projectId: Identifier,\n endpoint: Schema.String.check(Schema.isMaxLength(2048)),\n eventTypes: Schema.Array(Schema.String.check(Schema.isMaxLength(128))).check(\n Schema.isMaxLength(64),\n ),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\n/** A signing secret is returned once, redacted so it cannot be logged by accident. */\nexport interface WebhookRegistration {\n readonly webhook: WebhookMetadata;\n readonly secret: Redacted.Redacted<string>;\n}\n\nexport interface WebhookPage {\n readonly webhooks: ReadonlyArray<WebhookMetadata>;\n readonly nextCursor: string | undefined;\n}\n\nconst ProviderWebhook = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n endpoint: WebhookMetadata.fields.endpoint,\n eventTypes: WebhookMetadata.fields.eventTypes,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n});\n\nconst Secret = Schema.NonEmptyString.check(Schema.isMaxLength(1024));\n\nconst Page = Schema.Struct({\n data: Schema.Array(ProviderWebhook).check(Schema.isMaxLength(100)),\n nextCursor: Schema.optionalKey(Schema.NullOr(Schema.String.check(Schema.isMaxLength(4096)))),\n});\n\nexport const WebhookListQuery = Schema.Struct({\n cursor: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(4096))),\n limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 }))),\n});\n\nexport type WebhookListQuery = typeof WebhookListQuery.Type;\n\n/** Webhook administration for the Client's project. Mutations are never retried. */\nexport class BrowserbaseWebhooks extends Context.Service<\n BrowserbaseWebhooks,\n {\n readonly create: (\n settings: WebhookSettings,\n ) => Effect.Effect<WebhookRegistration, PlatformError>;\n readonly list: (query?: WebhookListQuery) => Effect.Effect<WebhookPage, PlatformError>;\n readonly retrieve: (webhookId: string) => Effect.Effect<WebhookMetadata, PlatformError>;\n readonly update: (\n webhookId: string,\n update: WebhookUpdate,\n ) => Effect.Effect<WebhookMetadata, PlatformError>;\n readonly delete: (webhookId: string) => Effect.Effect<void, PlatformError>;\n /** Issues a new secret; the old one keeps working unless `revokeImmediately`. */\n readonly rotateSecret: (\n webhookId: string,\n options?: { readonly revokeImmediately?: boolean },\n ) => Effect.Effect<Redacted.Redacted<string>, PlatformError>;\n }\n>()(\"effect-browserbase/Webhooks\") {\n static readonly layer: Layer.Layer<BrowserbaseWebhooks, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseWebhooks,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const api = resource<PlatformError>(client, (failure) =>\n PlatformError.make({ ...failure, service: \"webhooks\" }),\n );\n\n const decode = (\n operation: PlatformError[\"operation\"],\n mutation: boolean,\n expected?: string,\n ) =>\n Effect.fnUntraced(function* (value: typeof ProviderWebhook.Type) {\n if (\n value.projectId !== client.projectId ||\n (expected !== undefined && value.id !== expected)\n )\n return yield* api.malformed(operation, mutation);\n\n const { id, ...rest } = value;\n\n return WebhookMetadata.make({ webhookId: id, ...rest });\n });\n\n const path = (id: string) => `/v1/webhooks/${api.segment(id)}`;\n\n const create = Effect.fn(\"BrowserbaseWebhooks.create\")(function* (settings: WebhookSettings) {\n const value = yield* api.input(WebhookSettings, settings, \"webhook-create\");\n\n const created = yield* api.request(\n \"POST\",\n \"/v1/webhooks\",\n Schema.Struct({ ...ProviderWebhook.fields, secret: Secret }),\n \"webhook-create\",\n value,\n );\n\n const { secret, ...webhook } = created;\n\n return {\n webhook: yield* decode(\"webhook-create\", true)(webhook),\n secret: Redacted.make(secret),\n };\n });\n\n const list = Effect.fn(\"BrowserbaseWebhooks.list\")(function* (query: WebhookListQuery = {}) {\n const value = yield* api.input(WebhookListQuery, query, \"webhook-list\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/webhooks${api.query(value)}`,\n Page,\n \"webhook-list\",\n );\n\n return {\n webhooks: yield* Effect.forEach(page.data, decode(\"webhook-list\", false)),\n nextCursor: page.nextCursor ?? undefined,\n };\n });\n\n const retrieve = Effect.fn(\"BrowserbaseWebhooks.retrieve\")(function* (webhookId: string) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-retrieve\");\n const value = yield* api.request(\"GET\", path(id), ProviderWebhook, \"webhook-retrieve\");\n\n return yield* decode(\"webhook-retrieve\", false, id)(value);\n });\n\n const update = Effect.fn(\"BrowserbaseWebhooks.update\")(function* (\n webhookId: string,\n changes: WebhookUpdate,\n ) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-update\");\n const value = yield* api.input(WebhookUpdate, changes, \"webhook-update\");\n\n if (value.endpoint === undefined && value.eventTypes === undefined)\n return yield* api.configuration(\"webhook-update\");\n\n const updated = yield* api.request(\n \"PATCH\",\n path(id),\n ProviderWebhook,\n \"webhook-update\",\n value,\n );\n\n return yield* decode(\"webhook-update\", true, id)(updated);\n });\n\n const remove = Effect.fn(\"BrowserbaseWebhooks.delete\")(function* (webhookId: string) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-delete\");\n\n yield* api.remove(path(id), \"webhook-delete\");\n });\n\n const rotateSecret = Effect.fn(\"BrowserbaseWebhooks.rotateSecret\")(function* (\n webhookId: string,\n options: { readonly revokeImmediately?: boolean } = {},\n ) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-rotate-secret\");\n\n const value = yield* api.input(\n Schema.Struct({ revokeImmediately: Schema.optionalKey(Schema.Boolean) }),\n options,\n \"webhook-rotate-secret\",\n );\n\n const rotated = yield* api.request(\n \"POST\",\n `${path(id)}/secret`,\n Schema.Struct({ secret: Secret }),\n \"webhook-rotate-secret\",\n value,\n );\n\n return Redacted.make(rotated.secret);\n });\n\n return BrowserbaseWebhooks.of({\n create,\n list,\n retrieve,\n update,\n delete: remove,\n rotateSecret,\n });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAOA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;;AAG5D,MAAa,mBAAmB,OAAO,SAAS;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAID,MAAM,WAAW,OAAO,eAAe,MACrC,OAAO,YAAY,IAAI,GACvB,OAAO,YAAY,UAAU;CAC3B,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EAEzB,OAAO,IAAI,aAAa,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI;CAC5D,QAAQ;EACN,OAAO;CACT;AACF,CAAC,CACH;AAEA,MAAM,aAAa,OAAO,MAAM,gBAAgB,CAAC,CAAC,MAChD,OAAO,YAAY,CAAC,GACpB,OAAO,YAAY,CAAC,GACpB,OAAO,SAAS,CAClB;AAEA,MAAa,kBAAkB,OAAO,OAAO;CAAE,UAAU;CAAU,YAAY;AAAW,CAAC;AAG3F,MAAa,gBAAgB,OAAO,OAAO;CACzC,UAAU,OAAO,YAAY,QAAQ;CACrC,YAAY,OAAO,YAAY,UAAU;AAC3C,CAAC;AAID,IAAa,kBAAb,cAAqC,OAAO,MAAuB,4BAA4B,CAAC,CAAC;CAC/F,WAAW;CACX,WAAW;CACX,UAAU,OAAO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B,CAAC,CAAC,WACrD,WACA,SACA;GACA,MAAM,KAAK,OAAO,IAAI,MAAM,YAAY,WAAW,gBAAgB;GACnE,MAAM,QAAQ,OAAO,IAAI,MAAM,eAAe,SAAS,gBAAgB;GAEvE,IAAI,MAAM,aAAa,KAAA,KAAa,MAAM,eAAe,KAAA,GACvD,OAAO,OAAO,IAAI,cAAc,gBAAgB;GAElD,MAAM,UAAU,OAAO,IAAI,QACzB,SACA,KAAK,EAAE,GACP,iBACA,kBACA,KACF;GAEA,OAAO,OAAO,OAAO,kBAAkB,MAAM,EAAE,CAAC,CAAC,OAAO;EAC1D,CAAC;EAED,MAAM,SAAS,OAAO,GAAG,4BAA4B,CAAC,CAAC,WAAW,WAAmB;GACnF,MAAM,KAAK,OAAO,IAAI,MAAM,YAAY,WAAW,gBAAgB;GAEnE,OAAO,IAAI,OAAO,KAAK,EAAE,GAAG,gBAAgB;EAC9C,CAAC;EAED,MAAM,eAAe,OAAO,GAAG,kCAAkC,CAAC,CAAC,WACjE,WACA,UAAoD,CAAC,GACrD;GACA,MAAM,KAAK,OAAO,IAAI,MAAM,YAAY,WAAW,uBAAuB;GAE1E,MAAM,QAAQ,OAAO,IAAI,MACvB,OAAO,OAAO,EAAE,mBAAmB,OAAO,YAAY,OAAO,OAAO,EAAE,CAAC,GACvE,SACA,uBACF;GAEA,MAAM,UAAU,OAAO,IAAI,QACzB,QACA,GAAG,KAAK,EAAE,EAAE,UACZ,OAAO,OAAO,EAAE,QAAQ,OAAO,CAAC,GAChC,yBACA,KACF;GAEA,OAAO,SAAS,KAAK,QAAQ,MAAM;EACrC,CAAC;EAED,OAAO,oBAAoB,GAAG;GAC5B;GACA;GACA;GACA;GACA,QAAQ;GACR;EACF,CAAC;CACH,CAAC,CACH;AACF"}
1
+ {"version":3,"file":"Webhooks.mjs","names":[],"sources":["../src/Webhooks.ts"],"sourcesContent":["import { Context, Effect, Layer, Redacted, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { PlatformError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport { Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\n\n/** Provider event names. Browserbase currently emits Functions events only. */\nexport const WebhookEventType = Schema.Literals([\n \"functions.builds.running\",\n \"functions.builds.completed\",\n \"functions.builds.failed\",\n \"functions.invocations.pending\",\n \"functions.invocations.running\",\n \"functions.invocations.completed\",\n \"functions.invocations.failed\",\n]);\n\nexport type WebhookEventType = typeof WebhookEventType.Type;\n\nconst Endpoint = Schema.NonEmptyString.check(\n Schema.isMaxLength(2048),\n Schema.makeFilter((value) => {\n try {\n const url = new URL(value);\n\n return url.protocol === \"https:\" && !url.username && !url.password;\n } catch {\n return false;\n }\n }),\n);\n\nconst EventTypes = Schema.Array(WebhookEventType).check(\n Schema.isMinLength(1),\n Schema.isMaxLength(7),\n Schema.isUnique(),\n);\n\nexport const WebhookSettings = Schema.Struct({ endpoint: Endpoint, eventTypes: EventTypes });\nexport type WebhookSettings = typeof WebhookSettings.Type;\n\nexport const WebhookUpdate = Schema.Struct({\n endpoint: Schema.optionalKey(Endpoint),\n eventTypes: Schema.optionalKey(EventTypes),\n});\n\nexport type WebhookUpdate = typeof WebhookUpdate.Type;\n\nexport class WebhookMetadata extends Schema.Class<WebhookMetadata>(\"BrowserbaseWebhookMetadata\")({\n webhookId: Identifier,\n projectId: Identifier,\n endpoint: Schema.String.check(Schema.isMaxLength(2048)),\n eventTypes: Schema.Array(Schema.String.check(Schema.isMaxLength(128))).check(\n Schema.isMaxLength(64),\n ),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\n/** A signing secret is returned once, redacted so it cannot be logged by accident. */\nexport interface WebhookRegistration {\n readonly webhook: WebhookMetadata;\n readonly secret: Redacted.Redacted<string>;\n}\n\nexport interface WebhookPage {\n readonly webhooks: ReadonlyArray<WebhookMetadata>;\n readonly nextCursor: string | undefined;\n}\n\nconst ProviderWebhook = Schema.Struct({\n id: Identifier,\n projectId: Identifier,\n endpoint: WebhookMetadata.fields.endpoint,\n eventTypes: WebhookMetadata.fields.eventTypes,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n});\n\nconst Secret = Schema.NonEmptyString.check(Schema.isMaxLength(1024));\n\nconst Page = Schema.Struct({\n data: Schema.Array(ProviderWebhook).check(Schema.isMaxLength(100)),\n nextCursor: Schema.optionalKey(Schema.NullOr(Schema.String.check(Schema.isMaxLength(4096)))),\n});\n\nexport const WebhookListQuery = Schema.Struct({\n cursor: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(4096))),\n limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 }))),\n});\n\nexport type WebhookListQuery = typeof WebhookListQuery.Type;\n\n/** Webhook administration for the Client's project. Mutations are never retried. */\nexport class BrowserbaseWebhooks extends Context.Service<\n BrowserbaseWebhooks,\n {\n readonly create: (\n settings: WebhookSettings,\n ) => Effect.Effect<WebhookRegistration, PlatformError>;\n readonly list: (query?: WebhookListQuery) => Effect.Effect<WebhookPage, PlatformError>;\n readonly retrieve: (webhookId: string) => Effect.Effect<WebhookMetadata, PlatformError>;\n readonly update: (\n webhookId: string,\n update: WebhookUpdate,\n ) => Effect.Effect<WebhookMetadata, PlatformError>;\n readonly delete: (webhookId: string) => Effect.Effect<void, PlatformError>;\n /** Issues a new secret; the old one keeps working unless `revokeImmediately`. */\n readonly rotateSecret: (\n webhookId: string,\n options?: { readonly revokeImmediately?: boolean },\n ) => Effect.Effect<Redacted.Redacted<string>, PlatformError>;\n }\n>()(\"effect-browserbase/Webhooks\") {\n static readonly layer: Layer.Layer<BrowserbaseWebhooks, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseWebhooks,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const api = resource<PlatformError>(client, (failure) =>\n PlatformError.make({ ...failure, service: \"webhooks\" }),\n );\n\n const decode = (\n operation: PlatformError[\"operation\"],\n mutation: boolean,\n expected?: string,\n ) =>\n Effect.fnUntraced(function* (value: typeof ProviderWebhook.Type) {\n if (\n value.projectId !== client.projectId ||\n (expected !== undefined && value.id !== expected)\n )\n return yield* api.malformed(operation, mutation);\n\n const { id, ...rest } = value;\n\n return WebhookMetadata.make({ webhookId: id, ...rest });\n });\n\n const path = (id: string) => `/v1/webhooks/${api.segment(id)}`;\n\n const create = Effect.fn(\"BrowserbaseWebhooks.create\")(function* (settings: WebhookSettings) {\n const value = yield* api.input(WebhookSettings, settings, \"webhook-create\");\n\n const created = yield* api.request(\n \"POST\",\n \"/v1/webhooks\",\n Schema.Struct({ ...ProviderWebhook.fields, secret: Secret }),\n \"webhook-create\",\n value,\n );\n\n const { secret, ...webhook } = created;\n\n return {\n webhook: yield* decode(\"webhook-create\", true)(webhook),\n secret: Redacted.make(secret),\n };\n });\n\n const list = Effect.fn(\"BrowserbaseWebhooks.list\")(function* (query: WebhookListQuery = {}) {\n const value = yield* api.input(WebhookListQuery, query, \"webhook-list\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/webhooks${api.query(value)}`,\n Page,\n \"webhook-list\",\n );\n\n return {\n webhooks: yield* Effect.forEach(page.data, decode(\"webhook-list\", false)),\n nextCursor: page.nextCursor ?? undefined,\n };\n });\n\n const retrieve = Effect.fn(\"BrowserbaseWebhooks.retrieve\")(function* (webhookId: string) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-retrieve\");\n const value = yield* api.request(\"GET\", path(id), ProviderWebhook, \"webhook-retrieve\");\n\n return yield* decode(\"webhook-retrieve\", false, id)(value);\n });\n\n const update = Effect.fn(\"BrowserbaseWebhooks.update\")(function* (\n webhookId: string,\n changes: WebhookUpdate,\n ) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-update\");\n const value = yield* api.input(WebhookUpdate, changes, \"webhook-update\");\n\n if (value.endpoint === undefined && value.eventTypes === undefined)\n return yield* api.configuration(\"webhook-update\");\n\n const updated = yield* api.request(\n \"PATCH\",\n path(id),\n ProviderWebhook,\n \"webhook-update\",\n value,\n );\n\n return yield* decode(\"webhook-update\", true, id)(updated);\n });\n\n const remove = Effect.fn(\"BrowserbaseWebhooks.delete\")(function* (webhookId: string) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-delete\");\n\n yield* api.remove(path(id), \"webhook-delete\");\n });\n\n const rotateSecret = Effect.fn(\"BrowserbaseWebhooks.rotateSecret\")(function* (\n webhookId: string,\n options: { readonly revokeImmediately?: boolean } = {},\n ) {\n const id = yield* api.input(Identifier, webhookId, \"webhook-rotate-secret\");\n\n const value = yield* api.input(\n Schema.Struct({ revokeImmediately: Schema.optionalKey(Schema.Boolean) }),\n options,\n \"webhook-rotate-secret\",\n );\n\n const rotated = yield* api.request(\n \"POST\",\n `${path(id)}/secret`,\n Schema.Struct({ secret: Secret }),\n \"webhook-rotate-secret\",\n value,\n );\n\n return Redacted.make(rotated.secret);\n });\n\n return BrowserbaseWebhooks.of({\n create,\n list,\n retrieve,\n update,\n delete: remove,\n rotateSecret,\n });\n }),\n );\n}\n"],"mappings":";;;;;;AAOA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;;AAG5D,MAAa,mBAAmB,OAAO,SAAS;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAID,MAAM,WAAW,OAAO,eAAe,MACrC,OAAO,YAAY,IAAI,GACvB,OAAO,YAAY,UAAU;CAC3B,IAAI;EACF,MAAM,MAAM,IAAI,IAAI,KAAK;EAEzB,OAAO,IAAI,aAAa,YAAY,CAAC,IAAI,YAAY,CAAC,IAAI;CAC5D,QAAQ;EACN,OAAO;CACT;AACF,CAAC,CACH;AAEA,MAAM,aAAa,OAAO,MAAM,gBAAgB,CAAC,CAAC,MAChD,OAAO,YAAY,CAAC,GACpB,OAAO,YAAY,CAAC,GACpB,OAAO,SAAS,CAClB;AAEA,MAAa,kBAAkB,OAAO,OAAO;CAAE,UAAU;CAAU,YAAY;AAAW,CAAC;AAG3F,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ACA;GACA;GACA;GACA,QAAQ;GACR;EACF,CAAC;CACH,CAAC,CACH;AACF"}
@@ -1,5 +1,5 @@
1
- import { n as ContextReference, o as SessionReference, t as AllocationAttempt } from "./References-URDAtapt.mjs";
2
- import { n as CleanupResult } from "./Cleanup-G2YpTCuU.mjs";
1
+ import { a as SessionReference, n as ContextReference, t as AllocationAttempt } from "./References-DOH3Wu44.mjs";
2
+ import { n as CleanupResult } from "./Cleanup-DMTDBir8.mjs";
3
3
  import { Effect, Schema } from "effect";
4
4
  //#region src/internal/session/WriterFacts.d.ts
5
5
  /**
@@ -58,4 +58,5 @@ interface WriterOptions<A, VerifyE, VerifyR> {
58
58
  }
59
59
  //#endregion
60
60
  export { WriterLease as a, WriterAttemptFacts as i, ContextWriterPermit as n, WriterOptions as o, PersistenceEvidence as r, WriterSettlementFacts as s, ContextWriterBackend as t };
61
- //# sourceMappingURL=WriterFacts-osvYAsIx.d.mts.map
61
+ export {};
62
+ //# sourceMappingURL=WriterFacts-5CPBGG1P.d.mts.map
package/dist/index.d.mts CHANGED
@@ -1,31 +1,27 @@
1
- import { a as References_d_exports } from "./References-URDAtapt.mjs";
2
- import { t as Errors_d_exports } from "./Errors.mjs";
3
- import { i as Client_d_exports } from "./Client-Ca0zSg1n.mjs";
4
- import { t as Agents_d_exports } from "./Agents.mjs";
5
- import { t as Certificates_d_exports } from "./Certificates.mjs";
6
- import { t as Contexts_d_exports } from "./Contexts.mjs";
7
- import { o as Sessions_d_exports } from "./Sessions-B8E4kMxo.mjs";
8
- import { n as SessionData_d_exports } from "./SessionData-DRKcKCqw.mjs";
9
- import { d as Transfers_d_exports } from "./Transfers-Czv5IZzJ.mjs";
10
- import { t as Downloads_d_exports } from "./Downloads.mjs";
11
- import { t as Extensions_d_exports } from "./Extensions.mjs";
12
- import { t as Functions_d_exports } from "./Functions.mjs";
13
- import { t as PageFetch_d_exports } from "./PageFetch.mjs";
14
- import { t as Projects_d_exports } from "./Projects.mjs";
15
- import { t as Recordings_d_exports } from "./Recordings.mjs";
16
- import { t as Replays_d_exports } from "./Replays.mjs";
17
- import { t as Search_d_exports } from "./Search.mjs";
18
- import { t as Uploads_d_exports } from "./Uploads.mjs";
19
- import { t as Webhooks_d_exports } from "./Webhooks.mjs";
20
- import { t as Account_d_exports } from "./Account.mjs";
21
- import { r as Cleanup_d_exports } from "./Cleanup-G2YpTCuU.mjs";
22
- import { t as ContextCoordination_d_exports } from "./ContextCoordination.mjs";
23
- import { t as Allocation_d_exports } from "./Allocation.mjs";
24
- import { s as Bootstrap_d_exports } from "./Bootstrap-m7lHgj0D.mjs";
25
- import { r as BrowserData_d_exports } from "./BrowserData-LpcAuAub.mjs";
26
- import { n as Launch_d_exports } from "./Launch-C8CfaYxb.mjs";
27
- import { t as Browser_d_exports } from "./Browser.mjs";
28
- import { t as Capture_d_exports } from "./Capture-BvWI-l1A.mjs";
29
- import { a as LocalBrowser_d_exports } from "./LocalBrowser-BLancJ3R.mjs";
30
- import { t as PageControl_d_exports } from "./PageControl.mjs";
31
- export { Account_d_exports as Account, Agents_d_exports as Agents, Allocation_d_exports as Allocation, Bootstrap_d_exports as Bootstrap, Browser_d_exports as Browser, BrowserData_d_exports as BrowserData, Capture_d_exports as Capture, Certificates_d_exports as Certificates, Cleanup_d_exports as Cleanup, Client_d_exports as Client, ContextCoordination_d_exports as ContextCoordination, Contexts_d_exports as Contexts, Downloads_d_exports as Downloads, Errors_d_exports as Errors, Extensions_d_exports as Extensions, Functions_d_exports as Functions, Launch_d_exports as Launch, LocalBrowser_d_exports as LocalBrowser, PageControl_d_exports as PageControl, PageFetch_d_exports as PageFetch, Projects_d_exports as Projects, Recordings_d_exports as Recordings, References_d_exports as References, Replays_d_exports as Replays, Search_d_exports as Search, SessionData_d_exports as SessionData, Sessions_d_exports as Sessions, Transfers_d_exports as Transfers, Uploads_d_exports as Uploads, Webhooks_d_exports as Webhooks };
1
+ import * as Account from "./Account.mjs";
2
+ import * as Agents from "./Agents.mjs";
3
+ import * as Allocation from "./Allocation.mjs";
4
+ import * as Browser from "./Browser.mjs";
5
+ import * as Certificates from "./Certificates.mjs";
6
+ import * as Cleanup from "./Cleanup.mjs";
7
+ import * as Client from "./Client.mjs";
8
+ import * as ContextCoordination from "./ContextCoordination.mjs";
9
+ import * as Contexts from "./Contexts.mjs";
10
+ import * as Downloads from "./Downloads.mjs";
11
+ import * as Errors from "./Errors.mjs";
12
+ import * as Extensions from "./Extensions.mjs";
13
+ import * as Functions from "./Functions.mjs";
14
+ import * as Launch from "./Launch.mjs";
15
+ import * as PageFetch from "./PageFetch.mjs";
16
+ import * as Projects from "./Projects.mjs";
17
+ import * as Recordings from "./Recordings.mjs";
18
+ import * as References from "./References.mjs";
19
+ import * as Replays from "./Replays.mjs";
20
+ import * as Search from "./Search.mjs";
21
+ import * as SessionData from "./SessionData.mjs";
22
+ import * as Sessions from "./Sessions.mjs";
23
+ import * as Transfers from "./Transfers.mjs";
24
+ import * as Uploads from "./Uploads.mjs";
25
+ import * as Webhooks from "./Webhooks.mjs";
26
+ export { Account, Agents, Allocation, Browser, Certificates, Cleanup, Client, ContextCoordination, Contexts, Downloads, Errors, Extensions, Functions, Launch, PageFetch, Projects, Recordings, References, Replays, Search, SessionData, Sessions, Transfers, Uploads, Webhooks };
27
+ export {};
package/dist/index.mjs CHANGED
@@ -1,31 +1,26 @@
1
- import { t as References_exports } from "./References.mjs";
2
- import { t as Errors_exports } from "./Errors.mjs";
3
- import { t as Transfers_exports } from "./Transfers.mjs";
4
- import { n as Client_exports } from "./Client-D1_xYM9o.mjs";
5
- import { t as BrowserData_exports } from "./BrowserData.mjs";
6
- import { t as Launch_exports } from "./Launch.mjs";
7
- import { t as SessionData_exports } from "./SessionData.mjs";
8
- import { t as Cleanup_exports } from "./Cleanup.mjs";
9
- import { t as Agents_exports } from "./Agents.mjs";
10
- import { t as Certificates_exports } from "./Certificates.mjs";
11
- import { t as Contexts_exports } from "./Contexts.mjs";
12
- import { a as Sessions_exports } from "./Sessions-CtbseWEh.mjs";
13
- import { t as Downloads_exports } from "./Downloads.mjs";
14
- import { i as Extensions_exports } from "./Extensions-ClZbYb1H.mjs";
15
- import { t as Functions_exports } from "./Functions.mjs";
16
- import { t as PageFetch_exports } from "./PageFetch.mjs";
17
- import { t as Projects_exports } from "./Projects.mjs";
18
- import { t as Recordings_exports } from "./Recordings.mjs";
19
- import { t as Replays_exports } from "./Replays.mjs";
20
- import { t as Search_exports } from "./Search.mjs";
21
- import { t as Uploads_exports } from "./Uploads.mjs";
22
- import { t as Webhooks_exports } from "./Webhooks.mjs";
23
- import { t as Account_exports } from "./Account.mjs";
24
- import { t as Allocation_exports } from "./Allocation.mjs";
25
- import { n as Bootstrap_exports } from "./Bootstrap-BXuzZojd.mjs";
26
- import { t as Browser_exports } from "./Browser.mjs";
27
- import { t as Capture_exports } from "./Capture-Bc0z9IAi.mjs";
28
- import { t as ContextCoordination_exports } from "./ContextCoordination.mjs";
29
- import { n as LocalBrowser_exports } from "./LocalBrowser-DsQLWNL1.mjs";
30
- import { t as PageControl_exports } from "./PageControl.mjs";
31
- export { Account_exports as Account, Agents_exports as Agents, Allocation_exports as Allocation, Bootstrap_exports as Bootstrap, Browser_exports as Browser, BrowserData_exports as BrowserData, Capture_exports as Capture, Certificates_exports as Certificates, Cleanup_exports as Cleanup, Client_exports as Client, ContextCoordination_exports as ContextCoordination, Contexts_exports as Contexts, Downloads_exports as Downloads, Errors_exports as Errors, Extensions_exports as Extensions, Functions_exports as Functions, Launch_exports as Launch, LocalBrowser_exports as LocalBrowser, PageControl_exports as PageControl, PageFetch_exports as PageFetch, Projects_exports as Projects, Recordings_exports as Recordings, References_exports as References, Replays_exports as Replays, Search_exports as Search, SessionData_exports as SessionData, Sessions_exports as Sessions, Transfers_exports as Transfers, Uploads_exports as Uploads, Webhooks_exports as Webhooks };
1
+ import * as Account from "./Account.mjs";
2
+ import * as Agents from "./Agents.mjs";
3
+ import * as Allocation from "./Allocation.mjs";
4
+ import * as Browser from "./Browser.mjs";
5
+ import * as Certificates from "./Certificates.mjs";
6
+ import * as Cleanup from "./Cleanup.mjs";
7
+ import * as Client from "./Client.mjs";
8
+ import * as ContextCoordination from "./ContextCoordination.mjs";
9
+ import * as Contexts from "./Contexts.mjs";
10
+ import * as Downloads from "./Downloads.mjs";
11
+ import * as Errors from "./Errors.mjs";
12
+ import * as Extensions from "./Extensions.mjs";
13
+ import * as Functions from "./Functions.mjs";
14
+ import * as Launch from "./Launch.mjs";
15
+ import * as PageFetch from "./PageFetch.mjs";
16
+ import * as Projects from "./Projects.mjs";
17
+ import * as Recordings from "./Recordings.mjs";
18
+ import * as References from "./References.mjs";
19
+ import * as Replays from "./Replays.mjs";
20
+ import * as Search from "./Search.mjs";
21
+ import * as SessionData from "./SessionData.mjs";
22
+ import * as Sessions from "./Sessions.mjs";
23
+ import * as Transfers from "./Transfers.mjs";
24
+ import * as Uploads from "./Uploads.mjs";
25
+ import * as Webhooks from "./Webhooks.mjs";
26
+ export { Account, Agents, Allocation, Browser, Certificates, Cleanup, Client, ContextCoordination, Contexts, Downloads, Errors, Extensions, Functions, Launch, PageFetch, Projects, Recordings, References, Replays, Search, SessionData, Sessions, Transfers, Uploads, Webhooks };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "effect-browserbase",
3
- "version": "0.1.0-beta.104",
4
- "description": "Effect-based Browserbase resources, owned browser control and independent browser artifacts.",
3
+ "version": "0.2.0-beta.0",
4
+ "description": "Effect-based Browserbase resources and hosted integration for effect-browser.",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
@@ -15,12 +15,7 @@
15
15
  },
16
16
  "peerDependencies": {
17
17
  "effect": "^4.0.0-rc.115",
18
- "playwright-core": "1.63.0"
19
- },
20
- "peerDependenciesMeta": {
21
- "playwright-core": {
22
- "optional": true
23
- }
18
+ "effect-browser": "0.2.0-beta.0"
24
19
  },
25
20
  "homepage": "https://github.com/mannyc2/effect-agent-browserbase#readme",
26
21
  "bugs": {
@@ -46,10 +41,6 @@
46
41
  "types": "./dist/Allocation.d.mts",
47
42
  "default": "./dist/Allocation.mjs"
48
43
  },
49
- "./bootstrap": {
50
- "types": "./dist/Bootstrap.d.mts",
51
- "default": "./dist/Bootstrap.mjs"
52
- },
53
44
  "./browser": {
54
45
  "types": "./dist/Browser.d.mts",
55
46
  "default": "./dist/Browser.mjs"
@@ -58,14 +49,6 @@
58
49
  "types": "./dist/BrowserBinding.d.mts",
59
50
  "default": "./dist/BrowserBinding.mjs"
60
51
  },
61
- "./browser-data": {
62
- "types": "./dist/BrowserData.d.mts",
63
- "default": "./dist/BrowserData.mjs"
64
- },
65
- "./capture": {
66
- "types": "./dist/Capture.d.mts",
67
- "default": "./dist/Capture.mjs"
68
- },
69
52
  "./certificates": {
70
53
  "types": "./dist/Certificates.d.mts",
71
54
  "default": "./dist/Certificates.mjs"
@@ -106,14 +89,6 @@
106
89
  "types": "./dist/Launch.d.mts",
107
90
  "default": "./dist/Launch.mjs"
108
91
  },
109
- "./local-browser": {
110
- "types": "./dist/LocalBrowser.d.mts",
111
- "default": "./dist/LocalBrowser.mjs"
112
- },
113
- "./page-control": {
114
- "types": "./dist/PageControl.d.mts",
115
- "default": "./dist/PageControl.mjs"
116
- },
117
92
  "./page-fetch": {
118
93
  "types": "./dist/PageFetch.d.mts",
119
94
  "default": "./dist/PageFetch.mjs"