@every-app/sdk 0.2.0 → 0.3.0-rc.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.
Files changed (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +609 -3
  3. package/dist/cloudflare/catalogSettings.generated.d.ts +81 -0
  4. package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -0
  5. package/dist/cloudflare/catalogSettings.generated.js +174 -0
  6. package/dist/cloudflare/index.d.ts +23 -0
  7. package/dist/cloudflare/index.d.ts.map +1 -0
  8. package/dist/cloudflare/index.js +24 -0
  9. package/dist/cloudflare/sentinel.d.ts +127 -0
  10. package/dist/cloudflare/sentinel.d.ts.map +1 -0
  11. package/dist/cloudflare/sentinel.js +85 -0
  12. package/dist/cloudflare/worker.d.ts +805 -0
  13. package/dist/cloudflare/worker.d.ts.map +1 -0
  14. package/dist/cloudflare/worker.js +997 -0
  15. package/dist/dev/index.d.ts +8 -0
  16. package/dist/dev/index.d.ts.map +1 -0
  17. package/dist/dev/index.js +7 -0
  18. package/dist/dev/keypair.d.ts +26 -0
  19. package/dist/dev/keypair.d.ts.map +1 -0
  20. package/dist/dev/keypair.js +62 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +5 -0
  24. package/dist/internal/aiDefault.d.ts +204 -0
  25. package/dist/internal/aiDefault.d.ts.map +1 -0
  26. package/dist/internal/aiDefault.js +334 -0
  27. package/dist/internal/aiProviders.d.ts +72 -0
  28. package/dist/internal/aiProviders.d.ts.map +1 -0
  29. package/dist/internal/aiProviders.js +233 -0
  30. package/dist/internal/appSettings.d.ts +315 -0
  31. package/dist/internal/appSettings.d.ts.map +1 -0
  32. package/dist/internal/appSettings.js +549 -0
  33. package/dist/internal/audit.d.ts +108 -0
  34. package/dist/internal/audit.d.ts.map +1 -0
  35. package/dist/internal/audit.js +235 -0
  36. package/dist/internal/capabilities.d.ts +3174 -0
  37. package/dist/internal/capabilities.d.ts.map +1 -0
  38. package/dist/internal/capabilities.js +1110 -0
  39. package/dist/internal/catalog/commerce.d.ts +394 -0
  40. package/dist/internal/catalog/commerce.d.ts.map +1 -0
  41. package/dist/internal/catalog/commerce.js +477 -0
  42. package/dist/internal/catalog/comms.d.ts +375 -0
  43. package/dist/internal/catalog/comms.d.ts.map +1 -0
  44. package/dist/internal/catalog/comms.js +520 -0
  45. package/dist/internal/catalog/index.d.ts +1973 -0
  46. package/dist/internal/catalog/index.d.ts.map +1 -0
  47. package/dist/internal/catalog/index.js +19 -0
  48. package/dist/internal/catalog/inference.d.ts +393 -0
  49. package/dist/internal/catalog/inference.d.ts.map +1 -0
  50. package/dist/internal/catalog/inference.js +460 -0
  51. package/dist/internal/catalog/infra.d.ts +423 -0
  52. package/dist/internal/catalog/infra.d.ts.map +1 -0
  53. package/dist/internal/catalog/infra.js +543 -0
  54. package/dist/internal/catalog/search.d.ts +400 -0
  55. package/dist/internal/catalog/search.d.ts.map +1 -0
  56. package/dist/internal/catalog/search.js +463 -0
  57. package/dist/internal/devProviders.d.ts +49 -0
  58. package/dist/internal/devProviders.d.ts.map +1 -0
  59. package/dist/internal/devProviders.js +80 -0
  60. package/dist/internal/email.d.ts +280 -0
  61. package/dist/internal/email.d.ts.map +1 -0
  62. package/dist/internal/email.js +613 -0
  63. package/dist/internal/events.d.ts +193 -0
  64. package/dist/internal/events.d.ts.map +1 -0
  65. package/dist/internal/events.js +367 -0
  66. package/dist/internal/gatewaySettings.d.ts +83 -0
  67. package/dist/internal/gatewaySettings.d.ts.map +1 -0
  68. package/dist/internal/gatewaySettings.js +215 -0
  69. package/dist/internal/identity.d.ts +57 -5
  70. package/dist/internal/identity.d.ts.map +1 -1
  71. package/dist/internal/identity.js +99 -22
  72. package/dist/internal/index.d.ts +22 -1
  73. package/dist/internal/index.d.ts.map +1 -1
  74. package/dist/internal/index.js +22 -1
  75. package/dist/internal/members.d.ts +36 -0
  76. package/dist/internal/members.d.ts.map +1 -0
  77. package/dist/internal/members.js +7 -0
  78. package/dist/internal/oauthClient.d.ts +61 -0
  79. package/dist/internal/oauthClient.d.ts.map +1 -0
  80. package/dist/internal/oauthClient.js +133 -0
  81. package/dist/internal/oauthPresets.d.ts +33 -0
  82. package/dist/internal/oauthPresets.d.ts.map +1 -0
  83. package/dist/internal/oauthPresets.js +1064 -0
  84. package/dist/internal/oauthScopes.d.ts +172 -0
  85. package/dist/internal/oauthScopes.d.ts.map +1 -0
  86. package/dist/internal/oauthScopes.js +510 -0
  87. package/dist/internal/oauthSpec.d.ts +102 -0
  88. package/dist/internal/oauthSpec.d.ts.map +1 -0
  89. package/dist/internal/oauthSpec.js +789 -0
  90. package/dist/internal/organizationName.d.ts +18 -0
  91. package/dist/internal/organizationName.d.ts.map +1 -0
  92. package/dist/internal/organizationName.js +24 -0
  93. package/dist/internal/protocol.d.ts +150 -3
  94. package/dist/internal/protocol.d.ts.map +1 -1
  95. package/dist/internal/protocol.js +163 -2
  96. package/dist/internal/providerApps.d.ts +75 -0
  97. package/dist/internal/providerApps.d.ts.map +1 -0
  98. package/dist/internal/providerApps.js +59 -0
  99. package/dist/internal/providerRegistry.d.ts +218 -0
  100. package/dist/internal/providerRegistry.d.ts.map +1 -0
  101. package/dist/internal/providerRegistry.js +432 -0
  102. package/dist/internal/providerSpec.d.ts +66 -0
  103. package/dist/internal/providerSpec.d.ts.map +1 -0
  104. package/dist/internal/providerSpec.js +1154 -0
  105. package/dist/internal/remoteMcp.d.ts +188 -0
  106. package/dist/internal/remoteMcp.d.ts.map +1 -0
  107. package/dist/internal/remoteMcp.js +543 -0
  108. package/dist/internal/signInProviders.d.ts +104 -0
  109. package/dist/internal/signInProviders.d.ts.map +1 -0
  110. package/dist/internal/signInProviders.js +245 -0
  111. package/dist/internal/tools.d.ts +115 -0
  112. package/dist/internal/tools.d.ts.map +1 -0
  113. package/dist/internal/tools.js +80 -0
  114. package/dist/manifest.d.ts +238 -0
  115. package/dist/manifest.d.ts.map +1 -0
  116. package/dist/manifest.js +30 -0
  117. package/dist/server/ai.d.ts +111 -0
  118. package/dist/server/ai.d.ts.map +1 -0
  119. package/dist/server/ai.js +145 -0
  120. package/dist/server/aiBinding.d.ts +68 -0
  121. package/dist/server/aiBinding.d.ts.map +1 -0
  122. package/dist/server/aiBinding.js +294 -0
  123. package/dist/server/attribution.d.ts +43 -0
  124. package/dist/server/attribution.d.ts.map +1 -0
  125. package/dist/server/attribution.js +75 -0
  126. package/dist/server/authorizeUrl.d.ts +43 -0
  127. package/dist/server/authorizeUrl.d.ts.map +1 -0
  128. package/dist/server/authorizeUrl.js +106 -0
  129. package/dist/server/connectUrl.d.ts +21 -0
  130. package/dist/server/connectUrl.d.ts.map +1 -0
  131. package/dist/server/connectUrl.js +37 -0
  132. package/dist/server/context.d.ts +68 -0
  133. package/dist/server/context.d.ts.map +1 -0
  134. package/dist/server/context.js +117 -0
  135. package/dist/server/emailBinding.d.ts +72 -0
  136. package/dist/server/emailBinding.d.ts.map +1 -0
  137. package/dist/server/emailBinding.js +124 -0
  138. package/dist/server/emit.d.ts +63 -0
  139. package/dist/server/emit.d.ts.map +1 -0
  140. package/dist/server/emit.js +101 -0
  141. package/dist/server/env.d.ts +44 -0
  142. package/dist/server/env.d.ts.map +1 -0
  143. package/dist/server/env.js +1 -0
  144. package/dist/server/everyApp.d.ts +65 -19
  145. package/dist/server/everyApp.d.ts.map +1 -1
  146. package/dist/server/everyApp.js +195 -30
  147. package/dist/server/fromMcpTools.d.ts +89 -0
  148. package/dist/server/fromMcpTools.d.ts.map +1 -0
  149. package/dist/server/fromMcpTools.js +192 -0
  150. package/dist/server/gatewayFetch.d.ts +54 -14
  151. package/dist/server/gatewayFetch.d.ts.map +1 -1
  152. package/dist/server/gatewayFetch.js +201 -37
  153. package/dist/server/gatewayUrl.d.ts +13 -0
  154. package/dist/server/gatewayUrl.d.ts.map +1 -0
  155. package/dist/server/gatewayUrl.js +34 -0
  156. package/dist/server/index.d.ts +23 -3
  157. package/dist/server/index.d.ts.map +1 -1
  158. package/dist/server/index.js +19 -2
  159. package/dist/server/integrationFetch.d.ts +162 -0
  160. package/dist/server/integrationFetch.d.ts.map +1 -0
  161. package/dist/server/integrationFetch.js +688 -0
  162. package/dist/server/listMembers.d.ts +32 -0
  163. package/dist/server/listMembers.d.ts.map +1 -0
  164. package/dist/server/listMembers.js +71 -0
  165. package/dist/server/nodeServer.d.ts +48 -0
  166. package/dist/server/nodeServer.d.ts.map +1 -0
  167. package/dist/server/nodeServer.js +45 -0
  168. package/dist/server/refusal.d.ts +55 -0
  169. package/dist/server/refusal.d.ts.map +1 -0
  170. package/dist/server/refusal.js +193 -0
  171. package/dist/server/sendEmail.d.ts +39 -0
  172. package/dist/server/sendEmail.d.ts.map +1 -0
  173. package/dist/server/sendEmail.js +114 -0
  174. package/dist/server/tools.d.ts +184 -0
  175. package/dist/server/tools.d.ts.map +1 -0
  176. package/dist/server/tools.js +347 -0
  177. package/dist/server/toolsEndpoint.d.ts +32 -0
  178. package/dist/server/toolsEndpoint.d.ts.map +1 -0
  179. package/dist/server/toolsEndpoint.js +237 -0
  180. package/dist/tanstack-start/index.d.ts +9 -0
  181. package/dist/tanstack-start/index.d.ts.map +1 -0
  182. package/dist/tanstack-start/index.js +29 -0
  183. package/dist/testing/index.d.ts +93 -0
  184. package/dist/testing/index.d.ts.map +1 -0
  185. package/dist/testing/index.js +156 -0
  186. package/package.json +42 -8
  187. package/dist/server/mcp.d.ts +0 -66
  188. package/dist/server/mcp.d.ts.map +0 -1
  189. package/dist/server/mcp.js +0 -147
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Provider apps, "MCP apps" to the person: a data provider (DataForSEO
3
+ * today) offered to members as an app of the Gateway's own, with no page
4
+ * and no Worker to deploy. The operator turns it on (`everyapp mcp on
5
+ * <id>`) and sets the provider's key as a Gateway setting; the Gateway then
6
+ * serves the provider's tools on its `/mcp` under `<id>_<tool>` names, with
7
+ * the key never leaving the Gateway, every call attributed to the member
8
+ * who made it, counted and audited like an app's capability calls. The
9
+ * launcher lists it under "MCP apps" and its card opens the "Use it from
10
+ * your agent" dialog instead of a page (docs/design/2026-10-mcp-apps-ui.md).
11
+ *
12
+ * A provider app is an `apps` row of tier {@link PROVIDER_APP_TIER} with no
13
+ * hostname and no Worker name: the perimeter never routes it, and the
14
+ * Gateway reaches its tools in-process rather than over a service binding.
15
+ * Its manifest is generated here, so the settings model
16
+ * (./appSettings.ts) reads the provider's key as a required Gateway setting
17
+ * like any app's capability. The registry rules that write the row are in
18
+ * `@every-app/perimeter/registry` (providerApps.ts); the Gateway serves it
19
+ * from `apps/every-app-gateway/src/server/provider-apps/`.
20
+ */
21
+ import { CAPABILITIES, authSettingNames, } from "./capabilities.js";
22
+ /** The `apps.tier` of a provider app: no Worker, served by the Gateway itself. */
23
+ export const PROVIDER_APP_TIER = "provider";
24
+ export const PROVIDER_APPS = {
25
+ dataforseo: {
26
+ id: "dataforseo",
27
+ name: "DataForSEO",
28
+ description: "SEO data for your agent: keyword metrics and suggestions, live Google results, domain rankings, competitors and backlinks, through the Gateway's DataForSEO key.",
29
+ capability: "dataforseo",
30
+ why: "Serves DataForSEO's keyword, search-result, domain and backlink data to members' AI clients.",
31
+ example: "find keyword ideas for a page about running shoes",
32
+ },
33
+ };
34
+ /** The provider app ids, in a stable order. */
35
+ export const PROVIDER_APP_IDS = Object.keys(PROVIDER_APPS).sort();
36
+ export function isProviderAppId(id) {
37
+ return Object.hasOwn(PROVIDER_APPS, id);
38
+ }
39
+ /** The Gateway setting that holds a provider app's key (`DATAFORSEO_API_KEY`). */
40
+ export function providerAppKeySetting(id) {
41
+ return authSettingNames(CAPABILITIES[PROVIDER_APPS[id].capability].auth)[0];
42
+ }
43
+ /**
44
+ * The manifest a provider app's registry row stores: what a deployed app
45
+ * would declare to use the same capability, so Admin → Apps, the settings
46
+ * model and the integration proxy read it like any app's. Read-only
47
+ * access: every provider app only reads data.
48
+ */
49
+ export function providerAppManifest(id) {
50
+ const provider = PROVIDER_APPS[id];
51
+ return {
52
+ id: provider.id,
53
+ name: provider.name,
54
+ description: provider.description,
55
+ capabilities: {
56
+ [provider.capability]: { access: "read", why: provider.why },
57
+ },
58
+ };
59
+ }
@@ -0,0 +1,218 @@
1
+ /**
2
+ * The provider registry: the built-in catalog (./capabilities.ts) and the
3
+ * providers one gateway registered as rows (`everyapp provider add`,
4
+ * `everyapp_provider_add`), resolved as one lookup
5
+ * (docs/design/2026-10-provider-registry.md). The catalog comes first and
6
+ * a row can never shadow it. Every row is parsed and checked again each
7
+ * time a registry is built, so a row written by hand into D1, or one that
8
+ * stopped passing the rules when a later catalog took its name, is left
9
+ * out and named in `rejected` rather than served.
10
+ *
11
+ * The rules a row must pass (the register's `registry.*` invariants):
12
+ *
13
+ * - `registry.builtin-precedence`: not a catalog id, and never `everyapp`;
14
+ * - `registry.row-secret-is-its-own`: each Gateway setting it names starts
15
+ * with its own id (`STRIPE_` for `stripe`) and is nobody else's: no
16
+ * install-owned, dev-only or reserved name, no settable Gateway setting
17
+ * (the catalog's keys and clients included), no other row's;
18
+ * - `registry.row-hosts-public-https`: each host is a public DNS name (not
19
+ * an IP literal, localhost, or a `.local`, `.internal` or `.arpa` name)
20
+ * and not one the gateway serves itself (`refuseHost`, which knows the
21
+ * gateway's own host and `APP_BASE_DOMAIN`).
22
+ *
23
+ * A second kind of row, a scope-set overlay (`provider_scope_sets`,
24
+ * `everyapp provider scope-set add`), adds a named scope set to a
25
+ * built-in OAuth client that has scope sets (Google, Microsoft, Slack):
26
+ * its scopes, and the routes on the client's own API hosts it unlocks,
27
+ * checked by the rules a built-in set is checked by
28
+ * (`providers.scope-set-overlay-within-client`). An overlay never replaces
29
+ * one of the client's own sets, never names a host outside the client's
30
+ * `api`, and never applies to a registered row (an operator replaces the
31
+ * row's spec instead). Apps list an overlay set under `scopes` as they
32
+ * list a built-in one.
33
+ */
34
+ import { type Capability, type CapabilityLookup, type OAuthClientCapability, type OAuthScopeSet } from "./capabilities.js";
35
+ import { type RegistrableCapability } from "./providerSpec.js";
36
+ /** A `providers` row as the gateway or the CLI read it. */
37
+ export interface ProviderRow {
38
+ id: string;
39
+ /** The spec, as JSON text or already parsed. */
40
+ spec: unknown;
41
+ /**
42
+ * What the row's key was set for: {@link providerBindingKey} of the row
43
+ * as it was when `everyapp secret set` last set one of its settings;
44
+ * null until then. The gateway reads the row's settings only while this
45
+ * equals the key of the row it has now (`providers.value-bound-to-hosts`).
46
+ */
47
+ boundTo?: string | null;
48
+ /** Who registered it (the Cloudflare login's email, or a member's), for the person setting its key. */
49
+ addedBy?: string | null;
50
+ /** When, in epoch milliseconds. */
51
+ addedAt?: number | null;
52
+ }
53
+ /** A `provider_scope_sets` row as the gateway or the CLI read it. */
54
+ export interface ScopeSetRow {
55
+ /** The built-in OAuth client the set belongs to (`google-workspace`). */
56
+ providerId: string;
57
+ /** The set's name, what an app lists under `scopes` (`gmail.send`). */
58
+ name: string;
59
+ /** The set's spec, as JSON text or already parsed (`parseScopeSetOverlay`'s shape). */
60
+ spec: unknown;
61
+ addedBy?: string | null;
62
+ addedAt?: number | null;
63
+ }
64
+ /** One overlay the registry serves, as `provider show` reports it. */
65
+ export interface RegisteredScopeSet {
66
+ providerId: string;
67
+ name: string;
68
+ set: OAuthScopeSet;
69
+ addedBy: string | null;
70
+ addedAt: number | null;
71
+ }
72
+ export type ScopeSetRefusalCode = "SCOPE_SET_INVALID" | "SCOPE_SET_PROVIDER_UNKNOWN" | "SCOPE_SET_BUILTIN";
73
+ /** Why an overlay row is not a scope set on this gateway. */
74
+ export interface ScopeSetRefusal {
75
+ providerId: string;
76
+ name: string;
77
+ code: ScopeSetRefusalCode;
78
+ message: string;
79
+ }
80
+ /**
81
+ * The part of a row a key is set for: its hosts, its host setting and its
82
+ * auth, as one canonical string (sorted keys, sorted hosts), so that
83
+ * replacing a row's hosts or auth changes the key and the value it held
84
+ * is no longer read until the operator sets it again. For an OAuth
85
+ * provider the client is bound to its authorize, token and revoke URLs,
86
+ * its API hosts, where the client goes on the token request and its
87
+ * client setting names (`oauth.client-bound-to-endpoints`): an admin who
88
+ * re-points `tokenUrl` has to paste the secret again.
89
+ */
90
+ export declare function providerBindingKey(capability: RegistrableCapability): string;
91
+ /** One registered row as `provider list` and `provider show` report it. */
92
+ export interface RegisteredProvider {
93
+ id: string;
94
+ capability: RegistrableCapability;
95
+ /** Whether the row's key was set for the hosts and auth it has now. */
96
+ bound: boolean;
97
+ addedBy: string | null;
98
+ addedAt: number | null;
99
+ }
100
+ export type RowRefusalCode = "PROVIDER_SPEC_INVALID" | "PROVIDER_BUILTIN" | "PROVIDER_SECRET_TAKEN" | "PROVIDER_HOST_REFUSED";
101
+ /** Why a row is not a provider on this gateway. */
102
+ export interface RowRefusal {
103
+ id: string;
104
+ code: RowRefusalCode;
105
+ message: string;
106
+ }
107
+ export interface ProviderRegistry extends CapabilityLookup {
108
+ /** Every id, the catalog's first in catalog order, then the rows' in row order. */
109
+ ids(): readonly string[];
110
+ entries(): ReadonlyArray<readonly [string, Capability]>;
111
+ sourceOf(id: string): "catalog" | "row" | undefined;
112
+ /** Every Gateway setting any provider reads, the catalog's and the rows'. */
113
+ settingNames(): ReadonlySet<string>;
114
+ /**
115
+ * Whether `id`'s settings may be read: always for a catalog entry; for a
116
+ * row, only while its key was set for the hosts and auth it has now.
117
+ * False for an id the registry doesn't have.
118
+ */
119
+ bound(id: string): boolean;
120
+ /** The settings of rows whose key isn't bound: read as unset everywhere. */
121
+ unboundSettings(): ReadonlySet<string>;
122
+ /** The registered rows this registry serves, in row order. */
123
+ rows(): readonly RegisteredProvider[];
124
+ /** The rows this registry left out, each with why. */
125
+ readonly rejected: readonly RowRefusal[];
126
+ /** The scope-set overlays this registry applied to built-in clients, in row order. */
127
+ scopeSets(): readonly RegisteredScopeSet[];
128
+ /** Where a client's scope set comes from: its catalog entry, an overlay row, or nowhere. */
129
+ scopeSetSource(providerId: string, name: string): "catalog" | "row" | undefined;
130
+ /** The overlay rows this registry left out, each with why. */
131
+ readonly rejectedScopeSets: readonly ScopeSetRefusal[];
132
+ }
133
+ export interface ProviderRegistryOptions {
134
+ /**
135
+ * A host no row may name on this gateway, with why: the gateway's own
136
+ * host and anything under its apps' base domain. The pure rules refuse
137
+ * the rest (IP literals, localhost, `.internal`).
138
+ */
139
+ refuseHost?: (host: string) => string | null;
140
+ /** The scope-set overlays (`provider_scope_sets`), applied to the catalog's OAuth clients. */
141
+ scopeSets?: readonly ScopeSetRow[];
142
+ }
143
+ /** The prefix a provider's own Gateway settings carry: `stripe` → `STRIPE_`, `tiktok-business` → `TIKTOK_BUSINESS_`. */
144
+ export declare function providerSettingPrefix(id: string): string;
145
+ /** Why `host` can't be a row's, by the pure rules alone; null when it can. */
146
+ export declare function publicHostProblem(host: string): string | null;
147
+ /** What a gateway serves itself, for {@link gatewayHostRefusal}. */
148
+ export interface GatewayHosts {
149
+ /** The gateway's own host (`apps.example.com`), or its URL. */
150
+ gatewayHost?: string | null;
151
+ /** Where its apps live (`APP_BASE_DOMAIN`): the domain and everything under it. */
152
+ appBaseDomain?: string | null;
153
+ /** A hosted gateway's third-party domain (`THIRD_PARTY_DOMAIN`), when it has one. */
154
+ thirdPartyDomain?: string | null;
155
+ }
156
+ /**
157
+ * Why a row can't send its key to `host` on this gateway: the gateway's
158
+ * own host, an app host under its base domain, or a host under its
159
+ * third-party domain. Null when none applies. The gateway applies it on
160
+ * every read (`refusedGatewayHost`, with its env) and the CLI at `provider
161
+ * add` (with the install's gateway host and base domain), in the same words.
162
+ */
163
+ export declare function gatewayHostRefusal(host: string, hosts: GatewayHosts): string | null;
164
+ /**
165
+ * Why a setting name can't be a row's: a name the Gateway, the catalog or
166
+ * another provider already reads, or one outside the row's own prefix.
167
+ * Null when the row may hold it.
168
+ */
169
+ export declare function rowSecretProblem(id: string, name: string, taken: (name: string) => boolean): string | null;
170
+ /**
171
+ * Check one parsed row against the catalog and the other rows. Pure: the
172
+ * CLI runs it before writing D1, the MCP tool before writing, and the
173
+ * gateway again on every read.
174
+ */
175
+ export declare function checkProviderRow(id: string, capability: RegistrableCapability, context: {
176
+ /** Settings the other rows hold. */
177
+ rowSettings: ReadonlySet<string>;
178
+ refuseHost?: (host: string) => string | null;
179
+ }): RowRefusal | null;
180
+ /**
181
+ * Every host a row sends a secret to: an API-key provider's `hosts`; an
182
+ * OAuth provider's API hosts (the token), and its authorize, token and
183
+ * revoke hosts (the client). Each passes the row host rules.
184
+ */
185
+ export declare function registrableHosts(capability: RegistrableCapability): string[];
186
+ /** A row's spec parsed and checked: the capability, or the refusal. */
187
+ export declare function resolveProviderRow(row: ProviderRow, context: {
188
+ rowSettings: ReadonlySet<string>;
189
+ refuseHost?: (host: string) => string | null;
190
+ }): {
191
+ ok: true;
192
+ capability: RegistrableCapability;
193
+ } | {
194
+ ok: false;
195
+ refusal: RowRefusal;
196
+ };
197
+ /**
198
+ * The built-in OAuth client an overlay may extend: a catalog entry of mode
199
+ * `oauth_client` with a scope policy. Null for anything else (an API-key
200
+ * entry, a client without sets, a registered row, an unknown id).
201
+ */
202
+ export declare function overlayableClient(providerId: string): OAuthClientCapability | null;
203
+ /** An overlay row's spec parsed and checked against its client: the set, or the refusal. */
204
+ export declare function resolveScopeSetRow(row: ScopeSetRow): {
205
+ ok: true;
206
+ set: OAuthScopeSet;
207
+ } | {
208
+ ok: false;
209
+ refusal: ScopeSetRefusal;
210
+ };
211
+ /**
212
+ * The catalog and `rows` as one registry. Rows are taken in order; a row
213
+ * whose settings another earlier row holds is the one refused.
214
+ */
215
+ export declare function providerRegistry(rows?: readonly ProviderRow[], options?: ProviderRegistryOptions): ProviderRegistry;
216
+ /** The catalog alone, as a registry: what every surface reads without a gateway's rows. */
217
+ export declare const BUILTIN_PROVIDERS: ProviderRegistry;
218
+ //# sourceMappingURL=providerRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providerRegistry.d.ts","sourceRoot":"","sources":["../../src/internal/providerRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;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