@every-app/sdk 0.3.0-rc.1 → 0.3.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/cloudflare/catalogSettings.generated.d.ts +81 -0
- package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -0
- package/dist/cloudflare/catalogSettings.generated.js +174 -0
- package/dist/cloudflare/index.d.ts +3 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -1
- package/dist/cloudflare/sentinel.d.ts +60 -2
- package/dist/cloudflare/sentinel.d.ts.map +1 -1
- package/dist/cloudflare/sentinel.js +37 -2
- package/dist/cloudflare/worker.d.ts +357 -63
- package/dist/cloudflare/worker.d.ts.map +1 -1
- package/dist/cloudflare/worker.js +363 -104
- package/dist/dev/index.d.ts +1 -1
- package/dist/dev/index.d.ts.map +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/dev/keypair.d.ts +2 -0
- package/dist/dev/keypair.d.ts.map +1 -1
- package/dist/dev/keypair.js +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/internal/aiDefault.d.ts +204 -0
- package/dist/internal/aiDefault.d.ts.map +1 -0
- package/dist/internal/aiDefault.js +334 -0
- package/dist/internal/aiProviders.d.ts +7 -2
- package/dist/internal/aiProviders.d.ts.map +1 -1
- package/dist/internal/aiProviders.js +17 -4
- package/dist/internal/appSettings.d.ts +82 -4
- package/dist/internal/appSettings.d.ts.map +1 -1
- package/dist/internal/appSettings.js +204 -29
- package/dist/internal/audit.d.ts +108 -0
- package/dist/internal/audit.d.ts.map +1 -0
- package/dist/internal/audit.js +235 -0
- package/dist/internal/capabilities.d.ts +2268 -438
- package/dist/internal/capabilities.d.ts.map +1 -1
- package/dist/internal/capabilities.js +128 -539
- package/dist/internal/catalog/commerce.d.ts +394 -0
- package/dist/internal/catalog/commerce.d.ts.map +1 -0
- package/dist/internal/catalog/commerce.js +477 -0
- package/dist/internal/catalog/comms.d.ts +375 -0
- package/dist/internal/catalog/comms.d.ts.map +1 -0
- package/dist/internal/catalog/comms.js +520 -0
- package/dist/internal/catalog/index.d.ts +1973 -0
- package/dist/internal/catalog/index.d.ts.map +1 -0
- package/dist/internal/catalog/index.js +19 -0
- package/dist/internal/catalog/inference.d.ts +393 -0
- package/dist/internal/catalog/inference.d.ts.map +1 -0
- package/dist/internal/catalog/inference.js +460 -0
- package/dist/internal/catalog/infra.d.ts +423 -0
- package/dist/internal/catalog/infra.d.ts.map +1 -0
- package/dist/internal/catalog/infra.js +543 -0
- package/dist/internal/catalog/search.d.ts +400 -0
- package/dist/internal/catalog/search.d.ts.map +1 -0
- package/dist/internal/catalog/search.js +463 -0
- package/dist/internal/devProviders.d.ts +2 -2
- package/dist/internal/devProviders.d.ts.map +1 -1
- package/dist/internal/devProviders.js +19 -1
- package/dist/internal/events.d.ts +13 -2
- package/dist/internal/events.d.ts.map +1 -1
- package/dist/internal/events.js +47 -4
- package/dist/internal/gatewaySettings.d.ts +3 -2
- package/dist/internal/gatewaySettings.d.ts.map +1 -1
- package/dist/internal/gatewaySettings.js +12 -6
- package/dist/internal/identity.d.ts +41 -4
- package/dist/internal/identity.d.ts.map +1 -1
- package/dist/internal/identity.js +48 -10
- package/dist/internal/index.d.ts +6 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +6 -1
- package/dist/internal/members.d.ts +3 -2
- package/dist/internal/members.d.ts.map +1 -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 +33 -0
- package/dist/internal/oauthPresets.d.ts.map +1 -0
- package/dist/internal/oauthPresets.js +1064 -0
- package/dist/internal/oauthScopes.d.ts +56 -1
- package/dist/internal/oauthScopes.d.ts.map +1 -1
- package/dist/internal/oauthScopes.js +98 -4
- package/dist/internal/oauthSpec.d.ts +102 -0
- package/dist/internal/oauthSpec.d.ts.map +1 -0
- package/dist/internal/oauthSpec.js +789 -0
- package/dist/internal/protocol.d.ts +64 -1
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +51 -1
- package/dist/internal/providerRegistry.d.ts +77 -6
- package/dist/internal/providerRegistry.d.ts.map +1 -1
- package/dist/internal/providerRegistry.js +178 -8
- package/dist/internal/providerSpec.d.ts +18 -7
- package/dist/internal/providerSpec.d.ts.map +1 -1
- package/dist/internal/providerSpec.js +442 -34
- package/dist/internal/signInProviders.d.ts +104 -0
- package/dist/internal/signInProviders.d.ts.map +1 -0
- package/dist/internal/signInProviders.js +245 -0
- package/dist/manifest.d.ts +238 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +30 -0
- package/dist/server/ai.d.ts +111 -0
- package/dist/server/ai.d.ts.map +1 -0
- package/dist/server/ai.js +145 -0
- package/dist/server/aiBinding.d.ts +68 -0
- package/dist/server/aiBinding.d.ts.map +1 -0
- package/dist/server/aiBinding.js +294 -0
- package/dist/server/attribution.d.ts +9 -5
- package/dist/server/attribution.d.ts.map +1 -1
- package/dist/server/attribution.js +12 -4
- 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/connectUrl.d.ts +21 -0
- package/dist/server/connectUrl.d.ts.map +1 -0
- package/dist/server/connectUrl.js +37 -0
- package/dist/server/context.d.ts +68 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +117 -0
- package/dist/server/emailBinding.d.ts +72 -0
- package/dist/server/emailBinding.d.ts.map +1 -0
- package/dist/server/emailBinding.js +124 -0
- package/dist/server/emit.d.ts +1 -1
- package/dist/server/emit.d.ts.map +1 -1
- package/dist/server/emit.js +7 -7
- package/dist/server/env.d.ts +44 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +1 -0
- package/dist/server/everyApp.d.ts +27 -7
- package/dist/server/everyApp.d.ts.map +1 -1
- package/dist/server/everyApp.js +106 -5
- package/dist/server/fromMcpTools.d.ts +89 -0
- package/dist/server/fromMcpTools.d.ts.map +1 -0
- package/dist/server/fromMcpTools.js +192 -0
- package/dist/server/gatewayFetch.d.ts +42 -18
- package/dist/server/gatewayFetch.d.ts.map +1 -1
- package/dist/server/gatewayFetch.js +138 -19
- package/dist/server/gatewayUrl.d.ts +13 -0
- package/dist/server/gatewayUrl.d.ts.map +1 -0
- package/dist/server/gatewayUrl.js +34 -0
- package/dist/server/index.d.ts +15 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +12 -2
- package/dist/server/integrationFetch.d.ts +70 -39
- package/dist/server/integrationFetch.d.ts.map +1 -1
- package/dist/server/integrationFetch.js +244 -82
- package/dist/server/listMembers.d.ts +1 -1
- package/dist/server/listMembers.d.ts.map +1 -1
- package/dist/server/listMembers.js +8 -11
- 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.d.ts +1 -1
- package/dist/server/sendEmail.d.ts.map +1 -1
- package/dist/server/sendEmail.js +7 -7
- package/dist/server/toolsEndpoint.d.ts.map +1 -1
- package/dist/server/toolsEndpoint.js +11 -5
- package/dist/tanstack-start/index.d.ts +9 -0
- package/dist/tanstack-start/index.d.ts.map +1 -0
- package/dist/tanstack-start/index.js +29 -0
- package/dist/testing/index.d.ts +93 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +156 -0
- package/package.json +35 -14
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sign-in providers a Gateway can offer beside passwords ("Continue
|
|
3
|
+
* with Google"), as data: what each one is called, the Worker secrets it
|
|
4
|
+
* reads, where the OAuth app is made, the scopes asked for and which claim
|
|
5
|
+
* becomes the email. One catalog serves the Gateway (which providers are
|
|
6
|
+
* on, the sign-in page's buttons, Manage workspace → Sign-in), the CLI
|
|
7
|
+
* (`everyapp signin add|list|show|remove`, `secret set`), the manifest
|
|
8
|
+
* validator (an app's own secret can never take one of these names) and
|
|
9
|
+
* the docs' drift tests.
|
|
10
|
+
*
|
|
11
|
+
* Naming rule, agreed with the provider registry's conventions
|
|
12
|
+
* (docs/design/2026-10-provider-registry.md, section 6): a sign-in
|
|
13
|
+
* provider's settings are `<ID>_SIGNIN_<FIELD>`, with FIELD one of
|
|
14
|
+
* CLIENT_ID, CLIENT_SECRET, ISSUER, LABEL or TENANT. The `_SIGNIN_` infix is
|
|
15
|
+
* what keeps the family apart from the API providers' `<ID>_API_KEY`,
|
|
16
|
+
* `<ID>_CLIENT_ID` (the OAuth clients the Gateway holds for apps) and the
|
|
17
|
+
* MCP apps' `<ID>_MCP_TOKEN`: `GOOGLE_SIGNIN_CLIENT_ID` is the sign-in
|
|
18
|
+
* provider's, `GOOGLE_WORKSPACE_CLIENT_ID` the OAuth client apps use, and
|
|
19
|
+
* a registered provider row or an app manifest can never claim a name in
|
|
20
|
+
* the family (isSignInSettingName).
|
|
21
|
+
*
|
|
22
|
+
* The settings are Worker secrets, set under the Cloudflare login (`everyapp
|
|
23
|
+
* signin add`, or `secret set`), never from the admin UI or an agent
|
|
24
|
+
* connection: a stolen session can't add a way in.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SIGN_IN_PROVIDER_IDS: readonly ["google", "microsoft", "github", "apple", "cloudflare", "oidc"];
|
|
27
|
+
export type SignInProviderId = (typeof SIGN_IN_PROVIDER_IDS)[number];
|
|
28
|
+
/** What a setting of a sign-in provider holds. */
|
|
29
|
+
export type SignInSettingRole = "clientId" | "clientSecret" | "issuer" | "label" | "tenant";
|
|
30
|
+
export interface SignInSetting {
|
|
31
|
+
/** `GOOGLE_SIGNIN_CLIENT_ID`. */
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly role: SignInSettingRole;
|
|
34
|
+
/** Without it the provider is off (an incomplete set is reported). */
|
|
35
|
+
readonly required: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* A plain value (an id, a URL, a word) `everyapp secret set` may show as
|
|
38
|
+
* typed; a credential stays hidden.
|
|
39
|
+
*/
|
|
40
|
+
readonly plain: boolean;
|
|
41
|
+
/** One line: what to paste here. */
|
|
42
|
+
readonly what: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SignInProvider {
|
|
45
|
+
readonly id: SignInProviderId;
|
|
46
|
+
/** The button: "Continue with <label>". The `oidc` entry's label is a setting. */
|
|
47
|
+
readonly label: string;
|
|
48
|
+
/** Where the OAuth app is created. */
|
|
49
|
+
readonly console: string;
|
|
50
|
+
/** What the OAuth app is called there ("OAuth client ID", "App registration"). */
|
|
51
|
+
readonly appNoun: string;
|
|
52
|
+
readonly settings: readonly SignInSetting[];
|
|
53
|
+
/** The scopes requested: identity only, nothing an app could act with. */
|
|
54
|
+
readonly scopes: readonly string[];
|
|
55
|
+
/** Which claim becomes the email, and what makes it count as verified. */
|
|
56
|
+
readonly emailClaim: string;
|
|
57
|
+
/** The everyapp skill's setup guide, relative to the skill. */
|
|
58
|
+
readonly setup: `setup/signin-${SignInProviderId}.md`;
|
|
59
|
+
/** Caveats worth a line in every listing. */
|
|
60
|
+
readonly notes: readonly string[];
|
|
61
|
+
}
|
|
62
|
+
/** The path Better Auth serves the provider's callback on, under the Gateway's URL. */
|
|
63
|
+
export declare function signInCallbackPath(id: SignInProviderId): string;
|
|
64
|
+
/** The redirect URL to register with the provider, for a Gateway at `gatewayUrl`. */
|
|
65
|
+
export declare function signInCallbackUrl(gatewayUrl: string, id: SignInProviderId): string;
|
|
66
|
+
export declare const SIGN_IN_PROVIDERS: Readonly<Record<SignInProviderId, SignInProvider>>;
|
|
67
|
+
/** The catalog in listing order. */
|
|
68
|
+
export declare const SIGN_IN_PROVIDER_LIST: readonly SignInProvider[];
|
|
69
|
+
export declare function isSignInProviderId(value: string): value is SignInProviderId;
|
|
70
|
+
/**
|
|
71
|
+
* Every setting a sign-in provider reads, in catalog order: what `everyapp
|
|
72
|
+
* secret set` accepts for the Gateway, and what the Gateway's dev config
|
|
73
|
+
* declares.
|
|
74
|
+
*/
|
|
75
|
+
export declare const SIGN_IN_GATEWAY_SETTINGS: readonly string[];
|
|
76
|
+
/** The plain (non-credential) ones among them: ids, the issuer, the label, the tenant. */
|
|
77
|
+
export declare const PLAIN_SIGN_IN_SETTINGS: readonly string[];
|
|
78
|
+
/**
|
|
79
|
+
* The family: any name of the shape `<ID>_SIGNIN_<FIELD>`. Reserved for the
|
|
80
|
+
* catalog above, whether or not an entry reads the name today, so no
|
|
81
|
+
* registered provider row and no app manifest can ever take one.
|
|
82
|
+
*/
|
|
83
|
+
export declare const SIGN_IN_SETTING_PATTERN: RegExp;
|
|
84
|
+
export declare function isSignInSettingName(name: string): boolean;
|
|
85
|
+
/** The provider a setting belongs to, if one reads it. */
|
|
86
|
+
export declare function signInProviderOfSetting(name: string): SignInProvider | null;
|
|
87
|
+
/** Whether a provider is on, off, or half set up, from which names are set. */
|
|
88
|
+
export type SignInProviderStatus = "on" | "off" | "incomplete";
|
|
89
|
+
export interface SignInProviderState {
|
|
90
|
+
readonly id: SignInProviderId;
|
|
91
|
+
readonly status: SignInProviderStatus;
|
|
92
|
+
/** The required settings not set (empty when on or off). */
|
|
93
|
+
readonly missing: readonly string[];
|
|
94
|
+
/** The settings set, required or not. */
|
|
95
|
+
readonly set: readonly string[];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* A provider's state from which of its settings exist: on when every
|
|
99
|
+
* required one is set, off when none at all is, incomplete in between (the
|
|
100
|
+
* Gateway refuses to half-configure a sign-in: the provider is off and the
|
|
101
|
+
* problem is reported).
|
|
102
|
+
*/
|
|
103
|
+
export declare function signInProviderState(provider: SignInProvider, isSet: (name: string) => boolean): SignInProviderState;
|
|
104
|
+
//# sourceMappingURL=signInProviders.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAC/B,mBAAmB,CAiBrB"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The sign-in providers a Gateway can offer beside passwords ("Continue
|
|
3
|
+
* with Google"), as data: what each one is called, the Worker secrets it
|
|
4
|
+
* reads, where the OAuth app is made, the scopes asked for and which claim
|
|
5
|
+
* becomes the email. One catalog serves the Gateway (which providers are
|
|
6
|
+
* on, the sign-in page's buttons, Manage workspace → Sign-in), the CLI
|
|
7
|
+
* (`everyapp signin add|list|show|remove`, `secret set`), the manifest
|
|
8
|
+
* validator (an app's own secret can never take one of these names) and
|
|
9
|
+
* the docs' drift tests.
|
|
10
|
+
*
|
|
11
|
+
* Naming rule, agreed with the provider registry's conventions
|
|
12
|
+
* (docs/design/2026-10-provider-registry.md, section 6): a sign-in
|
|
13
|
+
* provider's settings are `<ID>_SIGNIN_<FIELD>`, with FIELD one of
|
|
14
|
+
* CLIENT_ID, CLIENT_SECRET, ISSUER, LABEL or TENANT. The `_SIGNIN_` infix is
|
|
15
|
+
* what keeps the family apart from the API providers' `<ID>_API_KEY`,
|
|
16
|
+
* `<ID>_CLIENT_ID` (the OAuth clients the Gateway holds for apps) and the
|
|
17
|
+
* MCP apps' `<ID>_MCP_TOKEN`: `GOOGLE_SIGNIN_CLIENT_ID` is the sign-in
|
|
18
|
+
* provider's, `GOOGLE_WORKSPACE_CLIENT_ID` the OAuth client apps use, and
|
|
19
|
+
* a registered provider row or an app manifest can never claim a name in
|
|
20
|
+
* the family (isSignInSettingName).
|
|
21
|
+
*
|
|
22
|
+
* The settings are Worker secrets, set under the Cloudflare login (`everyapp
|
|
23
|
+
* signin add`, or `secret set`), never from the admin UI or an agent
|
|
24
|
+
* connection: a stolen session can't add a way in.
|
|
25
|
+
*/
|
|
26
|
+
export const SIGN_IN_PROVIDER_IDS = [
|
|
27
|
+
"google",
|
|
28
|
+
"microsoft",
|
|
29
|
+
"github",
|
|
30
|
+
"apple",
|
|
31
|
+
"cloudflare",
|
|
32
|
+
"oidc",
|
|
33
|
+
];
|
|
34
|
+
/** The path Better Auth serves the provider's callback on, under the Gateway's URL. */
|
|
35
|
+
export function signInCallbackPath(id) {
|
|
36
|
+
return `/api/auth/callback/${id}`;
|
|
37
|
+
}
|
|
38
|
+
/** The redirect URL to register with the provider, for a Gateway at `gatewayUrl`. */
|
|
39
|
+
export function signInCallbackUrl(gatewayUrl, id) {
|
|
40
|
+
return `${gatewayUrl.replace(/\/+$/, "")}${signInCallbackPath(id)}`;
|
|
41
|
+
}
|
|
42
|
+
function settingName(id, field) {
|
|
43
|
+
return `${id.toUpperCase()}_SIGNIN_${field}`;
|
|
44
|
+
}
|
|
45
|
+
function clientPair(id, what) {
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
name: settingName(id, "CLIENT_ID"),
|
|
49
|
+
role: "clientId",
|
|
50
|
+
required: true,
|
|
51
|
+
plain: true,
|
|
52
|
+
what: what.clientId,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: settingName(id, "CLIENT_SECRET"),
|
|
56
|
+
role: "clientSecret",
|
|
57
|
+
required: true,
|
|
58
|
+
plain: false,
|
|
59
|
+
what: what.clientSecret,
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
}
|
|
63
|
+
const IDENTITY_SCOPES = ["openid", "email", "profile"];
|
|
64
|
+
export const SIGN_IN_PROVIDERS = {
|
|
65
|
+
google: {
|
|
66
|
+
id: "google",
|
|
67
|
+
label: "Google",
|
|
68
|
+
console: "https://console.cloud.google.com/apis/credentials",
|
|
69
|
+
appNoun: "OAuth client ID (Web application)",
|
|
70
|
+
settings: clientPair("google", {
|
|
71
|
+
clientId: "The OAuth client's Client ID (ends in .apps.googleusercontent.com)",
|
|
72
|
+
clientSecret: "The OAuth client's Client secret",
|
|
73
|
+
}),
|
|
74
|
+
scopes: IDENTITY_SCOPES,
|
|
75
|
+
emailClaim: "the ID token's `email`, counted as verified only when its `email_verified` is true (every Google account's own address is)",
|
|
76
|
+
setup: "setup/signin-google.md",
|
|
77
|
+
notes: [
|
|
78
|
+
"An OAuth consent screen still in Testing only signs in the test users listed on it; publish it for everyone else.",
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
microsoft: {
|
|
82
|
+
id: "microsoft",
|
|
83
|
+
label: "Microsoft",
|
|
84
|
+
console: "https://entra.microsoft.com/#view/Microsoft_AAD_RegisteredApps/ApplicationsListBlade",
|
|
85
|
+
appNoun: "App registration",
|
|
86
|
+
settings: [
|
|
87
|
+
...clientPair("microsoft", {
|
|
88
|
+
clientId: "The app registration's Application (client) ID",
|
|
89
|
+
clientSecret: "A client secret from Certificates & secrets (it expires; 24 months at most)",
|
|
90
|
+
}),
|
|
91
|
+
{
|
|
92
|
+
name: settingName("microsoft", "TENANT"),
|
|
93
|
+
role: "tenant",
|
|
94
|
+
required: false,
|
|
95
|
+
plain: true,
|
|
96
|
+
what: "The Directory (tenant) ID to pin sign-in to your own directory; unset means any Microsoft account (common), which then needs the xms_edov claim",
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
scopes: IDENTITY_SCOPES,
|
|
100
|
+
emailClaim: "the ID token's `email`, counted as verified when MICROSOFT_SIGNIN_TENANT pins your own directory, or the token carries `xms_edov: true` (the optional claim that says the domain's owner verified it), `email_verified: true`, a matching `verified_primary_email`, or comes from a personal Microsoft account",
|
|
101
|
+
setup: "setup/signin-microsoft.md",
|
|
102
|
+
notes: [
|
|
103
|
+
"Without MICROSOFT_SIGNIN_TENANT, add the optional claims `email` and `xms_edov` under Token configuration, or every sign-in is refused as unverified: any tenant's admin can put any address on their users.",
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
github: {
|
|
107
|
+
id: "github",
|
|
108
|
+
label: "GitHub",
|
|
109
|
+
console: "https://github.com/settings/developers",
|
|
110
|
+
appNoun: "OAuth App",
|
|
111
|
+
settings: clientPair("github", {
|
|
112
|
+
clientId: "The OAuth App's Client ID",
|
|
113
|
+
clientSecret: "A client secret generated on the OAuth App",
|
|
114
|
+
}),
|
|
115
|
+
scopes: ["read:user", "user:email"],
|
|
116
|
+
emailClaim: "the primary address from GitHub's emails API, counted as verified only when GitHub marks it verified",
|
|
117
|
+
setup: "setup/signin-github.md",
|
|
118
|
+
notes: [
|
|
119
|
+
"GitHub Apps are something else: make an OAuth App (Settings → Developer settings → OAuth Apps).",
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
apple: {
|
|
123
|
+
id: "apple",
|
|
124
|
+
label: "Apple",
|
|
125
|
+
console: "https://developer.apple.com/account/resources/identifiers/list/serviceId",
|
|
126
|
+
appNoun: "Services ID",
|
|
127
|
+
settings: clientPair("apple", {
|
|
128
|
+
clientId: "The Services ID's identifier (com.example.gateway)",
|
|
129
|
+
clientSecret: "The client secret JWT you generate from your Sign in with Apple key (ES256; valid six months at most, then generate it again)",
|
|
130
|
+
}),
|
|
131
|
+
scopes: ["email", "name"],
|
|
132
|
+
emailClaim: "the ID token's `email`, counted as verified only when its `email_verified` is true; someone who chose Hide My Email arrives as a @privaterelay.appleid.com address, which no invitation names",
|
|
133
|
+
setup: "setup/signin-apple.md",
|
|
134
|
+
notes: [
|
|
135
|
+
"Apple returns to the Gateway with a POST; behind the outer ring, `everyapp access on` leaves /api/auth/callback/apple public (it only redirects to the same URL as a GET, which Access then checks).",
|
|
136
|
+
"The client secret is a JWT that expires within six months: generate a new one before then or sign-in stops.",
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
cloudflare: {
|
|
140
|
+
id: "cloudflare",
|
|
141
|
+
label: "Cloudflare",
|
|
142
|
+
console: "https://dash.cloudflare.com/?to=/:account/oauth-clients",
|
|
143
|
+
appNoun: "OAuth client (Manage Account → OAuth clients)",
|
|
144
|
+
settings: clientPair("cloudflare", {
|
|
145
|
+
clientId: "The OAuth client's Client ID",
|
|
146
|
+
clientSecret: "The OAuth client's Client secret",
|
|
147
|
+
}),
|
|
148
|
+
scopes: ["user-details.read"],
|
|
149
|
+
emailClaim: "the Cloudflare API's /user `email` (the account's sign-in address). Cloudflare reports no verified flag, so the email counts as verified on the strength of the client being private: only members of your Cloudflare account can authorize it, and they got in by accepting an invitation sent to that address",
|
|
150
|
+
setup: "setup/signin-cloudflare.md",
|
|
151
|
+
notes: [
|
|
152
|
+
"Keep the client private (the default): a public client lets any Cloudflare user sign in, and Cloudflare says nothing about whether their address is verified. Making a client public is permanent.",
|
|
153
|
+
"The Cloudflare account's members sign in; for everyone else use Cloudflare Access's one-time PIN (`everyapp access on`) or another provider.",
|
|
154
|
+
],
|
|
155
|
+
},
|
|
156
|
+
oidc: {
|
|
157
|
+
id: "oidc",
|
|
158
|
+
label: "SSO",
|
|
159
|
+
console: "your identity provider's admin console",
|
|
160
|
+
appNoun: "OpenID Connect client (web application, authorization code)",
|
|
161
|
+
settings: [
|
|
162
|
+
{
|
|
163
|
+
name: settingName("oidc", "ISSUER"),
|
|
164
|
+
role: "issuer",
|
|
165
|
+
required: true,
|
|
166
|
+
plain: true,
|
|
167
|
+
what: "The issuer URL (https://…), which serves /.well-known/openid-configuration",
|
|
168
|
+
},
|
|
169
|
+
...clientPair("oidc", {
|
|
170
|
+
clientId: "The client ID",
|
|
171
|
+
clientSecret: "The client secret",
|
|
172
|
+
}),
|
|
173
|
+
{
|
|
174
|
+
name: settingName("oidc", "LABEL"),
|
|
175
|
+
role: "label",
|
|
176
|
+
required: false,
|
|
177
|
+
plain: true,
|
|
178
|
+
what: 'The button text after "Continue with" (default "SSO")',
|
|
179
|
+
},
|
|
180
|
+
],
|
|
181
|
+
scopes: IDENTITY_SCOPES,
|
|
182
|
+
emailClaim: "the ID token's `email` (else the userinfo endpoint's), counted as verified only when `email_verified` is true",
|
|
183
|
+
setup: "setup/signin-oidc.md",
|
|
184
|
+
notes: [
|
|
185
|
+
"Cloudflare Access has its own settings (CLOUDFLARE_ACCESS_OIDC_*, `everyapp access`): use those for Access, this for Okta, Keycloak, Auth0, Authentik, Google Workspace as an OIDC issuer and the like. For Microsoft Entra ID use the `microsoft` provider: Entra's ID tokens carry no `email_verified`, so through this entry every sign-in would be refused as unverified.",
|
|
186
|
+
"ID tokens must be signed with RS256 (every major provider's default).",
|
|
187
|
+
],
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
/** The catalog in listing order. */
|
|
191
|
+
export const SIGN_IN_PROVIDER_LIST = SIGN_IN_PROVIDER_IDS.map((id) => SIGN_IN_PROVIDERS[id]);
|
|
192
|
+
export function isSignInProviderId(value) {
|
|
193
|
+
return SIGN_IN_PROVIDER_IDS.includes(value);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Every setting a sign-in provider reads, in catalog order: what `everyapp
|
|
197
|
+
* secret set` accepts for the Gateway, and what the Gateway's dev config
|
|
198
|
+
* declares.
|
|
199
|
+
*/
|
|
200
|
+
export const SIGN_IN_GATEWAY_SETTINGS = SIGN_IN_PROVIDER_LIST.flatMap((provider) => provider.settings.map((setting) => setting.name));
|
|
201
|
+
/** The plain (non-credential) ones among them: ids, the issuer, the label, the tenant. */
|
|
202
|
+
export const PLAIN_SIGN_IN_SETTINGS = SIGN_IN_PROVIDER_LIST.flatMap((provider) => provider.settings
|
|
203
|
+
.filter((setting) => setting.plain)
|
|
204
|
+
.map((setting) => setting.name));
|
|
205
|
+
/**
|
|
206
|
+
* The family: any name of the shape `<ID>_SIGNIN_<FIELD>`. Reserved for the
|
|
207
|
+
* catalog above, whether or not an entry reads the name today, so no
|
|
208
|
+
* registered provider row and no app manifest can ever take one.
|
|
209
|
+
*/
|
|
210
|
+
export const SIGN_IN_SETTING_PATTERN = /^[A-Z][A-Z0-9_]*_SIGNIN_(CLIENT_ID|CLIENT_SECRET|ISSUER|LABEL|TENANT)$/;
|
|
211
|
+
export function isSignInSettingName(name) {
|
|
212
|
+
return SIGN_IN_SETTING_PATTERN.test(name);
|
|
213
|
+
}
|
|
214
|
+
/** The provider a setting belongs to, if one reads it. */
|
|
215
|
+
export function signInProviderOfSetting(name) {
|
|
216
|
+
for (const provider of SIGN_IN_PROVIDER_LIST) {
|
|
217
|
+
if (provider.settings.some((setting) => setting.name === name)) {
|
|
218
|
+
return provider;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* A provider's state from which of its settings exist: on when every
|
|
225
|
+
* required one is set, off when none at all is, incomplete in between (the
|
|
226
|
+
* Gateway refuses to half-configure a sign-in: the provider is off and the
|
|
227
|
+
* problem is reported).
|
|
228
|
+
*/
|
|
229
|
+
export function signInProviderState(provider, isSet) {
|
|
230
|
+
const set = provider.settings
|
|
231
|
+
.filter((setting) => isSet(setting.name))
|
|
232
|
+
.map((setting) => setting.name);
|
|
233
|
+
const unset = provider.settings
|
|
234
|
+
.filter((setting) => setting.required && !isSet(setting.name))
|
|
235
|
+
.map((setting) => setting.name);
|
|
236
|
+
const status = unset.length === 0 ? "on" : set.length === 0 ? "off" : "incomplete";
|
|
237
|
+
// `missing` names what a half-set provider still needs; a provider nobody
|
|
238
|
+
// started setting up isn't missing anything, it is off.
|
|
239
|
+
return {
|
|
240
|
+
id: provider.id,
|
|
241
|
+
status,
|
|
242
|
+
missing: status === "incomplete" ? unset : [],
|
|
243
|
+
set,
|
|
244
|
+
};
|
|
245
|
+
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The manifest an app author writes as `everyapp.config.ts`, typed:
|
|
3
|
+
*
|
|
4
|
+
* import { defineEveryApp } from "@every-app/sdk";
|
|
5
|
+
*
|
|
6
|
+
* export default defineEveryApp({
|
|
7
|
+
* id: "notes",
|
|
8
|
+
* name: "Notes",
|
|
9
|
+
* resources: { d1: ["DB"] },
|
|
10
|
+
* });
|
|
11
|
+
*
|
|
12
|
+
* Types only, and a leaf module: `cloudflare.config.ts` imports the manifest,
|
|
13
|
+
* and the Cloudflare Vite plugin hides from the Worker every file the config
|
|
14
|
+
* imports. The rules beyond the shape (which ids exist, which names are
|
|
15
|
+
* reserved, which scope sets a provider has) are the CLI's: `everyapp deploy`
|
|
16
|
+
* and `everyapp dev` validate the manifest and say what is wrong. The
|
|
17
|
+
* perimeter's schema (`@every-app/perimeter/manifest`) is held to this type
|
|
18
|
+
* by a test there.
|
|
19
|
+
*
|
|
20
|
+
* The Worker reads the manifest back as `env.EVERYAPP_MANIFEST`, which
|
|
21
|
+
* `everyAppWorker()` sets and `cf workers types` types from the file.
|
|
22
|
+
*/
|
|
23
|
+
/** Why a setting is needed and whether the app opens without it (the settings model). */
|
|
24
|
+
export interface EveryAppSettingNeed {
|
|
25
|
+
/** Why the app needs it, for whoever sets it. At most 200 characters. */
|
|
26
|
+
readonly why?: string;
|
|
27
|
+
/** An https page that says where the key or client comes from. */
|
|
28
|
+
readonly docs?: string;
|
|
29
|
+
/** The app opens without it; the feature using it says what is missing. */
|
|
30
|
+
readonly optional?: boolean;
|
|
31
|
+
/** The group of which one member is enough ("AI model"). */
|
|
32
|
+
readonly anyOf?: string;
|
|
33
|
+
}
|
|
34
|
+
/** A route reachable without a signed-in member. */
|
|
35
|
+
export interface EveryAppPublicRoute {
|
|
36
|
+
/** Absolute glob: `*` matches one segment, `**` one or more. */
|
|
37
|
+
readonly path: string;
|
|
38
|
+
/** The methods it answers; `["GET"]` when left out. */
|
|
39
|
+
readonly methods?: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
/** A Durable Object or Workflow class: its binding, the class, and the helper Worker that defines it. */
|
|
42
|
+
export interface EveryAppClassResource {
|
|
43
|
+
readonly name: string;
|
|
44
|
+
readonly className: string;
|
|
45
|
+
readonly worker?: string;
|
|
46
|
+
}
|
|
47
|
+
/** A Cloudflare Queue's consumer settings. */
|
|
48
|
+
export interface EveryAppQueueConsumer {
|
|
49
|
+
readonly worker?: string;
|
|
50
|
+
readonly maxBatchSize?: number;
|
|
51
|
+
readonly maxBatchTimeout?: number;
|
|
52
|
+
readonly maxRetries?: number;
|
|
53
|
+
readonly maxConcurrency?: number | null;
|
|
54
|
+
readonly retryDelay?: number;
|
|
55
|
+
readonly visibilityTimeoutMs?: number;
|
|
56
|
+
readonly deadLetterQueue?: string;
|
|
57
|
+
}
|
|
58
|
+
/** Cloudflare's limits for one of the app's Workers. */
|
|
59
|
+
export interface EveryAppWorkerLimits {
|
|
60
|
+
/** CPU milliseconds an invocation may use, up to 300000. */
|
|
61
|
+
readonly cpuMs?: number;
|
|
62
|
+
}
|
|
63
|
+
/** The Cloudflare resources the app's Workers bind; the deploy creates them. */
|
|
64
|
+
export interface EveryAppResources {
|
|
65
|
+
readonly d1?: readonly string[];
|
|
66
|
+
readonly kv?: readonly string[];
|
|
67
|
+
readonly r2?: readonly string[];
|
|
68
|
+
readonly durableObjects?: readonly EveryAppClassResource[];
|
|
69
|
+
readonly workflows?: readonly EveryAppClassResource[];
|
|
70
|
+
readonly hyperdrive?: readonly {
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly worker?: string;
|
|
73
|
+
readonly caching?: "off" | "default";
|
|
74
|
+
}[];
|
|
75
|
+
readonly queues?: readonly {
|
|
76
|
+
readonly name: string;
|
|
77
|
+
readonly consumer?: true | EveryAppQueueConsumer;
|
|
78
|
+
}[];
|
|
79
|
+
readonly ai?: readonly string[];
|
|
80
|
+
readonly browser?: readonly string[];
|
|
81
|
+
readonly images?: readonly string[];
|
|
82
|
+
readonly vectorize?: readonly {
|
|
83
|
+
readonly name: string;
|
|
84
|
+
readonly dimensions?: number;
|
|
85
|
+
readonly metric?: "cosine" | "euclidean" | "dot-product";
|
|
86
|
+
/** A Workers AI embedding model's shape, instead of `dimensions` and `metric`. */
|
|
87
|
+
readonly preset?: "@cf/baai/bge-small-en-v1.5" | "@cf/baai/bge-base-en-v1.5" | "@cf/baai/bge-large-en-v1.5" | "openai/text-embedding-ada-002" | "cohere/embed-multilingual-v2.0";
|
|
88
|
+
}[];
|
|
89
|
+
readonly aiGateway?: readonly {
|
|
90
|
+
readonly name: string;
|
|
91
|
+
readonly collectLogs?: boolean;
|
|
92
|
+
readonly cacheTtl?: number;
|
|
93
|
+
}[];
|
|
94
|
+
readonly sendEmail?: readonly {
|
|
95
|
+
readonly name: string;
|
|
96
|
+
readonly allowedSenderAddresses: readonly string[];
|
|
97
|
+
readonly destinationAddress?: string;
|
|
98
|
+
readonly allowedDestinationAddresses?: readonly string[];
|
|
99
|
+
}[];
|
|
100
|
+
readonly secretsStore?: readonly {
|
|
101
|
+
readonly name: string;
|
|
102
|
+
}[];
|
|
103
|
+
readonly analyticsEngine?: readonly {
|
|
104
|
+
readonly name: string;
|
|
105
|
+
readonly dataset?: string;
|
|
106
|
+
}[];
|
|
107
|
+
}
|
|
108
|
+
/** One capability the Gateway serves the app with keys it holds. */
|
|
109
|
+
export interface EveryAppCapabilityEntry extends EveryAppSettingNeed {
|
|
110
|
+
readonly access: "read" | "write";
|
|
111
|
+
/** An OAuth client's scope sets, by name (`["gmail.read"]`). */
|
|
112
|
+
readonly scopes?: readonly string[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* One of the app's plain settings: a value that isn't a secret and
|
|
116
|
+
* differs per install (a PostHog host, a region), set with `everyapp
|
|
117
|
+
* configure <app>` and read from `env`.
|
|
118
|
+
*/
|
|
119
|
+
export interface EveryAppSettingEntry {
|
|
120
|
+
readonly name: string;
|
|
121
|
+
/** Why the app needs it: what whoever installs the app reads. */
|
|
122
|
+
readonly why: string;
|
|
123
|
+
readonly docs?: string;
|
|
124
|
+
readonly optional?: boolean;
|
|
125
|
+
/** What it takes; text when not given. */
|
|
126
|
+
readonly type?: "text" | "url" | "number" | "boolean";
|
|
127
|
+
/** The values a text setting may take. */
|
|
128
|
+
readonly values?: readonly string[];
|
|
129
|
+
/** What the app reads while nobody has set it; the deploy writes it. */
|
|
130
|
+
readonly default?: string;
|
|
131
|
+
}
|
|
132
|
+
/** One of the app's own secrets, with its need. */
|
|
133
|
+
export interface EveryAppSecretEntry extends EveryAppSettingNeed {
|
|
134
|
+
readonly name: string;
|
|
135
|
+
/** Its guide in the everyapp skill (`"setup/main-secret.md"`). */
|
|
136
|
+
readonly setup?: string;
|
|
137
|
+
}
|
|
138
|
+
/** `everyapp.config.ts`. */
|
|
139
|
+
export interface EveryAppManifest {
|
|
140
|
+
/** Stable id, kebab-case: the app's hostname and Worker. */
|
|
141
|
+
readonly id: string;
|
|
142
|
+
readonly name?: string;
|
|
143
|
+
/** The one line the Gateway's app library shows under the name. */
|
|
144
|
+
readonly description?: string;
|
|
145
|
+
/** The path of an SVG the app serves (`"/everyapp-icon.svg"`). */
|
|
146
|
+
readonly icon?: string;
|
|
147
|
+
/** Legacy: the entry comes from `cloudflare.config.ts`. */
|
|
148
|
+
readonly main?: string;
|
|
149
|
+
/** YYYY-MM-DD. */
|
|
150
|
+
readonly compatibilityDate?: string;
|
|
151
|
+
readonly resources?: EveryAppResources;
|
|
152
|
+
/** Helper Workers deployed beside the app's as `<app worker>--<name>`. */
|
|
153
|
+
readonly workers?: readonly {
|
|
154
|
+
readonly name: string;
|
|
155
|
+
readonly binding?: string;
|
|
156
|
+
readonly limits?: EveryAppWorkerLimits;
|
|
157
|
+
}[];
|
|
158
|
+
readonly database?: {
|
|
159
|
+
readonly provider: "d1" | "postgres";
|
|
160
|
+
/** A cloud region such as `"aws:us-east-1"`. */
|
|
161
|
+
readonly region?: string;
|
|
162
|
+
};
|
|
163
|
+
readonly limits?: EveryAppWorkerLimits;
|
|
164
|
+
/** Routes open without a signed-in member. Default: none. */
|
|
165
|
+
readonly public?: readonly EveryAppPublicRoute[];
|
|
166
|
+
/**
|
|
167
|
+
* Static files of the asset bundle anyone may fetch (favicons, icons, an
|
|
168
|
+
* OG image): path patterns, GET and HEAD, never Worker code.
|
|
169
|
+
*/
|
|
170
|
+
readonly publicAssets?: readonly string[];
|
|
171
|
+
/**
|
|
172
|
+
* Routes a bearer client (a native app, a script with a personal token)
|
|
173
|
+
* reaches with its token only: `paths` in `public`'s glob syntax, every
|
|
174
|
+
* method, and `why` the app needs them, shown to the operator. The
|
|
175
|
+
* Gateway answers 401 to a request carrying its session cookie there,
|
|
176
|
+
* and `everyapp access on` lets these paths through Cloudflare Access.
|
|
177
|
+
* Default: none.
|
|
178
|
+
*/
|
|
179
|
+
readonly bearerRoutes?: {
|
|
180
|
+
readonly paths: readonly string[];
|
|
181
|
+
readonly why: string;
|
|
182
|
+
};
|
|
183
|
+
/** AI providers the Gateway calls for the app, by id or with their need. */
|
|
184
|
+
readonly providers?: readonly (string | (EveryAppSettingNeed & {
|
|
185
|
+
readonly id: string;
|
|
186
|
+
}))[];
|
|
187
|
+
/** Capabilities by id (`members`, `email`, `dataforseo`, …). */
|
|
188
|
+
readonly capabilities?: {
|
|
189
|
+
readonly [id: string]: EveryAppCapabilityEntry;
|
|
190
|
+
};
|
|
191
|
+
/** The app's own secrets, by name or with their need. */
|
|
192
|
+
readonly secrets?: readonly (string | EveryAppSecretEntry)[];
|
|
193
|
+
/** The app's plain settings: per-install values that aren't secrets. */
|
|
194
|
+
readonly settings?: readonly EveryAppSettingEntry[];
|
|
195
|
+
readonly ai?: {
|
|
196
|
+
/** Model ids the app may request; any other is `model_not_allowed`. */
|
|
197
|
+
readonly models?: readonly string[];
|
|
198
|
+
/** OpenAI API paths beyond inference (`"/v1/files"`). */
|
|
199
|
+
readonly routes?: readonly string[];
|
|
200
|
+
/** The app takes the Gateway's default chat model (`ai()`). */
|
|
201
|
+
readonly chat?: boolean | EveryAppSettingNeed;
|
|
202
|
+
};
|
|
203
|
+
/** `inbound: true`: the Worker exports an `email()` handler. */
|
|
204
|
+
readonly email?: {
|
|
205
|
+
readonly inbound?: boolean;
|
|
206
|
+
};
|
|
207
|
+
/** Who can open the app once registered; `"admins"` by default. */
|
|
208
|
+
readonly access?: "everyone" | "admins";
|
|
209
|
+
readonly serverFnGuard?: boolean;
|
|
210
|
+
readonly serverFnBase?: string;
|
|
211
|
+
/** Shell command that builds the app; `cf build` by default. */
|
|
212
|
+
readonly build?: string;
|
|
213
|
+
/** Shell command `everyapp dev` starts; it must listen on PORT. */
|
|
214
|
+
readonly dev?: string;
|
|
215
|
+
/** Legacy: the port comes from PORT. */
|
|
216
|
+
readonly devPort?: number;
|
|
217
|
+
/** Dependency install command; false skips it. */
|
|
218
|
+
readonly install?: false | string;
|
|
219
|
+
readonly migrations?: {
|
|
220
|
+
readonly engine: "drizzle" | "d1-sql" | "prisma";
|
|
221
|
+
readonly dialect?: "sqlite" | "postgresql";
|
|
222
|
+
readonly dir?: string;
|
|
223
|
+
readonly config?: string;
|
|
224
|
+
readonly binding?: string;
|
|
225
|
+
};
|
|
226
|
+
/** Who answers `/mcp` on the app's own host, and why it needs to. */
|
|
227
|
+
readonly mcp?: {
|
|
228
|
+
readonly by: "gateway" | "app";
|
|
229
|
+
readonly why: string;
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Type `everyapp.config.ts` without widening it: the literal binding names
|
|
234
|
+
* stay, so `everyAppWorker()` types `env.DB` and `env.EVERYAPP_MANIFEST`
|
|
235
|
+
* from them. Returns the manifest as given.
|
|
236
|
+
*/
|
|
237
|
+
export declare function defineEveryApp<const M extends EveryAppManifest>(manifest: M): M;
|
|
238
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,yFAAyF;AACzF,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oDAAo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EAAmE;IACnE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,wCAAwC;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,kDAAkD;IAClD,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACpB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;QACjD,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;QAC3C,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,qEAAqE;IACrE,QAAQ,CAAC,GAAG,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,EAAE,SAAS,GAAG,KAAK,CAAC;QAAC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACzE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,gBAAgB,EAC7D,QAAQ,EAAE,CAAC,GACV,CAAC,CAEH"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The manifest an app author writes as `everyapp.config.ts`, typed:
|
|
3
|
+
*
|
|
4
|
+
* import { defineEveryApp } from "@every-app/sdk";
|
|
5
|
+
*
|
|
6
|
+
* export default defineEveryApp({
|
|
7
|
+
* id: "notes",
|
|
8
|
+
* name: "Notes",
|
|
9
|
+
* resources: { d1: ["DB"] },
|
|
10
|
+
* });
|
|
11
|
+
*
|
|
12
|
+
* Types only, and a leaf module: `cloudflare.config.ts` imports the manifest,
|
|
13
|
+
* and the Cloudflare Vite plugin hides from the Worker every file the config
|
|
14
|
+
* imports. The rules beyond the shape (which ids exist, which names are
|
|
15
|
+
* reserved, which scope sets a provider has) are the CLI's: `everyapp deploy`
|
|
16
|
+
* and `everyapp dev` validate the manifest and say what is wrong. The
|
|
17
|
+
* perimeter's schema (`@every-app/perimeter/manifest`) is held to this type
|
|
18
|
+
* by a test there.
|
|
19
|
+
*
|
|
20
|
+
* The Worker reads the manifest back as `env.EVERYAPP_MANIFEST`, which
|
|
21
|
+
* `everyAppWorker()` sets and `cf workers types` types from the file.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Type `everyapp.config.ts` without widening it: the literal binding names
|
|
25
|
+
* stay, so `everyAppWorker()` types `env.DB` and `env.EVERYAPP_MANIFEST`
|
|
26
|
+
* from them. Returns the manifest as given.
|
|
27
|
+
*/
|
|
28
|
+
export function defineEveryApp(manifest) {
|
|
29
|
+
return manifest;
|
|
30
|
+
}
|