effect-browserbase 0.1.0-beta.104 → 0.2.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -307
- package/dist/Account.d.mts +17 -19
- package/dist/Account.mjs +4 -9
- package/dist/Account.mjs.map +1 -1
- package/dist/{Acquisition-WBafHwXH.mjs → Acquisition-CAsTTXp4.mjs} +25 -70
- package/dist/Acquisition-CAsTTXp4.mjs.map +1 -0
- package/dist/Agents-5HpTp9YE.d.mts +155 -0
- package/dist/Agents.d.mts +3 -156
- package/dist/Agents.mjs +4 -20
- package/dist/Agents.mjs.map +1 -1
- package/dist/Allocation.d.mts +9 -11
- package/dist/Allocation.mjs +2 -4
- package/dist/Allocation.mjs.map +1 -1
- package/dist/Browser-DpSajNai.mjs +270 -0
- package/dist/Browser-DpSajNai.mjs.map +1 -0
- package/dist/Browser.d.mts +26 -143
- package/dist/Browser.mjs +3 -223
- package/dist/BrowserBinding.d.mts +7 -34
- package/dist/BrowserBinding.mjs +30 -1
- package/dist/BrowserBinding.mjs.map +1 -0
- package/dist/Certificates-D4NQmyeA.d.mts +34 -0
- package/dist/Certificates.d.mts +3 -35
- package/dist/Certificates.mjs +2 -7
- package/dist/Certificates.mjs.map +1 -1
- package/dist/{Cleanup-G2YpTCuU.d.mts → Cleanup-DMTDBir8.d.mts} +5 -6
- package/dist/Cleanup.d.mts +3 -2
- package/dist/Cleanup.mjs +1 -6
- package/dist/Cleanup.mjs.map +1 -1
- package/dist/{Client-D1_xYM9o.mjs → Client-4RMKIpL2.mjs} +12 -12
- package/dist/Client-4RMKIpL2.mjs.map +1 -0
- package/dist/{Client-Ca0zSg1n.d.mts → Client-B_f6bBLT.d.mts} +4 -5
- package/dist/Client.d.mts +3 -2
- package/dist/Client.mjs +1 -1
- package/dist/Connection-sxyxtwlk.mjs +56 -0
- package/dist/Connection-sxyxtwlk.mjs.map +1 -0
- package/dist/ContextCoordination.d.mts +5 -6
- package/dist/ContextCoordination.mjs +2 -9
- package/dist/ContextCoordination.mjs.map +1 -1
- package/dist/{ContextWriter-BrQmoXRg.mjs → ContextWriter-oKWFLHuP.mjs} +8 -12
- package/dist/ContextWriter-oKWFLHuP.mjs.map +1 -0
- package/dist/Contexts-DqdL7cyX.d.mts +31 -0
- package/dist/Contexts.d.mts +3 -32
- package/dist/Contexts.mjs +3 -9
- package/dist/Contexts.mjs.map +1 -1
- package/dist/Downloads-CdhiCO5X.d.mts +43 -0
- package/dist/Downloads.d.mts +3 -44
- package/dist/Downloads.mjs +3 -8
- package/dist/Downloads.mjs.map +1 -1
- package/dist/Errors.d.mts +3 -26
- package/dist/Errors.mjs +1 -137
- package/dist/Errors.mjs.map +1 -1
- package/dist/Extensions-DBXuVM1f.d.mts +43 -0
- package/dist/{Extensions-ClZbYb1H.mjs → Extensions-Dg3jHOf0.mjs} +3 -9
- package/dist/Extensions-Dg3jHOf0.mjs.map +1 -0
- package/dist/Extensions.d.mts +3 -44
- package/dist/Extensions.mjs +1 -1
- package/dist/Functions-CsKMMUuZ.d.mts +226 -0
- package/dist/Functions.d.mts +3 -227
- package/dist/Functions.mjs +4 -18
- package/dist/Functions.mjs.map +1 -1
- package/dist/{Launch-BHcAEq05.mjs → Launch-cAdE2rrZ.mjs} +16 -12
- package/dist/Launch-cAdE2rrZ.mjs.map +1 -0
- package/dist/Launch.d.mts +127 -2
- package/dist/Launch.mjs +5 -13
- package/dist/Launch.mjs.map +1 -1
- package/dist/PageFetch-CAMqb5m8.d.mts +39 -0
- package/dist/PageFetch.d.mts +3 -40
- package/dist/PageFetch.mjs +2 -8
- package/dist/PageFetch.mjs.map +1 -1
- package/dist/Projects-tm5bTDH0.d.mts +38 -0
- package/dist/Projects.d.mts +3 -39
- package/dist/Projects.mjs +2 -8
- package/dist/Projects.mjs.map +1 -1
- package/dist/Recordings-bVI33sTq.d.mts +27 -0
- package/dist/Recordings.d.mts +3 -28
- package/dist/Recordings.mjs +3 -5
- package/dist/Recordings.mjs.map +1 -1
- package/dist/{References-URDAtapt.d.mts → References-DOH3Wu44.d.mts} +5 -6
- package/dist/References.d.mts +3 -2
- package/dist/References.mjs +10 -18
- package/dist/References.mjs.map +1 -1
- package/dist/Replays-Bo-9xeLz.d.mts +27 -0
- package/dist/Replays.d.mts +3 -28
- package/dist/Replays.mjs +3 -5
- package/dist/Replays.mjs.map +1 -1
- package/dist/Search-1g6TUem7.d.mts +37 -0
- package/dist/Search.d.mts +3 -38
- package/dist/Search.mjs +2 -9
- package/dist/Search.mjs.map +1 -1
- package/dist/{SessionData-DRKcKCqw.d.mts → SessionData-5xYZDshJ.d.mts} +5 -6
- package/dist/SessionData.d.mts +3 -2
- package/dist/SessionData.mjs +1 -8
- package/dist/SessionData.mjs.map +1 -1
- package/dist/{Sessions-B8E4kMxo.d.mts → Sessions-BpZgjteE.d.mts} +8 -8
- package/dist/{Sessions-CtbseWEh.mjs → Sessions-suOLSym9.mjs} +34 -18
- package/dist/Sessions-suOLSym9.mjs.map +1 -0
- package/dist/Sessions.d.mts +4 -3
- package/dist/Sessions.mjs +1 -1
- package/dist/Testing.d.mts +119 -0
- package/dist/Testing.mjs +206 -0
- package/dist/Testing.mjs.map +1 -0
- package/dist/{Transfers-Czv5IZzJ.d.mts → Transfers-GVqzrDWl.d.mts} +22 -9
- package/dist/Transfers.d.mts +3 -2
- package/dist/Transfers.mjs +12 -28
- package/dist/Transfers.mjs.map +1 -1
- package/dist/Uploads-C2neBEpj.d.mts +28 -0
- package/dist/Uploads.d.mts +3 -29
- package/dist/Uploads.mjs +3 -5
- package/dist/Uploads.mjs.map +1 -1
- package/dist/Webhooks-BoeRAxzG.d.mts +59 -0
- package/dist/Webhooks.d.mts +3 -60
- package/dist/Webhooks.mjs +2 -11
- package/dist/Webhooks.mjs.map +1 -1
- package/dist/{WriterFacts-osvYAsIx.d.mts → WriterFacts-BBJRDZYY.d.mts} +8 -15
- package/dist/index.d.mts +27 -31
- package/dist/index.mjs +26 -31
- package/package.json +7 -28
- package/dist/Acquisition-WBafHwXH.mjs.map +0 -1
- package/dist/Association-CEps4hYP.mjs +0 -10
- package/dist/Association-CEps4hYP.mjs.map +0 -1
- package/dist/Bootstrap-BXuzZojd.mjs +0 -194
- package/dist/Bootstrap-BXuzZojd.mjs.map +0 -1
- package/dist/Bootstrap-m7lHgj0D.d.mts +0 -177
- package/dist/Bootstrap.d.mts +0 -2
- package/dist/Bootstrap.mjs +0 -2
- package/dist/Browser.mjs.map +0 -1
- package/dist/BrowserBinding-DlJTGYZL.mjs +0 -2508
- package/dist/BrowserBinding-DlJTGYZL.mjs.map +0 -1
- package/dist/BrowserData-LpcAuAub.d.mts +0 -369
- package/dist/BrowserData.d.mts +0 -2
- package/dist/BrowserData.mjs +0 -442
- package/dist/BrowserData.mjs.map +0 -1
- package/dist/Capture-Bc0z9IAi.mjs +0 -571
- package/dist/Capture-Bc0z9IAi.mjs.map +0 -1
- package/dist/Capture-BvWI-l1A.d.mts +0 -168
- package/dist/Capture.d.mts +0 -2
- package/dist/Capture.mjs +0 -2
- package/dist/Client-D1_xYM9o.mjs.map +0 -1
- package/dist/ContextWriter-BrQmoXRg.mjs.map +0 -1
- package/dist/Extensions-ClZbYb1H.mjs.map +0 -1
- package/dist/Images-DgscEfSf.mjs +0 -127
- package/dist/Images-DgscEfSf.mjs.map +0 -1
- package/dist/Launch-BHcAEq05.mjs.map +0 -1
- package/dist/Launch-C8CfaYxb.d.mts +0 -132
- package/dist/LocalBrowser-BLancJ3R.d.mts +0 -79
- package/dist/LocalBrowser-DsQLWNL1.mjs +0 -439
- package/dist/LocalBrowser-DsQLWNL1.mjs.map +0 -1
- package/dist/LocalBrowser.d.mts +0 -2
- package/dist/LocalBrowser.mjs +0 -2
- package/dist/PageControl.d.mts +0 -16
- package/dist/PageControl.mjs +0 -36
- package/dist/PageControl.mjs.map +0 -1
- package/dist/PageControlAssociation-DabEg5AR.mjs +0 -10
- package/dist/PageControlAssociation-DabEg5AR.mjs.map +0 -1
- package/dist/Session-D4nT9hOO.mjs +0 -1379
- package/dist/Session-D4nT9hOO.mjs.map +0 -1
- package/dist/Sessions-CtbseWEh.mjs.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.mjs +0 -13
package/dist/Webhooks.d.mts
CHANGED
|
@@ -1,60 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare namespace Webhooks_d_exports {
|
|
5
|
-
export { BrowserbaseWebhooks, WebhookEventType, WebhookListQuery, WebhookMetadata, WebhookPage, WebhookRegistration, WebhookSettings, WebhookUpdate };
|
|
6
|
-
}
|
|
7
|
-
/** Provider event names. Browserbase currently emits Functions events only. */
|
|
8
|
-
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
|
-
export type WebhookEventType = typeof WebhookEventType.Type;
|
|
10
|
-
export declare const WebhookSettings: Schema.Struct<{
|
|
11
|
-
readonly endpoint: Schema.NonEmptyString;
|
|
12
|
-
readonly eventTypes: Schema.$Array<Schema.Literals<readonly ["functions.builds.running", "functions.builds.completed", "functions.builds.failed", "functions.invocations.pending", "functions.invocations.running", "functions.invocations.completed", "functions.invocations.failed"]>>;
|
|
13
|
-
}>;
|
|
14
|
-
export type WebhookSettings = typeof WebhookSettings.Type;
|
|
15
|
-
export declare const WebhookUpdate: Schema.Struct<{
|
|
16
|
-
readonly endpoint: Schema.optionalKey<Schema.NonEmptyString>;
|
|
17
|
-
readonly eventTypes: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["functions.builds.running", "functions.builds.completed", "functions.builds.failed", "functions.invocations.pending", "functions.invocations.running", "functions.invocations.completed", "functions.invocations.failed"]>>>;
|
|
18
|
-
}>;
|
|
19
|
-
export type WebhookUpdate = typeof WebhookUpdate.Type;
|
|
20
|
-
declare const WebhookMetadata_base: Schema.Class<WebhookMetadata, Schema.Struct<{
|
|
21
|
-
readonly webhookId: Schema.NonEmptyString;
|
|
22
|
-
readonly projectId: Schema.NonEmptyString;
|
|
23
|
-
readonly endpoint: Schema.String;
|
|
24
|
-
readonly eventTypes: Schema.$Array<Schema.String>;
|
|
25
|
-
readonly createdAt: Schema.String;
|
|
26
|
-
readonly updatedAt: Schema.String;
|
|
27
|
-
}>, {}>;
|
|
28
|
-
export declare class WebhookMetadata extends WebhookMetadata_base {}
|
|
29
|
-
/** A signing secret is returned once, redacted so it cannot be logged by accident. */
|
|
30
|
-
export interface WebhookRegistration {
|
|
31
|
-
readonly webhook: WebhookMetadata;
|
|
32
|
-
readonly secret: Redacted.Redacted<string>;
|
|
33
|
-
}
|
|
34
|
-
export interface WebhookPage {
|
|
35
|
-
readonly webhooks: ReadonlyArray<WebhookMetadata>;
|
|
36
|
-
readonly nextCursor: string | undefined;
|
|
37
|
-
}
|
|
38
|
-
export declare const WebhookListQuery: Schema.Struct<{
|
|
39
|
-
readonly cursor: Schema.optionalKey<Schema.NonEmptyString>;
|
|
40
|
-
readonly limit: Schema.optionalKey<Schema.Int>;
|
|
41
|
-
}>;
|
|
42
|
-
export type WebhookListQuery = typeof WebhookListQuery.Type;
|
|
43
|
-
declare const BrowserbaseWebhooks_base: Context.ServiceClass<BrowserbaseWebhooks, "effect-browserbase/Webhooks", {
|
|
44
|
-
readonly create: (settings: WebhookSettings) => Effect.Effect<WebhookRegistration, PlatformError>;
|
|
45
|
-
readonly list: (query?: WebhookListQuery) => Effect.Effect<WebhookPage, PlatformError>;
|
|
46
|
-
readonly retrieve: (webhookId: string) => Effect.Effect<WebhookMetadata, PlatformError>;
|
|
47
|
-
readonly update: (webhookId: string, update: WebhookUpdate) => Effect.Effect<WebhookMetadata, PlatformError>;
|
|
48
|
-
readonly delete: (webhookId: string) => Effect.Effect<void, PlatformError>;
|
|
49
|
-
/** Issues a new secret; the old one keeps working unless `revokeImmediately`. */
|
|
50
|
-
readonly rotateSecret: (webhookId: string, options?: {
|
|
51
|
-
readonly revokeImmediately?: boolean;
|
|
52
|
-
}) => Effect.Effect<Redacted.Redacted<string>, PlatformError>;
|
|
53
|
-
}>;
|
|
54
|
-
/** Webhook administration for the Client's project. Mutations are never retried. */
|
|
55
|
-
export declare class BrowserbaseWebhooks extends BrowserbaseWebhooks_base {
|
|
56
|
-
static readonly layer: Layer.Layer<BrowserbaseWebhooks, never, BrowserbaseClient>;
|
|
57
|
-
}
|
|
58
|
-
//#endregion
|
|
59
|
-
export { Webhooks_d_exports as t };
|
|
60
|
-
//# sourceMappingURL=Webhooks.d.mts.map
|
|
1
|
+
import { a as WebhookPage, c as WebhookUpdate, i as WebhookMetadata, n as WebhookEventType, o as WebhookRegistration, r as WebhookListQuery, s as WebhookSettings, t as BrowserbaseWebhooks } from "./Webhooks-BoeRAxzG.mjs";
|
|
2
|
+
export { BrowserbaseWebhooks, WebhookEventType, WebhookListQuery, WebhookMetadata, WebhookPage, WebhookRegistration, WebhookSettings, WebhookUpdate };
|
|
3
|
+
export {};
|
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-
|
|
3
|
+
import { t as BrowserbaseClient } from "./Client-4RMKIpL2.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
|
|
132
|
+
export { BrowserbaseWebhooks, WebhookEventType, WebhookListQuery, WebhookMetadata, WebhookSettings, WebhookUpdate };
|
|
142
133
|
|
|
143
134
|
//# sourceMappingURL=Webhooks.mjs.map
|
package/dist/Webhooks.mjs.map
CHANGED
|
@@ -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,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC;CACtD,YAAY,OAAO,MAAM,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,MACrE,OAAO,YAAY,EAAE,CACvB;CACA,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CAAC,CAAC;AAaJ,MAAM,kBAAkB,OAAO,OAAO;CACpC,IAAI;CACJ,WAAW;CACX,UAAU,gBAAgB,OAAO;CACjC,YAAY,gBAAg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ACA,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,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,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC;CACtD,YAAY,OAAO,MAAM,OAAO,OAAO,MAAM,OAAO,YAAY,GAAG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,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,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as CleanupResult } from "./Cleanup-
|
|
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
|
/**
|
|
@@ -7,13 +7,9 @@ import { Effect, Schema } from "effect";
|
|
|
7
7
|
* implementation need. Keeping it here leaves one direction of dependency:
|
|
8
8
|
* `ContextCoordination` and `ContextWriter` both read this module, never each other.
|
|
9
9
|
*/
|
|
10
|
-
declare const PersistenceEvidence: Schema.Union<readonly [Schema.
|
|
11
|
-
readonly _tag: Schema.Literal<"NotRequested">;
|
|
12
|
-
}>, Schema.Struct<{
|
|
13
|
-
readonly _tag: Schema.Literal<"Unconfirmed">;
|
|
10
|
+
declare const PersistenceEvidence: Schema.Union<readonly [Schema.TaggedStruct<"NotRequested", {}>, Schema.TaggedStruct<"Unconfirmed", {
|
|
14
11
|
readonly reason: Schema.Literals<readonly ["writer-active", "writer-unknown", "flush-unacknowledged"]>;
|
|
15
|
-
}>, Schema.
|
|
16
|
-
readonly _tag: Schema.Literal<"Observed">;
|
|
12
|
+
}>, Schema.TaggedStruct<"Observed", {
|
|
17
13
|
readonly method: Schema.Literal<"consumer-readback">;
|
|
18
14
|
readonly observedAtMillis: Schema.Finite;
|
|
19
15
|
}>]>;
|
|
@@ -28,13 +24,9 @@ declare class WriterAttemptFacts extends WriterAttemptFacts_base {}
|
|
|
28
24
|
declare const WriterSettlementFacts_base: Schema.Class<WriterSettlementFacts, Schema.Struct<{
|
|
29
25
|
readonly reference: typeof ContextReference;
|
|
30
26
|
readonly attempts: Schema.$Array<typeof WriterAttemptFacts>;
|
|
31
|
-
readonly persistence: Schema.Union<readonly [Schema.
|
|
32
|
-
readonly _tag: Schema.Literal<"NotRequested">;
|
|
33
|
-
}>, Schema.Struct<{
|
|
34
|
-
readonly _tag: Schema.Literal<"Unconfirmed">;
|
|
27
|
+
readonly persistence: Schema.Union<readonly [Schema.TaggedStruct<"NotRequested", {}>, Schema.TaggedStruct<"Unconfirmed", {
|
|
35
28
|
readonly reason: Schema.Literals<readonly ["writer-active", "writer-unknown", "flush-unacknowledged"]>;
|
|
36
|
-
}>, Schema.
|
|
37
|
-
readonly _tag: Schema.Literal<"Observed">;
|
|
29
|
+
}>, Schema.TaggedStruct<"Observed", {
|
|
38
30
|
readonly method: Schema.Literal<"consumer-readback">;
|
|
39
31
|
readonly observedAtMillis: Schema.Finite;
|
|
40
32
|
}>]>;
|
|
@@ -58,4 +50,5 @@ interface WriterOptions<A, VerifyE, VerifyR> {
|
|
|
58
50
|
}
|
|
59
51
|
//#endregion
|
|
60
52
|
export { WriterLease as a, WriterAttemptFacts as i, ContextWriterPermit as n, WriterOptions as o, PersistenceEvidence as r, WriterSettlementFacts as s, ContextWriterBackend as t };
|
|
61
|
-
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=WriterFacts-BBJRDZYY.d.mts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
|
|
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.
|
|
4
|
-
"description": "Effect-based Browserbase resources
|
|
3
|
+
"version": "0.2.0-beta.1",
|
|
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
|
-
"
|
|
19
|
-
},
|
|
20
|
-
"peerDependenciesMeta": {
|
|
21
|
-
"playwright-core": {
|
|
22
|
-
"optional": true
|
|
23
|
-
}
|
|
18
|
+
"effect-browser": "0.2.0-beta.1"
|
|
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"
|
|
@@ -146,6 +121,10 @@
|
|
|
146
121
|
"types": "./dist/Sessions.d.mts",
|
|
147
122
|
"default": "./dist/Sessions.mjs"
|
|
148
123
|
},
|
|
124
|
+
"./testing": {
|
|
125
|
+
"types": "./dist/Testing.d.mts",
|
|
126
|
+
"default": "./dist/Testing.mjs"
|
|
127
|
+
},
|
|
149
128
|
"./transfers": {
|
|
150
129
|
"types": "./dist/Transfers.d.mts",
|
|
151
130
|
"default": "./dist/Transfers.mjs"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Acquisition-WBafHwXH.mjs","names":[],"sources":["../src/internal/provider/Connection.ts","../src/internal/session/Cleanup.ts","../src/internal/session/Diagnostics.ts","../src/internal/session/Acquisition.ts"],"sourcesContent":["import { Effect, Redacted, Schema } from \"effect\";\n\nimport type { BrowserbaseClient } from \"../../Client.ts\";\nimport { SessionError } from \"../../Errors.ts\";\nimport { SessionReference } from \"../../References.ts\";\nimport { ProviderSession } from \"../../SessionData.ts\";\nimport type { BrowserbaseSessions } from \"../../Sessions.ts\";\nimport { deadlineAfter, nowMillis, until } from \"../Deadline.ts\";\n\nconst Connection = Schema.Struct({\n ...ProviderSession.fields,\n connectUrl: Schema.String.check(Schema.isMaxLength(16384)),\n});\n\n/** A provider-issued endpoint is authority, not a persisted session identifier. */\nexport const connectionUrl = Schema.String.check(\n Schema.isMaxLength(16384),\n Schema.makeFilter((value) => {\n try {\n const url = new URL(value);\n\n return (\n url.protocol === \"wss:\" &&\n !url.username &&\n !url.password &&\n !url.port &&\n !url.hash &&\n url.hostname.endsWith(\".browserbase.com\")\n );\n } catch {\n return false;\n }\n }),\n);\n\nexport const connectionAddress = Effect.fnUntraced(function* (\n client: BrowserbaseClient[\"Service\"],\n sessions: BrowserbaseSessions[\"Service\"],\n reference: SessionReference,\n timeoutMillis: number,\n) {\n const fail = (reason: SessionError[\"reason\"]) =>\n SessionError.make({ operation: \"session-connect\", reason });\n\n const ref = yield* Schema.decodeEffect(SessionReference)(reference).pipe(\n Effect.mapError(() => fail(\"configuration\")),\n );\n\n if (ref.projectId !== client.projectId) return yield* fail(\"authorization\");\n const deadline = yield* deadlineAfter(timeoutMillis);\n\n yield* sessions.waitUntilRunning(ref, { timeoutMillis });\n if ((yield* nowMillis) >= deadline) return yield* fail(\"timeout\");\n\n const raw = yield* until(\n client.json(\"GET\", `/v1/sessions/${encodeURIComponent(ref.sessionId)}`, undefined, deadline),\n deadline,\n () => fail(\"timeout\"),\n ).pipe(Effect.mapError((error) => fail(error.reason)));\n\n const value = yield* Schema.decodeUnknownEffect(Connection)(raw).pipe(\n Effect.mapError(() => fail(\"malformed\")),\n );\n\n if (value.id !== ref.sessionId || value.projectId !== ref.projectId)\n return yield* fail(\"malformed\");\n if (value.status !== \"RUNNING\") return yield* fail(\"expired\");\n\n const url = yield* Schema.decodeEffect(connectionUrl)(value.connectUrl).pipe(\n Effect.mapError(() => fail(\"unsafe-url\")),\n );\n\n return Redacted.make(url);\n});\n","import { Cause, Effect, Exit, Option } from \"effect\";\n\nimport { CleanupIssue, CleanupResult } from \"../../Cleanup.ts\";\nimport type { BrowserError, InitializationError } from \"../../Errors.ts\";\nimport type { SessionReference } from \"../../References.ts\";\nimport type { SessionStatus } from \"../../SessionData.ts\";\nimport type { BrowserbaseSessions } from \"../../Sessions.ts\";\n\n/** All effects are captured by the owning connection; no native value is exported. */\nexport interface LocalCleanup {\n readonly fence: Effect.Effect<void>;\n readonly capture: Effect.Effect<void, BrowserError>;\n readonly initialization: Effect.Effect<void, BrowserError | InitializationError>;\n readonly disconnect: Effect.Effect<CleanupResult[\"local\"], BrowserError>;\n}\n\nexport const noLocalConnection: LocalCleanup = {\n fence: Effect.void,\n capture: Effect.void,\n initialization: Effect.void,\n disconnect: Effect.succeed(\"not-connected\"),\n};\n\n/** Bounded host notification of canonical facts. Reporting never changes them. */\nexport const reported = <A, E>(effect: Effect.Effect<A, E>) =>\n effect.pipe(\n Effect.interruptible,\n Effect.timeoutOrElse({ duration: 2000, orElse: () => Effect.void }),\n Effect.ignore,\n );\n\n/** Internal limits, also injectable by deterministic failure tests. */\nexport interface CleanupLimits {\n readonly localStepMillis: number;\n readonly releaseMillis: number;\n readonly terminalMillis: number;\n}\n\nexport const defaultCleanupLimits: CleanupLimits = {\n localStepMillis: 3000,\n releaseMillis: 4000,\n terminalMillis: 4000,\n};\n\n/**\n * Close is one uninterruptible, bounded transaction over *local cleanup evidence*, not\n * a transaction over the remote browser. Each step observes its own Exit so failures\n * cannot suppress a later disconnect, release request, or exact-session status read.\n */\nexport const makeCleanup = Effect.fnUntraced(function* (\n reference: SessionReference,\n ownership: CleanupResult[\"ownership\"],\n sessions: BrowserbaseSessions[\"Service\"],\n local: LocalCleanup,\n report: (result: CleanupResult) => void,\n limits: CleanupLimits = defaultCleanupLimits,\n) {\n let latest: CleanupResult | undefined;\n\n const close = yield* Effect.cached(\n Effect.uninterruptible(\n Effect.gen(function* () {\n const issues: CleanupIssue[] = [];\n\n const step = <A, E>(\n name: CleanupIssue[\"step\"],\n action: Effect.Effect<A, E>,\n milliseconds: number,\n ) =>\n action.pipe(\n Effect.interruptible,\n Effect.timeoutOrElse({\n duration: milliseconds,\n orElse: () => Effect.fail(CleanupIssue.make({ step: name, reason: \"timeout\" })),\n }),\n Effect.exit,\n Effect.tap((exit) =>\n Effect.sync(() => {\n if (Exit.isSuccess(exit)) return;\n const reason = Cause.findErrorOption(exit.cause);\n\n issues.push(\n CleanupIssue.make({\n step: name,\n reason:\n Option.isSome(reason) && reason.value instanceof CleanupIssue\n ? reason.value.reason\n : Cause.hasInterrupts(exit.cause)\n ? \"interrupted\"\n : \"failed\",\n }),\n );\n }),\n ),\n );\n\n // The fence runs synchronously before interruptible native teardown begins.\n yield* step(\"fence\", local.fence, limits.localStepMillis);\n yield* step(\"capture\", local.capture, limits.localStepMillis);\n yield* step(\"initialization\", local.initialization, limits.localStepMillis);\n const disconnected = yield* step(\"disconnect\", local.disconnect, limits.localStepMillis);\n const localState = Exit.isSuccess(disconnected) ? disconnected.value : \"failed\";\n\n let releaseRequested = false;\n let remote: CleanupResult[\"remote\"] = ownership === \"borrowed\" ? \"not-owned\" : \"unknown\";\n let observedStatus: SessionStatus | undefined;\n\n if (ownership === \"owned\") {\n const requested = yield* step(\n \"release\",\n sessions.requestRelease(reference),\n limits.releaseMillis,\n );\n\n releaseRequested = Exit.isSuccess(requested);\n\n // A POST response is never substituted for a passive terminal-state observation.\n const terminal = yield* step(\n \"status\",\n sessions.waitForTerminal(reference, { timeoutMillis: limits.terminalMillis }),\n limits.terminalMillis,\n );\n\n if (Exit.isSuccess(terminal)) {\n remote = \"confirmed\";\n observedStatus = terminal.value.status;\n } else if (Exit.isSuccess(requested)) {\n remote = \"pending\";\n }\n }\n\n const result = CleanupResult.make({\n reference,\n ownership,\n releaseRequested,\n remote,\n local: localState,\n ...(observedStatus === undefined ? {} : { observedStatus }),\n issues,\n });\n\n Object.freeze(result.issues);\n latest = Object.freeze(result);\n report(latest);\n\n return latest;\n }),\n ),\n );\n\n return {\n close,\n result: Effect.sync(() => Option.fromNullishOr(latest)),\n };\n});\n","import { Cause, Data, Effect, ErrorReporter } from \"effect\";\n\nimport type { CleanupResult } from \"../../Cleanup.ts\";\nimport type { AllocationAttempt } from \"../../References.ts\";\n\n/**\n * Operator-visible evidence that a session's fate was not settled. It carries identity and\n * outcome labels only: no provider body, connection URL, credential or page content. The\n * transport deliberately disables tracing where credentials travel, so without this an\n * unconfirmed release or an allocation of unknown outcome would leave no trace for anyone who\n * did not register a callback.\n */\nclass SessionUnsettled extends Data.TaggedError(\"BrowserbaseSessionUnsettled\")<{\n readonly message: string;\n readonly details: Readonly<Record<string, string | number>>;\n}> {\n readonly [ErrorReporter.severity] = \"Warn\" as const;\n\n get [ErrorReporter.attributes]() {\n return this.details;\n }\n}\n\nconst surface = (message: string, details: Readonly<Record<string, string | number>>) =>\n Effect.logWarning(message).pipe(\n Effect.annotateLogs(details),\n Effect.andThen(ErrorReporter.report(Cause.fail(new SessionUnsettled({ message, details })))),\n );\n\n/** A borrowed scope never owns release, so only its local teardown can be unsettled. */\nexport const reportCleanup = (result: CleanupResult): Effect.Effect<void> => {\n const remoteUnsettled =\n result.ownership === \"owned\" && (result.remote !== \"confirmed\" || !result.releaseRequested);\n\n if (!remoteUnsettled && result.local !== \"failed\" && result.issues.length === 0)\n return Effect.void;\n\n return surface(\"Browserbase session cleanup ended without confirmation\", {\n projectId: result.reference.projectId,\n sessionId: result.reference.sessionId,\n ownership: result.ownership,\n remote: result.remote,\n local: result.local,\n observedStatus: result.observedStatus ?? \"unobserved\",\n issues: result.issues.map((issue) => `${issue.step}:${issue.reason}`).join(\",\") || \"none\",\n });\n};\n\n/** The provider may have allocated a session this process has no reference for. */\nexport const reportAllocationUncertain = (attempt: AllocationAttempt): Effect.Effect<void> =>\n surface(\"Browserbase allocation outcome is unknown\", {\n projectId: attempt.projectId,\n attemptId: attempt.attemptId,\n requestedAtMillis: attempt.requestedAtMillis,\n });\n","import { Clock, Effect, Exit, Option, Schema, Scope } from \"effect\";\n\nimport type { CleanupResult } from \"../../Cleanup.ts\";\nimport { BrowserbaseClient } from \"../../Client.ts\";\nimport { AllocationError, ContextError, type ClientError, SessionError } from \"../../Errors.ts\";\nimport type { LaunchRecipe } from \"../../Launch.ts\";\nimport { type AllocationAttempt, Identifier, SessionReference } from \"../../References.ts\";\nimport { BrowserbaseSessions } from \"../../Sessions.ts\";\nimport { connectionAddress } from \"../provider/Connection.ts\";\nimport { compileLaunch } from \"../provider/Launch.ts\";\nimport {\n makeCleanup,\n noLocalConnection,\n reported,\n type CleanupLimits,\n type LocalCleanup,\n} from \"./Cleanup.ts\";\nimport { requireContextWriterPermit, type ContextWriterPermitInternal } from \"./ContextWriter.ts\";\nimport { reportAllocationUncertain, reportCleanup } from \"./Diagnostics.ts\";\nimport type { ContextWriterPermit } from \"./WriterFacts.ts\";\n\nconst AllocatedIdentity = Schema.Struct({ id: Identifier, projectId: Identifier });\n\nexport interface AcquisitionOptions {\n readonly launch: LaunchRecipe;\n readonly contextWriter?: ContextWriterPermit;\n readonly allocationDeadline?: number;\n /** Bounded host notification of the canonical facts. Reporting never changes them. */\n readonly onCleanup?: (result: CleanupResult) => Effect.Effect<void>;\n /** Exactly one notification when a creation attempt's effect on the provider is unknown. */\n readonly onAllocationUncertain?: (attempt: AllocationAttempt) => Effect.Effect<void>;\n}\n\n/**\n * The remote lease is registered before POST. Local connection work is supplied by\n * the same browser owner; the control plane never invents a second operation owner.\n */\nexport const acquireRemote = Effect.fnUntraced(function* (\n options: AcquisitionOptions,\n local: LocalCleanup = noLocalConnection,\n limits?: CleanupLimits,\n) {\n const client = yield* BrowserbaseClient;\n const sessions = yield* BrowserbaseSessions;\n const parent = yield* Scope.Scope;\n\n const launch = yield* compileLaunch(options.launch, {\n projectId: client.projectId,\n attemptId: globalThis.crypto.randomUUID(),\n requestedAtMillis: yield* Clock.currentTimeMillis,\n });\n\n const attempt = launch.attempt;\n let writer: ContextWriterPermitInternal | undefined;\n\n if (launch.context?.persist) {\n if (options.contextWriter === undefined) {\n return yield* ContextError.make({\n operation: \"writer-authority\",\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n }\n writer = yield* requireContextWriterPermit(options.contextWriter, {\n provider: \"browserbase\",\n projectId: client.projectId,\n contextId: launch.context.id,\n });\n } else if (options.contextWriter !== undefined) {\n return yield* ContextError.make({\n operation: \"writer-authority\",\n reason: \"configuration\",\n outcome: \"undispatched\",\n });\n }\n\n return yield* Effect.uninterruptibleMask((restore) =>\n Effect.gen(function* () {\n const resourceScope = yield* Scope.make();\n let reference: SessionReference | undefined;\n let admitted = false;\n let knownRejection = false;\n let closing = false;\n let cleanup: CleanupResult | undefined;\n\n let uncertainReported = false;\n\n const allocationUncertain = Effect.suspend(() => {\n if (uncertainReported) return Effect.void;\n uncertainReported = true;\n\n return reportAllocationUncertain(attempt).pipe(\n Effect.andThen(\n options.onAllocationUncertain === undefined\n ? Effect.void\n : reported(options.onAllocationUncertain(attempt)),\n ),\n );\n });\n\n const terminate = yield* Effect.cached(\n Effect.uninterruptible(\n Effect.gen(function* () {\n closing = true;\n if (reference === undefined) {\n if (admitted && !knownRejection) {\n writer?.uncertain(attempt);\n yield* allocationUncertain;\n }\n\n return;\n }\n\n const coordinator = yield* makeCleanup(\n reference,\n \"owned\",\n sessions,\n local,\n (result) => {\n cleanup = result;\n writer?.completed(attempt, result);\n },\n limits,\n );\n\n yield* coordinator.close;\n if (cleanup !== undefined) yield* reportCleanup(cleanup);\n if (cleanup !== undefined && options.onCleanup !== undefined)\n yield* reported(options.onCleanup(cleanup));\n }),\n ),\n );\n\n const closeScope = yield* Effect.cached(Scope.close(resourceScope, Exit.void));\n\n yield* Scope.addFinalizer(resourceScope, terminate);\n yield* Scope.addFinalizer(parent, closeScope);\n\n const failedAllocation = (error: ClientError): AllocationError => {\n knownRejection = error.outcome === \"rejected\" || error.outcome === \"undispatched\";\n if (knownRejection) writer?.rejected(attempt);\n else writer?.uncertain(attempt);\n const reason = error.reason;\n\n return AllocationError.make({\n attempt,\n outcome: knownRejection ? \"rejected\" : \"unknown\",\n reason:\n reason === \"authorization\" ||\n reason === \"rate-limited\" ||\n reason === \"configuration\" ||\n reason === \"transport\" ||\n reason === \"timeout\" ||\n reason === \"malformed\"\n ? reason\n : \"provider\",\n ...(error.status === undefined ? {} : { status: error.status }),\n ...(error.retryAfterMillis === undefined\n ? {}\n : { retryAfterMillis: error.retryAfterMillis }),\n });\n };\n\n const allocate = Effect.gen(function* () {\n if (writer !== undefined) yield* writer.recordAttempt(attempt);\n admitted = true;\n\n const raw = yield* restore(\n client.json(\"POST\", \"/v1/sessions\", launch.body, options.allocationDeadline),\n ).pipe(Effect.mapError(failedAllocation));\n\n const identity = yield* Schema.decodeUnknownEffect(AllocatedIdentity)(raw).pipe(\n Effect.mapError(() =>\n AllocationError.make({ attempt, outcome: \"unknown\", reason: \"malformed\" }),\n ),\n );\n\n // Save identity before interpreting any connection credentials or provider metadata.\n reference = Object.freeze(\n SessionReference.make({\n provider: \"browserbase\",\n projectId: identity.projectId,\n sessionId: identity.id,\n }),\n );\n writer?.recordSession(attempt, reference);\n if (reference.projectId !== client.projectId) {\n return yield* AllocationError.make({\n attempt,\n reference,\n outcome: \"unknown\",\n reason: \"malformed\",\n });\n }\n const ref = reference;\n\n return {\n reference: ref,\n attempt,\n launch,\n resourceScope,\n isClosed: () => closing,\n connection: (timeoutMillis: number) =>\n Effect.suspend(() =>\n closing\n ? Effect.fail(\n SessionError.make({\n operation: \"session-connect\",\n reason: \"expired\",\n outcome: \"undispatched\",\n }),\n )\n : connectionAddress(client, sessions, ref, timeoutMillis),\n ),\n release: closeScope.pipe(\n Effect.andThen(\n Effect.suspend(() =>\n cleanup === undefined\n ? Effect.die(new Error(\"Owned session closed without cleanup evidence\"))\n : Effect.succeed(cleanup),\n ),\n ),\n ),\n cleanupResult: Effect.sync(() => Option.fromNullishOr(cleanup)),\n };\n });\n\n return yield* allocate.pipe(\n Effect.onError(() => closeScope),\n Effect.onInterrupt(() => closeScope),\n );\n }),\n );\n});\n\nexport type RemoteAcquisition = Effect.Success<ReturnType<typeof acquireRemote>>;\n"],"mappings":";;;;;;;;;;;AASA,MAAM,aAAa,OAAO,OAAO;CAC/B,GAAG,gBAAgB;CACnB,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,KAAK,CAA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ACH,IACA,kBAAkB,QAAQ,UAAU,KAAK,aAAa,CAC5D;IACF,SAAS,WAAW,KAClB,OAAO,QACL,OAAO,cACL,YAAY,KAAA,IACR,OAAO,oBAAI,IAAI,MAAM,+CAA+C,CAAC,IACrE,OAAO,QAAQ,OAAO,CAC5B,CACF,CACF;IACA,eAAe,OAAO,WAAW,OAAO,cAAc,OAAO,CAAC;GAChE;EACF,CAEqB,CAAC,CAAC,KACrB,OAAO,cAAc,UAAU,GAC/B,OAAO,kBAAkB,UAAU,CACrC;CACF,CAAC,CACH;AACF,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
//#region src/internal/browser/Association.ts
|
|
2
|
-
const parents = /* @__PURE__ */ new WeakMap();
|
|
3
|
-
const associate = (session, parent) => {
|
|
4
|
-
parents.set(session, parent);
|
|
5
|
-
};
|
|
6
|
-
const captureParent = (session) => parents.get(session);
|
|
7
|
-
//#endregion
|
|
8
|
-
export { captureParent as n, associate as t };
|
|
9
|
-
|
|
10
|
-
//# sourceMappingURL=Association-CEps4hYP.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Association-CEps4hYP.mjs","names":[],"sources":["../src/internal/browser/Association.ts"],"sourcesContent":["import type { Effect } from \"effect\";\n\nimport type { PageInfo, Target } from \"../../BrowserData.ts\";\nimport type { BrowserError } from \"../../Errors.ts\";\nimport type { CaptureSource } from \"./Driver.ts\";\nimport type { Owner, Ticket } from \"./Owner.ts\";\n\nexport interface CaptureLease {\n readonly stop: Effect.Effect<void>;\n readonly invalidate: (reason: string) => void;\n readonly reservedBytes: number;\n}\n\nexport interface CaptureResolution {\n /** Stable native page identity used to quarantine an unconfirmed screencast across reconnects. */\n readonly key: string;\n readonly target: Target;\n readonly source: CaptureSource;\n}\n\nexport interface CaptureParent {\n readonly owner: Owner;\n readonly resolve: (\n ticket: Ticket,\n target?: PageInfo,\n ) => Effect.Effect<CaptureResolution, BrowserError>;\n readonly target: () => Target;\n readonly captureLeases: Map<string, CaptureLease>;\n captureReservedBytes: number;\n}\n\n// This is a private capability registry, not stored domain data. Exact live session identity is\n// required: spreading/cloning a session must not copy authority to mutate its capture owner,\n// leases or reservations. A public/enumerable parent field would weaken that boundary.\n// Keep this access centralized here; schemas describe data, never this mutable ownership state.\nconst parents = new WeakMap<object, CaptureParent>();\n\nexport const associate = (session: object, parent: CaptureParent): void => {\n parents.set(session, parent);\n};\n\nexport const captureParent = (session: object): CaptureParent | undefined => parents.get(session);\n"],"mappings":";AAmCA,MAAM,0BAAU,IAAI,QAA+B;AAEnD,MAAa,aAAa,SAAiB,WAAgC;CACzE,QAAQ,IAAI,SAAS,MAAM;AAC7B;AAEA,MAAa,iBAAiB,YAA+C,QAAQ,IAAI,OAAO"}
|