@every-app/sdk 0.3.0-rc.8 → 0.3.0

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 (146) hide show
  1. package/README.md +75 -74
  2. package/dist/cloudflare/catalogSettings.generated.d.ts +20 -6
  3. package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -1
  4. package/dist/cloudflare/catalogSettings.generated.js +45 -14
  5. package/dist/cloudflare/index.d.ts +1 -1
  6. package/dist/cloudflare/index.d.ts.map +1 -1
  7. package/dist/cloudflare/sentinel.d.ts +3 -0
  8. package/dist/cloudflare/sentinel.d.ts.map +1 -1
  9. package/dist/cloudflare/sentinel.js +10 -0
  10. package/dist/cloudflare/worker.d.ts +67 -23
  11. package/dist/cloudflare/worker.d.ts.map +1 -1
  12. package/dist/cloudflare/worker.js +68 -32
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/internal/aiDefault.d.ts +36 -79
  16. package/dist/internal/aiDefault.d.ts.map +1 -1
  17. package/dist/internal/aiDefault.js +47 -149
  18. package/dist/internal/aiProviders.d.ts +1 -1
  19. package/dist/internal/aiProviders.d.ts.map +1 -1
  20. package/dist/internal/aiProviders.js +2 -2
  21. package/dist/internal/appSettings.d.ts +140 -89
  22. package/dist/internal/appSettings.d.ts.map +1 -1
  23. package/dist/internal/appSettings.js +264 -156
  24. package/dist/internal/capabilities.d.ts +145 -503
  25. package/dist/internal/capabilities.d.ts.map +1 -1
  26. package/dist/internal/capabilities.js +29 -550
  27. package/dist/internal/catalog/commerce.js +1 -1
  28. package/dist/internal/catalog/comms.d.ts +37 -0
  29. package/dist/internal/catalog/comms.d.ts.map +1 -1
  30. package/dist/internal/catalog/comms.js +43 -0
  31. package/dist/internal/catalog/index.d.ts +72 -0
  32. package/dist/internal/catalog/index.d.ts.map +1 -1
  33. package/dist/internal/catalog/infra.d.ts +35 -0
  34. package/dist/internal/catalog/infra.d.ts.map +1 -1
  35. package/dist/internal/catalog/infra.js +65 -0
  36. package/dist/internal/devProviders.d.ts +1 -19
  37. package/dist/internal/devProviders.d.ts.map +1 -1
  38. package/dist/internal/devProviders.js +7 -1
  39. package/dist/internal/events.d.ts +52 -1
  40. package/dist/internal/events.d.ts.map +1 -1
  41. package/dist/internal/events.js +66 -2
  42. package/dist/internal/gatewaySettings.d.ts +6 -16
  43. package/dist/internal/gatewaySettings.d.ts.map +1 -1
  44. package/dist/internal/gatewaySettings.js +6 -24
  45. package/dist/internal/index.d.ts +1 -0
  46. package/dist/internal/index.d.ts.map +1 -1
  47. package/dist/internal/index.js +1 -0
  48. package/dist/internal/mcpOAuth.d.ts +210 -0
  49. package/dist/internal/mcpOAuth.d.ts.map +1 -0
  50. package/dist/internal/mcpOAuth.js +735 -0
  51. package/dist/internal/oauthClient.d.ts +7 -47
  52. package/dist/internal/oauthClient.d.ts.map +1 -1
  53. package/dist/internal/oauthClient.js +1 -115
  54. package/dist/internal/oauthPresets.d.ts +356 -20
  55. package/dist/internal/oauthPresets.d.ts.map +1 -1
  56. package/dist/internal/oauthPresets.js +183 -861
  57. package/dist/internal/oauthScopes.d.ts +43 -155
  58. package/dist/internal/oauthScopes.d.ts.map +1 -1
  59. package/dist/internal/oauthScopes.js +82 -475
  60. package/dist/internal/oauthSpec.d.ts +28 -71
  61. package/dist/internal/oauthSpec.d.ts.map +1 -1
  62. package/dist/internal/oauthSpec.js +172 -448
  63. package/dist/internal/protocol.d.ts +39 -15
  64. package/dist/internal/protocol.d.ts.map +1 -1
  65. package/dist/internal/protocol.js +40 -7
  66. package/dist/internal/providerApps.d.ts +2 -2
  67. package/dist/internal/providerApps.js +2 -2
  68. package/dist/internal/providerRegistry.d.ts +5 -64
  69. package/dist/internal/providerRegistry.d.ts.map +1 -1
  70. package/dist/internal/providerRegistry.js +19 -118
  71. package/dist/internal/providerSpec.d.ts.map +1 -1
  72. package/dist/internal/providerSpec.js +14 -36
  73. package/dist/internal/remoteMcp.d.ts +191 -47
  74. package/dist/internal/remoteMcp.d.ts.map +1 -1
  75. package/dist/internal/remoteMcp.js +338 -133
  76. package/dist/internal/signInProviders.d.ts +1 -1
  77. package/dist/internal/signInProviders.d.ts.map +1 -1
  78. package/dist/internal/tools.d.ts +15 -8
  79. package/dist/internal/tools.d.ts.map +1 -1
  80. package/dist/internal/tools.js +9 -8
  81. package/dist/manifest.d.ts +96 -28
  82. package/dist/manifest.d.ts.map +1 -1
  83. package/dist/manifest.js +1 -1
  84. package/dist/server/ai.d.ts +1 -93
  85. package/dist/server/ai.d.ts.map +1 -1
  86. package/dist/server/ai.js +17 -111
  87. package/dist/server/attribution.d.ts +10 -1
  88. package/dist/server/attribution.d.ts.map +1 -1
  89. package/dist/server/attribution.js +7 -1
  90. package/dist/server/connectUrl.d.ts +4 -9
  91. package/dist/server/connectUrl.d.ts.map +1 -1
  92. package/dist/server/connectUrl.js +17 -14
  93. package/dist/server/context.d.ts +12 -14
  94. package/dist/server/context.d.ts.map +1 -1
  95. package/dist/server/context.js +23 -25
  96. package/dist/server/emit.d.ts.map +1 -1
  97. package/dist/server/emit.js +2 -2
  98. package/dist/server/env.d.ts +3 -0
  99. package/dist/server/env.d.ts.map +1 -1
  100. package/dist/server/eventsEndpoint.d.ts +48 -0
  101. package/dist/server/eventsEndpoint.d.ts.map +1 -0
  102. package/dist/server/eventsEndpoint.js +145 -0
  103. package/dist/server/everyApp.d.ts +16 -26
  104. package/dist/server/everyApp.d.ts.map +1 -1
  105. package/dist/server/everyApp.js +22 -46
  106. package/dist/server/gatewayFetch.d.ts +19 -1
  107. package/dist/server/gatewayFetch.d.ts.map +1 -1
  108. package/dist/server/gatewayFetch.js +45 -3
  109. package/dist/server/index.d.ts +6 -9
  110. package/dist/server/index.d.ts.map +1 -1
  111. package/dist/server/index.js +4 -8
  112. package/dist/server/integrationFetch.d.ts +60 -72
  113. package/dist/server/integrationFetch.d.ts.map +1 -1
  114. package/dist/server/integrationFetch.js +124 -397
  115. package/dist/server/listMembers.d.ts.map +1 -1
  116. package/dist/server/listMembers.js +2 -2
  117. package/dist/server/refusal.d.ts +0 -9
  118. package/dist/server/refusal.d.ts.map +1 -1
  119. package/dist/server/refusal.js +0 -22
  120. package/dist/server/sendEmail.d.ts.map +1 -1
  121. package/dist/server/sendEmail.js +2 -2
  122. package/dist/server/tools.d.ts +17 -6
  123. package/dist/server/tools.d.ts.map +1 -1
  124. package/dist/server/tools.js +14 -4
  125. package/dist/server/toolsEndpoint.d.ts +2 -1
  126. package/dist/server/toolsEndpoint.d.ts.map +1 -1
  127. package/dist/server/toolsEndpoint.js +4 -3
  128. package/dist/server/webhooks.d.ts +56 -0
  129. package/dist/server/webhooks.d.ts.map +1 -0
  130. package/dist/server/webhooks.js +205 -0
  131. package/dist/testing/index.d.ts +2 -3
  132. package/dist/testing/index.d.ts.map +1 -1
  133. package/dist/testing/index.js +2 -6
  134. package/package.json +6 -1
  135. package/dist/server/aiBinding.d.ts +0 -68
  136. package/dist/server/aiBinding.d.ts.map +0 -1
  137. package/dist/server/aiBinding.js +0 -294
  138. package/dist/server/authorizeUrl.d.ts +0 -43
  139. package/dist/server/authorizeUrl.d.ts.map +0 -1
  140. package/dist/server/authorizeUrl.js +0 -106
  141. package/dist/server/emailBinding.d.ts +0 -72
  142. package/dist/server/emailBinding.d.ts.map +0 -1
  143. package/dist/server/emailBinding.js +0 -124
  144. package/dist/server/fromMcpTools.d.ts +0 -89
  145. package/dist/server/fromMcpTools.d.ts.map +0 -1
  146. package/dist/server/fromMcpTools.js +0 -192
