@apifuse/provider-sdk 2.2.0-beta.32 → 2.2.0-beta.33

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.
@@ -71,7 +71,7 @@ type ResolvedResolverVendor =
71
71
  | {
72
72
  readonly vendor: Exclude<ProviderResolverVendor, "custom">;
73
73
  readonly available: true;
74
- readonly configuration: string;
74
+ readonly configuration: string | undefined;
75
75
  }
76
76
  | {
77
77
  readonly vendor: ProviderResolverVendor;
@@ -184,13 +184,16 @@ export type ResolverInstrumentationMetadata = {
184
184
  };
185
185
 
186
186
  export type ResolverAdapterFactory = (
187
- configuration: string,
187
+ configuration: string | undefined,
188
188
  timeoutMs: number,
189
189
  allowedHosts: readonly string[],
190
190
  ) => ResolverVendorAdapter;
191
191
 
192
192
  const resolverAdapterRegistry: Partial<Record<ProviderResolverVendor, ResolverAdapterFactory>> = {
193
193
  "2captcha"(configuration, timeoutMs, allowedHosts) {
194
+ if (configuration === undefined) {
195
+ throw new Error("2captcha resolver adapter factory requires an API key");
196
+ }
194
197
  return createTwoCaptchaResolverVendorAdapter({
195
198
  allowedHosts,
196
199
  apiKey: configuration,
@@ -966,15 +969,20 @@ function resolveVendorAvailability(
966
969
  reason: "missing_transport",
967
970
  };
968
971
  }
972
+ if (vendor === "browser") {
973
+ return {
974
+ vendor,
975
+ available: true,
976
+ configuration: normalizedEnvValue(env, APIFUSE__CDP_POOL__URL),
977
+ };
978
+ }
969
979
 
970
980
  const envKey =
971
981
  vendor === "2captcha"
972
982
  ? APIFUSE__RESOLVER__2CAPTCHA__API_KEY
973
983
  : vendor === "capsolver"
974
984
  ? APIFUSE__RESOLVER__CAPSOLVER__API_KEY
975
- : vendor === "capmonster"
976
- ? APIFUSE__RESOLVER__CAPMONSTER__API_KEY
977
- : APIFUSE__CDP_POOL__URL;
985
+ : APIFUSE__RESOLVER__CAPMONSTER__API_KEY;
978
986
 
979
987
  const configuration = normalizedEnvValue(env, envKey);
980
988
  return configuration
@@ -39,7 +39,6 @@ import { createProviderCache } from "../runtime/cache.js";
39
39
  import {
40
40
  createProviderChoiceContext,
41
41
  PROVIDER_RUNTIME_CHOICE_TOKEN_MASTER_SECRET_ENV,
42
- PROVIDER_RUNTIME_CHOICE_WORD_ISSUANCE_ENV,
43
42
  } from "../runtime/choice.js";
44
43
  import { createCredentialContext } from "../runtime/credential.js";
45
44
  import { createEnvContext } from "../runtime/env.js";
@@ -627,7 +626,6 @@ function createProviderContext(
627
626
  const env = createEnvContext([
628
627
  ...(provider.secrets?.map((secret) => secret.name) ?? []),
629
628
  PROVIDER_RUNTIME_CHOICE_TOKEN_MASTER_SECRET_ENV,
630
- PROVIDER_RUNTIME_CHOICE_WORD_ISSUANCE_ENV,
631
629
  ]);
632
630
  const credential = createCredentialContext({
633
631
  allowedKeys: provider.credential?.keys,
package/src/types.ts CHANGED
@@ -1757,7 +1757,7 @@ export interface BrowserCookie {
1757
1757
  readonly sameSite?: "Strict" | "Lax" | "None";
1758
1758
  }
1759
1759
 
1760
- export type BrowserResourceMethod = "GET" | "HEAD";
1760
+ export type BrowserResourceMethod = "GET" | "HEAD" | "POST";
1761
1761
 
1762
1762
  export type BrowserResourceRequest = {
1763
1763
  readonly url: string;
@@ -1769,6 +1769,9 @@ export type BrowserResourceRequest = {
1769
1769
  export type BrowserResourceBody = Buffer | Uint8Array | ArrayBuffer | string;
1770
1770
 
1771
1771
  export type BrowserResourceDecision =
1772
+ | {
1773
+ readonly action: "continue";
1774
+ }
1772
1775
  | {
1773
1776
  readonly action: "fulfill";
1774
1777
  readonly status?: number;
@@ -1793,6 +1796,12 @@ export type BrowserResourceRoute = {
1793
1796
  export type BrowserResourcePolicy = {
1794
1797
  readonly defaultAction?: "block";
1795
1798
  readonly allowedMethods?: readonly BrowserResourceMethod[];
1799
+ /**
1800
+ * Appends an enforcing CSP header to every renderable document response
1801
+ * while the policy is active. Existing CSP headers are retained, so this
1802
+ * can only further restrict the document.
1803
+ */
1804
+ readonly documentContentSecurityPolicy?: string;
1796
1805
  readonly routes: readonly BrowserResourceRoute[];
1797
1806
  };
1798
1807