@apifuse/provider-sdk 2.2.0-beta.20 → 2.2.0-beta.21
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/CHANGELOG.md +5 -0
- package/dist/ceremonies/index.d.ts +8 -0
- package/dist/ceremonies/index.js +57 -0
- package/dist/define.js +103 -1
- package/dist/index.d.ts +1 -1
- package/dist/lint.d.ts +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/runtime/auth-flow.d.ts +1 -0
- package/dist/runtime/auth-flow.js +1 -0
- package/dist/runtime/state.js +223 -22
- package/dist/server/serve.d.ts +9 -8
- package/dist/server/serve.js +7 -1
- package/dist/server/types.d.ts +4 -0
- package/dist/server/types.js +7 -1
- package/dist/testing/run.js +8 -2
- package/dist/types.d.ts +28 -12
- package/package.json +1 -1
- package/src/ceremonies/index.ts +79 -0
- package/src/define.ts +138 -1
- package/src/index.ts +1 -0
- package/src/lint.ts +7 -1
- package/src/provider.ts +1 -0
- package/src/runtime/auth-flow.ts +2 -0
- package/src/runtime/state.ts +317 -28
- package/src/server/serve.ts +20 -14
- package/src/server/types.ts +7 -1
- package/src/testing/run.ts +8 -2
- package/src/types.ts +48 -26
package/src/types.ts
CHANGED
|
@@ -63,6 +63,8 @@ export interface OperationToolRouterMetadata {
|
|
|
63
63
|
riskClass?: OperationRiskClass;
|
|
64
64
|
/** OpenAI remote-MCP approval hint. Defaults from riskClass. */
|
|
65
65
|
approval?: OperationApprovalPolicy;
|
|
66
|
+
/** Canonical operation-level connection requirement consumed by the registry and Gateway. */
|
|
67
|
+
connectionMode?: "none" | "optional" | "required";
|
|
66
68
|
/** Override connection requirement when provider auth + openWorld inference is insufficient. */
|
|
67
69
|
requiresConnection?: boolean;
|
|
68
70
|
/** Public argument used to resolve the tenant-owned connection. Defaults to externalRef. */
|
|
@@ -211,14 +213,14 @@ export type SmsOrigin =
|
|
|
211
213
|
kind: "e164";
|
|
212
214
|
value: E164PhoneNumber;
|
|
213
215
|
display?: string;
|
|
214
|
-
|
|
216
|
+
}
|
|
215
217
|
| {
|
|
216
218
|
/** Country-local service sender, for example KR 1661-5270. */
|
|
217
219
|
kind: "nationalServiceCode";
|
|
218
220
|
country: Iso3166Alpha2CountryCode;
|
|
219
221
|
value: string;
|
|
220
222
|
display?: string;
|
|
221
|
-
|
|
223
|
+
};
|
|
222
224
|
|
|
223
225
|
export interface SmsOtpExtractionPattern {
|
|
224
226
|
/** RegExp or source string containing exactly one usable OTP capture. */
|
|
@@ -340,11 +342,11 @@ export type HealthScheduleRandomization =
|
|
|
340
342
|
| {
|
|
341
343
|
mode: "centered";
|
|
342
344
|
maxOffset: Iso8601Duration;
|
|
343
|
-
|
|
345
|
+
}
|
|
344
346
|
| {
|
|
345
347
|
mode: "delayed";
|
|
346
348
|
maxDelay: Iso8601Duration;
|
|
347
|
-
|
|
349
|
+
};
|
|
348
350
|
|
|
349
351
|
export interface HealthJourneyStep {
|
|
350
352
|
id: string;
|
|
@@ -459,7 +461,7 @@ export type HealthJourneyManualTriggerPolicy =
|
|
|
459
461
|
/** ISO 8601 duration. Minimum time between manual executions. */
|
|
460
462
|
minManualInterval: Iso8601Duration;
|
|
461
463
|
publicRationale: string;
|
|
462
|
-
|
|
464
|
+
};
|
|
463
465
|
|
|
464
466
|
export interface HealthJourneyRunResult {
|
|
465
467
|
status?: "ok" | "degraded" | "down" | "unknown";
|
|
@@ -764,7 +766,12 @@ export interface StealthProfile {
|
|
|
764
766
|
headerOrder?: string[];
|
|
765
767
|
}
|
|
766
768
|
|
|
767
|
-
export type AuthMode =
|
|
769
|
+
export type AuthMode =
|
|
770
|
+
| "none"
|
|
771
|
+
| "platform-managed"
|
|
772
|
+
| "credentials"
|
|
773
|
+
| "oauth2"
|
|
774
|
+
| "oauth2_proxied";
|
|
768
775
|
|
|
769
776
|
export type ConnectionMode = AuthMode;
|
|
770
777
|
|
|
@@ -779,18 +786,18 @@ export type ProviderProxyMode = "disabled" | "optional" | "required";
|
|
|
779
786
|
* (a common mistake because the names collide with a well-known rebrand):
|
|
780
787
|
*
|
|
781
788
|
* - `smartproxy` — **api.smartproxy.org**, a residential proxy with an IP
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
789
|
+
* *extraction/allocation* API (app_key → a pool of raw `ip:port` CONNECT
|
|
790
|
+
* endpoints). This is our own vendor. It is NOT the company formerly named
|
|
791
|
+
* "Smartproxy". Credentials: `APIFUSE__PROXY__SMARTPROXY_APP_KEY`.
|
|
785
792
|
* - `nodemaven` — **gate.nodemaven.com**, a *gateway* proxy with static
|
|
786
|
-
*
|
|
793
|
+
* credentials; geo/session encoded in the username, no allocation API.
|
|
787
794
|
* - `decodo` — **decodo.com**, the *gateway* proxy that was named "Smartproxy"
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
795
|
+
* (smartproxy.com) before its 2025 rebrand to Decodo. Sticky sessions via
|
|
796
|
+
* username params. A different company from `smartproxy` above.
|
|
797
|
+
* **@deprecated** — unused; no managed adapter. Use `smartproxy`/`nodemaven`,
|
|
798
|
+
* or the `APIFUSE__PROXY__URL` bring-your-own escape hatch.
|
|
792
799
|
* - `custom` — **@deprecated** bring-your-own static proxy URL marker. The
|
|
793
|
-
*
|
|
800
|
+
* `APIFUSE__PROXY__URL` env still works without declaring this value.
|
|
794
801
|
*/
|
|
795
802
|
export type ProviderProxyProvider = "smartproxy" | "nodemaven" | "decodo" | "custom";
|
|
796
803
|
|
|
@@ -844,9 +851,9 @@ export interface ProviderAccessConfig {
|
|
|
844
851
|
* Provider-level rollout visibility.
|
|
845
852
|
*
|
|
846
853
|
* - `public`: visible in public docs/catalog/OpenAPI and callable through
|
|
847
|
-
*
|
|
854
|
+
* the existing provider policy stack.
|
|
848
855
|
* - `early_access`: hidden from public discovery and callable only when the
|
|
849
|
-
*
|
|
856
|
+
* active customer organization has a provider-level access grant.
|
|
850
857
|
*
|
|
851
858
|
* This is intentionally provider-level only. It does not alter auth mode,
|
|
852
859
|
* operation schemas, health-check authoring, `openWorld`, or Connection
|
|
@@ -868,12 +875,12 @@ export type ProviderLogoProfile =
|
|
|
868
875
|
*/
|
|
869
876
|
url?: string;
|
|
870
877
|
background?: string;
|
|
871
|
-
|
|
878
|
+
}
|
|
872
879
|
| {
|
|
873
880
|
source: "monogram" | "none";
|
|
874
881
|
background?: string;
|
|
875
882
|
fallbackReason: string;
|
|
876
|
-
|
|
883
|
+
};
|
|
877
884
|
|
|
878
885
|
export type ProviderPublicConnectionMode =
|
|
879
886
|
| "apifuse_managed"
|
|
@@ -1573,11 +1580,11 @@ export type BrowserResourceDecision =
|
|
|
1573
1580
|
readonly status?: number;
|
|
1574
1581
|
readonly headers?: Readonly<Record<string, string>>;
|
|
1575
1582
|
readonly body?: BrowserResourceBody;
|
|
1576
|
-
|
|
1583
|
+
}
|
|
1577
1584
|
| {
|
|
1578
1585
|
readonly action: "block";
|
|
1579
1586
|
readonly reason?: string;
|
|
1580
|
-
|
|
1587
|
+
};
|
|
1581
1588
|
|
|
1582
1589
|
export type BrowserResourceRoute = {
|
|
1583
1590
|
readonly match:
|
|
@@ -1689,7 +1696,7 @@ export interface ProviderChoiceBindingOptions {
|
|
|
1689
1696
|
export type ProviderChoiceStorageOptions =
|
|
1690
1697
|
| {
|
|
1691
1698
|
readonly mode: "inline";
|
|
1692
|
-
|
|
1699
|
+
}
|
|
1693
1700
|
| {
|
|
1694
1701
|
readonly mode: "server";
|
|
1695
1702
|
readonly namespace: string;
|
|
@@ -1698,7 +1705,7 @@ export type ProviderChoiceStorageOptions =
|
|
|
1698
1705
|
readonly maxEntries: number;
|
|
1699
1706
|
readonly maxValueBytes: number;
|
|
1700
1707
|
readonly unavailable?: "reject";
|
|
1701
|
-
|
|
1708
|
+
}
|
|
1702
1709
|
| {
|
|
1703
1710
|
readonly mode: "auto";
|
|
1704
1711
|
readonly namespace: string;
|
|
@@ -1708,7 +1715,7 @@ export type ProviderChoiceStorageOptions =
|
|
|
1708
1715
|
readonly maxEntries: number;
|
|
1709
1716
|
readonly maxValueBytes: number;
|
|
1710
1717
|
readonly unavailable?: "reject";
|
|
1711
|
-
|
|
1718
|
+
};
|
|
1712
1719
|
|
|
1713
1720
|
export interface ProviderChoiceIssueOptions<
|
|
1714
1721
|
TPayload extends Record<string, unknown>,
|
|
@@ -1852,11 +1859,11 @@ export interface AuthFlowTerminalContext {
|
|
|
1852
1859
|
}
|
|
1853
1860
|
>;
|
|
1854
1861
|
readonly expectedInput?: never;
|
|
1855
|
-
|
|
1862
|
+
}
|
|
1856
1863
|
| {
|
|
1857
1864
|
readonly expectedInput: Record<string, unknown>;
|
|
1858
1865
|
readonly fields?: never;
|
|
1859
|
-
|
|
1866
|
+
}
|
|
1860
1867
|
),
|
|
1861
1868
|
): AuthTurn;
|
|
1862
1869
|
nextPoll(options?: {
|
|
@@ -1869,6 +1876,8 @@ export interface AuthFlowTerminalContext {
|
|
|
1869
1876
|
}
|
|
1870
1877
|
|
|
1871
1878
|
export interface FlowContext {
|
|
1879
|
+
/** Gateway auth-flow id. Required by flow-scoped auth ceremonies. */
|
|
1880
|
+
flowId?: string;
|
|
1872
1881
|
connectionId?: string;
|
|
1873
1882
|
externalRef?: string;
|
|
1874
1883
|
tenantId: string;
|
|
@@ -2009,8 +2018,21 @@ export interface ProviderContext {
|
|
|
2009
2018
|
choice: ProviderChoiceContext;
|
|
2010
2019
|
}
|
|
2011
2020
|
|
|
2021
|
+
export interface ProxiedOAuthConfig {
|
|
2022
|
+
authorizeUrl: string;
|
|
2023
|
+
tokenUrl: string;
|
|
2024
|
+
customScheme: string;
|
|
2025
|
+
rewriteProfile: string;
|
|
2026
|
+
clientIdEnvKey: string;
|
|
2027
|
+
pkce?: "S256" | "none";
|
|
2028
|
+
authorizeParams?: Record<string, string>;
|
|
2029
|
+
tokenParams?: Record<string, string>;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2012
2032
|
export interface AuthConfig {
|
|
2013
2033
|
mode: AuthMode;
|
|
2034
|
+
/** Browser reverse-proxy contract for providers with custom-scheme OAuth callbacks. */
|
|
2035
|
+
proxied?: ProxiedOAuthConfig;
|
|
2014
2036
|
flow?: AuthFlowDefinition;
|
|
2015
2037
|
}
|
|
2016
2038
|
|