@@ -1,13 +1,13 @@
1
1
  /**
2
- * The `oauth_client` capability's wire rules (docs/capabilities.md "OAuth
3
- * clients"), shared by the gateway, which puts the operator's client on an
4
- * app's token request, and the SDK's local-dev fallback, which puts the
5
- * developer's own on it the same way.
2
+ * An OAuth provider's client as the gateway holds it in its settings
3
+ * (`everyapp secret set <CLIENT_ID> <CLIENT_SECRET>`); one an owner or
4
+ * admin pasted under Manage workspace → Providers is the gateway's own
5
+ * D1 row instead.
6
6
  */
7
- import { type CapabilitySettings, type OAuthClientCapability, type OAuthTokenEndpoint } from "./capabilities.js";
8
- /** The largest token request body the gateway reads: real ones are a few hundred bytes. */
7
+ import type { CapabilitySettings, OAuthClientCapability } from "./capabilities.js";
8
+ /** The largest token answer the gateway reads: real ones are a few kilobytes. */
9
9
  export declare const OAUTH_TOKEN_BODY_LIMIT: number;
10
- /** An OAuth client as the gateway (or `.dev.vars`) holds it. */
10
+ /** An OAuth client as the gateway holds it. */
11
11
  export interface OAuthClientCredentials {
12
12
  clientId: string;
13
13
  /** Absent for a public client. */
@@ -18,44 +18,4 @@ export interface OAuthClientCredentials {
18
18
  * it needs is set: the id, and the secret unless it is a public client.
19
19
  */
20
20
  export declare function oauthClientCredentials(capability: OAuthClientCapability, settings: CapabilitySettings): OAuthClientCredentials | null;
21
- /** A token request: where it goes, its headers, its (buffered) body. */
22
- export interface TokenRequest {
23
- url: URL;
24
- headers: Headers;
25
- body: string | null;
26
- }
27
- export type InjectedTokenRequest = ({
28
- ok: true;
29
- } & TokenRequest) | {
30
- ok: false;
31
- problem: string;
32
- };
33
- /**
34
- * `request` with `client` put where `rule` says (the form body or HTTP
35
- * Basic), and every client credential the app sent removed wherever it
36
- * was: the `Authorization` header, and `client_id`/`client_secret` (in any
37
- * case) in the query string and the body. The body is re-serialised from
38
- * its parsed values, so a crafted body can't carry a second secret past
39
- * the parser. Token requests are form-encoded; anything else is refused.
40
- */
41
- export declare function injectClientCredentials(request: TokenRequest, rule: OAuthTokenEndpoint, client: OAuthClientCredentials): InjectedTokenRequest;
42
- /**
43
- * The grants the gateway completes: each ends in a user's own tokens. The
44
- * client-credentials grant, and anything else a network serves on the same
45
- * endpoint, would mint a token for the gateway's own application instead,
46
- * which on many providers manages the application's settings, its
47
- * webhooks and every tenant's tokens.
48
- */
49
- export declare const USER_BOUND_GRANT_TYPES: ReadonlySet<string>;
50
- /**
51
- * A token request's `grant_type` as the app sent it, from its body or query
52
- * string, or null when it names none (Slack's code exchange). Never the
53
- * request's other fields.
54
- */
55
- export declare function requestedGrantType(request: TokenRequest): string | null;
56
- /**
57
- * A token request's `grant_type` for logs: one of the known grant types,
58
- * `other`, or null when it names none.
59
- */
60
- export declare function tokenGrantType(request: TokenRequest): string | null;
61
21
  //# sourceMappingURL=oauthClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauthClient.d.ts","sourceRoot":"","sources":["../../src/internal/oauthClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACxB,MAAM,mBAAmB,CAAC;AAE3B,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB,QAAY,CAAC;AAEhD,gEAAgE;AAChE,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,EACjC,QAAQ,EAAE,kBAAkB,GAC3B,sBAAsB,GAAG,IAAI,CAQ/B;AAMD,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,GAAG,CAAC;IACT,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,oBAAoB,GAC5B,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,YAAY,CAAC,GAC7B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAOnC;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,sBAAsB,GAC7B,oBAAoB,CAoDtB;AAUD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAIrD,CAAC;AAEH;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAQvE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAInE"}
1
+ {"version":3,"file":"oauthClient.d.ts","sourceRoot":"","sources":["../../src/internal/oauthClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EACV,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,iFAAiF;AACjF,eAAO,MAAM,sBAAsB,QAAY,CAAC;AAEhD,+CAA+C;AAC/C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,qBAAqB,EACjC,QAAQ,EAAE,kBAAkB,GAC3B,sBAAsB,GAAG,IAAI,CAQ/B"}
@@ -1,11 +1,4 @@
1
- /**
2
- * The `oauth_client` capability's wire rules (docs/capabilities.md "OAuth
3
- * clients"), shared by the gateway, which puts the operator's client on an
4
- * app's token request, and the SDK's local-dev fallback, which puts the
5
- * developer's own on it the same way.
6
- */
7
- import { base64Utf8, } from "./capabilities.js";
8
- /** The largest token request body the gateway reads: real ones are a few hundred bytes. */
1
+ /** The largest token answer the gateway reads: real ones are a few kilobytes. */
9
2
  export const OAUTH_TOKEN_BODY_LIMIT = 64 * 1024;
10
3
  /**
11
4
  * The client `settings` hold for `capability`, or null until every setting
@@ -24,110 +17,3 @@ export function oauthClientCredentials(capability, settings) {
24
17
  function settingValue(value) {
25
18
  return typeof value === "string" && value.trim() ? value.trim() : undefined;
26
19
  }
27
- const FORM = "application/x-www-form-urlencoded";
28
- const isCredential = (name) => ["client_id", "client_secret"].includes(name.toLowerCase());
29
- /**
30
- * `request` with `client` put where `rule` says (the form body or HTTP
31
- * Basic), and every client credential the app sent removed wherever it
32
- * was: the `Authorization` header, and `client_id`/`client_secret` (in any
33
- * case) in the query string and the body. The body is re-serialised from
34
- * its parsed values, so a crafted body can't carry a second secret past
35
- * the parser. Token requests are form-encoded; anything else is refused.
36
- */
37
- export function injectClientCredentials(request, rule, client) {
38
- const fields = [
39
- ["client_id", client.clientId],
40
- ...(client.clientSecret
41
- ? [["client_secret", client.clientSecret]]
42
- : []),
43
- ];
44
- // The query keeps the app's other fields as they were sent.
45
- const url = new URL(request.url);
46
- url.search = url.search
47
- .slice(1)
48
- .split("&")
49
- .filter((pair) => {
50
- const [name] = new URLSearchParams(pair).keys();
51
- return pair !== "" && !(name !== undefined && isCredential(name));
52
- })
53
- .join("&");
54
- const headers = new Headers(request.headers);
55
- headers.delete("authorization");
56
- headers.delete("content-length");
57
- if (rule.inject === "basic") {
58
- headers.set("authorization", `Basic ${base64Utf8(`${client.clientId}:${client.clientSecret ?? ""}`)}`);
59
- }
60
- let body = request.body;
61
- if (body === null || body === "") {
62
- // Nothing the app sent; the form rule makes the body.
63
- if (rule.inject === "form") {
64
- headers.set("content-type", FORM);
65
- body = new URLSearchParams(fields).toString();
66
- }
67
- }
68
- else if (mediaType(headers.get("content-type")) === FORM) {
69
- const params = new URLSearchParams(body);
70
- for (const name of new Set([...params.keys()].filter(isCredential))) {
71
- params.delete(name);
72
- }
73
- if (rule.inject === "form") {
74
- for (const [name, value] of fields)
75
- params.set(name, value);
76
- }
77
- body = params.toString();
78
- }
79
- else {
80
- return {
81
- ok: false,
82
- problem: `A token request's body is form-encoded (${FORM}).`,
83
- };
84
- }
85
- return { ok: true, url, headers, body };
86
- }
87
- /** The grant types logs may name; anything else is logged as `other`. */
88
- const GRANT_TYPES = new Set([
89
- "authorization_code",
90
- "refresh_token",
91
- "client_credentials",
92
- "urn:ietf:params:oauth:grant-type:token-exchange",
93
- ]);
94
- /**
95
- * The grants the gateway completes: each ends in a user's own tokens. The
96
- * client-credentials grant, and anything else a network serves on the same
97
- * endpoint, would mint a token for the gateway's own application instead,
98
- * which on many providers manages the application's settings, its
99
- * webhooks and every tenant's tokens.
100
- */
101
- export const USER_BOUND_GRANT_TYPES = new Set([
102
- "authorization_code",
103
- "refresh_token",
104
- "urn:ietf:params:oauth:grant-type:token-exchange",
105
- ]);
106
- /**
107
- * A token request's `grant_type` as the app sent it, from its body or query
108
- * string, or null when it names none (Slack's code exchange). Never the
109
- * request's other fields.
110
- */
111
- export function requestedGrantType(request) {
112
- let value = null;
113
- const type = mediaType(request.headers.get("content-type"));
114
- if (request.body && type === FORM) {
115
- value = new URLSearchParams(request.body).get("grant_type");
116
- }
117
- value ??= request.url.searchParams.get("grant_type");
118
- return typeof value === "string" && value ? value : null;
119
- }
120
- /**
121
- * A token request's `grant_type` for logs: one of the known grant types,
122
- * `other`, or null when it names none.
123
- */
124
- export function tokenGrantType(request) {
125
- const value = requestedGrantType(request);
126
- if (value === null)
127
- return null;
128
- return GRANT_TYPES.has(value) ? value : "other";
129
- }
130
- /** A Content-Type's media type, lowercased and without parameters. */
131
- function mediaType(contentType) {
132
- return (contentType ?? "").split(";")[0].trim().toLowerCase();
133
- }
@@ -1,33 +1,369 @@
1
1
  /**
2
- * OAuth presets (docs/design/2026-10-oauth-providers.md section 4): ready
3
- * `oauth2-user` specs, in the JSON shape `everyapp provider add` takes,
4
- * for the providers people most often want a "Connect" button for. A
5
- * preset becomes a `providers` row when added (`everyapp provider add
6
- * --oauth github`, the Admin dialog, `everyapp_provider_add` with
7
- * `preset`), so an operator may `provider show` and edit a copy; nothing
8
- * here is a hidden catalog entry, and no gateway reserves a preset's
9
- * setting names until it is added. Google, Microsoft and Slack are
10
- * catalog clients with a `flow` and are offered in the same picker. The
11
- * social networks' presets carry the tag `social`.
2
+ * The OAuth providers, as presets: ready `oauth2-user` specs in the JSON
3
+ * shape `everyapp provider add` takes. Every OAuth provider a Gateway
4
+ * serves is a `providers` row, and a preset is that row's spec, written
5
+ * when an app whose manifest names the preset's id is deployed or
6
+ * installed, or when an operator adds it (`everyapp provider add
7
+ * google-workspace`, the Admin dialog, `everyapp_provider_add` with
8
+ * `preset`). An operator may `provider show` and edit the row's copy. No
9
+ * gateway reserves a preset's setting names until its row is written.
10
+ * What differs between providers is data here: the endpoints, the API
11
+ * hosts, how scopes are separated and prefixed, the extra authorize
12
+ * parameters, how the account is named, and the scopes a token may carry
13
+ * beyond what the app asked. No code reads a provider id to decide
14
+ * anything.
12
15
  *
13
- * Each preset parses with `parseProviderSpec` (oauthPresets.test.ts),
16
+ * Each preset parses with `parseProviderSpec` (oauthPresets.test.ts) and
14
17
  * names a console where the client is made, the API hosts the token is
15
- * sent to, and scope sets an app declares under `scopes`. Scope strings
16
- * are the providers' own, verified against their docs on 2026-10-25;
17
- * the social presets' come from the catalog entries Postiz used, and
18
- * none of them has been tried against a live connect yet.
18
+ * sent to, and how the provider spells scopes. Which scopes a connection
19
+ * holds is each app's `everyapp.config.ts`, never the preset. Endpoints
20
+ * were checked against the providers' docs on 2026-10-25; only GitHub's
21
+ * and Google's have been tried against a live connect.
22
+ *
23
+ * A row is a copy: changing a preset here changes no Gateway that has
24
+ * written its row already. A change that must reach them ships with a D1
25
+ * data migration (as 0032 wrote the first rows) that rewrites the rows
26
+ * still equal to the old spec and moves `bound_to` (and a pasted client's
27
+ * `oauth_clients.bound_to`) from the old binding key to the new one, so
28
+ * the client keeps being read and `isPresetRow` keeps matching.
19
29
  */
30
+ import type { CapabilityLookup } from "./capabilities.js";
20
31
  import { type RegistrableCapability } from "./providerSpec.js";
21
32
  /** A preset's spec as JSON: the shape of ./oauthSpec.ts. */
22
33
  export type OAuthPresetSpec = Readonly<Record<string, unknown>>;
34
+ declare const PRESETS: {
35
+ readonly "google-workspace": {
36
+ readonly id: "google-workspace";
37
+ readonly name: "Google";
38
+ readonly description: "Gmail, Calendar, Drive, Search Console, Analytics and the other Google APIs, as the person who connects.";
39
+ readonly docs: "https://console.cloud.google.com/apis/credentials";
40
+ readonly api: "https://developers.google.com/identity/protocols/oauth2/scopes";
41
+ readonly hosts: readonly ["gmail.googleapis.com", "www.googleapis.com", "searchconsole.googleapis.com", "analyticsdata.googleapis.com", "analyticsadmin.googleapis.com", "openidconnect.googleapis.com"];
42
+ readonly auth: {
43
+ readonly kind: "oauth2-user";
44
+ readonly authorizeUrl: "https://accounts.google.com/o/oauth2/v2/auth";
45
+ readonly tokenUrl: "https://oauth2.googleapis.com/token";
46
+ readonly revokeUrl: "https://oauth2.googleapis.com/revoke";
47
+ readonly clientId: "GOOGLE_WORKSPACE_CLIENT_ID";
48
+ readonly clientSecret: "GOOGLE_WORKSPACE_CLIENT_SECRET";
49
+ readonly inject: "form";
50
+ readonly pkce: true;
51
+ readonly scopeSeparator: "space";
52
+ readonly scopePrefix: "https://www.googleapis.com/auth/";
53
+ readonly authorizeParams: {
54
+ readonly access_type: "offline";
55
+ readonly prompt: "consent";
56
+ };
57
+ readonly identity: {
58
+ readonly url: "https://openidconnect.googleapis.com/v1/userinfo";
59
+ readonly label: "email";
60
+ readonly id: "sub";
61
+ readonly scopes: readonly ["openid", "email"];
62
+ };
63
+ readonly tolerated: readonly ["profile", "https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"];
64
+ };
65
+ readonly hint: "A Web application OAuth client in Google Cloud, with the Gateway's callback as its redirect URI and the scopes your apps list on its consent screen.";
66
+ };
67
+ readonly "microsoft-365": {
68
+ readonly id: "microsoft-365";
69
+ readonly name: "Microsoft 365";
70
+ readonly description: "Outlook mail and calendar, OneDrive and the rest of Microsoft Graph, as the person who connects.";
71
+ readonly docs: "https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade";
72
+ readonly api: "https://learn.microsoft.com/graph/permissions-reference";
73
+ readonly hosts: readonly ["graph.microsoft.com"];
74
+ readonly auth: {
75
+ readonly kind: "oauth2-user";
76
+ readonly authorizeUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize";
77
+ readonly tokenUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/token";
78
+ readonly clientId: "MICROSOFT_365_CLIENT_ID";
79
+ readonly clientSecret: "MICROSOFT_365_CLIENT_SECRET";
80
+ readonly inject: "form";
81
+ readonly pkce: true;
82
+ readonly scopeSeparator: "space";
83
+ readonly scopePrefix: "https://graph.microsoft.com/";
84
+ readonly identity: {
85
+ readonly url: "https://graph.microsoft.com/v1.0/me";
86
+ readonly label: "userPrincipalName";
87
+ readonly id: "id";
88
+ readonly scopes: readonly ["User.Read", "offline_access"];
89
+ };
90
+ readonly tolerated: readonly ["openid", "profile", "email"];
91
+ };
92
+ readonly hint: "An app registration in Entra for accounts in any organization and personal accounts, with the Gateway's callback as a Web redirect URI. If two apps share this client with different scopes, Microsoft may hand back both apps' scopes and the Gateway refuses the token: give each app its own client.";
93
+ };
94
+ readonly slack: {
95
+ readonly id: "slack";
96
+ readonly name: "Slack";
97
+ readonly description: "Channels, members and messages, as the Slack app.";
98
+ readonly docs: "https://api.slack.com/apps";
99
+ readonly api: "https://api.slack.com/scopes";
100
+ readonly hosts: readonly ["slack.com"];
101
+ readonly auth: {
102
+ readonly kind: "oauth2-user";
103
+ readonly authorizeUrl: "https://slack.com/oauth/v2/authorize";
104
+ readonly tokenUrl: "https://slack.com/api/oauth.v2.access";
105
+ readonly revokeUrl: "https://slack.com/api/auth.revoke";
106
+ readonly clientId: "SLACK_CLIENT_ID";
107
+ readonly clientSecret: "SLACK_CLIENT_SECRET";
108
+ readonly inject: "form";
109
+ readonly pkce: false;
110
+ readonly scopeSeparator: "comma";
111
+ readonly identity: {
112
+ readonly url: "https://slack.com/api/auth.test";
113
+ readonly label: "team";
114
+ readonly id: "team_id";
115
+ };
116
+ };
117
+ readonly hint: "A Slack app with the Gateway's callback as its redirect URL and the bot scopes your apps list. The Gateway takes its Client ID and Client Secret, not a bot token (xoxb-).";
118
+ };
119
+ readonly "github-oauth": {
120
+ readonly id: "github-oauth";
121
+ readonly name: "GitHub";
122
+ readonly description: "Repositories, issues, pull requests and the person's profile.";
123
+ readonly docs: "https://github.com/settings/developers";
124
+ readonly api: "https://docs.github.com/apps/oauth-apps/building-oauth-apps/scopes-for-oauth-apps";
125
+ readonly hosts: readonly ["api.github.com"];
126
+ readonly auth: {
127
+ readonly kind: "oauth2-user";
128
+ readonly authorizeUrl: "https://github.com/login/oauth/authorize";
129
+ readonly tokenUrl: "https://github.com/login/oauth/access_token";
130
+ readonly revokeUrl: "https://api.github.com/applications/{client_id}/grant";
131
+ readonly revokeMethod: "DELETE";
132
+ readonly clientId: "GITHUB_OAUTH_CLIENT_ID";
133
+ readonly clientSecret: "GITHUB_OAUTH_CLIENT_SECRET";
134
+ readonly inject: "form";
135
+ readonly pkce: true;
136
+ readonly scopeSeparator: "comma";
137
+ readonly tokenHeaders: {
138
+ readonly Accept: "application/json";
139
+ };
140
+ readonly identity: {
141
+ readonly url: "https://api.github.com/user";
142
+ readonly label: "login";
143
+ readonly id: "id";
144
+ };
145
+ };
146
+ readonly hint: "Register an OAuth App (not a GitHub App) and paste its client id and secret. GitHub's `repo` scope is read and write.";
147
+ };
148
+ readonly "notion-oauth": {
149
+ readonly id: "notion-oauth";
150
+ readonly name: "Notion";
151
+ readonly description: "Pages and databases the person shares with the integration.";
152
+ readonly docs: "https://www.notion.so/my-integrations";
153
+ readonly api: "https://developers.notion.com/reference";
154
+ readonly hosts: readonly ["api.notion.com"];
155
+ readonly auth: {
156
+ readonly kind: "oauth2-user";
157
+ readonly authorizeUrl: "https://api.notion.com/v1/oauth/authorize";
158
+ readonly tokenUrl: "https://api.notion.com/v1/oauth/token";
159
+ readonly clientId: "NOTION_OAUTH_CLIENT_ID";
160
+ readonly clientSecret: "NOTION_OAUTH_CLIENT_SECRET";
161
+ readonly inject: "basic";
162
+ readonly pkce: false;
163
+ readonly scopeSeparator: "space";
164
+ readonly authorizeParams: {
165
+ readonly owner: "user";
166
+ };
167
+ };
168
+ readonly hint: "Notion has no scopes: an app lists scopes: [] and the person picks the pages to share on Notion's consent screen. Make the integration public to get a client id and secret. Apps send `Notion-Version` on every call.";
169
+ };
170
+ readonly "linear-oauth": {
171
+ readonly id: "linear-oauth";
172
+ readonly name: "Linear";
173
+ readonly description: "Issues, projects and teams, over Linear's GraphQL API.";
174
+ readonly docs: "https://linear.app/settings/api/applications";
175
+ readonly api: "https://developers.linear.app/docs/oauth/authentication";
176
+ readonly hosts: readonly ["api.linear.app"];
177
+ readonly auth: {
178
+ readonly kind: "oauth2-user";
179
+ readonly authorizeUrl: "https://linear.app/oauth/authorize";
180
+ readonly tokenUrl: "https://api.linear.app/oauth/token";
181
+ readonly revokeUrl: "https://api.linear.app/oauth/revoke";
182
+ readonly clientId: "LINEAR_OAUTH_CLIENT_ID";
183
+ readonly clientSecret: "LINEAR_OAUTH_CLIENT_SECRET";
184
+ readonly inject: "form";
185
+ readonly pkce: false;
186
+ readonly scopeSeparator: "comma";
187
+ };
188
+ readonly hint: "Linear's scopes are read, write, issues:create and comments:create; its API is GraphQL over POST.";
189
+ };
190
+ readonly "gitlab-oauth": {
191
+ readonly id: "gitlab-oauth";
192
+ readonly name: "GitLab";
193
+ readonly description: "Projects, merge requests and issues on gitlab.com.";
194
+ readonly docs: "https://gitlab.com/-/user_settings/applications";
195
+ readonly api: "https://docs.gitlab.com/integration/oauth_provider/#view-all-authorized-applications";
196
+ readonly hosts: readonly ["gitlab.com"];
197
+ readonly auth: {
198
+ readonly kind: "oauth2-user";
199
+ readonly authorizeUrl: "https://gitlab.com/oauth/authorize";
200
+ readonly tokenUrl: "https://gitlab.com/oauth/token";
201
+ readonly revokeUrl: "https://gitlab.com/oauth/revoke";
202
+ readonly clientId: "GITLAB_OAUTH_CLIENT_ID";
203
+ readonly clientSecret: "GITLAB_OAUTH_CLIENT_SECRET";
204
+ readonly inject: "form";
205
+ readonly pkce: true;
206
+ readonly scopeSeparator: "space";
207
+ readonly identity: {
208
+ readonly url: "https://gitlab.com/api/v4/user";
209
+ readonly label: "username";
210
+ readonly id: "id";
211
+ readonly scopes: readonly ["read_user"];
212
+ };
213
+ };
214
+ readonly hint: "A self-managed GitLab needs a custom provider with its own host in place of gitlab.com.";
215
+ };
216
+ readonly atlassian: {
217
+ readonly id: "atlassian";
218
+ readonly name: "Atlassian (Jira and Confluence)";
219
+ readonly description: "Jira issues and Confluence pages on the sites the person grants.";
220
+ readonly docs: "https://developer.atlassian.com/console/myapps/";
221
+ readonly api: "https://developer.atlassian.com/cloud/jira/platform/scopes-for-oauth-2-3LO-and-forge-apps/";
222
+ readonly hosts: readonly ["api.atlassian.com"];
223
+ readonly auth: {
224
+ readonly kind: "oauth2-user";
225
+ readonly authorizeUrl: "https://auth.atlassian.com/authorize";
226
+ readonly tokenUrl: "https://auth.atlassian.com/oauth/token";
227
+ readonly clientId: "ATLASSIAN_CLIENT_ID";
228
+ readonly clientSecret: "ATLASSIAN_CLIENT_SECRET";
229
+ readonly inject: "form";
230
+ readonly pkce: false;
231
+ readonly scopeSeparator: "space";
232
+ readonly authorizeParams: {
233
+ readonly audience: "api.atlassian.com";
234
+ readonly prompt: "consent";
235
+ };
236
+ readonly identity: {
237
+ readonly url: "https://api.atlassian.com/me";
238
+ readonly label: "email";
239
+ readonly id: "account_id";
240
+ readonly scopes: readonly ["read:me", "offline_access"];
241
+ };
242
+ };
243
+ readonly hint: "Calls go to api.atlassian.com/ex/jira/<cloud id>/… ; the cloud id comes from /oauth/token/accessible-resources.";
244
+ };
245
+ readonly "hubspot-oauth": {
246
+ readonly id: "hubspot-oauth";
247
+ readonly name: "HubSpot";
248
+ readonly description: "CRM contacts, companies and deals.";
249
+ readonly docs: "https://developers.hubspot.com/";
250
+ readonly api: "https://developers.hubspot.com/docs/api/working-with-oauth";
251
+ readonly hosts: readonly ["api.hubapi.com"];
252
+ readonly auth: {
253
+ readonly kind: "oauth2-user";
254
+ readonly authorizeUrl: "https://app.hubspot.com/oauth/authorize";
255
+ readonly tokenUrl: "https://api.hubapi.com/oauth/v1/token";
256
+ readonly clientId: "HUBSPOT_OAUTH_CLIENT_ID";
257
+ readonly clientSecret: "HUBSPOT_OAUTH_CLIENT_SECRET";
258
+ readonly inject: "form";
259
+ readonly pkce: false;
260
+ readonly scopeSeparator: "space";
261
+ };
262
+ readonly hint: "The app's scopes in HubSpot's developer console must include the scopes apps list, or HubSpot refuses the authorize URL.";
263
+ };
264
+ readonly zoom: {
265
+ readonly id: "zoom";
266
+ readonly name: "Zoom";
267
+ readonly description: "The person's meetings and recordings.";
268
+ readonly docs: "https://marketplace.zoom.us/develop/create";
269
+ readonly api: "https://developers.zoom.us/docs/integrations/oauth-scopes-overview/";
270
+ readonly hosts: readonly ["api.zoom.us"];
271
+ readonly auth: {
272
+ readonly kind: "oauth2-user";
273
+ readonly authorizeUrl: "https://zoom.us/oauth/authorize";
274
+ readonly tokenUrl: "https://zoom.us/oauth/token";
275
+ readonly revokeUrl: "https://zoom.us/oauth/revoke";
276
+ readonly clientId: "ZOOM_CLIENT_ID";
277
+ readonly clientSecret: "ZOOM_CLIENT_SECRET";
278
+ readonly inject: "basic";
279
+ readonly pkce: true;
280
+ readonly scopeSeparator: "space";
281
+ readonly identity: {
282
+ readonly url: "https://api.zoom.us/v2/users/me";
283
+ readonly label: "email";
284
+ readonly id: "id";
285
+ readonly scopes: readonly ["user:read:user"];
286
+ };
287
+ };
288
+ readonly hint: "A General app with user-managed OAuth, using Zoom's granular scope names.";
289
+ };
290
+ readonly dropbox: {
291
+ readonly id: "dropbox";
292
+ readonly name: "Dropbox";
293
+ readonly description: "Files and folders in the person's Dropbox.";
294
+ readonly docs: "https://www.dropbox.com/developers/apps";
295
+ readonly api: "https://developers.dropbox.com/oauth-guide";
296
+ readonly hosts: readonly ["api.dropboxapi.com", "content.dropboxapi.com"];
297
+ readonly auth: {
298
+ readonly kind: "oauth2-user";
299
+ readonly authorizeUrl: "https://www.dropbox.com/oauth2/authorize";
300
+ readonly tokenUrl: "https://api.dropboxapi.com/oauth2/token";
301
+ readonly revokeUrl: "https://api.dropboxapi.com/2/auth/token/revoke";
302
+ readonly clientId: "DROPBOX_OAUTH_CLIENT_ID";
303
+ readonly clientSecret: "DROPBOX_OAUTH_CLIENT_SECRET";
304
+ readonly inject: "form";
305
+ readonly pkce: true;
306
+ readonly scopeSeparator: "space";
307
+ readonly authorizeParams: {
308
+ readonly token_access_type: "offline";
309
+ };
310
+ readonly tolerated: readonly ["account_info.read"];
311
+ };
312
+ readonly hint: "`token_access_type=offline` is what yields a refresh token.";
313
+ };
314
+ readonly spotify: {
315
+ readonly id: "spotify";
316
+ readonly name: "Spotify";
317
+ readonly description: "The person's library, playlists and listening.";
318
+ readonly docs: "https://developer.spotify.com/dashboard";
319
+ readonly api: "https://developer.spotify.com/documentation/web-api/concepts/scopes";
320
+ readonly hosts: readonly ["api.spotify.com"];
321
+ readonly auth: {
322
+ readonly kind: "oauth2-user";
323
+ readonly authorizeUrl: "https://accounts.spotify.com/authorize";
324
+ readonly tokenUrl: "https://accounts.spotify.com/api/token";
325
+ readonly clientId: "SPOTIFY_CLIENT_ID";
326
+ readonly clientSecret: "SPOTIFY_CLIENT_SECRET";
327
+ readonly inject: "basic";
328
+ readonly pkce: true;
329
+ readonly scopeSeparator: "space";
330
+ readonly identity: {
331
+ readonly url: "https://api.spotify.com/v1/me";
332
+ readonly label: "display_name";
333
+ readonly id: "id";
334
+ };
335
+ };
336
+ };
337
+ };
338
+ /** The id of an OAuth provider the SDK ships a preset for (`google-workspace`, `github-oauth`, ...). */
339
+ export type OAuthPresetId = keyof typeof PRESETS;
340
+ /** Every preset by id, in the order the picker shows them. */
23
341
  export declare const OAUTH_PRESETS: Readonly<Record<string, OAuthPresetSpec>>;
342
+ /** The setup guide for OAuth provider `id`'s client, when its preset has one (`setup` in an app's settings report). */
343
+ export declare function oauthSetupGuide(id: string): string | undefined;
24
344
  /** The preset ids, in the order the picker shows them. */
25
345
  export declare function oauthPresetIds(): string[];
26
346
  /** A preset's parsed capability, for the picker's labels; throws for an unknown id (the test parses every preset). */
27
347
  export declare function oauthPreset(id: string): RegistrableCapability | null;
28
- /** Whether `capability` is an OAuth provider the Gateway runs the flow for. */
29
- export declare function isOAuthProvider(capability: {
30
- mode: string;
31
- flow?: unknown;
32
- } | undefined): boolean;
348
+ /**
349
+ * Whether `capability`, a Gateway's row for `id`, is that preset's: its
350
+ * client would go to the preset's endpoints and hosts under the preset's
351
+ * setting names (the same binding key). Adding the preset again takes the
352
+ * client for such a row; a row of another spec under a preset's id is the
353
+ * operator's own and is never taken for the preset.
354
+ */
355
+ export declare function isPresetRow(id: string, capability: RegistrableCapability): boolean;
356
+ /**
357
+ * The preset ids among `ids` (an app's capabilities) that `lookup` (a
358
+ * Gateway's registry) doesn't have: the rows a deploy or an install
359
+ * writes from their presets before it checks the manifest.
360
+ */
361
+ export declare function unregisteredPresetIds(ids: Iterable<string>, lookup: Pick<CapabilityLookup, "get">): string[];
362
+ /**
363
+ * `lookup` with every preset it lacks, as the row it would be: what a
364
+ * local run (`everyapp dev`) and a check made before a Gateway is asked
365
+ * read, since a deploy writes the row of any preset an app names.
366
+ */
367
+ export declare function withOAuthPresets(lookup: CapabilityLookup): CapabilityLookup;
368
+ export {};
33
369
  //# sourceMappingURL=oauthPresets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"oauthPresets.d.ts","sourceRoot":"","sources":["../../src/internal/oauthPresets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEhE,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAugCnE,CAAC;AAEF,0DAA0D;AAC1D,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED,sHAAsH;AACtH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAUpE;AAED,+EAA+E;AAC/E,wBAAgB,eAAe,CAC7B,UAAU,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,GACvD,OAAO,CAET"}
1
+ {"version":3,"file":"oauthPresets.d.ts","sourceRoot":"","sources":["../../src/internal/oauthPresets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,4DAA4D;AAC5D,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEhE,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwUuC,CAAC;AAErD,wGAAwG;AACxG,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,OAAO,CAAC;AAEjD,8DAA8D;AAC9D,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAW,CAAC;AAShF,uHAAuH;AACvH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE9D;AAED,0DAA0D;AAC1D,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAEzC;AAED,sHAAsH;AACtH,wBAAgB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAUpE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,qBAAqB,GAChC,OAAO,CAMT;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,QAAQ,CAAC,MAAM,CAAC,EACrB,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,GACpC,MAAM,EAAE,CAIV;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,CAQ3E"}