effect-browserbase 0.2.0-beta.9 → 0.3.0-beta.10
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 +277 -319
- package/dist/Browserbase-CaPKwEY9.mjs +544 -0
- package/dist/Browserbase-CaPKwEY9.mjs.map +1 -0
- package/dist/Browserbase.d.mts +110 -0
- package/dist/Browserbase.mjs +3 -0
- package/dist/BrowserbaseClient-CtAQ2rg4.d.mts +195 -0
- package/dist/BrowserbaseClient.d.mts +2 -0
- package/dist/BrowserbaseClient.mjs +190 -0
- package/dist/BrowserbaseClient.mjs.map +1 -0
- package/dist/BrowserbaseError-D1EOrLNc.d.mts +79 -0
- package/dist/BrowserbaseError.d.mts +2 -0
- package/dist/BrowserbaseError.mjs +101 -0
- package/dist/BrowserbaseError.mjs.map +1 -0
- package/dist/ContextLease.d.mts +42 -0
- package/dist/ContextLease.mjs +80 -0
- package/dist/ContextLease.mjs.map +1 -0
- package/dist/index.d.mts +5 -27
- package/dist/index.mjs +5 -26
- package/dist/rolldown-runtime-D7D4PA-g.mjs +13 -0
- package/dist/testing/index.d.mts +136 -0
- package/dist/testing/index.mjs +440 -0
- package/dist/testing/index.mjs.map +1 -0
- package/package.json +51 -121
- package/src/Browserbase.ts +729 -0
- package/src/BrowserbaseClient.ts +559 -0
- package/src/BrowserbaseError.ts +108 -0
- package/src/ContextLease.ts +118 -0
- package/src/index.ts +7 -0
- package/src/internal/captureConnection.ts +214 -0
- package/src/testing/BrowserbaseContract.ts +170 -0
- package/src/testing/TestBrowserbase.ts +509 -0
- package/src/testing/index.ts +7 -0
- package/dist/Account.d.mts +0 -32
- package/dist/Account.mjs +0 -36
- package/dist/Account.mjs.map +0 -1
- package/dist/Acquisition-BOABu_qJ.mjs +0 -244
- package/dist/Acquisition-BOABu_qJ.mjs.map +0 -1
- package/dist/Agents-CPaTOH_g.d.mts +0 -156
- package/dist/Agents.d.mts +0 -3
- package/dist/Agents.mjs +0 -292
- package/dist/Agents.mjs.map +0 -1
- package/dist/Allocation.d.mts +0 -97
- package/dist/Allocation.mjs +0 -27
- package/dist/Allocation.mjs.map +0 -1
- package/dist/Authorization-Ll5f_XNM.mjs +0 -12
- package/dist/Authorization-Ll5f_XNM.mjs.map +0 -1
- package/dist/Browser-ByrWJ0ss.mjs +0 -274
- package/dist/Browser-ByrWJ0ss.mjs.map +0 -1
- package/dist/Browser.d.mts +0 -83
- package/dist/Browser.mjs +0 -3
- package/dist/BrowserBinding.d.mts +0 -13
- package/dist/BrowserBinding.mjs +0 -31
- package/dist/BrowserBinding.mjs.map +0 -1
- package/dist/Certificates-D4NQmyeA.d.mts +0 -34
- package/dist/Certificates.d.mts +0 -3
- package/dist/Certificates.mjs +0 -85
- package/dist/Certificates.mjs.map +0 -1
- package/dist/Cleanup-DMTDBir8.d.mts +0 -23
- package/dist/Cleanup.d.mts +0 -3
- package/dist/Cleanup.mjs +0 -43
- package/dist/Cleanup.mjs.map +0 -1
- package/dist/Client-BEC4Q8ZS.mjs +0 -564
- package/dist/Client-BEC4Q8ZS.mjs.map +0 -1
- package/dist/Client-B_f6bBLT.d.mts +0 -52
- package/dist/Client.d.mts +0 -3
- package/dist/Client.mjs +0 -2
- package/dist/Connection-sxyxtwlk.mjs +0 -56
- package/dist/Connection-sxyxtwlk.mjs.map +0 -1
- package/dist/ContextCoordination.d.mts +0 -29
- package/dist/ContextCoordination.mjs +0 -94
- package/dist/ContextCoordination.mjs.map +0 -1
- package/dist/ContextWriter-CiEma24z.mjs +0 -204
- package/dist/ContextWriter-CiEma24z.mjs.map +0 -1
- package/dist/Contexts-DqdL7cyX.d.mts +0 -31
- package/dist/Contexts.d.mts +0 -3
- package/dist/Contexts.mjs +0 -97
- package/dist/Contexts.mjs.map +0 -1
- package/dist/Deadline-CrViaogr.mjs +0 -13
- package/dist/Deadline-CrViaogr.mjs.map +0 -1
- package/dist/Downloads-CX52GOFJ.d.mts +0 -43
- package/dist/Downloads.d.mts +0 -3
- package/dist/Downloads.mjs +0 -137
- package/dist/Downloads.mjs.map +0 -1
- package/dist/Errors.d.mts +0 -100
- package/dist/Errors.mjs +0 -194
- package/dist/Errors.mjs.map +0 -1
- package/dist/Extensions-BTUn9zhK.mjs +0 -231
- package/dist/Extensions-BTUn9zhK.mjs.map +0 -1
- package/dist/Extensions-DBXuVM1f.d.mts +0 -43
- package/dist/Extensions.d.mts +0 -3
- package/dist/Extensions.mjs +0 -2
- package/dist/Functions-CsKMMUuZ.d.mts +0 -226
- package/dist/Functions.d.mts +0 -3
- package/dist/Functions.mjs +0 -318
- package/dist/Functions.mjs.map +0 -1
- package/dist/Issued-DejqoMYL.mjs +0 -15
- package/dist/Issued-DejqoMYL.mjs.map +0 -1
- package/dist/Launch-cAdE2rrZ.mjs +0 -115
- package/dist/Launch-cAdE2rrZ.mjs.map +0 -1
- package/dist/Launch.d.mts +0 -127
- package/dist/Launch.mjs +0 -97
- package/dist/Launch.mjs.map +0 -1
- package/dist/PageFetch-CjAM_0DS.d.mts +0 -40
- package/dist/PageFetch.d.mts +0 -3
- package/dist/PageFetch.mjs +0 -59
- package/dist/PageFetch.mjs.map +0 -1
- package/dist/Projects-tm5bTDH0.d.mts +0 -38
- package/dist/Projects.d.mts +0 -3
- package/dist/Projects.mjs +0 -65
- package/dist/Projects.mjs.map +0 -1
- package/dist/Recordings-B9k5aODB.d.mts +0 -27
- package/dist/Recordings.d.mts +0 -3
- package/dist/Recordings.mjs +0 -144
- package/dist/Recordings.mjs.map +0 -1
- package/dist/References-DOH3Wu44.d.mts +0 -34
- package/dist/References.d.mts +0 -3
- package/dist/References.mjs +0 -33
- package/dist/References.mjs.map +0 -1
- package/dist/Replays-mV93WGtx.d.mts +0 -27
- package/dist/Replays.d.mts +0 -3
- package/dist/Replays.mjs +0 -107
- package/dist/Replays.mjs.map +0 -1
- package/dist/Resource-J7Kkk5mu.mjs +0 -54
- package/dist/Resource-J7Kkk5mu.mjs.map +0 -1
- package/dist/Search-B64e7g-h.d.mts +0 -37
- package/dist/Search.d.mts +0 -3
- package/dist/Search.mjs +0 -46
- package/dist/Search.mjs.map +0 -1
- package/dist/SessionData-5xYZDshJ.d.mts +0 -38
- package/dist/SessionData.d.mts +0 -3
- package/dist/SessionData.mjs +0 -48
- package/dist/SessionData.mjs.map +0 -1
- package/dist/Sessions-D2H5m6rF.mjs +0 -260
- package/dist/Sessions-D2H5m6rF.mjs.map +0 -1
- package/dist/Sessions-oJEUmZth.d.mts +0 -69
- package/dist/Sessions.d.mts +0 -4
- package/dist/Sessions.mjs +0 -3
- package/dist/Testing.d.mts +0 -119
- package/dist/Testing.mjs +0 -206
- package/dist/Testing.mjs.map +0 -1
- package/dist/TransferPolicy-DQ06i7SZ.mjs +0 -25
- package/dist/TransferPolicy-DQ06i7SZ.mjs.map +0 -1
- package/dist/Transfers-GVqzrDWl.d.mts +0 -89
- package/dist/Transfers.d.mts +0 -3
- package/dist/Transfers.mjs +0 -85
- package/dist/Transfers.mjs.map +0 -1
- package/dist/Uploads-C2_bACgv.d.mts +0 -28
- package/dist/Uploads.d.mts +0 -3
- package/dist/Uploads.mjs +0 -105
- package/dist/Uploads.mjs.map +0 -1
- package/dist/Webhooks-BoeRAxzG.d.mts +0 -59
- package/dist/Webhooks.d.mts +0 -3
- package/dist/Webhooks.mjs +0 -134
- package/dist/Webhooks.mjs.map +0 -1
- package/dist/WriterFacts-BBJRDZYY.d.mts +0 -54
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { n as ContextReference } from "./References-DOH3Wu44.mjs";
|
|
2
|
-
import { PlatformError } from "./Errors.mjs";
|
|
3
|
-
import { t as BrowserbaseClient } from "./Client-B_f6bBLT.mjs";
|
|
4
|
-
import { Context, Effect, Layer, Schema } from "effect";
|
|
5
|
-
//#region src/Functions.d.ts
|
|
6
|
-
declare const Status: Schema.Literals<readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"]>;
|
|
7
|
-
type FunctionStatus = typeof Status.Type;
|
|
8
|
-
declare const FunctionMetadata_base: Schema.Class<FunctionMetadata, Schema.Struct<{
|
|
9
|
-
readonly id: Schema.NonEmptyString;
|
|
10
|
-
readonly projectId: Schema.NonEmptyString;
|
|
11
|
-
readonly name: Schema.String;
|
|
12
|
-
readonly createdAt: Schema.String;
|
|
13
|
-
readonly updatedAt: Schema.String;
|
|
14
|
-
}>, {}>;
|
|
15
|
-
declare class FunctionMetadata extends FunctionMetadata_base {}
|
|
16
|
-
declare const FunctionVersion_base: Schema.Class<FunctionVersion, Schema.Struct<{
|
|
17
|
-
readonly id: Schema.NonEmptyString;
|
|
18
|
-
readonly projectId: Schema.NonEmptyString;
|
|
19
|
-
readonly functionId: Schema.NonEmptyString;
|
|
20
|
-
readonly functionBuildId: Schema.NonEmptyString;
|
|
21
|
-
readonly sessionCreateParams: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
22
|
-
readonly userParamsSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
23
|
-
readonly createdAt: Schema.String;
|
|
24
|
-
readonly updatedAt: Schema.String;
|
|
25
|
-
}>, {}>;
|
|
26
|
-
declare class FunctionVersion extends FunctionVersion_base {}
|
|
27
|
-
declare const FunctionBuild_base: Schema.Class<FunctionBuild, Schema.Struct<{
|
|
28
|
-
readonly id: Schema.NonEmptyString;
|
|
29
|
-
readonly projectId: Schema.NonEmptyString;
|
|
30
|
-
readonly request: Schema.Struct<{
|
|
31
|
-
readonly entrypoint: Schema.String;
|
|
32
|
-
readonly functionNames: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
33
|
-
}>;
|
|
34
|
-
readonly status: Schema.Literals<readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"]>;
|
|
35
|
-
readonly createdAt: Schema.String;
|
|
36
|
-
readonly updatedAt: Schema.String;
|
|
37
|
-
readonly startedAt: Schema.String;
|
|
38
|
-
readonly endedAt: Schema.optionalKey<Schema.String>;
|
|
39
|
-
readonly expiresAt: Schema.String;
|
|
40
|
-
readonly cause: Schema.optionalKey<Schema.Struct<{
|
|
41
|
-
readonly code: Schema.String;
|
|
42
|
-
readonly message: Schema.optionalKey<Schema.String>;
|
|
43
|
-
}>>;
|
|
44
|
-
}>, {}>;
|
|
45
|
-
declare class FunctionBuild extends FunctionBuild_base {}
|
|
46
|
-
declare const FunctionInvocation_base: Schema.Class<FunctionInvocation, Schema.Struct<{
|
|
47
|
-
readonly id: Schema.NonEmptyString;
|
|
48
|
-
readonly projectId: Schema.NonEmptyString;
|
|
49
|
-
readonly functionId: Schema.NonEmptyString;
|
|
50
|
-
readonly versionId: Schema.NonEmptyString;
|
|
51
|
-
readonly sessionId: Schema.NonEmptyString;
|
|
52
|
-
readonly region: Schema.optionalKey<Schema.String>;
|
|
53
|
-
readonly params: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
54
|
-
readonly status: Schema.Literals<readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"]>;
|
|
55
|
-
readonly results: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
56
|
-
readonly cause: Schema.optionalKey<Schema.Struct<{
|
|
57
|
-
readonly code: Schema.String;
|
|
58
|
-
readonly message: Schema.optionalKey<Schema.String>;
|
|
59
|
-
}>>;
|
|
60
|
-
readonly createdAt: Schema.String;
|
|
61
|
-
readonly updatedAt: Schema.String;
|
|
62
|
-
readonly startedAt: Schema.String;
|
|
63
|
-
readonly endedAt: Schema.optionalKey<Schema.String>;
|
|
64
|
-
readonly expiresAt: Schema.String;
|
|
65
|
-
}>, {}>;
|
|
66
|
-
declare class FunctionInvocation extends FunctionInvocation_base {}
|
|
67
|
-
declare const FunctionLogLine_base: Schema.Class<FunctionLogLine, Schema.Struct<{
|
|
68
|
-
readonly message: Schema.String;
|
|
69
|
-
readonly timestamp: Schema.Finite;
|
|
70
|
-
}>, {}>;
|
|
71
|
-
declare class FunctionLogLine extends FunctionLogLine_base {}
|
|
72
|
-
/** The session a Function invocation runs in; the provider's invoke-time subset. */
|
|
73
|
-
declare const FunctionSessionParams: Schema.Struct<{
|
|
74
|
-
/** Seconds, 60–900; the provider defaults to 900. */
|
|
75
|
-
readonly timeout: Schema.optionalKey<Schema.Int>;
|
|
76
|
-
readonly extensionId: Schema.optionalKey<Schema.NonEmptyString>;
|
|
77
|
-
readonly context: Schema.optionalKey<Schema.Struct<{
|
|
78
|
-
readonly reference: typeof ContextReference;
|
|
79
|
-
readonly persist: Schema.Boolean;
|
|
80
|
-
}>>;
|
|
81
|
-
readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
82
|
-
readonly type: Schema.Literal<"browserbase">;
|
|
83
|
-
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
84
|
-
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
85
|
-
readonly country: Schema.String;
|
|
86
|
-
readonly state: Schema.optionalKey<Schema.String>;
|
|
87
|
-
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
88
|
-
}>>;
|
|
89
|
-
}>, Schema.Struct<{
|
|
90
|
-
readonly type: Schema.Literal<"external">;
|
|
91
|
-
readonly server: Schema.NonEmptyString;
|
|
92
|
-
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
93
|
-
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
94
|
-
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
95
|
-
}>, Schema.Struct<{
|
|
96
|
-
readonly type: Schema.Literal<"none">;
|
|
97
|
-
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
98
|
-
}>]>>]>>;
|
|
99
|
-
readonly proxySettings: Schema.optionalKey<Schema.Struct<{
|
|
100
|
-
readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
101
|
-
}>>;
|
|
102
|
-
readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
103
|
-
readonly browserSettings: Schema.optionalKey<Schema.Struct<{
|
|
104
|
-
readonly viewport: Schema.optionalKey<Schema.Struct<{
|
|
105
|
-
readonly width: Schema.optionalKey<Schema.Int>;
|
|
106
|
-
readonly height: Schema.optionalKey<Schema.Int>;
|
|
107
|
-
}>>;
|
|
108
|
-
readonly blockAds: Schema.optionalKey<Schema.Boolean>;
|
|
109
|
-
readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
|
|
110
|
-
readonly recordSession: Schema.optionalKey<Schema.Boolean>;
|
|
111
|
-
readonly logSession: Schema.optionalKey<Schema.Boolean>;
|
|
112
|
-
readonly verified: Schema.optionalKey<Schema.Boolean>;
|
|
113
|
-
readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
114
|
-
readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
115
|
-
readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
|
|
116
|
-
readonly size: Schema.optionalKey<Schema.Literals<readonly ["small", "medium", "large"]>>;
|
|
117
|
-
readonly enableNativeSelectPolyfill: Schema.optionalKey<Schema.Boolean>;
|
|
118
|
-
readonly enablePdfViewer: Schema.optionalKey<Schema.Boolean>;
|
|
119
|
-
readonly extensions: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["onepassword", "browser-events"]>>>;
|
|
120
|
-
readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
121
|
-
readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
|
|
122
|
-
}>>;
|
|
123
|
-
}>;
|
|
124
|
-
type FunctionSessionParams = typeof FunctionSessionParams.Type;
|
|
125
|
-
declare const FunctionInvokeRequest: Schema.Struct<{
|
|
126
|
-
readonly params: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
127
|
-
readonly session: Schema.optionalKey<Schema.Struct<{
|
|
128
|
-
/** Seconds, 60–900; the provider defaults to 900. */
|
|
129
|
-
readonly timeout: Schema.optionalKey<Schema.Int>;
|
|
130
|
-
readonly extensionId: Schema.optionalKey<Schema.NonEmptyString>;
|
|
131
|
-
readonly context: Schema.optionalKey<Schema.Struct<{
|
|
132
|
-
readonly reference: typeof ContextReference;
|
|
133
|
-
readonly persist: Schema.Boolean;
|
|
134
|
-
}>>;
|
|
135
|
-
readonly proxies: Schema.optionalKey<Schema.Union<readonly [Schema.Boolean, Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
136
|
-
readonly type: Schema.Literal<"browserbase">;
|
|
137
|
-
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
138
|
-
readonly geolocation: Schema.optionalKey<Schema.Struct<{
|
|
139
|
-
readonly country: Schema.String;
|
|
140
|
-
readonly state: Schema.optionalKey<Schema.String>;
|
|
141
|
-
readonly city: Schema.optionalKey<Schema.NonEmptyString>;
|
|
142
|
-
}>>;
|
|
143
|
-
}>, Schema.Struct<{
|
|
144
|
-
readonly type: Schema.Literal<"external">;
|
|
145
|
-
readonly server: Schema.NonEmptyString;
|
|
146
|
-
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
147
|
-
readonly username: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
148
|
-
readonly password: Schema.optionalKey<Schema.Redacted<Schema.String>>;
|
|
149
|
-
}>, Schema.Struct<{
|
|
150
|
-
readonly type: Schema.Literal<"none">;
|
|
151
|
-
readonly domainPattern: Schema.optionalKey<Schema.NonEmptyString>;
|
|
152
|
-
}>]>>]>>;
|
|
153
|
-
readonly proxySettings: Schema.optionalKey<Schema.Struct<{
|
|
154
|
-
readonly caCertificates: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
155
|
-
}>>;
|
|
156
|
-
readonly userMetadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
157
|
-
readonly browserSettings: Schema.optionalKey<Schema.Struct<{
|
|
158
|
-
readonly viewport: Schema.optionalKey<Schema.Struct<{
|
|
159
|
-
readonly width: Schema.optionalKey<Schema.Int>;
|
|
160
|
-
readonly height: Schema.optionalKey<Schema.Int>;
|
|
161
|
-
}>>;
|
|
162
|
-
readonly blockAds: Schema.optionalKey<Schema.Boolean>;
|
|
163
|
-
readonly solveCaptchas: Schema.optionalKey<Schema.Boolean>;
|
|
164
|
-
readonly recordSession: Schema.optionalKey<Schema.Boolean>;
|
|
165
|
-
readonly logSession: Schema.optionalKey<Schema.Boolean>;
|
|
166
|
-
readonly verified: Schema.optionalKey<Schema.Boolean>;
|
|
167
|
-
readonly captchaImageSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
168
|
-
readonly captchaInputSelector: Schema.optionalKey<Schema.NonEmptyString>;
|
|
169
|
-
readonly os: Schema.optionalKey<Schema.Literals<readonly ["windows", "mac", "linux", "mobile", "tablet"]>>;
|
|
170
|
-
readonly size: Schema.optionalKey<Schema.Literals<readonly ["small", "medium", "large"]>>;
|
|
171
|
-
readonly enableNativeSelectPolyfill: Schema.optionalKey<Schema.Boolean>;
|
|
172
|
-
readonly enablePdfViewer: Schema.optionalKey<Schema.Boolean>;
|
|
173
|
-
readonly extensions: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["onepassword", "browser-events"]>>>;
|
|
174
|
-
readonly allowedDomains: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
|
|
175
|
-
readonly ignoreCertificateErrors: Schema.optionalKey<Schema.Boolean>;
|
|
176
|
-
}>>;
|
|
177
|
-
}>>;
|
|
178
|
-
}>;
|
|
179
|
-
type FunctionInvokeRequest = typeof FunctionInvokeRequest.Type;
|
|
180
|
-
declare const FunctionPageQuery: Schema.Struct<{
|
|
181
|
-
offset: Schema.optionalKey<Schema.Int>;
|
|
182
|
-
limit: Schema.optionalKey<Schema.Int>;
|
|
183
|
-
}>;
|
|
184
|
-
type FunctionPageQuery = typeof FunctionPageQuery.Type;
|
|
185
|
-
declare const FunctionStatusQuery: Schema.Struct<{
|
|
186
|
-
readonly offset: Schema.optionalKey<Schema.Int>;
|
|
187
|
-
readonly limit: Schema.optionalKey<Schema.Int>;
|
|
188
|
-
readonly status: Schema.optionalKey<Schema.Literals<readonly ["PENDING", "RUNNING", "COMPLETED", "FAILED"]>>;
|
|
189
|
-
}>;
|
|
190
|
-
type FunctionStatusQuery = typeof FunctionStatusQuery.Type;
|
|
191
|
-
declare const FunctionWaitOptions: Schema.Struct<{
|
|
192
|
-
readonly timeoutMillis: Schema.Int;
|
|
193
|
-
readonly pollIntervalMillis: Schema.optionalKey<Schema.Int>;
|
|
194
|
-
}>;
|
|
195
|
-
type FunctionWaitOptions = typeof FunctionWaitOptions.Type;
|
|
196
|
-
interface OffsetPage<A> {
|
|
197
|
-
readonly items: ReadonlyArray<A>;
|
|
198
|
-
readonly total: number;
|
|
199
|
-
}
|
|
200
|
-
declare const BrowserbaseFunctions_base: Context.ServiceClass<BrowserbaseFunctions, "effect-browserbase/Functions", {
|
|
201
|
-
readonly list: (query?: FunctionPageQuery) => Effect.Effect<OffsetPage<FunctionMetadata>, PlatformError>;
|
|
202
|
-
readonly retrieve: (functionId: string) => Effect.Effect<FunctionMetadata, PlatformError>;
|
|
203
|
-
readonly invoke: (functionId: string, request?: FunctionInvokeRequest) => Effect.Effect<FunctionInvocation, PlatformError>;
|
|
204
|
-
readonly versions: (functionId: string, query?: FunctionPageQuery) => Effect.Effect<OffsetPage<FunctionVersion>, PlatformError>;
|
|
205
|
-
readonly version: (versionId: string) => Effect.Effect<FunctionVersion, PlatformError>;
|
|
206
|
-
readonly invocations: (versionId: string, query?: FunctionStatusQuery) => Effect.Effect<OffsetPage<FunctionInvocation>, PlatformError>;
|
|
207
|
-
readonly invocation: (invocationId: string) => Effect.Effect<FunctionInvocation, PlatformError>;
|
|
208
|
-
readonly invocationLogs: (invocationId: string) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;
|
|
209
|
-
readonly builds: (query?: FunctionStatusQuery) => Effect.Effect<OffsetPage<FunctionBuild>, PlatformError>;
|
|
210
|
-
readonly build: (buildId: string) => Effect.Effect<FunctionBuild, PlatformError>;
|
|
211
|
-
readonly buildLogs: (buildId: string) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;
|
|
212
|
-
/** Polls until the invocation is terminal. Interrupting the wait does not cancel it. */
|
|
213
|
-
readonly waitForInvocation: (invocationId: string, options: FunctionWaitOptions) => Effect.Effect<FunctionInvocation, PlatformError>;
|
|
214
|
-
}>;
|
|
215
|
-
/**
|
|
216
|
-
* Browserbase Functions: deployed code invoked in a provider-allocated session. Deployment
|
|
217
|
-
* happens through Browserbase's CLI; this service reads, invokes and observes. `invoke` is
|
|
218
|
-
* never retried, and a lost reply is `outcome: "unknown"`.
|
|
219
|
-
*/
|
|
220
|
-
declare class BrowserbaseFunctions extends BrowserbaseFunctions_base {
|
|
221
|
-
static readonly layer: Layer.Layer<BrowserbaseFunctions, never, BrowserbaseClient>;
|
|
222
|
-
}
|
|
223
|
-
//#endregion
|
|
224
|
-
export { FunctionLogLine as a, FunctionSessionParams as c, FunctionVersion as d, FunctionWaitOptions as f, FunctionInvokeRequest as i, FunctionStatus as l, FunctionBuild as n, FunctionMetadata as o, OffsetPage as p, FunctionInvocation as r, FunctionPageQuery as s, BrowserbaseFunctions as t, FunctionStatusQuery as u };
|
|
225
|
-
export {};
|
|
226
|
-
//# sourceMappingURL=Functions-CsKMMUuZ.d.mts.map
|
package/dist/Functions.d.mts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { a as FunctionLogLine, c as FunctionSessionParams, d as FunctionVersion, f as FunctionWaitOptions, i as FunctionInvokeRequest, l as FunctionStatus, n as FunctionBuild, o as FunctionMetadata, p as OffsetPage, r as FunctionInvocation, s as FunctionPageQuery, t as BrowserbaseFunctions, u as FunctionStatusQuery } from "./Functions-CsKMMUuZ.mjs";
|
|
2
|
-
export { BrowserbaseFunctions, FunctionBuild, FunctionInvocation, FunctionInvokeRequest, FunctionLogLine, FunctionMetadata, FunctionPageQuery, FunctionSessionParams, FunctionStatus, FunctionStatusQuery, FunctionVersion, FunctionWaitOptions, OffsetPage };
|
|
3
|
-
export {};
|
package/dist/Functions.mjs
DELETED
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import { ContextReference, Identifier } from "./References.mjs";
|
|
2
|
-
import { PlatformError } from "./Errors.mjs";
|
|
3
|
-
import { r as span, t as BrowserbaseClient } from "./Client-BEC4Q8ZS.mjs";
|
|
4
|
-
import { t as resource } from "./Resource-J7Kkk5mu.mjs";
|
|
5
|
-
import { ProxyRule } from "./Launch.mjs";
|
|
6
|
-
import { n as proxy } from "./Launch-cAdE2rrZ.mjs";
|
|
7
|
-
import { r as isContextWriterBusy } from "./ContextWriter-CiEma24z.mjs";
|
|
8
|
-
import { Clock, Context, Effect, Layer, Schema } from "effect";
|
|
9
|
-
//#region src/Functions.ts
|
|
10
|
-
const Timestamp = Schema.String.check(Schema.isMaxLength(64));
|
|
11
|
-
const JsonObject = Schema.Record(Schema.String, Schema.Json);
|
|
12
|
-
const Name = Schema.String.check(Schema.isMaxLength(1024));
|
|
13
|
-
const Status = Schema.Literals([
|
|
14
|
-
"PENDING",
|
|
15
|
-
"RUNNING",
|
|
16
|
-
"COMPLETED",
|
|
17
|
-
"FAILED"
|
|
18
|
-
]);
|
|
19
|
-
var FunctionMetadata = class extends Schema.Class("BrowserbaseFunctionMetadata")({
|
|
20
|
-
id: Identifier,
|
|
21
|
-
projectId: Identifier,
|
|
22
|
-
name: Name,
|
|
23
|
-
createdAt: Timestamp,
|
|
24
|
-
updatedAt: Timestamp
|
|
25
|
-
}) {};
|
|
26
|
-
var FunctionVersion = class extends Schema.Class("BrowserbaseFunctionVersion")({
|
|
27
|
-
id: Identifier,
|
|
28
|
-
projectId: Identifier,
|
|
29
|
-
functionId: Identifier,
|
|
30
|
-
functionBuildId: Identifier,
|
|
31
|
-
sessionCreateParams: Schema.optionalKey(JsonObject),
|
|
32
|
-
userParamsSchema: Schema.optionalKey(JsonObject),
|
|
33
|
-
createdAt: Timestamp,
|
|
34
|
-
updatedAt: Timestamp
|
|
35
|
-
}) {};
|
|
36
|
-
var FunctionBuild = class extends Schema.Class("BrowserbaseFunctionBuild")({
|
|
37
|
-
id: Identifier,
|
|
38
|
-
projectId: Identifier,
|
|
39
|
-
request: Schema.Struct({
|
|
40
|
-
entrypoint: Name,
|
|
41
|
-
functionNames: Schema.optionalKey(Schema.Array(Name).check(Schema.isMaxLength(1024)))
|
|
42
|
-
}),
|
|
43
|
-
status: Status,
|
|
44
|
-
createdAt: Timestamp,
|
|
45
|
-
updatedAt: Timestamp,
|
|
46
|
-
startedAt: Timestamp,
|
|
47
|
-
endedAt: Schema.optionalKey(Timestamp),
|
|
48
|
-
expiresAt: Timestamp,
|
|
49
|
-
cause: Schema.optionalKey(Schema.Struct({
|
|
50
|
-
code: Schema.String.check(Schema.isMaxLength(64)),
|
|
51
|
-
message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096)))
|
|
52
|
-
}))
|
|
53
|
-
}) {};
|
|
54
|
-
var FunctionInvocation = class extends Schema.Class("BrowserbaseFunctionInvocation")({
|
|
55
|
-
id: Identifier,
|
|
56
|
-
projectId: Identifier,
|
|
57
|
-
functionId: Identifier,
|
|
58
|
-
versionId: Identifier,
|
|
59
|
-
sessionId: Identifier,
|
|
60
|
-
region: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))),
|
|
61
|
-
params: Schema.optionalKey(JsonObject),
|
|
62
|
-
status: Status,
|
|
63
|
-
results: Schema.optionalKey(Schema.Json),
|
|
64
|
-
cause: Schema.optionalKey(Schema.Struct({
|
|
65
|
-
code: Schema.String.check(Schema.isMaxLength(64)),
|
|
66
|
-
message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096)))
|
|
67
|
-
})),
|
|
68
|
-
createdAt: Timestamp,
|
|
69
|
-
updatedAt: Timestamp,
|
|
70
|
-
startedAt: Timestamp,
|
|
71
|
-
endedAt: Schema.optionalKey(Timestamp),
|
|
72
|
-
expiresAt: Timestamp
|
|
73
|
-
}) {};
|
|
74
|
-
var FunctionLogLine = class extends Schema.Class("BrowserbaseFunctionLogLine")({
|
|
75
|
-
message: Schema.String.check(Schema.isMaxLength(65536)),
|
|
76
|
-
timestamp: Schema.Finite
|
|
77
|
-
}) {};
|
|
78
|
-
/** The session a Function invocation runs in; the provider's invoke-time subset. */
|
|
79
|
-
const FunctionSessionParams = Schema.Struct({
|
|
80
|
-
/** Seconds, 60–900; the provider defaults to 900. */
|
|
81
|
-
timeout: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
82
|
-
minimum: 60,
|
|
83
|
-
maximum: 900
|
|
84
|
-
}))),
|
|
85
|
-
extensionId: Schema.optionalKey(Identifier),
|
|
86
|
-
context: Schema.optionalKey(Schema.Struct({
|
|
87
|
-
reference: ContextReference,
|
|
88
|
-
persist: Schema.Boolean
|
|
89
|
-
})),
|
|
90
|
-
proxies: Schema.optionalKey(Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))])),
|
|
91
|
-
proxySettings: Schema.optionalKey(Schema.Struct({ caCertificates: Schema.optionalKey(Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique())) })),
|
|
92
|
-
userMetadata: Schema.optionalKey(Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json)),
|
|
93
|
-
browserSettings: Schema.optionalKey(Schema.Struct({
|
|
94
|
-
viewport: Schema.optionalKey(Schema.Struct({
|
|
95
|
-
width: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
96
|
-
minimum: 1,
|
|
97
|
-
maximum: 8192
|
|
98
|
-
}))),
|
|
99
|
-
height: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
100
|
-
minimum: 1,
|
|
101
|
-
maximum: 8192
|
|
102
|
-
})))
|
|
103
|
-
})),
|
|
104
|
-
blockAds: Schema.optionalKey(Schema.Boolean),
|
|
105
|
-
solveCaptchas: Schema.optionalKey(Schema.Boolean),
|
|
106
|
-
recordSession: Schema.optionalKey(Schema.Boolean),
|
|
107
|
-
logSession: Schema.optionalKey(Schema.Boolean),
|
|
108
|
-
verified: Schema.optionalKey(Schema.Boolean),
|
|
109
|
-
captchaImageSelector: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1024))),
|
|
110
|
-
captchaInputSelector: Schema.optionalKey(Schema.NonEmptyString.check(Schema.isMaxLength(1024))),
|
|
111
|
-
os: Schema.optionalKey(Schema.Literals([
|
|
112
|
-
"windows",
|
|
113
|
-
"mac",
|
|
114
|
-
"linux",
|
|
115
|
-
"mobile",
|
|
116
|
-
"tablet"
|
|
117
|
-
])),
|
|
118
|
-
size: Schema.optionalKey(Schema.Literals([
|
|
119
|
-
"small",
|
|
120
|
-
"medium",
|
|
121
|
-
"large"
|
|
122
|
-
])),
|
|
123
|
-
enableNativeSelectPolyfill: Schema.optionalKey(Schema.Boolean),
|
|
124
|
-
enablePdfViewer: Schema.optionalKey(Schema.Boolean),
|
|
125
|
-
extensions: Schema.optionalKey(Schema.Array(Schema.Literals(["onepassword", "browser-events"])).check(Schema.isUnique())),
|
|
126
|
-
allowedDomains: Schema.optionalKey(Schema.Array(Schema.NonEmptyString.check(Schema.isMaxLength(1024))).check(Schema.isMaxLength(64), Schema.isUnique())),
|
|
127
|
-
ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean)
|
|
128
|
-
}))
|
|
129
|
-
});
|
|
130
|
-
const FunctionInvokeRequest = Schema.Struct({
|
|
131
|
-
params: Schema.optionalKey(JsonObject),
|
|
132
|
-
session: Schema.optionalKey(FunctionSessionParams)
|
|
133
|
-
});
|
|
134
|
-
const Offset = {
|
|
135
|
-
offset: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
136
|
-
minimum: 0,
|
|
137
|
-
maximum: 1e6
|
|
138
|
-
}))),
|
|
139
|
-
limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
140
|
-
minimum: 1,
|
|
141
|
-
maximum: 100
|
|
142
|
-
})))
|
|
143
|
-
};
|
|
144
|
-
const FunctionPageQuery = Schema.Struct(Offset);
|
|
145
|
-
const FunctionStatusQuery = Schema.Struct({
|
|
146
|
-
...Offset,
|
|
147
|
-
status: Schema.optionalKey(Status)
|
|
148
|
-
});
|
|
149
|
-
const FunctionWaitOptions = Schema.Struct({
|
|
150
|
-
timeoutMillis: Schema.Int.check(Schema.isBetween({
|
|
151
|
-
minimum: 1,
|
|
152
|
-
maximum: 36e5
|
|
153
|
-
})),
|
|
154
|
-
pollIntervalMillis: Schema.optionalKey(Schema.Int.check(Schema.isBetween({
|
|
155
|
-
minimum: 250,
|
|
156
|
-
maximum: 6e4
|
|
157
|
-
})))
|
|
158
|
-
});
|
|
159
|
-
const DataPage = (item) => Schema.Struct({
|
|
160
|
-
data: Schema.Array(item).check(Schema.isMaxLength(100)),
|
|
161
|
-
total: Schema.Natural
|
|
162
|
-
});
|
|
163
|
-
const ResultsPage = (item) => Schema.Struct({
|
|
164
|
-
results: Schema.Array(item).check(Schema.isMaxLength(100)),
|
|
165
|
-
total: Schema.Natural
|
|
166
|
-
});
|
|
167
|
-
const Logs = Schema.Struct({
|
|
168
|
-
logs: Schema.Array(FunctionLogLine).check(Schema.isMaxLength(1e5)),
|
|
169
|
-
total: Schema.Natural
|
|
170
|
-
});
|
|
171
|
-
const now = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1e6));
|
|
172
|
-
/**
|
|
173
|
-
* Browserbase Functions: deployed code invoked in a provider-allocated session. Deployment
|
|
174
|
-
* happens through Browserbase's CLI; this service reads, invokes and observes. `invoke` is
|
|
175
|
-
* never retried, and a lost reply is `outcome: "unknown"`.
|
|
176
|
-
*/
|
|
177
|
-
var BrowserbaseFunctions = class BrowserbaseFunctions extends Context.Service()("effect-browserbase/Functions") {
|
|
178
|
-
static layer = Layer.effect(BrowserbaseFunctions, Effect.gen(function* () {
|
|
179
|
-
const client = yield* BrowserbaseClient;
|
|
180
|
-
const api = resource(client, (failure) => PlatformError.make({
|
|
181
|
-
...failure,
|
|
182
|
-
service: "functions"
|
|
183
|
-
}));
|
|
184
|
-
/** Every record names its project; a foreign or mismatched one is malformed. */
|
|
185
|
-
const owned = (operation, mutation, expected) => (value) => value.projectId === client.projectId && (expected === void 0 || value.id === expected) ? Effect.succeed(value) : Effect.fail(api.malformed(operation, mutation));
|
|
186
|
-
const id = (value, operation) => api.input(Identifier, value, operation);
|
|
187
|
-
const list = Effect.fnUntraced(function* (query = {}) {
|
|
188
|
-
const value = yield* api.input(FunctionPageQuery, query, "function-list");
|
|
189
|
-
const page = yield* api.request("GET", `/v1/functions${api.query(value)}`, DataPage(FunctionMetadata), "function-list");
|
|
190
|
-
return {
|
|
191
|
-
items: yield* Effect.forEach(page.data, owned("function-list", false)),
|
|
192
|
-
total: page.total
|
|
193
|
-
};
|
|
194
|
-
}, span("BrowserbaseFunctions.list"));
|
|
195
|
-
const retrieve = Effect.fnUntraced(function* (functionId) {
|
|
196
|
-
const checked = yield* id(functionId, "function-retrieve");
|
|
197
|
-
return yield* api.request("GET", `/v1/functions/${api.segment(checked)}`, FunctionMetadata, "function-retrieve").pipe(Effect.flatMap(owned("function-retrieve", false, checked)));
|
|
198
|
-
}, span("BrowserbaseFunctions.retrieve"));
|
|
199
|
-
const invoke = Effect.fnUntraced(function* (functionId, request = {}) {
|
|
200
|
-
const checked = yield* id(functionId, "function-invoke");
|
|
201
|
-
const value = yield* api.input(FunctionInvokeRequest, request, "function-invoke");
|
|
202
|
-
const session = value.session;
|
|
203
|
-
const context = session?.context;
|
|
204
|
-
if (context !== void 0) {
|
|
205
|
-
if (context.reference.projectId !== client.projectId) return yield* api.make({
|
|
206
|
-
operation: "function-invoke",
|
|
207
|
-
reason: "authorization",
|
|
208
|
-
outcome: "undispatched"
|
|
209
|
-
});
|
|
210
|
-
if (context.persist && isContextWriterBusy(context.reference)) return yield* api.make({
|
|
211
|
-
operation: "function-invoke",
|
|
212
|
-
reason: "active",
|
|
213
|
-
outcome: "undispatched"
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
const sessionCreateParams = session === void 0 ? void 0 : {
|
|
217
|
-
...session.timeout === void 0 ? {} : { timeout: session.timeout },
|
|
218
|
-
...session.extensionId === void 0 ? {} : { extensionId: session.extensionId },
|
|
219
|
-
...session.proxies === void 0 ? {} : { proxies: typeof session.proxies === "boolean" ? session.proxies : session.proxies.map(proxy) },
|
|
220
|
-
...session.proxySettings === void 0 ? {} : { proxySettings: session.proxySettings },
|
|
221
|
-
...session.userMetadata === void 0 ? {} : { userMetadata: session.userMetadata },
|
|
222
|
-
...session.browserSettings === void 0 && context === void 0 ? {} : { browserSettings: {
|
|
223
|
-
...session.browserSettings,
|
|
224
|
-
...context === void 0 ? {} : { context: {
|
|
225
|
-
id: context.reference.contextId,
|
|
226
|
-
persist: context.persist
|
|
227
|
-
} }
|
|
228
|
-
} }
|
|
229
|
-
};
|
|
230
|
-
return yield* api.request("POST", `/v1/functions/${api.segment(checked)}/invoke`, FunctionInvocation, "function-invoke", {
|
|
231
|
-
...value.params === void 0 ? {} : { params: value.params },
|
|
232
|
-
...sessionCreateParams === void 0 ? {} : { sessionCreateParams }
|
|
233
|
-
}).pipe(Effect.flatMap(owned("function-invoke", true)));
|
|
234
|
-
}, span("BrowserbaseFunctions.invoke"));
|
|
235
|
-
const versions = Effect.fnUntraced(function* (functionId, query = {}) {
|
|
236
|
-
const checked = yield* id(functionId, "function-versions");
|
|
237
|
-
const value = yield* api.input(FunctionPageQuery, query, "function-versions");
|
|
238
|
-
const page = yield* api.request("GET", `/v1/functions/${api.segment(checked)}/versions${api.query(value)}`, ResultsPage(FunctionVersion), "function-versions");
|
|
239
|
-
return {
|
|
240
|
-
items: yield* Effect.forEach(page.results, owned("function-versions", false)),
|
|
241
|
-
total: page.total
|
|
242
|
-
};
|
|
243
|
-
}, span("BrowserbaseFunctions.versions"));
|
|
244
|
-
const version = Effect.fnUntraced(function* (versionId) {
|
|
245
|
-
const checked = yield* id(versionId, "function-version");
|
|
246
|
-
return yield* api.request("GET", `/v1/functions/versions/${api.segment(checked)}`, FunctionVersion, "function-version").pipe(Effect.flatMap(owned("function-version", false, checked)));
|
|
247
|
-
}, span("BrowserbaseFunctions.version"));
|
|
248
|
-
const invocations = Effect.fnUntraced(function* (versionId, query = {}) {
|
|
249
|
-
const checked = yield* id(versionId, "function-invocations");
|
|
250
|
-
const value = yield* api.input(FunctionStatusQuery, query, "function-invocations");
|
|
251
|
-
const page = yield* api.request("GET", `/v1/functions/versions/${api.segment(checked)}/invocations${api.query(value)}`, ResultsPage(FunctionInvocation), "function-invocations");
|
|
252
|
-
return {
|
|
253
|
-
items: yield* Effect.forEach(page.results, owned("function-invocations", false)),
|
|
254
|
-
total: page.total
|
|
255
|
-
};
|
|
256
|
-
}, span("BrowserbaseFunctions.invocations"));
|
|
257
|
-
const invocation = Effect.fnUntraced(function* (invocationId) {
|
|
258
|
-
const checked = yield* id(invocationId, "function-invocation");
|
|
259
|
-
return yield* api.request("GET", `/v1/functions/invocations/${api.segment(checked)}`, FunctionInvocation, "function-invocation").pipe(Effect.flatMap(owned("function-invocation", false, checked)));
|
|
260
|
-
}, span("BrowserbaseFunctions.invocation"));
|
|
261
|
-
const logs = (path, operation) => api.request("GET", path, Logs, operation).pipe(Effect.map((value) => ({
|
|
262
|
-
items: value.logs,
|
|
263
|
-
total: value.total
|
|
264
|
-
})));
|
|
265
|
-
const invocationLogs = Effect.fnUntraced(function* (invocationId) {
|
|
266
|
-
const checked = yield* id(invocationId, "function-invocation-logs");
|
|
267
|
-
return yield* logs(`/v1/functions/invocations/${api.segment(checked)}/logs`, "function-invocation-logs");
|
|
268
|
-
}, span("BrowserbaseFunctions.invocationLogs"));
|
|
269
|
-
const builds = Effect.fnUntraced(function* (query = {}) {
|
|
270
|
-
const value = yield* api.input(FunctionStatusQuery, query, "function-builds");
|
|
271
|
-
const page = yield* api.request("GET", `/v1/functions/builds${api.query(value)}`, DataPage(FunctionBuild), "function-builds");
|
|
272
|
-
return {
|
|
273
|
-
items: yield* Effect.forEach(page.data, owned("function-builds", false)),
|
|
274
|
-
total: page.total
|
|
275
|
-
};
|
|
276
|
-
}, span("BrowserbaseFunctions.builds"));
|
|
277
|
-
const build = Effect.fnUntraced(function* (buildId) {
|
|
278
|
-
const checked = yield* id(buildId, "function-build");
|
|
279
|
-
return yield* api.request("GET", `/v1/functions/builds/${api.segment(checked)}`, FunctionBuild, "function-build").pipe(Effect.flatMap(owned("function-build", false, checked)));
|
|
280
|
-
}, span("BrowserbaseFunctions.build"));
|
|
281
|
-
const buildLogs = Effect.fnUntraced(function* (buildId) {
|
|
282
|
-
const checked = yield* id(buildId, "function-build-logs");
|
|
283
|
-
return yield* logs(`/v1/functions/builds/${api.segment(checked)}/logs`, "function-build-logs");
|
|
284
|
-
}, span("BrowserbaseFunctions.buildLogs"));
|
|
285
|
-
const waitForInvocation = Effect.fnUntraced(function* (invocationId, options) {
|
|
286
|
-
const bounds = yield* api.input(FunctionWaitOptions, options, "function-wait");
|
|
287
|
-
const deadline = (yield* now) + bounds.timeoutMillis;
|
|
288
|
-
for (;;) {
|
|
289
|
-
const current = yield* invocation(invocationId).pipe(Effect.withTracerEnabled(false));
|
|
290
|
-
if (current.status === "COMPLETED" || current.status === "FAILED") return current;
|
|
291
|
-
const remaining = deadline - (yield* now);
|
|
292
|
-
if (remaining <= 0) return yield* api.make({
|
|
293
|
-
operation: "function-wait",
|
|
294
|
-
reason: "timeout"
|
|
295
|
-
});
|
|
296
|
-
yield* Effect.sleep(Math.min(bounds.pollIntervalMillis ?? 1e3, remaining));
|
|
297
|
-
}
|
|
298
|
-
}, span("BrowserbaseFunctions.waitForInvocation"));
|
|
299
|
-
return BrowserbaseFunctions.of({
|
|
300
|
-
list,
|
|
301
|
-
retrieve,
|
|
302
|
-
invoke,
|
|
303
|
-
versions,
|
|
304
|
-
version,
|
|
305
|
-
invocations,
|
|
306
|
-
invocation,
|
|
307
|
-
invocationLogs,
|
|
308
|
-
builds,
|
|
309
|
-
build,
|
|
310
|
-
buildLogs,
|
|
311
|
-
waitForInvocation
|
|
312
|
-
});
|
|
313
|
-
}));
|
|
314
|
-
};
|
|
315
|
-
//#endregion
|
|
316
|
-
export { BrowserbaseFunctions, FunctionBuild, FunctionInvocation, FunctionInvokeRequest, FunctionLogLine, FunctionMetadata, FunctionPageQuery, FunctionSessionParams, FunctionStatusQuery, FunctionVersion, FunctionWaitOptions };
|
|
317
|
-
|
|
318
|
-
//# sourceMappingURL=Functions.mjs.map
|
package/dist/Functions.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Functions.mjs","names":["Trace.span"],"sources":["../src/Functions.ts"],"sourcesContent":["import { Clock, Context, Effect, Layer, Schema } from \"effect\";\n\nimport { BrowserbaseClient } from \"./Client.ts\";\nimport { PlatformError } from \"./Errors.ts\";\nimport { resource } from \"./internal/http/Resource.ts\";\nimport { proxy } from \"./internal/provider/Launch.ts\";\nimport { isContextWriterBusy } from \"./internal/session/ContextWriter.ts\";\nimport * as Trace from \"./internal/Trace.ts\";\nimport { ProxyRule } from \"./Launch.ts\";\nimport { ContextReference, Identifier } from \"./References.ts\";\n\nconst Timestamp = Schema.String.check(Schema.isMaxLength(64));\nconst JsonObject = Schema.Record(Schema.String, Schema.Json);\nconst Name = Schema.String.check(Schema.isMaxLength(1024));\nconst Status = Schema.Literals([\"PENDING\", \"RUNNING\", \"COMPLETED\", \"FAILED\"]);\n\nexport type FunctionStatus = typeof Status.Type;\n\nexport class FunctionMetadata extends Schema.Class<FunctionMetadata>(\"BrowserbaseFunctionMetadata\")(\n {\n id: Identifier,\n projectId: Identifier,\n name: Name,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n },\n) {}\n\nexport class FunctionVersion extends Schema.Class<FunctionVersion>(\"BrowserbaseFunctionVersion\")({\n id: Identifier,\n projectId: Identifier,\n functionId: Identifier,\n functionBuildId: Identifier,\n sessionCreateParams: Schema.optionalKey(JsonObject),\n userParamsSchema: Schema.optionalKey(JsonObject),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n}) {}\n\nexport class FunctionBuild extends Schema.Class<FunctionBuild>(\"BrowserbaseFunctionBuild\")({\n id: Identifier,\n projectId: Identifier,\n request: Schema.Struct({\n entrypoint: Name,\n functionNames: Schema.optionalKey(Schema.Array(Name).check(Schema.isMaxLength(1024))),\n }),\n status: Status,\n createdAt: Timestamp,\n updatedAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n expiresAt: Timestamp,\n cause: Schema.optionalKey(\n Schema.Struct({\n code: Schema.String.check(Schema.isMaxLength(64)),\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096))),\n }),\n ),\n}) {}\n\nexport class FunctionInvocation extends Schema.Class<FunctionInvocation>(\n \"BrowserbaseFunctionInvocation\",\n)({\n id: Identifier,\n projectId: Identifier,\n functionId: Identifier,\n versionId: Identifier,\n sessionId: Identifier,\n region: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(64))),\n params: Schema.optionalKey(JsonObject),\n status: Status,\n results: Schema.optionalKey(Schema.Json),\n cause: Schema.optionalKey(\n Schema.Struct({\n code: Schema.String.check(Schema.isMaxLength(64)),\n message: Schema.optionalKey(Schema.String.check(Schema.isMaxLength(4096))),\n }),\n ),\n createdAt: Timestamp,\n updatedAt: Timestamp,\n startedAt: Timestamp,\n endedAt: Schema.optionalKey(Timestamp),\n expiresAt: Timestamp,\n}) {}\n\nexport class FunctionLogLine extends Schema.Class<FunctionLogLine>(\"BrowserbaseFunctionLogLine\")({\n message: Schema.String.check(Schema.isMaxLength(65_536)),\n timestamp: Schema.Finite,\n}) {}\n\n/** The session a Function invocation runs in; the provider's invoke-time subset. */\nexport const FunctionSessionParams = Schema.Struct({\n /** Seconds, 60–900; the provider defaults to 900. */\n timeout: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 60, maximum: 900 }))),\n extensionId: Schema.optionalKey(Identifier),\n context: Schema.optionalKey(\n Schema.Struct({ reference: ContextReference, persist: Schema.Boolean }),\n ),\n proxies: Schema.optionalKey(\n Schema.Union([Schema.Boolean, Schema.Array(ProxyRule).check(Schema.isMaxLength(64))]),\n ),\n proxySettings: Schema.optionalKey(\n Schema.Struct({\n caCertificates: Schema.optionalKey(\n Schema.Array(Identifier).check(Schema.isMaxLength(64), Schema.isUnique()),\n ),\n }),\n ),\n userMetadata: Schema.optionalKey(\n Schema.Record(Schema.String.check(Schema.isMaxLength(128)), Schema.Json),\n ),\n browserSettings: Schema.optionalKey(\n Schema.Struct({\n viewport: Schema.optionalKey(\n Schema.Struct({\n width: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 8192 })),\n ),\n height: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 8192 })),\n ),\n }),\n ),\n blockAds: Schema.optionalKey(Schema.Boolean),\n solveCaptchas: Schema.optionalKey(Schema.Boolean),\n recordSession: Schema.optionalKey(Schema.Boolean),\n logSession: Schema.optionalKey(Schema.Boolean),\n verified: Schema.optionalKey(Schema.Boolean),\n captchaImageSelector: Schema.optionalKey(\n Schema.NonEmptyString.check(Schema.isMaxLength(1024)),\n ),\n captchaInputSelector: Schema.optionalKey(\n Schema.NonEmptyString.check(Schema.isMaxLength(1024)),\n ),\n os: Schema.optionalKey(Schema.Literals([\"windows\", \"mac\", \"linux\", \"mobile\", \"tablet\"])),\n size: Schema.optionalKey(Schema.Literals([\"small\", \"medium\", \"large\"])),\n enableNativeSelectPolyfill: Schema.optionalKey(Schema.Boolean),\n enablePdfViewer: Schema.optionalKey(Schema.Boolean),\n extensions: Schema.optionalKey(\n Schema.Array(Schema.Literals([\"onepassword\", \"browser-events\"])).check(Schema.isUnique()),\n ),\n allowedDomains: Schema.optionalKey(\n Schema.Array(Schema.NonEmptyString.check(Schema.isMaxLength(1024))).check(\n Schema.isMaxLength(64),\n Schema.isUnique(),\n ),\n ),\n ignoreCertificateErrors: Schema.optionalKey(Schema.Boolean),\n }),\n ),\n});\n\nexport type FunctionSessionParams = typeof FunctionSessionParams.Type;\n\nexport const FunctionInvokeRequest = Schema.Struct({\n params: Schema.optionalKey(JsonObject),\n session: Schema.optionalKey(FunctionSessionParams),\n});\n\nexport type FunctionInvokeRequest = typeof FunctionInvokeRequest.Type;\n\nconst Offset = {\n offset: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 0, maximum: 1_000_000 })),\n ),\n limit: Schema.optionalKey(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 100 }))),\n};\n\nexport const FunctionPageQuery = Schema.Struct(Offset);\nexport type FunctionPageQuery = typeof FunctionPageQuery.Type;\n\nexport const FunctionStatusQuery = Schema.Struct({ ...Offset, status: Schema.optionalKey(Status) });\nexport type FunctionStatusQuery = typeof FunctionStatusQuery.Type;\n\nexport const FunctionWaitOptions = Schema.Struct({\n timeoutMillis: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 3_600_000 })),\n pollIntervalMillis: Schema.optionalKey(\n Schema.Int.check(Schema.isBetween({ minimum: 250, maximum: 60_000 })),\n ),\n});\n\nexport type FunctionWaitOptions = typeof FunctionWaitOptions.Type;\n\nexport interface OffsetPage<A> {\n readonly items: ReadonlyArray<A>;\n readonly total: number;\n}\n\nconst DataPage = <S extends Schema.Top>(item: S) =>\n Schema.Struct({ data: Schema.Array(item).check(Schema.isMaxLength(100)), total: Schema.Natural });\n\nconst ResultsPage = <S extends Schema.Top>(item: S) =>\n Schema.Struct({\n results: Schema.Array(item).check(Schema.isMaxLength(100)),\n total: Schema.Natural,\n });\n\nconst Logs = Schema.Struct({\n logs: Schema.Array(FunctionLogLine).check(Schema.isMaxLength(100_000)),\n total: Schema.Natural,\n});\n\nconst now = Clock.monotonicTimeNanos.pipe(Effect.map((value) => Number(value) / 1_000_000));\n\n/**\n * Browserbase Functions: deployed code invoked in a provider-allocated session. Deployment\n * happens through Browserbase's CLI; this service reads, invokes and observes. `invoke` is\n * never retried, and a lost reply is `outcome: \"unknown\"`.\n */\nexport class BrowserbaseFunctions extends Context.Service<\n BrowserbaseFunctions,\n {\n readonly list: (\n query?: FunctionPageQuery,\n ) => Effect.Effect<OffsetPage<FunctionMetadata>, PlatformError>;\n readonly retrieve: (functionId: string) => Effect.Effect<FunctionMetadata, PlatformError>;\n readonly invoke: (\n functionId: string,\n request?: FunctionInvokeRequest,\n ) => Effect.Effect<FunctionInvocation, PlatformError>;\n readonly versions: (\n functionId: string,\n query?: FunctionPageQuery,\n ) => Effect.Effect<OffsetPage<FunctionVersion>, PlatformError>;\n readonly version: (versionId: string) => Effect.Effect<FunctionVersion, PlatformError>;\n readonly invocations: (\n versionId: string,\n query?: FunctionStatusQuery,\n ) => Effect.Effect<OffsetPage<FunctionInvocation>, PlatformError>;\n readonly invocation: (invocationId: string) => Effect.Effect<FunctionInvocation, PlatformError>;\n readonly invocationLogs: (\n invocationId: string,\n ) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;\n readonly builds: (\n query?: FunctionStatusQuery,\n ) => Effect.Effect<OffsetPage<FunctionBuild>, PlatformError>;\n readonly build: (buildId: string) => Effect.Effect<FunctionBuild, PlatformError>;\n readonly buildLogs: (\n buildId: string,\n ) => Effect.Effect<OffsetPage<FunctionLogLine>, PlatformError>;\n /** Polls until the invocation is terminal. Interrupting the wait does not cancel it. */\n readonly waitForInvocation: (\n invocationId: string,\n options: FunctionWaitOptions,\n ) => Effect.Effect<FunctionInvocation, PlatformError>;\n }\n>()(\"effect-browserbase/Functions\") {\n static readonly layer: Layer.Layer<BrowserbaseFunctions, never, BrowserbaseClient> = Layer.effect(\n BrowserbaseFunctions,\n Effect.gen(function* () {\n const client = yield* BrowserbaseClient;\n\n const api = resource<PlatformError>(client, (failure) =>\n PlatformError.make({ ...failure, service: \"functions\" }),\n );\n\n /** Every record names its project; a foreign or mismatched one is malformed. */\n const owned =\n <A extends { readonly id: string; readonly projectId: string }>(\n operation: PlatformError[\"operation\"],\n mutation: boolean,\n expected?: string,\n ) =>\n (value: A): Effect.Effect<A, PlatformError> =>\n value.projectId === client.projectId && (expected === undefined || value.id === expected)\n ? Effect.succeed(value)\n : Effect.fail(api.malformed(operation, mutation));\n\n const id = (value: string, operation: PlatformError[\"operation\"]) =>\n api.input(Identifier, value, operation);\n\n const list = Effect.fnUntraced(function* (query: FunctionPageQuery = {}) {\n const value = yield* api.input(FunctionPageQuery, query, \"function-list\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions${api.query(value)}`,\n DataPage(FunctionMetadata),\n \"function-list\",\n );\n\n return {\n items: yield* Effect.forEach(page.data, owned(\"function-list\", false)),\n total: page.total,\n };\n }, Trace.span(\"BrowserbaseFunctions.list\"));\n\n const retrieve = Effect.fnUntraced(function* (functionId: string) {\n const checked = yield* id(functionId, \"function-retrieve\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/${api.segment(checked)}`,\n FunctionMetadata,\n \"function-retrieve\",\n )\n .pipe(Effect.flatMap(owned(\"function-retrieve\", false, checked)));\n }, Trace.span(\"BrowserbaseFunctions.retrieve\"));\n\n const invoke = Effect.fnUntraced(function* (\n functionId: string,\n request: FunctionInvokeRequest = {},\n ) {\n const checked = yield* id(functionId, \"function-invoke\");\n const value = yield* api.input(FunctionInvokeRequest, request, \"function-invoke\");\n const session = value.session;\n const context = session?.context;\n\n if (context !== undefined) {\n if (context.reference.projectId !== client.projectId)\n return yield* api.make({\n operation: \"function-invoke\",\n reason: \"authorization\",\n outcome: \"undispatched\",\n });\n if (context.persist && isContextWriterBusy(context.reference))\n return yield* api.make({\n operation: \"function-invoke\",\n reason: \"active\",\n outcome: \"undispatched\",\n });\n }\n\n const sessionCreateParams: Schema.Json | undefined =\n session === undefined\n ? undefined\n : {\n ...(session.timeout === undefined ? {} : { timeout: session.timeout }),\n ...(session.extensionId === undefined ? {} : { extensionId: session.extensionId }),\n ...(session.proxies === undefined\n ? {}\n : {\n proxies:\n typeof session.proxies === \"boolean\"\n ? session.proxies\n : session.proxies.map(proxy),\n }),\n ...(session.proxySettings === undefined\n ? {}\n : { proxySettings: session.proxySettings }),\n ...(session.userMetadata === undefined\n ? {}\n : { userMetadata: session.userMetadata }),\n ...(session.browserSettings === undefined && context === undefined\n ? {}\n : {\n browserSettings: {\n ...session.browserSettings,\n ...(context === undefined\n ? {}\n : {\n context: {\n id: context.reference.contextId,\n persist: context.persist,\n },\n }),\n },\n }),\n };\n\n return yield* api\n .request(\n \"POST\",\n `/v1/functions/${api.segment(checked)}/invoke`,\n FunctionInvocation,\n \"function-invoke\",\n {\n ...(value.params === undefined ? {} : { params: value.params }),\n ...(sessionCreateParams === undefined ? {} : { sessionCreateParams }),\n },\n )\n .pipe(Effect.flatMap(owned(\"function-invoke\", true)));\n }, Trace.span(\"BrowserbaseFunctions.invoke\"));\n\n const versions = Effect.fnUntraced(function* (\n functionId: string,\n query: FunctionPageQuery = {},\n ) {\n const checked = yield* id(functionId, \"function-versions\");\n const value = yield* api.input(FunctionPageQuery, query, \"function-versions\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/${api.segment(checked)}/versions${api.query(value)}`,\n ResultsPage(FunctionVersion),\n \"function-versions\",\n );\n\n return {\n items: yield* Effect.forEach(page.results, owned(\"function-versions\", false)),\n total: page.total,\n };\n }, Trace.span(\"BrowserbaseFunctions.versions\"));\n\n const version = Effect.fnUntraced(function* (versionId: string) {\n const checked = yield* id(versionId, \"function-version\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/versions/${api.segment(checked)}`,\n FunctionVersion,\n \"function-version\",\n )\n .pipe(Effect.flatMap(owned(\"function-version\", false, checked)));\n }, Trace.span(\"BrowserbaseFunctions.version\"));\n\n const invocations = Effect.fnUntraced(function* (\n versionId: string,\n query: FunctionStatusQuery = {},\n ) {\n const checked = yield* id(versionId, \"function-invocations\");\n const value = yield* api.input(FunctionStatusQuery, query, \"function-invocations\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/versions/${api.segment(checked)}/invocations${api.query(value)}`,\n ResultsPage(FunctionInvocation),\n \"function-invocations\",\n );\n\n return {\n items: yield* Effect.forEach(page.results, owned(\"function-invocations\", false)),\n total: page.total,\n };\n }, Trace.span(\"BrowserbaseFunctions.invocations\"));\n\n const invocation = Effect.fnUntraced(function* (invocationId: string) {\n const checked = yield* id(invocationId, \"function-invocation\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/invocations/${api.segment(checked)}`,\n FunctionInvocation,\n \"function-invocation\",\n )\n .pipe(Effect.flatMap(owned(\"function-invocation\", false, checked)));\n }, Trace.span(\"BrowserbaseFunctions.invocation\"));\n\n const logs = (path: string, operation: PlatformError[\"operation\"]) =>\n api\n .request(\"GET\", path, Logs, operation)\n .pipe(Effect.map((value) => ({ items: value.logs, total: value.total })));\n\n const invocationLogs = Effect.fnUntraced(function* (invocationId: string) {\n const checked = yield* id(invocationId, \"function-invocation-logs\");\n\n return yield* logs(\n `/v1/functions/invocations/${api.segment(checked)}/logs`,\n \"function-invocation-logs\",\n );\n }, Trace.span(\"BrowserbaseFunctions.invocationLogs\"));\n\n const builds = Effect.fnUntraced(function* (query: FunctionStatusQuery = {}) {\n const value = yield* api.input(FunctionStatusQuery, query, \"function-builds\");\n\n const page = yield* api.request(\n \"GET\",\n `/v1/functions/builds${api.query(value)}`,\n DataPage(FunctionBuild),\n \"function-builds\",\n );\n\n return {\n items: yield* Effect.forEach(page.data, owned(\"function-builds\", false)),\n total: page.total,\n };\n }, Trace.span(\"BrowserbaseFunctions.builds\"));\n\n const build = Effect.fnUntraced(function* (buildId: string) {\n const checked = yield* id(buildId, \"function-build\");\n\n return yield* api\n .request(\n \"GET\",\n `/v1/functions/builds/${api.segment(checked)}`,\n FunctionBuild,\n \"function-build\",\n )\n .pipe(Effect.flatMap(owned(\"function-build\", false, checked)));\n }, Trace.span(\"BrowserbaseFunctions.build\"));\n\n const buildLogs = Effect.fnUntraced(function* (buildId: string) {\n const checked = yield* id(buildId, \"function-build-logs\");\n\n return yield* logs(\n `/v1/functions/builds/${api.segment(checked)}/logs`,\n \"function-build-logs\",\n );\n }, Trace.span(\"BrowserbaseFunctions.buildLogs\"));\n\n const waitForInvocation = Effect.fnUntraced(function* (\n invocationId: string,\n options: FunctionWaitOptions,\n ) {\n const bounds = yield* api.input(FunctionWaitOptions, options, \"function-wait\");\n const deadline = (yield* now) + bounds.timeoutMillis;\n\n for (;;) {\n const current = yield* invocation(invocationId).pipe(Effect.withTracerEnabled(false));\n\n if (current.status === \"COMPLETED\" || current.status === \"FAILED\") return current;\n const remaining = deadline - (yield* now);\n\n if (remaining <= 0)\n return yield* api.make({ operation: \"function-wait\", reason: \"timeout\" });\n yield* Effect.sleep(Math.min(bounds.pollIntervalMillis ?? 1_000, remaining));\n }\n }, Trace.span(\"BrowserbaseFunctions.waitForInvocation\"));\n\n return BrowserbaseFunctions.of({\n list,\n retrieve,\n invoke,\n versions,\n version,\n invocations,\n invocation,\n invocationLogs,\n builds,\n build,\n buildLogs,\n waitForInvocation,\n });\n }),\n );\n}\n"],"mappings":";;;;;;;;;AAWA,MAAM,YAAY,OAAO,OAAO,MAAM,OAAO,YAAY,EAAE,CAAC;AAC5D,MAAM,aAAa,OAAO,OAAO,OAAO,QAAQ,OAAO,IAAI;AAC3D,MAAM,OAAO,OAAO,OAAO,MAAM,OAAO,YAAY,IAAI,CAAC;AACzD,MAAM,SAAS,OAAO,SAAS;CAAC;CAAW;CAAW;CAAa;AAAQ,CAAC;AAI5E,IAAa,mBAAb,cAAsC,OAAO,MAAwB,6BAA6B,CAAC,CACjG;CACE,IAAI;CACJ,WAAW;CACX,MAAM;CACN,WAAW;CACX,WAAW;AACb,CACF,CAAC,CAAC,CAAC;AAE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EvC,SAAS;IACP,MAAM,UAAU,OAAO,WAAW,YAAY,CAAC,CAAC,KAAK,OAAO,kBAAkB,KAAK,CAAC;IAEpF,IAAI,QAAQ,WAAW,eAAe,QAAQ,WAAW,UAAU,OAAO;IAC1E,MAAM,YAAY,YAAY,OAAO;IAErC,IAAI,aAAa,GACf,OAAO,OAAO,IAAI,KAAK;KAAE,WAAW;KAAiB,QAAQ;IAAU,CAAC;IAC1E,OAAO,OAAO,MAAM,KAAK,IAAI,OAAO,sBAAsB,KAAO,SAAS,CAAC;GAC7E;EACF,GAAGA,KAAW,wCAAwC,CAAC;EAEvD,OAAO,qBAAqB,GAAG;GAC7B;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF,CAAC;CACH,CAAC,CACH;AACF"}
|
package/dist/Issued-DejqoMYL.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/internal/upload/Issued.ts
|
|
2
|
-
/**
|
|
3
|
-
* Attachment authority belongs to the receipt this package actually issued, not to a value
|
|
4
|
-
* that merely has the right shape. A fabricated look-alike has no entry here, so no caller
|
|
5
|
-
* and no model can turn an arbitrary server pathname into an attached file.
|
|
6
|
-
*/
|
|
7
|
-
const issued = /* @__PURE__ */ new WeakMap();
|
|
8
|
-
const recordIssuedUpload = (receipt, upload) => {
|
|
9
|
-
issued.set(receipt, Object.freeze({ ...upload }));
|
|
10
|
-
};
|
|
11
|
-
const issuedUpload = (receipt) => issued.get(receipt);
|
|
12
|
-
//#endregion
|
|
13
|
-
export { recordIssuedUpload as n, issuedUpload as t };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=Issued-DejqoMYL.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Issued-DejqoMYL.mjs","names":[],"sources":["../src/internal/upload/Issued.ts"],"sourcesContent":["import type { SessionReference } from \"../../References.ts\";\nimport type { UploadReceipt } from \"../../Transfers.ts\";\n\nexport interface IssuedUpload {\n readonly reference: SessionReference;\n readonly remotePath: string;\n}\n\n/**\n * Attachment authority belongs to the receipt this package actually issued, not to a value\n * that merely has the right shape. A fabricated look-alike has no entry here, so no caller\n * and no model can turn an arbitrary server pathname into an attached file.\n */\nconst issued = new WeakMap<UploadReceipt, IssuedUpload>();\n\nexport const recordIssuedUpload = (receipt: UploadReceipt, upload: IssuedUpload): void => {\n issued.set(receipt, Object.freeze({ ...upload }));\n};\n\nexport const issuedUpload = (receipt: UploadReceipt): IssuedUpload | undefined =>\n issued.get(receipt);\n"],"mappings":";;;;;;AAaA,MAAM,yBAAS,IAAI,QAAqC;AAExD,MAAa,sBAAsB,SAAwB,WAA+B;CACxF,OAAO,IAAI,SAAS,OAAO,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC;AAClD;AAEA,MAAa,gBAAgB,YAC3B,OAAO,IAAI,OAAO"}
|