@every-app/sdk 0.3.0-rc.10 → 0.3.0-rc.11
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 +62 -64
- package/dist/cloudflare/catalogSettings.generated.d.ts +7 -4
- package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -1
- package/dist/cloudflare/catalogSettings.generated.js +7 -6
- package/dist/cloudflare/index.d.ts +1 -1
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/worker.d.ts +35 -1
- package/dist/cloudflare/worker.d.ts.map +1 -1
- package/dist/cloudflare/worker.js +31 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/aiDefault.d.ts +4 -3
- package/dist/internal/aiDefault.d.ts.map +1 -1
- package/dist/internal/aiDefault.js +6 -5
- package/dist/internal/aiProviders.d.ts.map +1 -1
- package/dist/internal/aiProviders.js +2 -2
- package/dist/internal/capabilities.d.ts +97 -481
- package/dist/internal/capabilities.d.ts.map +1 -1
- package/dist/internal/capabilities.js +47 -548
- package/dist/internal/catalog/index.d.ts +35 -0
- package/dist/internal/catalog/index.d.ts.map +1 -1
- package/dist/internal/catalog/infra.d.ts +35 -0
- package/dist/internal/catalog/infra.d.ts.map +1 -1
- package/dist/internal/catalog/infra.js +65 -0
- package/dist/internal/events.d.ts +52 -1
- package/dist/internal/events.d.ts.map +1 -1
- package/dist/internal/events.js +65 -3
- package/dist/internal/oauthBuiltIns.d.ts +101 -0
- package/dist/internal/oauthBuiltIns.d.ts.map +1 -0
- package/dist/internal/oauthBuiltIns.js +122 -0
- package/dist/internal/oauthClient.d.ts +7 -47
- package/dist/internal/oauthClient.d.ts.map +1 -1
- package/dist/internal/oauthClient.js +1 -115
- package/dist/internal/oauthPresets.d.ts +14 -15
- package/dist/internal/oauthPresets.d.ts.map +1 -1
- package/dist/internal/oauthPresets.js +42 -853
- package/dist/internal/oauthScopes.d.ts +43 -155
- package/dist/internal/oauthScopes.d.ts.map +1 -1
- package/dist/internal/oauthScopes.js +82 -475
- package/dist/internal/oauthSpec.d.ts +72 -71
- package/dist/internal/oauthSpec.d.ts.map +1 -1
- package/dist/internal/oauthSpec.js +178 -447
- package/dist/internal/protocol.d.ts +42 -13
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +45 -7
- package/dist/internal/providerRegistry.d.ts +1 -61
- package/dist/internal/providerRegistry.d.ts.map +1 -1
- package/dist/internal/providerRegistry.js +8 -115
- package/dist/internal/providerSpec.d.ts.map +1 -1
- package/dist/internal/providerSpec.js +14 -36
- package/dist/internal/remoteMcp.d.ts.map +1 -1
- package/dist/internal/remoteMcp.js +1 -5
- package/dist/internal/tools.d.ts +5 -4
- package/dist/internal/tools.d.ts.map +1 -1
- package/dist/internal/tools.js +4 -3
- package/dist/manifest.d.ts +34 -5
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +1 -1
- package/dist/server/attribution.d.ts +9 -0
- package/dist/server/attribution.d.ts.map +1 -1
- package/dist/server/attribution.js +7 -1
- package/dist/server/connectUrl.d.ts +4 -9
- package/dist/server/connectUrl.d.ts.map +1 -1
- package/dist/server/connectUrl.js +17 -14
- package/dist/server/eventsEndpoint.d.ts +48 -0
- package/dist/server/eventsEndpoint.d.ts.map +1 -0
- package/dist/server/eventsEndpoint.js +145 -0
- package/dist/server/everyApp.d.ts +15 -6
- package/dist/server/everyApp.d.ts.map +1 -1
- package/dist/server/everyApp.js +12 -3
- package/dist/server/index.d.ts +4 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/integrationFetch.d.ts +59 -71
- package/dist/server/integrationFetch.d.ts.map +1 -1
- package/dist/server/integrationFetch.js +117 -392
- package/dist/server/tools.d.ts +7 -2
- package/dist/server/tools.d.ts.map +1 -1
- package/dist/server/tools.js +2 -1
- package/dist/server/toolsEndpoint.d.ts +3 -1
- package/dist/server/toolsEndpoint.d.ts.map +1 -1
- package/dist/server/toolsEndpoint.js +9 -3
- package/dist/server/webhooks.d.ts +56 -0
- package/dist/server/webhooks.d.ts.map +1 -0
- package/dist/server/webhooks.js +205 -0
- package/package.json +1 -1
- package/dist/server/authorizeUrl.d.ts +0 -43
- package/dist/server/authorizeUrl.d.ts.map +0 -1
- package/dist/server/authorizeUrl.js +0 -106
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"everyApp.d.ts","sourceRoot":"","sources":["../../src/server/everyApp.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"everyApp.d.ts","sourceRoot":"","sources":["../../src/server/everyApp.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAGL,kBAAkB,EAElB,aAAa,EAMb,OAAO,EACP,WAAW,EACX,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,OAAO,EAEb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACnE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,gBAAgB,CAAC;AAEpD,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,iGAAiG;IACjG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qFAAqF;IACrF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6DAA6D;IAC7D,UAAU,CA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AAM,EAAE,OAAO,CAAC,EAC9B,IAAI,SAAS,oBAAoB,GAAG,gBAAgB,EAEpD,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EACpC,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,GAC9B,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9B;;;;GAIG;AACH,wBAAgB,QAAQ,CACtB,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,IAAI,SAAS,oBAAoB,GAAG,gBAAgB,EAEpD,OAAO,EAAE,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,EACpC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAC1C,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,GAC9B,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC"}
|
package/dist/server/everyApp.js
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* `everyapp.config.ts` (the Cloudflare Vite plugin hides every file
|
|
14
14
|
* `cloudflare.config.ts` imports from the Worker in dev).
|
|
15
15
|
* It also answers the gateway's internal tools contract
|
|
16
|
-
* (`/__everyapp/tools/*`) for the app's `defineTools()` catalog
|
|
16
|
+
* (`/__everyapp/tools/*`) for the app's `defineTools()` catalog, and the
|
|
17
|
+
* event sink's deliveries (`/__everyapp/events`) for `events: { on }`.
|
|
17
18
|
*
|
|
18
19
|
* Around the handler and around each tool call it opens the request
|
|
19
20
|
* context (context.ts): `currentUser()` reads the user anywhere below, and
|
|
@@ -25,10 +26,11 @@
|
|
|
25
26
|
* framework sets could never come back, and one named like the Gateway's
|
|
26
27
|
* session cookie would lock the person out of the app host.
|
|
27
28
|
*/
|
|
28
|
-
import { APP_ID_ENV, AUDIENCE_ENV, ConfigurationError, DEV_ENV, IdentityError, IDENTITY_HEADER, ISSUER_ENV, ORG_ID_ENV, PUBLIC_KEYS_ENV, getIdentityFromRequest, isAdmin, } from "../internal/index.js";
|
|
29
|
+
import { APP_ID_ENV, AUDIENCE_ENV, ConfigurationError, DEV_ENV, IdentityError, IDENTITY_HEADER, ISSUER_ENV, ORG_ID_ENV, PUBLIC_KEYS_ENV, getIdentityFromRequest, isAdmin, isAgentCall, } from "../internal/index.js";
|
|
29
30
|
import { currentUser, serveRequest } from "./context.js";
|
|
30
31
|
import { handleToolsRequest } from "./toolsEndpoint.js";
|
|
31
|
-
|
|
32
|
+
import { handleEventsRequest, } from "./eventsEndpoint.js";
|
|
33
|
+
export { ConfigurationError, IdentityError, isAdmin, isAgentCall };
|
|
32
34
|
const requestIdentities = new WeakMap();
|
|
33
35
|
function envValue(env, key) {
|
|
34
36
|
if (!env || typeof env !== "object")
|
|
@@ -261,6 +263,13 @@ export function everyApp(handler, manifestOrOptions, legacyOptions = {}) {
|
|
|
261
263
|
});
|
|
262
264
|
if (toolsResponse)
|
|
263
265
|
return toolsResponse;
|
|
266
|
+
// So does the event sink's delivery path (`/__everyapp/events`).
|
|
267
|
+
const eventsResponse = await handleEventsRequest(request, env, ctx, {
|
|
268
|
+
events: options.events,
|
|
269
|
+
identity: identityOptions(env, config, audience),
|
|
270
|
+
});
|
|
271
|
+
if (eventsResponse)
|
|
272
|
+
return eventsResponse;
|
|
264
273
|
let identity;
|
|
265
274
|
try {
|
|
266
275
|
identity = await getIdentityFromRequest(request, identityOptions(env, config, audience));
|
package/dist/server/index.d.ts
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
*
|
|
4
4
|
* There is intentionally no client-side export.
|
|
5
5
|
*/
|
|
6
|
-
export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, isAdmin, requireCurrentUser, requireEveryAppUser, type EveryAppOptions, type EveryAppManifestLike, type EveryAppHandler, type EveryAppUser, type IdentityResult, type OrgRole, } from "./everyApp.js";
|
|
6
|
+
export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, isAdmin, isAgentCall, requireCurrentUser, requireEveryAppUser, type EveryAppOptions, type EveryAppManifestLike, type EveryAppHandler, type EveryAppUser, type IdentityResult, type OrgRole, } from "./everyApp.js";
|
|
7
7
|
export { OrganizationMismatchError, RequestContextError, currentUser, withOrganization, } from "./context.js";
|
|
8
8
|
export { AttributionError, type GatewayCallFor } from "./attribution.js";
|
|
9
9
|
export { gatewayUrl } from "./gatewayUrl.js";
|
|
10
10
|
export type { EveryAppEnv } from "./env.js";
|
|
11
11
|
/** The header a Gateway refusal carries its code in; `gatewayRefusal()` reads the rest. */
|
|
12
12
|
export { GATEWAY_ERROR_HEADER } from "../internal/protocol.js";
|
|
13
|
-
export { authorizeUrl, type AuthorizeUrlOptions } from "./authorizeUrl.js";
|
|
14
13
|
export { connectPath, connectUrl, type ConnectUrlOptions, } from "./connectUrl.js";
|
|
15
14
|
export { createGatewayFetch, type CreateGatewayFetchOptions, } from "./gatewayFetch.js";
|
|
16
15
|
export { ai, aiBaseUrl, aiStatus, providerBaseUrl, AI_DEFAULT_BASE_URL, type AiClient, type AiStatus, } from "./ai.js";
|
|
@@ -22,7 +21,9 @@ export { gatewayAiBinding, type GatewayAiBindingOptions } from "./aiBinding.js";
|
|
|
22
21
|
export { gatewayEmailBinding, type GatewayEmailBindingMessage, type GatewayEmailBindingOptions, } from "./emailBinding.js";
|
|
23
22
|
export { listMembers, type ListMembersOptions } from "./listMembers.js";
|
|
24
23
|
export { emit, type EmitOptions } from "./emit.js";
|
|
25
|
-
export
|
|
24
|
+
export { WEBHOOK_MAX_BYTES_DEFAULT, verifyWebhook, type VerifyWebhookOptions, type WebhookProvider, type WebhookRefusalReason, type WebhookVerification, } from "./webhooks.js";
|
|
25
|
+
export type { AppEvent, AppEventHandler, AppEventsOptions, } from "./eventsEndpoint.js";
|
|
26
|
+
export type { ApiKeyCapabilityId, CapabilityId, OAuthClientCapabilityId, EmailAddressInput, EmailAttachmentInput, SendEmailMessage, SendEmailResult, ListMembersResult, OrganizationMember, OrganizationMemberRole, EmitEventResult, } from "../internal/index.js";
|
|
26
27
|
export { ToolError, defineTools, toolResult, type DefineToolsOptions, type PlainToolSchema, type StandardSchemaWithJSON, type ToolContext, type ToolDefinition, type ToolResult, type ToolSchema, type ToolSet, } from "./tools.js";
|
|
27
28
|
export type { ToolRisk } from "../internal/index.js";
|
|
28
29
|
export { fromMcpTools, type FromMcpToolsOptions, type McpToolAnnotationsLike, type McpToolLike, type McpToolResultLike, type McpToolSchemaLike, } from "./fromMcpTools.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,OAAO,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,2FAA2F;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,OAAO,EACP,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,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AuB,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EACL,mBAAmB,EACnB,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,GAChC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,QAAQ,EACR,eAAe,EACf,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,WAAW,EACX,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,OAAO,GACb,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,mBAAmB,CAAC"}
|
package/dist/server/index.js
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* There is intentionally no client-side export.
|
|
5
5
|
*/
|
|
6
|
-
export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, isAdmin, requireCurrentUser, requireEveryAppUser, } from "./everyApp.js";
|
|
6
|
+
export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, isAdmin, isAgentCall, requireCurrentUser, requireEveryAppUser, } from "./everyApp.js";
|
|
7
7
|
export { OrganizationMismatchError, RequestContextError, currentUser, withOrganization, } from "./context.js";
|
|
8
8
|
export { AttributionError } from "./attribution.js";
|
|
9
9
|
export { gatewayUrl } from "./gatewayUrl.js";
|
|
10
10
|
/** The header a Gateway refusal carries its code in; `gatewayRefusal()` reads the rest. */
|
|
11
11
|
export { GATEWAY_ERROR_HEADER } from "../internal/protocol.js";
|
|
12
|
-
export { authorizeUrl } from "./authorizeUrl.js";
|
|
13
12
|
export { connectPath, connectUrl, } from "./connectUrl.js";
|
|
14
13
|
export { createGatewayFetch, } from "./gatewayFetch.js";
|
|
15
14
|
export { ai, aiBaseUrl, aiStatus, providerBaseUrl, AI_DEFAULT_BASE_URL, } from "./ai.js";
|
|
@@ -21,5 +20,6 @@ export { gatewayAiBinding } from "./aiBinding.js";
|
|
|
21
20
|
export { gatewayEmailBinding, } from "./emailBinding.js";
|
|
22
21
|
export { listMembers } from "./listMembers.js";
|
|
23
22
|
export { emit } from "./emit.js";
|
|
23
|
+
export { WEBHOOK_MAX_BYTES_DEFAULT, verifyWebhook, } from "./webhooks.js";
|
|
24
24
|
export { ToolError, defineTools, toolResult, } from "./tools.js";
|
|
25
25
|
export { fromMcpTools, } from "./fromMcpTools.js";
|
|
@@ -1,45 +1,47 @@
|
|
|
1
|
-
import { type ApiKeyCapabilityId, type CapabilityId, type
|
|
1
|
+
import { type ApiKeyCapabilityId, type CapabilityId, type EmailCapabilityStatus, type OAuthClientCapabilityId } from "../internal/index.js";
|
|
2
2
|
import { type GatewayCallFor } from "./attribution.js";
|
|
3
3
|
import type { SetupInfo } from "./refusal.js";
|
|
4
4
|
export interface IntegrationFetchOptions {
|
|
5
5
|
/**
|
|
6
6
|
* The Worker env: the EVERY_APP_GATEWAY binding when deployed, or in local
|
|
7
7
|
* dev EVERYAPP_DEV and the provider's key (e.g. DATAFORSEO_API_KEY in
|
|
8
|
-
* `.dev.vars`)
|
|
8
|
+
* `.dev.vars`), or for an OAuth provider a token you obtained yourself
|
|
9
|
+
* (`GOOGLE_WORKSPACE_ACCESS_TOKEN`, {@link devAccessTokenName}).
|
|
9
10
|
*/
|
|
10
11
|
env: object;
|
|
11
12
|
/**
|
|
12
13
|
* A provider the app lists in its manifest's `capabilities`: one whose
|
|
13
|
-
* key the gateway holds, or
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
14
|
+
* key the gateway holds, or an OAuth provider whose connections it
|
|
15
|
+
* holds. The built-in catalog's ids complete; a provider registered on
|
|
16
|
+
* the gateway (`everyapp provider add`) is any other id, reached
|
|
17
|
+
* through the binding, which checks it. The `email` capability is sent
|
|
18
|
+
* with `sendEmail()` instead.
|
|
18
19
|
*/
|
|
19
20
|
provider: ApiKeyCapabilityId | OAuthClientCapabilityId | (string & {});
|
|
20
21
|
/**
|
|
21
22
|
* Whom the call is for. Left out, the request `everyApp()` is serving
|
|
22
|
-
* (its
|
|
23
|
+
* (its person, while the identity is good) or the organization
|
|
23
24
|
* `withOrganization()` named; outside both, `RequestContextError`.
|
|
24
25
|
* Explicitly: the inbound request, or `{ background: true,
|
|
25
26
|
* organizationId }` for work no person started (crons, Workflows,
|
|
26
27
|
* queues). A shared app's Worker must end up with one or the other
|
|
27
28
|
* ({@link AttributionError}).
|
|
29
|
+
*
|
|
30
|
+
* For an OAuth provider the call uses the connection the person behind
|
|
31
|
+
* it made in this app. `{ background: true, userId }` names another
|
|
32
|
+
* member's connection to this app instead, at any time, even while
|
|
33
|
+
* serving a different person: the call then carries that member and
|
|
34
|
+
* not the person being served. Only an organization's own app may.
|
|
28
35
|
*/
|
|
29
36
|
for?: GatewayCallFor;
|
|
30
|
-
/**
|
|
31
|
-
* For an OAuth provider the gateway holds connections for: whose
|
|
32
|
-
* connection the call uses, the person's (`user`, the default when a
|
|
33
|
-
* person is behind the call) or the organization's (`organization`,
|
|
34
|
-
* the default for background work). Sent as `x-everyapp-account`.
|
|
35
|
-
*/
|
|
36
|
-
account?: ConnectionAccount;
|
|
37
37
|
/**
|
|
38
38
|
* `true`: answer null instead of throwing `ConfigurationError` when the
|
|
39
39
|
* provider is unavailable (no binding, and in local dev not its
|
|
40
40
|
* settings in `.dev.vars`), so a feature that can do without it checks
|
|
41
41
|
* for null. A wrong provider id, a binding that isn't one, and an
|
|
42
|
-
* attribution mistake still throw.
|
|
42
|
+
* attribution mistake still throw. An OAuth provider is never
|
|
43
|
+
* unavailable this way: without a connection its calls answer
|
|
44
|
+
* `integration_not_connected`.
|
|
43
45
|
*/
|
|
44
46
|
optional?: boolean;
|
|
45
47
|
}
|
|
@@ -51,19 +53,19 @@ export interface IntegrationFetchOptions {
|
|
|
51
53
|
* sees the key. A refusal the gateway makes itself comes back as a response
|
|
52
54
|
* {@link gatewayRefusal} recognizes; anything else is the provider's answer.
|
|
53
55
|
*
|
|
54
|
-
* For an OAuth
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* `
|
|
58
|
-
* {@link
|
|
59
|
-
* token directly.
|
|
56
|
+
* For an OAuth provider (`google-workspace`, `github`, ...) the gateway
|
|
57
|
+
* puts the token of the person's connection in this app on the call, to
|
|
58
|
+
* the provider's API hosts only. Without one the answer is a 409
|
|
59
|
+
* `integration_not_connected` refusal with the `connectPath` to send the
|
|
60
|
+
* person to ({@link connectUrl}).
|
|
60
61
|
*
|
|
61
|
-
* In local dev only, with no binding, the developer's own key
|
|
62
|
-
*
|
|
62
|
+
* In local dev only, with no binding, the developer's own key from
|
|
63
|
+
* `.dev.vars` reaches the provider directly, under the gateway's names:
|
|
63
64
|
* a catalog provider's from the catalog, a provider registered on the
|
|
64
65
|
* gateway from its spec in `.everyapp/providers/<id>.json` (`everyapp
|
|
65
66
|
* provider show <id> --save` writes it), put on the call as the gateway's
|
|
66
|
-
* spec says.
|
|
67
|
+
* spec says. An OAuth provider's calls carry a token you obtained
|
|
68
|
+
* yourself ({@link devAccessTokenName}), to its API hosts only.
|
|
67
69
|
*/
|
|
68
70
|
export declare function integrationFetch(options: IntegrationFetchOptions & {
|
|
69
71
|
optional: true;
|
|
@@ -92,70 +94,56 @@ export interface IntegrationStatus extends SetupInfo {
|
|
|
92
94
|
*/
|
|
93
95
|
export type EmailIntegrationStatus = IntegrationStatus & Pick<EmailCapabilityStatus, "sender" | "senders" | "provider">;
|
|
94
96
|
/**
|
|
95
|
-
* An OAuth
|
|
96
|
-
*
|
|
97
|
-
*
|
|
97
|
+
* An OAuth provider's status: as {@link IntegrationStatus}, plus the
|
|
98
|
+
* scopes the app's manifest lists, where the person connects in this app,
|
|
99
|
+
* and their connection to this app. `configured` means the gateway holds
|
|
100
|
+
* the client; `ready` that a call for this person would go through.
|
|
98
101
|
*/
|
|
99
|
-
export
|
|
100
|
-
/** The
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* For a client with scope sets (`google-workspace`, `microsoft-365`): the
|
|
104
|
-
* set names the app's manifest entry declares, `[]` when the entry voids
|
|
105
|
-
* its grant (no `scopes`, or a set this gateway doesn't offer), in which
|
|
106
|
-
* case `ready` is false and no token call can complete.
|
|
107
|
-
*/
|
|
108
|
-
scopeSets?: readonly string[];
|
|
102
|
+
export type OAuthClientIntegrationStatus = IntegrationStatus & {
|
|
103
|
+
/** The provider's scopes as the app's `everyapp.config.ts` lists them. */
|
|
104
|
+
scopes: readonly string[];
|
|
109
105
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
106
|
+
* Where the person connects the provider in this app:
|
|
107
|
+
* `/connect/<id>?app=<app>` on the Gateway ({@link connectUrl} builds
|
|
108
|
+
* the absolute URL); null when the app can't connect (the manifest
|
|
109
|
+
* doesn't list it, or the gateway holds no client).
|
|
114
110
|
*/
|
|
115
|
-
|
|
116
|
-
/** Slack's `user_scope` strings, when the sets name any. */
|
|
117
|
-
userScopes?: readonly string[];
|
|
111
|
+
connectPath: string | null;
|
|
118
112
|
/**
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* `
|
|
123
|
-
*
|
|
113
|
+
* The connection the call would use (the person's in this app, or the
|
|
114
|
+
* member's `for: { background: true, userId }` names), or null when there
|
|
115
|
+
* is none. `ready` false with `missingScopes` when it lacks a scope the
|
|
116
|
+
* app now lists, and `reconnect` when the person has to connect again
|
|
117
|
+
* (missing scopes, or it expired).
|
|
124
118
|
*/
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
connectPath?: string;
|
|
128
|
-
/**
|
|
129
|
-
* The connection the caller's account would use (the person's, or the
|
|
130
|
-
* organization's for background work), or null when there is none yet;
|
|
131
|
-
* `reconnect` when it exists but lacks a set the app declares or has
|
|
132
|
-
* expired, so the person has to connect again.
|
|
133
|
-
*/
|
|
134
|
-
connection?: {
|
|
135
|
-
account: ConnectionAccount;
|
|
119
|
+
connection: {
|
|
120
|
+
/** The account's name at the provider (an email address, a login). */
|
|
136
121
|
label: string | null;
|
|
137
|
-
|
|
122
|
+
/** The scopes it holds, canonical. */
|
|
123
|
+
scopes: readonly string[];
|
|
138
124
|
ready: boolean;
|
|
139
|
-
|
|
125
|
+
missingScopes?: readonly string[];
|
|
126
|
+
reconnect?: true;
|
|
140
127
|
} | null;
|
|
141
|
-
}
|
|
142
|
-
/** The status of a capability: email's carries its senders, an OAuth
|
|
128
|
+
};
|
|
129
|
+
/** The status of a capability: email's carries its senders, an OAuth provider's the connection. */
|
|
143
130
|
export type IntegrationStatusOf<P extends string> = P extends "email" ? EmailIntegrationStatus : P extends OAuthClientCapabilityId ? OAuthClientIntegrationStatus : IntegrationStatus;
|
|
144
131
|
/**
|
|
145
132
|
* Whether the app can use an integration right now, without calling the
|
|
146
133
|
* provider: show "an admin needs to set up DataForSEO" (or "sending isn't
|
|
147
|
-
* set up") up front instead of failing mid-task. An
|
|
148
|
-
* carries
|
|
134
|
+
* set up", or "connect Google") up front instead of failing mid-task. An
|
|
135
|
+
* OAuth provider's status carries the person's connection in this app and
|
|
136
|
+
* where to connect.
|
|
149
137
|
*/
|
|
150
138
|
export declare function integrationStatus<P extends CapabilityId | (string & {})>({ env, provider, for: explicitTarget, }: {
|
|
151
139
|
env: object;
|
|
152
140
|
provider: P;
|
|
153
141
|
/**
|
|
154
142
|
* Whom the status is for: the request being served (its person), so an
|
|
155
|
-
* OAuth provider's `connection` is that person's;
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
143
|
+
* OAuth provider's `connection` is that person's in this app; `{
|
|
144
|
+
* background: true, userId }` that member's. Explicitly the inbound
|
|
145
|
+
* request or `{ background: true, organizationId, userId? }`, as on
|
|
146
|
+
* every call.
|
|
159
147
|
*/
|
|
160
148
|
for?: GatewayCallFor;
|
|
161
149
|
}): Promise<IntegrationStatusOf<P>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrationFetch.d.ts","sourceRoot":"","sources":["../../src/server/integrationFetch.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"integrationFetch.d.ts","sourceRoot":"","sources":["../../src/server/integrationFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAcL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAE1B,KAAK,uBAAuB,EAK7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAO9C,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,QAAQ,EAAE,kBAAkB,GAAG,uBAAuB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACvE;;;;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