@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,23 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The `oauth2-user` half of a provider spec
|
|
3
|
-
* (
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
2
|
+
* The `oauth2-user` half of a provider spec: a registered OAuth provider,
|
|
3
|
+
* a preset (./oauthPresets.ts) or a built-in one (./oauthBuiltIns.ts), as
|
|
4
|
+
* JSON, turned into an {@link OAuthClientCapability} whose `flow` the
|
|
5
|
+
* Gateway runs. `parseProviderSpec` (./providerSpec.ts) hands the common
|
|
6
|
+
* fields here once it sees `auth.kind: "oauth2-user"`. Nothing here reads
|
|
7
|
+
* a value: a spec names Gateway settings, never holds one.
|
|
8
|
+
*
|
|
9
|
+
* Every difference between providers is a field here, never code: the
|
|
10
|
+
* endpoints, how the client goes on the token request, PKCE, the scope
|
|
11
|
+
* separator and prefix, extra authorize parameters and token headers, the
|
|
12
|
+
* identity URL with the scopes it needs, and the scopes a token may carry
|
|
13
|
+
* beyond what was asked (`tolerated`). Which scopes an app gets is its own
|
|
14
|
+
* `everyapp.config.ts`, never the spec.
|
|
15
|
+
*
|
|
16
|
+
* Only type imports from ./capabilities.ts: the catalog builds its
|
|
17
|
+
* built-in entries with {@link oauthCapabilityFromSpec} at load.
|
|
9
18
|
*/
|
|
10
|
-
import
|
|
19
|
+
import type { OAuthClientCapability, OAuthClientInjection, OAuthScopeSeparator } from "./capabilities.js";
|
|
11
20
|
export interface SpecProblem {
|
|
12
21
|
path: string;
|
|
13
22
|
message: string;
|
|
14
23
|
}
|
|
15
|
-
/** A scope set's name: `identity`, or `<area>.<access>` (`repo.read`), lowercase. */
|
|
16
|
-
export declare const SCOPE_SET_NAME: RegExp;
|
|
17
|
-
/** Segments no set unlocks on any host: batch tunnels carry whole requests inside. */
|
|
18
|
-
export declare const DEFAULT_DENIED_SEGMENTS: readonly string[];
|
|
19
24
|
/** The fields of `auth` when its kind is `oauth2-user`. */
|
|
20
|
-
export declare const OAUTH_AUTH_FIELDS: readonly ["kind", "authorizeUrl", "tokenUrl", "revokeUrl", "revokeMethod", "clientId", "clientSecret", "inject", "pkce", "
|
|
25
|
+
export declare const OAUTH_AUTH_FIELDS: readonly ["kind", "authorizeUrl", "tokenUrl", "revokeUrl", "revokeMethod", "clientId", "clientSecret", "inject", "pkce", "scopeSeparator", "scopePrefix", "authorizeParams", "tokenHeaders", "identity", "tolerated"];
|
|
26
|
+
/**
|
|
27
|
+
* Fields an `oauth2-user` spec had before scopes moved to each app's
|
|
28
|
+
* `everyapp.config.ts`, each with what to write instead: refused with
|
|
29
|
+
* that message rather than "unknown field".
|
|
30
|
+
*/
|
|
31
|
+
export declare const REMOVED_OAUTH_FIELDS: Readonly<Record<string, string>>;
|
|
21
32
|
/** The common fields `parseProviderSpec` parsed before handing over. */
|
|
22
33
|
export interface OAuthSpecCommon {
|
|
23
34
|
id: string;
|
|
@@ -26,56 +37,12 @@ export interface OAuthSpecCommon {
|
|
|
26
37
|
hosts: readonly string[];
|
|
27
38
|
description?: string;
|
|
28
39
|
reference?: string;
|
|
29
|
-
access?: readonly CapabilityAccess[];
|
|
30
|
-
readMethods?: readonly string[];
|
|
31
|
-
writeMethods?: readonly string[];
|
|
32
40
|
hint?: string;
|
|
33
41
|
example?: string;
|
|
34
42
|
tags?: readonly string[];
|
|
35
43
|
}
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
* `at`, its routes on `hosts` alone; undefined when a field is wrong,
|
|
39
|
-
* every problem reported. `overlay`: a set added to a built-in client
|
|
40
|
-
* must name a scope and say what it unlocks (a set with no routes unlocks
|
|
41
|
-
* nothing on the held-token path); a spec's own set may leave both empty
|
|
42
|
-
* (Notion's sets carry no scope string).
|
|
43
|
-
*/
|
|
44
|
-
export declare function parseScopeSet(raw: unknown, at: string, hosts: readonly string[], problems: SpecProblem[], { overlay }?: {
|
|
45
|
-
overlay?: boolean;
|
|
46
|
-
}): OAuthScopeSet | undefined;
|
|
47
|
-
/** What `parseScopeSetOverlay` returns. */
|
|
48
|
-
export type ParsedScopeSetOverlay = {
|
|
49
|
-
ok: true;
|
|
50
|
-
name: string;
|
|
51
|
-
set: OAuthScopeSet;
|
|
52
|
-
} | {
|
|
53
|
-
ok: false;
|
|
54
|
-
problems: SpecProblem[];
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* A scope set an operator adds to a built-in OAuth client
|
|
58
|
-
* (`everyapp provider scope-set add google-workspace gmail-send.json`):
|
|
59
|
-
* `{ "name": "gmail.send", "label", "access", "scopes", "routes" }`, held
|
|
60
|
-
* to the rules a built-in set is (the set's shape, routes on the client's
|
|
61
|
-
* `api` hosts alone, anchored `posts`) plus two of its own: `access` is
|
|
62
|
-
* said outright (a write set is never implied by its scopes) and `routes`
|
|
63
|
-
* is required. A `provider` field, when present, must be `id`. The name
|
|
64
|
-
* may not be one of the client's own sets: an overlay adds, never
|
|
65
|
-
* replaces. Nothing here reads a value.
|
|
66
|
-
*/
|
|
67
|
-
export declare function parseScopeSetOverlay(input: unknown, client: {
|
|
68
|
-
id: string;
|
|
69
|
-
capability: OAuthClientCapability;
|
|
70
|
-
}): ParsedScopeSetOverlay;
|
|
71
|
-
/**
|
|
72
|
-
* `capability` with `sets` added to its scope policy: the sets after the
|
|
73
|
-
* client's own, in the order given, and each set's scopes added to the
|
|
74
|
-
* authorize URL's list (what the operator's client must be allowed), as
|
|
75
|
-
* `parseOAuthUserSpec` builds it. A name the client already has is left
|
|
76
|
-
* as the client's (the registry refuses such an overlay before this).
|
|
77
|
-
*/
|
|
78
|
-
export declare function withScopeSets(capability: OAuthClientCapability, sets: Readonly<Record<string, OAuthScopeSet>>): OAuthClientCapability;
|
|
44
|
+
/** A list of provider scope strings: each one scope, with no space or comma, each once. */
|
|
45
|
+
export declare function scopeList(value: unknown, path: string, problems: SpecProblem[]): string[] | undefined;
|
|
79
46
|
/** What `parseOAuthUserSpec` returns on success, before the registry's rules. */
|
|
80
47
|
export interface ParsedOAuthSpec {
|
|
81
48
|
capability: OAuthClientCapability;
|
|
@@ -83,20 +50,54 @@ export interface ParsedOAuthSpec {
|
|
|
83
50
|
hosts: string[];
|
|
84
51
|
}
|
|
85
52
|
/**
|
|
86
|
-
* Parse the OAuth half of a spec whose `auth.kind` is `oauth2-user
|
|
87
|
-
*
|
|
88
|
-
* the
|
|
89
|
-
* success the catalog-shaped capability with its `flow`.
|
|
53
|
+
* Parse the OAuth half of a spec whose `auth.kind` is `oauth2-user`, with
|
|
54
|
+
* the common fields already parsed. Every problem is reported; on success
|
|
55
|
+
* the capability with its `flow`.
|
|
90
56
|
*/
|
|
91
57
|
export declare function parseOAuthUserSpec(input: Record<string, unknown>, common: OAuthSpecCommon, problems: SpecProblem[]): ParsedOAuthSpec | undefined;
|
|
58
|
+
/** The JSON shape of an `oauth2-user` spec, as the built-ins and presets write it. */
|
|
59
|
+
export interface OAuthSpecJson {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly name: string;
|
|
62
|
+
readonly description?: string;
|
|
63
|
+
readonly docs: string;
|
|
64
|
+
readonly api?: string;
|
|
65
|
+
readonly hosts: readonly string[];
|
|
66
|
+
readonly auth: {
|
|
67
|
+
readonly kind: "oauth2-user";
|
|
68
|
+
readonly authorizeUrl: string;
|
|
69
|
+
readonly tokenUrl: string;
|
|
70
|
+
readonly revokeUrl?: string;
|
|
71
|
+
readonly revokeMethod?: "POST" | "DELETE";
|
|
72
|
+
readonly clientId: string;
|
|
73
|
+
readonly clientSecret?: string;
|
|
74
|
+
readonly inject?: OAuthClientInjection;
|
|
75
|
+
readonly pkce?: boolean;
|
|
76
|
+
readonly scopeSeparator?: OAuthScopeSeparator;
|
|
77
|
+
readonly scopePrefix?: string;
|
|
78
|
+
readonly authorizeParams?: Readonly<Record<string, string>>;
|
|
79
|
+
readonly tokenHeaders?: Readonly<Record<string, string>>;
|
|
80
|
+
readonly identity?: {
|
|
81
|
+
readonly url: string;
|
|
82
|
+
readonly label: string;
|
|
83
|
+
readonly id?: string;
|
|
84
|
+
readonly scopes?: readonly string[];
|
|
85
|
+
};
|
|
86
|
+
readonly tolerated?: readonly string[];
|
|
87
|
+
};
|
|
88
|
+
readonly hint?: string;
|
|
89
|
+
readonly example?: string;
|
|
90
|
+
readonly tags?: readonly string[];
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A spec already known to be good (a built-in, checked by its test) as
|
|
94
|
+
* its capability, without the parse: what the catalog runs at load, where
|
|
95
|
+
* calling the full parser would be an import cycle.
|
|
96
|
+
*/
|
|
97
|
+
export declare function oauthCapabilityFromSpec(spec: OAuthSpecJson): OAuthClientCapability;
|
|
92
98
|
/**
|
|
93
|
-
* The JSON spec of an OAuth capability
|
|
94
|
-
*
|
|
95
|
-
* capability back. A catalog client without a `flow` has no spec.
|
|
99
|
+
* The JSON spec of an OAuth capability (`provider show`, a preset's round
|
|
100
|
+
* trip): `parseProviderSpec` of it gives the capability back.
|
|
96
101
|
*/
|
|
97
|
-
export declare function oauthSpecOf(id: string, capability: OAuthClientCapability): Record<string, unknown
|
|
98
|
-
/** The methods a held-token write may use on `capability` beyond its reads. */
|
|
99
|
-
export declare function oauthWriteMethods(capability: OAuthClientCapability): readonly string[];
|
|
100
|
-
/** The methods a read grant may use on `capability` (GET and HEAD unless the spec says). */
|
|
101
|
-
export declare function oauthReadMethods(capability: OAuthClientCapability): readonly string[];
|
|
102
|
+
export declare function oauthSpecOf(id: string, capability: OAuthClientCapability): Record<string, unknown>;
|
|
102
103
|
//# sourceMappingURL=oauthSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauthSpec.d.ts","sourceRoot":"","sources":["../../src/internal/oauthSpec.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"oauthSpec.d.ts","sourceRoot":"","sources":["../../src/internal/oauthSpec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EAGpB,mBAAmB,EACpB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAoCD,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,uNAgBpB,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAajE,CAAC;AAQF,wEAAwE;AACxE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AA8GD,2FAA2F;AAC3F,wBAAgB,SAAS,CACvB,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,WAAW,EAAE,GACtB,MAAM,EAAE,GAAG,SAAS,CA0BtB;AA2DD,iFAAiF;AACjF,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,qBAAqB,CAAC;IAClC,8EAA8E;IAC9E,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,KAA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