@every-app/sdk 0.3.0-rc.5 → 0.3.0-rc.7
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/dist/cloudflare/catalogSettings.generated.d.ts +1 -16
- package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -1
- package/dist/cloudflare/catalogSettings.generated.js +0 -49
- package/dist/cloudflare/worker.d.ts +14 -0
- package/dist/cloudflare/worker.d.ts.map +1 -1
- package/dist/cloudflare/worker.js +19 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/internal/aiDefault.d.ts +70 -7
- package/dist/internal/aiDefault.d.ts.map +1 -1
- package/dist/internal/aiDefault.js +145 -15
- package/dist/internal/aiProviders.d.ts +3 -1
- package/dist/internal/aiProviders.d.ts.map +1 -1
- package/dist/internal/aiProviders.js +12 -3
- package/dist/internal/appSettings.d.ts +65 -5
- package/dist/internal/appSettings.d.ts.map +1 -1
- package/dist/internal/appSettings.js +141 -23
- package/dist/internal/capabilities.d.ts +52 -433
- package/dist/internal/capabilities.d.ts.map +1 -1
- package/dist/internal/capabilities.js +25 -558
- package/dist/internal/catalog/index.d.ts +6 -6
- package/dist/internal/catalog/inference.d.ts +6 -6
- package/dist/internal/catalog/inference.d.ts.map +1 -1
- package/dist/internal/catalog/inference.js +9 -6
- package/dist/internal/events.d.ts.map +1 -1
- package/dist/internal/events.js +1 -0
- package/dist/internal/gatewaySettings.d.ts +0 -6
- package/dist/internal/gatewaySettings.d.ts.map +1 -1
- package/dist/internal/gatewaySettings.js +1 -14
- package/dist/internal/identity.d.ts +12 -1
- package/dist/internal/identity.d.ts.map +1 -1
- package/dist/internal/identity.js +11 -1
- package/dist/internal/oauthClient.d.ts +10 -12
- package/dist/internal/oauthClient.d.ts.map +1 -1
- package/dist/internal/oauthClient.js +20 -81
- package/dist/internal/oauthPresets.d.ts +7 -3
- package/dist/internal/oauthPresets.d.ts.map +1 -1
- package/dist/internal/oauthPresets.js +533 -3
- package/dist/internal/oauthSpec.d.ts +44 -1
- package/dist/internal/oauthSpec.d.ts.map +1 -1
- package/dist/internal/oauthSpec.js +147 -34
- package/dist/internal/protocol.d.ts +14 -0
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +7 -0
- package/dist/internal/providerRegistry.d.ts +61 -1
- package/dist/internal/providerRegistry.d.ts.map +1 -1
- package/dist/internal/providerRegistry.js +127 -6
- package/dist/internal/providerSpec.d.ts +14 -7
- package/dist/internal/providerSpec.d.ts.map +1 -1
- package/dist/internal/providerSpec.js +306 -7
- package/dist/manifest.d.ts +25 -4
- package/dist/manifest.d.ts.map +1 -1
- package/dist/server/ai.d.ts +45 -0
- package/dist/server/ai.d.ts.map +1 -1
- package/dist/server/ai.js +77 -1
- package/dist/server/aiBinding.d.ts.map +1 -1
- package/dist/server/aiBinding.js +3 -3
- package/dist/server/authorizeUrl.d.ts +1 -1
- package/dist/server/authorizeUrl.d.ts.map +1 -1
- package/dist/server/authorizeUrl.js +2 -6
- package/dist/server/emailBinding.js +1 -1
- package/dist/server/emit.js +1 -1
- package/dist/server/gatewayFetch.d.ts.map +1 -1
- package/dist/server/gatewayFetch.js +20 -7
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -2
- package/dist/server/integrationFetch.d.ts +4 -31
- package/dist/server/integrationFetch.d.ts.map +1 -1
- package/dist/server/integrationFetch.js +44 -42
- package/dist/server/listMembers.js +1 -1
- package/dist/server/refusal.d.ts +55 -0
- package/dist/server/refusal.d.ts.map +1 -0
- package/dist/server/refusal.js +193 -0
- package/dist/server/sendEmail.js +1 -1
- package/package.json +1 -1
|
@@ -412,7 +412,7 @@ export declare const CATALOG_ENTRIES: {
|
|
|
412
412
|
readonly shape: "anthropic";
|
|
413
413
|
readonly chat: {
|
|
414
414
|
readonly path: "/v1/chat/completions";
|
|
415
|
-
readonly
|
|
415
|
+
readonly seedModel: "claude-haiku-5-5";
|
|
416
416
|
};
|
|
417
417
|
readonly aig: {
|
|
418
418
|
readonly slug: "anthropic";
|
|
@@ -453,11 +453,11 @@ export declare const CATALOG_ENTRIES: {
|
|
|
453
453
|
readonly inferenceRoutes: readonly ["/v1beta/openai/chat/completions", "/v1beta/openai/embeddings", "/v1beta/openai/images/generations"];
|
|
454
454
|
readonly chat: {
|
|
455
455
|
readonly path: "/v1beta/openai/chat/completions";
|
|
456
|
-
readonly
|
|
456
|
+
readonly seedModel: "gemini-3.1-flash-lite";
|
|
457
457
|
};
|
|
458
458
|
readonly embeddings: {
|
|
459
459
|
readonly path: "/v1beta/openai/embeddings";
|
|
460
|
-
readonly
|
|
460
|
+
readonly seedModel: "gemini-embedding-001";
|
|
461
461
|
};
|
|
462
462
|
readonly hint: "An API key from Google AI Studio; the Gateway sends it as a bearer token. Apps call Gemini's OpenAI-shaped paths under /v1beta/openai.";
|
|
463
463
|
readonly secrets: readonly [{
|
|
@@ -494,11 +494,11 @@ export declare const CATALOG_ENTRIES: {
|
|
|
494
494
|
readonly inferenceRoutes: readonly ["/v1/chat/completions", "/v1/fim/completions", "/v1/embeddings", "/v1/moderations", "/v1/chat/moderations", "/v1/classifications", "/v1/chat/classifications", "/v1/ocr", "/v1/audio/transcriptions", "/v1/audio/speech"];
|
|
495
495
|
readonly chat: {
|
|
496
496
|
readonly path: "/v1/chat/completions";
|
|
497
|
-
readonly
|
|
497
|
+
readonly seedModel: "mistral-small-latest";
|
|
498
498
|
};
|
|
499
499
|
readonly embeddings: {
|
|
500
500
|
readonly path: "/v1/embeddings";
|
|
501
|
-
readonly
|
|
501
|
+
readonly seedModel: "mistral-embed";
|
|
502
502
|
};
|
|
503
503
|
readonly aig: {
|
|
504
504
|
readonly slug: "mistral";
|
|
@@ -535,7 +535,7 @@ export declare const CATALOG_ENTRIES: {
|
|
|
535
535
|
readonly inferenceRoutes: readonly ["/openai/v1/chat/completions", "/openai/v1/responses", "/openai/v1/audio/transcriptions", "/openai/v1/audio/translations", "/openai/v1/audio/speech"];
|
|
536
536
|
readonly chat: {
|
|
537
537
|
readonly path: "/openai/v1/chat/completions";
|
|
538
|
-
readonly
|
|
538
|
+
readonly seedModel: "openai/gpt-oss-20b";
|
|
539
539
|
};
|
|
540
540
|
readonly aig: {
|
|
541
541
|
readonly slug: "groq";
|
|
@@ -15,7 +15,7 @@ export declare const INFERENCE: {
|
|
|
15
15
|
readonly shape: "anthropic";
|
|
16
16
|
readonly chat: {
|
|
17
17
|
readonly path: "/v1/chat/completions";
|
|
18
|
-
readonly
|
|
18
|
+
readonly seedModel: "claude-haiku-5-5";
|
|
19
19
|
};
|
|
20
20
|
readonly aig: {
|
|
21
21
|
readonly slug: "anthropic";
|
|
@@ -56,11 +56,11 @@ export declare const INFERENCE: {
|
|
|
56
56
|
readonly inferenceRoutes: readonly ["/v1beta/openai/chat/completions", "/v1beta/openai/embeddings", "/v1beta/openai/images/generations"];
|
|
57
57
|
readonly chat: {
|
|
58
58
|
readonly path: "/v1beta/openai/chat/completions";
|
|
59
|
-
readonly
|
|
59
|
+
readonly seedModel: "gemini-3.1-flash-lite";
|
|
60
60
|
};
|
|
61
61
|
readonly embeddings: {
|
|
62
62
|
readonly path: "/v1beta/openai/embeddings";
|
|
63
|
-
readonly
|
|
63
|
+
readonly seedModel: "gemini-embedding-001";
|
|
64
64
|
};
|
|
65
65
|
readonly hint: "An API key from Google AI Studio; the Gateway sends it as a bearer token. Apps call Gemini's OpenAI-shaped paths under /v1beta/openai.";
|
|
66
66
|
readonly secrets: readonly [{
|
|
@@ -97,11 +97,11 @@ export declare const INFERENCE: {
|
|
|
97
97
|
readonly inferenceRoutes: readonly ["/v1/chat/completions", "/v1/fim/completions", "/v1/embeddings", "/v1/moderations", "/v1/chat/moderations", "/v1/classifications", "/v1/chat/classifications", "/v1/ocr", "/v1/audio/transcriptions", "/v1/audio/speech"];
|
|
98
98
|
readonly chat: {
|
|
99
99
|
readonly path: "/v1/chat/completions";
|
|
100
|
-
readonly
|
|
100
|
+
readonly seedModel: "mistral-small-latest";
|
|
101
101
|
};
|
|
102
102
|
readonly embeddings: {
|
|
103
103
|
readonly path: "/v1/embeddings";
|
|
104
|
-
readonly
|
|
104
|
+
readonly seedModel: "mistral-embed";
|
|
105
105
|
};
|
|
106
106
|
readonly aig: {
|
|
107
107
|
readonly slug: "mistral";
|
|
@@ -138,7 +138,7 @@ export declare const INFERENCE: {
|
|
|
138
138
|
readonly inferenceRoutes: readonly ["/openai/v1/chat/completions", "/openai/v1/responses", "/openai/v1/audio/transcriptions", "/openai/v1/audio/translations", "/openai/v1/audio/speech"];
|
|
139
139
|
readonly chat: {
|
|
140
140
|
readonly path: "/openai/v1/chat/completions";
|
|
141
|
-
readonly
|
|
141
|
+
readonly seedModel: "openai/gpt-oss-20b";
|
|
142
142
|
};
|
|
143
143
|
readonly aig: {
|
|
144
144
|
readonly slug: "groq";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../src/internal/catalog/inference.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../src/internal/catalog/inference.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqdsD,CAAC"}
|
|
@@ -22,7 +22,7 @@ export const INFERENCE = {
|
|
|
22
22
|
unstoredRoutes: ["/v1/chat/completions"],
|
|
23
23
|
// The Messages API is the shape an app pins `anthropic` for.
|
|
24
24
|
shape: "anthropic",
|
|
25
|
-
chat: { path: "/v1/chat/completions",
|
|
25
|
+
chat: { path: "/v1/chat/completions", seedModel: "claude-haiku-5-5" },
|
|
26
26
|
aig: { slug: "anthropic" },
|
|
27
27
|
hint: "An API key from the Claude Console's API keys page; the Gateway sends it as a bearer token. Apps send the anthropic-version header themselves.",
|
|
28
28
|
secrets: [
|
|
@@ -66,11 +66,11 @@ export const INFERENCE = {
|
|
|
66
66
|
],
|
|
67
67
|
chat: {
|
|
68
68
|
path: "/v1beta/openai/chat/completions",
|
|
69
|
-
|
|
69
|
+
seedModel: "gemini-3.1-flash-lite",
|
|
70
70
|
},
|
|
71
71
|
embeddings: {
|
|
72
72
|
path: "/v1beta/openai/embeddings",
|
|
73
|
-
|
|
73
|
+
seedModel: "gemini-embedding-001",
|
|
74
74
|
},
|
|
75
75
|
// No `aig`: AI Gateway documents Google AI Studio's native form only
|
|
76
76
|
// (/v1/models/{model}:generateContent), not these OpenAI-shaped paths.
|
|
@@ -120,8 +120,8 @@ export const INFERENCE = {
|
|
|
120
120
|
"/v1/audio/transcriptions",
|
|
121
121
|
"/v1/audio/speech",
|
|
122
122
|
],
|
|
123
|
-
chat: { path: "/v1/chat/completions",
|
|
124
|
-
embeddings: { path: "/v1/embeddings",
|
|
123
|
+
chat: { path: "/v1/chat/completions", seedModel: "mistral-small-latest" },
|
|
124
|
+
embeddings: { path: "/v1/embeddings", seedModel: "mistral-embed" },
|
|
125
125
|
aig: { slug: "mistral" },
|
|
126
126
|
hint: "An API key from API Keys in the Mistral Studio console; the Gateway sends it as a bearer token. Free mode needs no card; usage and rate limits apply.",
|
|
127
127
|
secrets: [
|
|
@@ -161,7 +161,10 @@ export const INFERENCE = {
|
|
|
161
161
|
"/openai/v1/audio/translations",
|
|
162
162
|
"/openai/v1/audio/speech",
|
|
163
163
|
],
|
|
164
|
-
chat: {
|
|
164
|
+
chat: {
|
|
165
|
+
path: "/openai/v1/chat/completions",
|
|
166
|
+
seedModel: "openai/gpt-oss-20b",
|
|
167
|
+
},
|
|
165
168
|
// AI Gateway's Groq endpoint takes the path without `/openai/v1`.
|
|
166
169
|
aig: { slug: "groq", trim: "/openai/v1" },
|
|
167
170
|
hint: "An API key from the Groq console; the Gateway sends it as a bearer token. Apps call the OpenAI-shaped paths under /openai/v1.",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,cAAc,GACd,KAAK,GACL,KAAK,GACL,OAAO,GACP,MAAM,GACN,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,iBAAiB,GACjB,SAAS,GACT,UAAU,GACV,cAAc,GACd,IAAI,GACJ,MAAM,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,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AC;IAAE,EAAE,EAAE,KAAK,CAAA;CAAE,GAAG,gBAAgB,CAAC,CAAC;AAqBvC;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,OAAO,EACb,QAAQ,SAA2B,GAClC,cAAc,CAmDhB;AAED,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED,uBAAuB;AACvB,MAAM,WAAW,eAAe;IAC9B,iEAAiE;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEzE;AAED,kEAAkE;AAClE,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,CAER;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAChC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAY5C"}
|
package/dist/internal/events.js
CHANGED
|
@@ -73,6 +73,7 @@ export const EVENT_TYPES = [
|
|
|
73
73
|
entry("subscription", "subscription.removed", "An event subscription was removed"),
|
|
74
74
|
entry("subscription", "subscription.redelivered", "A delivery was queued again by hand"),
|
|
75
75
|
entry("ai", "ai.default_changed", "The default model provider changed"),
|
|
76
|
+
entry("ai", "ai.model_changed", "A provider's default model changed"),
|
|
76
77
|
entry("ping", "ping", "A test event, sent to one subscription on request"),
|
|
77
78
|
];
|
|
78
79
|
const typesByName = new Map(EVENT_TYPES.map((info) => [info.type, info]));
|
|
@@ -53,12 +53,6 @@ export declare function isSettableGatewaySetting(name: string): boolean;
|
|
|
53
53
|
* stays hidden.
|
|
54
54
|
*/
|
|
55
55
|
export declare const PLAIN_GATEWAY_SETTINGS: readonly ["EMAIL_FROM", "EMAIL_FROM_NAME", "EMAIL_PROVIDER", "EMAIL_PASSWORD_SIGN_IN", "AI_PROXY_EXTRA_ROUTES", "MCP_OAUTH_ENABLED", "MCP_DCR_ENABLED", "MCP_ALLOWED_ORIGINS", "MCP_AUDIT_RETENTION_DAYS", "CLOUDFLARE_ACCESS_OIDC_ISSUER", "CLOUDFLARE_ACCESS_OIDC_CLIENT_ID", "CLOUDFLARE_ACCESS_OIDC_LABEL", "CLOUDFLARE_ACCESS_TEAM_DOMAIN", "CLOUDFLARE_ACCESS_AUD", "CLOUDFLARE_ACCESS_APPS_AUD", "CLOUDFLARE_ACCESS_AUTO_JOIN_DOMAINS", "CLOUDFLARE_ACCESS_OUTER_RING_AUTO_JOIN", "HOSTED_OPEN_SIGNUP", "BROWSER_APP_INSTALLS", "DISPATCH_NAMESPACE", "THIRD_PARTY_DOMAIN", "EVENTS_ALLOW_PRIVATE_TARGETS"];
|
|
56
|
-
/**
|
|
57
|
-
* The settings naming the instance an OAuth client is registered on
|
|
58
|
-
* (`hostSetting` in the catalog: Mastodon's `MASTODON_URL`), in catalog
|
|
59
|
-
* order: an origin, a plain value.
|
|
60
|
-
*/
|
|
61
|
-
export declare const OAUTH_CLIENT_HOST_SETTINGS: readonly string[];
|
|
62
56
|
/** Whether a settable Gateway setting's value is a plain value, not a credential. */
|
|
63
57
|
export declare function isPlainGatewaySetting(name: string): boolean;
|
|
64
58
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatewaySettings.d.ts","sourceRoot":"","sources":["../../src/internal/gatewaySettings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAM3B;;;;;GAKG;AACH,eAAO,MAAM,8BA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uB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7D;AAmBD,iDAAiD;AACjD,eAAO,MAAM,8BAA8B,sFAC0C,CAAC;AAEtF,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAM7D;AAED,4EAA4E;AAC5E,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,IAAI,CAQ5E"}
|
|
@@ -34,8 +34,7 @@ export function isInstallOwnedGatewaySetting(name) {
|
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* The settings the catalog's providers read (the AI providers' keys, the
|
|
37
|
-
* API-key providers' keys, the OAuth clients
|
|
38
|
-
* URL), in catalog order, the install's own left out: what `everyapp
|
|
37
|
+
* API-key providers' keys and hosts, the OAuth clients), in catalog order, the install's own left out: what `everyapp
|
|
39
38
|
* secret set` accepts because a provider reads it. A gateway's registered
|
|
40
39
|
* rows add theirs at run time (providerRegistry.settingNames()).
|
|
41
40
|
*/
|
|
@@ -146,20 +145,8 @@ export const PLAIN_GATEWAY_SETTINGS = [
|
|
|
146
145
|
"THIRD_PARTY_DOMAIN",
|
|
147
146
|
"EVENTS_ALLOW_PRIVATE_TARGETS",
|
|
148
147
|
];
|
|
149
|
-
/**
|
|
150
|
-
* The settings naming the instance an OAuth client is registered on
|
|
151
|
-
* (`hostSetting` in the catalog: Mastodon's `MASTODON_URL`), in catalog
|
|
152
|
-
* order: an origin, a plain value.
|
|
153
|
-
*/
|
|
154
|
-
export const OAUTH_CLIENT_HOST_SETTINGS = CAPABILITY_IDS.flatMap((id) => {
|
|
155
|
-
const capability = CAPABILITIES[id];
|
|
156
|
-
return capability.mode === "oauth_client" && capability.hostSetting
|
|
157
|
-
? [capability.hostSetting]
|
|
158
|
-
: [];
|
|
159
|
-
});
|
|
160
148
|
const PLAIN = new Set([
|
|
161
149
|
...PLAIN_GATEWAY_SETTINGS,
|
|
162
|
-
...OAUTH_CLIENT_HOST_SETTINGS,
|
|
163
150
|
// The sign-in providers' ids, issuer, label and tenant; their client
|
|
164
151
|
// secrets are credentials.
|
|
165
152
|
...PLAIN_SIGN_IN_SETTINGS,
|
|
@@ -6,7 +6,18 @@ export declare class IdentityError extends Error {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class ConfigurationError extends Error {
|
|
8
8
|
readonly status = 500;
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The Gateway refusal code the same gap gets once deployed
|
|
11
|
+
* (`ai_provider_not_configured`, `ai_default_not_configured`), when the
|
|
12
|
+
* error is "not set up" rather than a mistake in the code.
|
|
13
|
+
*/
|
|
14
|
+
readonly code: string | undefined;
|
|
15
|
+
/** The settings that would close the gap (`.dev.vars` names in local dev). */
|
|
16
|
+
readonly settings: readonly string[];
|
|
17
|
+
constructor(message: string, setup?: {
|
|
18
|
+
code: string;
|
|
19
|
+
settings?: readonly string[];
|
|
20
|
+
});
|
|
10
21
|
}
|
|
11
22
|
/**
|
|
12
23
|
* Parse the public key set from an env var value. Accepts a JSON array of PEM
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/internal/identity.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAKjB,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,CAAC;AAEF,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,MAAM,OAAO;gBACV,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,MAAM,OAAO;
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/internal/identity.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAKjB,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,CAAC;AAEF,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,MAAM,OAAO;gBACV,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,MAAM,OAAO;IACtB;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;gBAEnC,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,C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M,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,sBAAsB,GAC9B,aAAa,CAwBf;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,GAAG,OAAO,EAC1B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC,CAmBzB"}
|
|
@@ -20,9 +20,19 @@ export class IdentityError extends Error {
|
|
|
20
20
|
}
|
|
21
21
|
export class ConfigurationError extends Error {
|
|
22
22
|
status = 500;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The Gateway refusal code the same gap gets once deployed
|
|
25
|
+
* (`ai_provider_not_configured`, `ai_default_not_configured`), when the
|
|
26
|
+
* error is "not set up" rather than a mistake in the code.
|
|
27
|
+
*/
|
|
28
|
+
code;
|
|
29
|
+
/** The settings that would close the gap (`.dev.vars` names in local dev). */
|
|
30
|
+
settings;
|
|
31
|
+
constructor(message, setup) {
|
|
24
32
|
super(message);
|
|
25
33
|
this.name = "ConfigurationError";
|
|
34
|
+
this.code = setup?.code;
|
|
35
|
+
this.settings = setup?.settings ?? [];
|
|
26
36
|
}
|
|
27
37
|
}
|
|
28
38
|
/**
|
|
@@ -15,8 +15,7 @@ export interface OAuthClientCredentials {
|
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* The client `settings` hold for `capability`, or null until every setting
|
|
18
|
-
* it needs is set: the id, the secret
|
|
19
|
-
* `hostSetting` that is an https origin when it is set at all.
|
|
18
|
+
* it needs is set: the id, and the secret unless it is a public client.
|
|
20
19
|
*/
|
|
21
20
|
export declare function oauthClientCredentials(capability: OAuthClientCapability, settings: CapabilitySettings): OAuthClientCredentials | null;
|
|
22
21
|
/** A token request: where it goes, its headers, its (buffered) body. */
|
|
@@ -32,26 +31,25 @@ export type InjectedTokenRequest = ({
|
|
|
32
31
|
problem: string;
|
|
33
32
|
};
|
|
34
33
|
/**
|
|
35
|
-
* `request` with `client` put where `rule` says (the form body
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* Token requests are form-encoded or JSON; anything else is refused.
|
|
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.
|
|
42
40
|
*/
|
|
43
41
|
export declare function injectClientCredentials(request: TokenRequest, rule: OAuthTokenEndpoint, client: OAuthClientCredentials): InjectedTokenRequest;
|
|
44
42
|
/**
|
|
45
43
|
* The grants the gateway completes: each ends in a user's own tokens. The
|
|
46
44
|
* client-credentials grant, and anything else a network serves on the same
|
|
47
45
|
* endpoint, would mint a token for the gateway's own application instead,
|
|
48
|
-
* which on
|
|
49
|
-
*
|
|
46
|
+
* which on many providers manages the application's settings, its
|
|
47
|
+
* webhooks and every tenant's tokens.
|
|
50
48
|
*/
|
|
51
49
|
export declare const USER_BOUND_GRANT_TYPES: ReadonlySet<string>;
|
|
52
50
|
/**
|
|
53
51
|
* A token request's `grant_type` as the app sent it, from its body or query
|
|
54
|
-
* string, or null when it names none (
|
|
52
|
+
* string, or null when it names none (Slack's code exchange). Never the
|
|
55
53
|
* request's other fields.
|
|
56
54
|
*/
|
|
57
55
|
export declare function requestedGrantType(request: TokenRequest): string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauthClient.d.ts","sourceRoot":"","sources":["../../src/internal/oauthClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,
|
|
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"}
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
* app's token request, and the SDK's local-dev fallback, which puts the
|
|
5
5
|
* developer's own on it the same way.
|
|
6
6
|
*/
|
|
7
|
-
import { base64Utf8,
|
|
7
|
+
import { base64Utf8, } from "./capabilities.js";
|
|
8
8
|
/** The largest token request body the gateway reads: real ones are a few hundred bytes. */
|
|
9
9
|
export const OAUTH_TOKEN_BODY_LIMIT = 64 * 1024;
|
|
10
10
|
/**
|
|
11
11
|
* The client `settings` hold for `capability`, or null until every setting
|
|
12
|
-
* it needs is set: the id, the secret
|
|
13
|
-
* `hostSetting` that is an https origin when it is set at all.
|
|
12
|
+
* it needs is set: the id, and the secret unless it is a public client.
|
|
14
13
|
*/
|
|
15
14
|
export function oauthClientCredentials(capability, settings) {
|
|
16
15
|
const clientId = settingValue(settings[capability.secrets.clientId]);
|
|
@@ -20,72 +19,53 @@ export function oauthClientCredentials(capability, settings) {
|
|
|
20
19
|
: undefined;
|
|
21
20
|
if (!clientId || (secretName && !clientSecret))
|
|
22
21
|
return null;
|
|
23
|
-
if (capability.hostSetting && !oauthClientOrigin(capability, settings)) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
22
|
return { clientId, ...(clientSecret ? { clientSecret } : {}) };
|
|
27
23
|
}
|
|
28
24
|
function settingValue(value) {
|
|
29
25
|
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
30
26
|
}
|
|
31
27
|
const FORM = "application/x-www-form-urlencoded";
|
|
32
|
-
const
|
|
28
|
+
const isCredential = (name) => ["client_id", "client_secret"].includes(name.toLowerCase());
|
|
33
29
|
/**
|
|
34
|
-
* `request` with `client` put where `rule` says (the form body
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* Token requests are form-encoded or JSON; anything else is refused.
|
|
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.
|
|
41
36
|
*/
|
|
42
37
|
export function injectClientCredentials(request, rule, client) {
|
|
43
|
-
const idName = rule.params?.clientId ?? "client_id";
|
|
44
|
-
const secretName = rule.params?.clientSecret ?? "client_secret";
|
|
45
|
-
const credentialNames = new Set(["client_id", "client_secret", idName, secretName].map((name) => name.toLowerCase()));
|
|
46
|
-
const isCredential = (name) => credentialNames.has(name.toLowerCase());
|
|
47
38
|
const fields = [
|
|
48
|
-
[
|
|
39
|
+
["client_id", client.clientId],
|
|
49
40
|
...(client.clientSecret
|
|
50
|
-
? [[
|
|
41
|
+
? [["client_secret", client.clientSecret]]
|
|
51
42
|
: []),
|
|
52
43
|
];
|
|
53
44
|
// The query keeps the app's other fields as they were sent.
|
|
54
45
|
const url = new URL(request.url);
|
|
55
|
-
|
|
46
|
+
url.search = url.search
|
|
56
47
|
.slice(1)
|
|
57
48
|
.split("&")
|
|
58
49
|
.filter((pair) => {
|
|
59
50
|
const [name] = new URLSearchParams(pair).keys();
|
|
60
51
|
return pair !== "" && !(name !== undefined && isCredential(name));
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
query.push(new URLSearchParams(fields).toString());
|
|
64
|
-
}
|
|
65
|
-
url.search = query.join("&");
|
|
52
|
+
})
|
|
53
|
+
.join("&");
|
|
66
54
|
const headers = new Headers(request.headers);
|
|
67
55
|
headers.delete("authorization");
|
|
68
56
|
headers.delete("content-length");
|
|
69
57
|
if (rule.inject === "basic") {
|
|
70
58
|
headers.set("authorization", `Basic ${base64Utf8(`${client.clientId}:${client.clientSecret ?? ""}`)}`);
|
|
71
59
|
}
|
|
72
|
-
const type = mediaType(headers.get("content-type"));
|
|
73
60
|
let body = request.body;
|
|
74
61
|
if (body === null || body === "") {
|
|
75
|
-
// Nothing the app sent; the form
|
|
62
|
+
// Nothing the app sent; the form rule makes the body.
|
|
76
63
|
if (rule.inject === "form") {
|
|
77
64
|
headers.set("content-type", FORM);
|
|
78
65
|
body = new URLSearchParams(fields).toString();
|
|
79
66
|
}
|
|
80
|
-
else if (rule.inject === "json") {
|
|
81
|
-
headers.set("content-type", JSON_TYPE);
|
|
82
|
-
body = JSON.stringify(Object.fromEntries(fields));
|
|
83
|
-
}
|
|
84
67
|
}
|
|
85
|
-
else if (type === FORM) {
|
|
86
|
-
if (rule.inject === "json") {
|
|
87
|
-
return { ok: false, problem: "This token endpoint takes a JSON body." };
|
|
88
|
-
}
|
|
68
|
+
else if (mediaType(headers.get("content-type")) === FORM) {
|
|
89
69
|
const params = new URLSearchParams(body);
|
|
90
70
|
for (const name of new Set([...params.keys()].filter(isCredential))) {
|
|
91
71
|
params.delete(name);
|
|
@@ -96,31 +76,10 @@ export function injectClientCredentials(request, rule, client) {
|
|
|
96
76
|
}
|
|
97
77
|
body = params.toString();
|
|
98
78
|
}
|
|
99
|
-
else if (type === JSON_TYPE) {
|
|
100
|
-
if (rule.inject === "form") {
|
|
101
|
-
return {
|
|
102
|
-
ok: false,
|
|
103
|
-
problem: `This token endpoint takes a form-encoded body (${FORM}).`,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
const parsed = jsonObject(body);
|
|
107
|
-
if (!parsed) {
|
|
108
|
-
return { ok: false, problem: "The body is not a JSON object." };
|
|
109
|
-
}
|
|
110
|
-
for (const name of Object.keys(parsed)) {
|
|
111
|
-
if (isCredential(name))
|
|
112
|
-
delete parsed[name];
|
|
113
|
-
}
|
|
114
|
-
if (rule.inject === "json") {
|
|
115
|
-
for (const [name, value] of fields)
|
|
116
|
-
parsed[name] = value;
|
|
117
|
-
}
|
|
118
|
-
body = JSON.stringify(parsed);
|
|
119
|
-
}
|
|
120
79
|
else {
|
|
121
80
|
return {
|
|
122
81
|
ok: false,
|
|
123
|
-
problem: `A token request's body is form-encoded (${FORM})
|
|
82
|
+
problem: `A token request's body is form-encoded (${FORM}).`,
|
|
124
83
|
};
|
|
125
84
|
}
|
|
126
85
|
return { ok: true, url, headers, body };
|
|
@@ -130,29 +89,23 @@ const GRANT_TYPES = new Set([
|
|
|
130
89
|
"authorization_code",
|
|
131
90
|
"refresh_token",
|
|
132
91
|
"client_credentials",
|
|
133
|
-
"fb_exchange_token",
|
|
134
|
-
"ig_exchange_token",
|
|
135
|
-
"th_exchange_token",
|
|
136
92
|
"urn:ietf:params:oauth:grant-type:token-exchange",
|
|
137
93
|
]);
|
|
138
94
|
/**
|
|
139
95
|
* The grants the gateway completes: each ends in a user's own tokens. The
|
|
140
96
|
* client-credentials grant, and anything else a network serves on the same
|
|
141
97
|
* endpoint, would mint a token for the gateway's own application instead,
|
|
142
|
-
* which on
|
|
143
|
-
*
|
|
98
|
+
* which on many providers manages the application's settings, its
|
|
99
|
+
* webhooks and every tenant's tokens.
|
|
144
100
|
*/
|
|
145
101
|
export const USER_BOUND_GRANT_TYPES = new Set([
|
|
146
102
|
"authorization_code",
|
|
147
103
|
"refresh_token",
|
|
148
|
-
"fb_exchange_token",
|
|
149
|
-
"ig_exchange_token",
|
|
150
|
-
"th_exchange_token",
|
|
151
104
|
"urn:ietf:params:oauth:grant-type:token-exchange",
|
|
152
105
|
]);
|
|
153
106
|
/**
|
|
154
107
|
* A token request's `grant_type` as the app sent it, from its body or query
|
|
155
|
-
* string, or null when it names none (
|
|
108
|
+
* string, or null when it names none (Slack's code exchange). Never the
|
|
156
109
|
* request's other fields.
|
|
157
110
|
*/
|
|
158
111
|
export function requestedGrantType(request) {
|
|
@@ -161,9 +114,6 @@ export function requestedGrantType(request) {
|
|
|
161
114
|
if (request.body && type === FORM) {
|
|
162
115
|
value = new URLSearchParams(request.body).get("grant_type");
|
|
163
116
|
}
|
|
164
|
-
else if (request.body && type === JSON_TYPE) {
|
|
165
|
-
value = jsonObject(request.body)?.["grant_type"] ?? null;
|
|
166
|
-
}
|
|
167
117
|
value ??= request.url.searchParams.get("grant_type");
|
|
168
118
|
return typeof value === "string" && value ? value : null;
|
|
169
119
|
}
|
|
@@ -181,14 +131,3 @@ export function tokenGrantType(request) {
|
|
|
181
131
|
function mediaType(contentType) {
|
|
182
132
|
return (contentType ?? "").split(";")[0].trim().toLowerCase();
|
|
183
133
|
}
|
|
184
|
-
function jsonObject(text) {
|
|
185
|
-
try {
|
|
186
|
-
const value = JSON.parse(text);
|
|
187
|
-
return value && typeof value === "object" && !Array.isArray(value)
|
|
188
|
-
? value
|
|
189
|
-
: null;
|
|
190
|
-
}
|
|
191
|
-
catch {
|
|
192
|
-
return null;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
@@ -5,13 +5,17 @@
|
|
|
5
5
|
* preset becomes a `providers` row when added (`everyapp provider add
|
|
6
6
|
* --oauth github`, the Admin dialog, `everyapp_provider_add` with
|
|
7
7
|
* `preset`), so an operator may `provider show` and edit a copy; nothing
|
|
8
|
-
* here is a hidden catalog entry
|
|
9
|
-
*
|
|
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`.
|
|
10
12
|
*
|
|
11
13
|
* Each preset parses with `parseProviderSpec` (oauthPresets.test.ts),
|
|
12
14
|
* names a console where the client is made, the API hosts the token is
|
|
13
15
|
* sent to, and scope sets an app declares under `scopes`. Scope strings
|
|
14
|
-
* are the providers' own, verified against their docs on 2026-10-25
|
|
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.
|
|
15
19
|
*/
|
|
16
20
|
import { type RegistrableCapability } from "./providerSpec.js";
|
|
17
21
|
/** A preset's spec as JSON: the shape of ./oauthSpec.ts. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauthPresets.d.ts","sourceRoot":"","sources":["../../src/internal/oauthPresets.ts"],"names":[],"mappings":"AAAA
|
|
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"}
|