@every-app/sdk 0.3.0-rc.2 → 0.3.0-rc.4
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 +1 -1
- package/dist/cloudflare/index.d.ts +2 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +1 -1
- package/dist/cloudflare/sentinel.d.ts +57 -2
- package/dist/cloudflare/sentinel.d.ts.map +1 -1
- package/dist/cloudflare/sentinel.js +27 -2
- package/dist/cloudflare/worker.d.ts +297 -5
- package/dist/cloudflare/worker.d.ts.map +1 -1
- package/dist/cloudflare/worker.js +279 -12
- 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/internal/aiDefault.d.ts +141 -0
- package/dist/internal/aiDefault.d.ts.map +1 -0
- package/dist/internal/aiDefault.js +204 -0
- package/dist/internal/aiProviders.d.ts +4 -1
- package/dist/internal/aiProviders.d.ts.map +1 -1
- package/dist/internal/aiProviders.js +5 -1
- package/dist/internal/appSettings.d.ts +20 -2
- package/dist/internal/appSettings.d.ts.map +1 -1
- package/dist/internal/appSettings.js +53 -7
- 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 +276 -7
- package/dist/internal/capabilities.d.ts.map +1 -1
- package/dist/internal/capabilities.js +111 -0
- package/dist/internal/catalog/index.d.ts +39 -2
- package/dist/internal/catalog/index.d.ts.map +1 -1
- package/dist/internal/catalog/inference.d.ts +39 -2
- package/dist/internal/catalog/inference.d.ts.map +1 -1
- package/dist/internal/catalog/inference.js +36 -4
- 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 +42 -4
- package/dist/internal/identity.d.ts +29 -3
- package/dist/internal/identity.d.ts.map +1 -1
- package/dist/internal/identity.js +37 -9
- package/dist/internal/index.d.ts +5 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +5 -1
- package/dist/internal/members.d.ts +3 -2
- package/dist/internal/members.d.ts.map +1 -1
- package/dist/internal/oauthPresets.d.ts +29 -0
- package/dist/internal/oauthPresets.d.ts.map +1 -0
- package/dist/internal/oauthPresets.js +534 -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 +59 -0
- package/dist/internal/oauthSpec.d.ts.map +1 -0
- package/dist/internal/oauthSpec.js +676 -0
- package/dist/internal/protocol.d.ts +36 -1
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +30 -1
- package/dist/internal/providerRegistry.d.ts +17 -6
- package/dist/internal/providerRegistry.d.ts.map +1 -1
- package/dist/internal/providerRegistry.js +47 -2
- package/dist/internal/providerSpec.d.ts +11 -7
- package/dist/internal/providerSpec.d.ts.map +1 -1
- package/dist/internal/providerSpec.js +134 -37
- package/dist/internal/signInProviders.d.ts.map +1 -1
- package/dist/internal/signInProviders.js +11 -4
- package/dist/server/ai.d.ts +45 -0
- package/dist/server/ai.d.ts.map +1 -0
- package/dist/server/ai.js +40 -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/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/emit.d.ts +1 -1
- package/dist/server/emit.d.ts.map +1 -1
- package/dist/server/emit.js +4 -4
- 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 +8 -6
- package/dist/server/gatewayFetch.d.ts.map +1 -1
- package/dist/server/gatewayFetch.js +78 -11
- package/dist/server/index.d.ts +7 -3
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +6 -2
- package/dist/server/integrationFetch.d.ts +55 -8
- package/dist/server/integrationFetch.d.ts.map +1 -1
- package/dist/server/integrationFetch.js +198 -18
- package/dist/server/listMembers.d.ts +1 -1
- package/dist/server/listMembers.d.ts.map +1 -1
- package/dist/server/listMembers.js +5 -8
- package/dist/server/sendEmail.d.ts +1 -1
- package/dist/server/sendEmail.d.ts.map +1 -1
- package/dist/server/sendEmail.js +4 -4
- package/dist/server/toolsEndpoint.d.ts.map +1 -1
- package/dist/server/toolsEndpoint.js +11 -5
- package/package.json +13 -14
- package/LICENSE +0 -21
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @every-app/sdk
|
|
2
2
|
|
|
3
|
-
The embedded SDK for building apps on the
|
|
3
|
+
The embedded SDK for building apps on the EveryApp platform.
|
|
4
4
|
|
|
5
5
|
It verifies the identity the Gateway injects, defines the app's Worker and its agent tools, and reaches the Gateway's AI, email and integrations. There is no client-side export.
|
|
6
6
|
|
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
* `/internal` would break `cf dev` wherever the SDK is linked from source.
|
|
18
18
|
* (The dev keypair it hands the dev Worker is a leaf the Worker never loads.)
|
|
19
19
|
*/
|
|
20
|
-
export { EVERYAPP_OBSERVABILITY, everyAppAuxiliaryWorker, everyAppWorker, helperWorkerName, localD1Id, localD1Path, workflowNameFor, type AiBinding, type D1Binding, type DurableObjectBinding, type DurableObjectExport, type EveryAppAuxiliaryWorkerConfig, type EveryAppAuxiliaryWorkerOptions, type EveryAppBinding, type EveryAppConfigContext, type EveryAppDeployEnv, type EveryAppDevEnv, type EveryAppExports, type EveryAppObservability, type EveryAppPlacement, type EveryAppWorkerConfig, type EveryAppWorkerManifest, type EveryAppWorkerOptions, type EveryAppWorkerReference, type GatewayBinding, type HyperdriveBinding, type KvBinding, type SecretBinding, type ServiceBinding, type TextBinding, type VersionMetadataBinding, type WorkflowBinding, type WorkflowExport, } from "./worker.js";
|
|
21
|
-
export { BUILD_SENTINEL, resourceSentinel, sentinelDeployTarget, type EveryAppDeployTarget, } from "./sentinel.js";
|
|
20
|
+
export { EVERYAPP_OBSERVABILITY, everyAppAuxiliaryWorker, everyAppWorker, helperWorkerName, localD1Id, localD1Path, workflowNameFor, type AiBinding, type AnalyticsEngineDatasetBinding, type BrowserBinding, type AiGatewayBinding, type D1Binding, type DurableObjectBinding, type DurableObjectExport, type EveryAppAuxiliaryWorkerConfig, type EveryAppAuxiliaryWorkerOptions, type EveryAppBinding, type EveryAppConfigContext, type EveryAppDeployEnv, type EveryAppDevEnv, type EveryAppExports, type EveryAppObservability, type EveryAppPlacement, type EveryAppTrigger, type EveryAppWorkerConfig, type EveryAppWorkerManifest, type EveryAppWorkerOptions, type EveryAppWorkerReference, type GatewayBinding, type HyperdriveBinding, type ImagesBinding, type JsonBinding, type KvBinding, type QueueBinding, type QueueConsumerTrigger, type SecretBinding, type SecretsStoreSecretBinding, type SendEmailBinding, type ServiceBinding, type TextBinding, type VectorizeBinding, type VersionMetadataBinding, type WorkflowBinding, type WorkflowExport, } from "./worker.js";
|
|
21
|
+
export { aiGatewayUrl, BUILD_SENTINEL, resourceSentinel, sentinelDeployTarget, type AiGatewayValue, type EveryAppDeployTarget, } from "./sentinel.js";
|
|
22
22
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,cAAc,EACd,gBAAgB,EAChB,SAAS,EACT,WAAW,EACX,eAAe,EACf,KAAK,SAAS,EACd,KAAK,6BAA6B,EAClC,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACnC,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,oBAAoB,EACpB,KAAK,cAAc,EACnB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC"}
|
package/dist/cloudflare/index.js
CHANGED
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
* (The dev keypair it hands the dev Worker is a leaf the Worker never loads.)
|
|
19
19
|
*/
|
|
20
20
|
export { EVERYAPP_OBSERVABILITY, everyAppAuxiliaryWorker, everyAppWorker, helperWorkerName, localD1Id, localD1Path, workflowNameFor, } from "./worker.js";
|
|
21
|
-
export { BUILD_SENTINEL, resourceSentinel, sentinelDeployTarget, } from "./sentinel.js";
|
|
21
|
+
export { aiGatewayUrl, BUILD_SENTINEL, resourceSentinel, sentinelDeployTarget, } from "./sentinel.js";
|
|
@@ -14,14 +14,22 @@
|
|
|
14
14
|
export declare const BUILD_SENTINEL: Readonly<{
|
|
15
15
|
workerName: "every-hosted--sentinel";
|
|
16
16
|
organizationId: "everyapp-hosted-deploy-sentinel";
|
|
17
|
+
/**
|
|
18
|
+
* The Cloudflare account the app is installed in (an AI Gateway's URL
|
|
19
|
+
* holds it). Starts with the Worker name's placeholder, so an install
|
|
20
|
+
* rewrites it before that one.
|
|
21
|
+
*/
|
|
22
|
+
accountId: "every-hosted--sentinel-account";
|
|
17
23
|
/** The gateway's URL, and so the identity issuer. */
|
|
18
24
|
gatewayUrl: "https://every-hosted--sentinel.invalid";
|
|
19
25
|
publicKey: "-----BEGIN PUBLIC KEY-----\nEVERYAPPHOSTEDDEPLOYSENTINEL\n-----END PUBLIC KEY-----\n";
|
|
20
26
|
}>;
|
|
21
27
|
/**
|
|
22
28
|
* A manifest binding's placeholder: a D1 database's name and id, an R2
|
|
23
|
-
* bucket's name, a KV namespace's
|
|
24
|
-
*
|
|
29
|
+
* bucket's, queue's or Vectorize index's name, a KV namespace's, Hyperdrive
|
|
30
|
+
* config's or AI Gateway's id, a Secrets Store secret's store id and name.
|
|
31
|
+
* The installer rewrites each by its binding name; the value only has to
|
|
32
|
+
* be recognizable.
|
|
25
33
|
*/
|
|
26
34
|
export declare function resourceSentinel(binding: string): string;
|
|
27
35
|
/** The fields of the manifest a build's placeholders are made for. */
|
|
@@ -33,14 +41,42 @@ interface SentinelManifest {
|
|
|
33
41
|
hyperdrive?: readonly {
|
|
34
42
|
readonly name: string;
|
|
35
43
|
}[];
|
|
44
|
+
queues?: readonly {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
}[];
|
|
47
|
+
vectorize?: readonly {
|
|
48
|
+
readonly name: string;
|
|
49
|
+
}[];
|
|
50
|
+
aiGateway?: readonly {
|
|
51
|
+
readonly name: string;
|
|
52
|
+
}[];
|
|
53
|
+
secretsStore?: readonly {
|
|
54
|
+
readonly name: string;
|
|
55
|
+
}[];
|
|
36
56
|
};
|
|
37
57
|
}
|
|
58
|
+
/** Where an AI Gateway takes requests: `https://gateway.ai.cloudflare.com/v1/<account>/<id>`. */
|
|
59
|
+
export declare function aiGatewayUrl(accountId: string, id: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* What an AI Gateway binding holds (a `json` binding): the gateway's id,
|
|
62
|
+
* its account, and its URL, under which each provider has a path
|
|
63
|
+
* (`<url>/openai`, `<url>/anthropic`, `<url>/workers-ai`, `<url>/compat`).
|
|
64
|
+
* In development `accountId` and `url` are empty: there is no gateway, so
|
|
65
|
+
* an app calls the provider directly.
|
|
66
|
+
*/
|
|
67
|
+
export type AiGatewayValue = {
|
|
68
|
+
id: string;
|
|
69
|
+
accountId: string;
|
|
70
|
+
url: string;
|
|
71
|
+
};
|
|
38
72
|
/** Everything install-specific a Worker is built from, by binding. */
|
|
39
73
|
export interface EveryAppDeployTarget {
|
|
40
74
|
/** The Worker name the gateway registry assigned to this app. */
|
|
41
75
|
workerName: string;
|
|
42
76
|
/** The organization that owns the app; scopes the AppGateway binding. */
|
|
43
77
|
organizationId: string;
|
|
78
|
+
/** The Cloudflare account the app is installed in. */
|
|
79
|
+
accountId: string;
|
|
44
80
|
/** The gateway's URL, which is also the identity tokens' issuer. */
|
|
45
81
|
gatewayUrl: string;
|
|
46
82
|
/** SPKI PEM public keys (current + next) that verify identity tokens. */
|
|
@@ -61,6 +97,25 @@ export interface EveryAppDeployTarget {
|
|
|
61
97
|
r2?: Record<string, {
|
|
62
98
|
name: string;
|
|
63
99
|
}>;
|
|
100
|
+
/** Queues by binding: each one's name (which its bindings and triggers use) and id. */
|
|
101
|
+
queues?: Record<string, {
|
|
102
|
+
name: string;
|
|
103
|
+
id: string;
|
|
104
|
+
}>;
|
|
105
|
+
/** Vectorize indexes by binding, under the names the deploy provisioned. */
|
|
106
|
+
vectorize?: Record<string, {
|
|
107
|
+
name: string;
|
|
108
|
+
}>;
|
|
109
|
+
/** AI Gateways by binding: each binding's whole value. */
|
|
110
|
+
aiGateway?: Record<string, AiGatewayValue>;
|
|
111
|
+
/**
|
|
112
|
+
* Secrets Store secrets by binding: the account's store and the
|
|
113
|
+
* secret the deploy made in it.
|
|
114
|
+
*/
|
|
115
|
+
secretsStore?: Record<string, {
|
|
116
|
+
storeId: string;
|
|
117
|
+
secretName: string;
|
|
118
|
+
}>;
|
|
64
119
|
};
|
|
65
120
|
}
|
|
66
121
|
/** The target every production build is made for: placeholders throughout. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../src/cloudflare/sentinel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,cAAc;;;IAKzB,qDAAqD;;;EAIrD,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../src/cloudflare/sentinel.ts"],"names":[],"mappings":"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"}
|
|
@@ -16,18 +16,30 @@ export const BUILD_SENTINEL = Object.freeze({
|
|
|
16
16
|
// and a string rewrite of it can't hit anything else.
|
|
17
17
|
workerName: "every-hosted--sentinel",
|
|
18
18
|
organizationId: "everyapp-hosted-deploy-sentinel",
|
|
19
|
+
/**
|
|
20
|
+
* The Cloudflare account the app is installed in (an AI Gateway's URL
|
|
21
|
+
* holds it). Starts with the Worker name's placeholder, so an install
|
|
22
|
+
* rewrites it before that one.
|
|
23
|
+
*/
|
|
24
|
+
accountId: "every-hosted--sentinel-account",
|
|
19
25
|
/** The gateway's URL, and so the identity issuer. */
|
|
20
26
|
gatewayUrl: "https://every-hosted--sentinel.invalid",
|
|
21
27
|
publicKey: "-----BEGIN PUBLIC KEY-----\nEVERYAPPHOSTEDDEPLOYSENTINEL\n-----END PUBLIC KEY-----\n",
|
|
22
28
|
});
|
|
23
29
|
/**
|
|
24
30
|
* A manifest binding's placeholder: a D1 database's name and id, an R2
|
|
25
|
-
* bucket's name, a KV namespace's
|
|
26
|
-
*
|
|
31
|
+
* bucket's, queue's or Vectorize index's name, a KV namespace's, Hyperdrive
|
|
32
|
+
* config's or AI Gateway's id, a Secrets Store secret's store id and name.
|
|
33
|
+
* The installer rewrites each by its binding name; the value only has to
|
|
34
|
+
* be recognizable.
|
|
27
35
|
*/
|
|
28
36
|
export function resourceSentinel(binding) {
|
|
29
37
|
return `${BUILD_SENTINEL.workerName}--${binding}`;
|
|
30
38
|
}
|
|
39
|
+
/** Where an AI Gateway takes requests: `https://gateway.ai.cloudflare.com/v1/<account>/<id>`. */
|
|
40
|
+
export function aiGatewayUrl(accountId, id) {
|
|
41
|
+
return `https://gateway.ai.cloudflare.com/v1/${accountId}/${id}`;
|
|
42
|
+
}
|
|
31
43
|
/** The target every production build is made for: placeholders throughout. */
|
|
32
44
|
export function sentinelDeployTarget(manifest) {
|
|
33
45
|
const byBinding = (bindings, value) => Object.fromEntries((bindings ?? []).map((binding) => [
|
|
@@ -38,6 +50,7 @@ export function sentinelDeployTarget(manifest) {
|
|
|
38
50
|
return {
|
|
39
51
|
workerName: BUILD_SENTINEL.workerName,
|
|
40
52
|
organizationId: BUILD_SENTINEL.organizationId,
|
|
53
|
+
accountId: BUILD_SENTINEL.accountId,
|
|
41
54
|
gatewayUrl: BUILD_SENTINEL.gatewayUrl,
|
|
42
55
|
identityPublicKeys: [BUILD_SENTINEL.publicKey],
|
|
43
56
|
resources: {
|
|
@@ -45,6 +58,18 @@ export function sentinelDeployTarget(manifest) {
|
|
|
45
58
|
kv: byBinding(resources?.kv, (id) => ({ id })),
|
|
46
59
|
hyperdrive: byBinding(resources?.hyperdrive?.map((config) => config.name), (id) => ({ id })),
|
|
47
60
|
r2: byBinding(resources?.r2, (name) => ({ name })),
|
|
61
|
+
...(resources?.queues?.length
|
|
62
|
+
? {
|
|
63
|
+
queues: byBinding(resources.queues.map((queue) => queue.name), (name) => ({ name, id: name })),
|
|
64
|
+
}
|
|
65
|
+
: {}),
|
|
66
|
+
vectorize: byBinding(resources?.vectorize?.map((index) => index.name), (name) => ({ name })),
|
|
67
|
+
aiGateway: byBinding(resources?.aiGateway?.map((gateway) => gateway.name), (id) => ({
|
|
68
|
+
id,
|
|
69
|
+
accountId: BUILD_SENTINEL.accountId,
|
|
70
|
+
url: aiGatewayUrl(BUILD_SENTINEL.accountId, id),
|
|
71
|
+
})),
|
|
72
|
+
secretsStore: byBinding(resources?.secretsStore?.map((secret) => secret.name), (placeholder) => ({ storeId: placeholder, secretName: placeholder })),
|
|
48
73
|
},
|
|
49
74
|
};
|
|
50
75
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AiGatewayValue } from "./sentinel.js";
|
|
1
2
|
/** A Durable Object or Workflow class, and the helper Worker defining it. */
|
|
2
3
|
interface ClassResource {
|
|
3
4
|
readonly name: string;
|
|
@@ -13,6 +14,62 @@ interface HyperdriveResource {
|
|
|
13
14
|
/** Whether Hyperdrive caches its reads (the deploy's concern; "off" by default). */
|
|
14
15
|
readonly caching?: "off" | "default";
|
|
15
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* How a queue's consumer takes its messages (`@cloudflare/config`'s
|
|
19
|
+
* `QueueConsumerTriggerOptions` but the name), and the helper Worker that
|
|
20
|
+
* consumes, when not the app's own.
|
|
21
|
+
*/
|
|
22
|
+
interface QueueConsumerSettings {
|
|
23
|
+
/** A helper Worker (`workers`) that consumes; the app's own when unset. */
|
|
24
|
+
readonly worker?: string;
|
|
25
|
+
readonly maxBatchSize?: number;
|
|
26
|
+
readonly maxBatchTimeout?: number;
|
|
27
|
+
readonly maxRetries?: number;
|
|
28
|
+
readonly maxConcurrency?: number | null;
|
|
29
|
+
readonly retryDelay?: number;
|
|
30
|
+
readonly visibilityTimeoutMs?: number;
|
|
31
|
+
/** Another of the manifest's queue bindings, which takes the messages that ran out of retries. */
|
|
32
|
+
readonly deadLetterQueue?: string;
|
|
33
|
+
}
|
|
34
|
+
/** A queue every Worker of the app produces to, and the Worker that consumes it. */
|
|
35
|
+
interface QueueResource {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
/** `true`: the app's own Worker consumes; settings, maybe naming a helper Worker. */
|
|
38
|
+
readonly consumer?: true | QueueConsumerSettings;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A Vectorize index: `dimensions` and `metric`, or a `preset` (the
|
|
42
|
+
* deploy's concern; the Worker only binds it by name).
|
|
43
|
+
*/
|
|
44
|
+
interface VectorizeResource {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
readonly dimensions?: number;
|
|
47
|
+
readonly metric?: string;
|
|
48
|
+
readonly preset?: string;
|
|
49
|
+
}
|
|
50
|
+
/** An AI Gateway of the app's own, which every one of its Workers binds. */
|
|
51
|
+
interface AiGatewayResource {
|
|
52
|
+
readonly name: string;
|
|
53
|
+
/** Whether the gateway logs each request (the deploy's concern; on by default). */
|
|
54
|
+
readonly collectLogs?: boolean;
|
|
55
|
+
/** How long the gateway caches a response, in seconds (the deploy's concern; 0 by default). */
|
|
56
|
+
readonly cacheTtl?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A Cloudflare `send_email` binding and the addresses it may use: the
|
|
60
|
+
* senders, and one destination or a list of them (never both).
|
|
61
|
+
*/
|
|
62
|
+
interface SendEmailResource {
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly allowedSenderAddresses?: readonly string[];
|
|
65
|
+
readonly destinationAddress?: string;
|
|
66
|
+
readonly allowedDestinationAddresses?: readonly string[];
|
|
67
|
+
}
|
|
68
|
+
/** An Analytics Engine dataset, by binding, and its name when not the default. */
|
|
69
|
+
interface AnalyticsEngineResource {
|
|
70
|
+
readonly name: string;
|
|
71
|
+
readonly dataset?: string;
|
|
72
|
+
}
|
|
16
73
|
/** Cloudflare's limits for one of the app's Workers. */
|
|
17
74
|
interface WorkerLimits {
|
|
18
75
|
readonly cpuMs?: number;
|
|
@@ -33,6 +90,12 @@ export interface EveryAppWorkerManifest {
|
|
|
33
90
|
workflows?: readonly ClassResource[];
|
|
34
91
|
/** Hyperdrive configs, named `<app worker>--<binding>` by the deploy. */
|
|
35
92
|
hyperdrive?: readonly HyperdriveResource[];
|
|
93
|
+
/**
|
|
94
|
+
* Cloudflare Queues, named `<app worker>--<binding>`: every Worker of
|
|
95
|
+
* the app binds each one to produce, and the consumer's Worker gets
|
|
96
|
+
* its trigger.
|
|
97
|
+
*/
|
|
98
|
+
queues?: readonly QueueResource[];
|
|
36
99
|
/**
|
|
37
100
|
* Workers AI, by binding (`["AI"]`), which every one of the app's
|
|
38
101
|
* Workers binds: nothing to create, billed to the account. In
|
|
@@ -40,6 +103,50 @@ export interface EveryAppWorkerManifest {
|
|
|
40
103
|
* turns `remoteBindings` on (see {@link AiBinding}).
|
|
41
104
|
*/
|
|
42
105
|
ai?: readonly string[];
|
|
106
|
+
/**
|
|
107
|
+
* Browser Rendering, by binding (`["BROWSER"]`), which every one of the
|
|
108
|
+
* app's Workers binds: nothing to create (Workers Paid). Local in
|
|
109
|
+
* development (see {@link BrowserBinding}).
|
|
110
|
+
*/
|
|
111
|
+
browser?: readonly string[];
|
|
112
|
+
/**
|
|
113
|
+
* Cloudflare Images, by binding (`["IMAGES"]`), which every one of the
|
|
114
|
+
* app's Workers binds: nothing to create. Local in development (see
|
|
115
|
+
* {@link ImagesBinding}).
|
|
116
|
+
*/
|
|
117
|
+
images?: readonly string[];
|
|
118
|
+
/**
|
|
119
|
+
* Vectorize indexes every one of the app's Workers binds, named
|
|
120
|
+
* `<app worker>--<binding>`. Cloudflare has no local Vectorize: in
|
|
121
|
+
* development each binding reaches the account's index (`dev.remote`),
|
|
122
|
+
* once the Vite plugin's `remoteBindings` is on and `cf auth login` ran.
|
|
123
|
+
*/
|
|
124
|
+
vectorize?: readonly VectorizeResource[];
|
|
125
|
+
/**
|
|
126
|
+
* AI Gateways of the app's own, each `<app worker>-<binding>` in the
|
|
127
|
+
* account, bound on every Worker as `{ id, accountId, url }`.
|
|
128
|
+
*/
|
|
129
|
+
aiGateway?: readonly AiGatewayResource[];
|
|
130
|
+
/**
|
|
131
|
+
* Cloudflare `send_email` bindings every one of the app's Workers
|
|
132
|
+
* gets, with their addresses; nothing is made in the account.
|
|
133
|
+
*/
|
|
134
|
+
sendEmail?: readonly SendEmailResource[];
|
|
135
|
+
/**
|
|
136
|
+
* Secrets Store secrets, by binding (`[{ name: "STRIPE_KEY" }]`), which
|
|
137
|
+
* every one of the app's Workers binds: each a secret in the account's
|
|
138
|
+
* store named `<app worker>--<binding>`, made by the deploy (see
|
|
139
|
+
* {@link SecretsStoreSecretBinding}).
|
|
140
|
+
*/
|
|
141
|
+
secretsStore?: readonly {
|
|
142
|
+
readonly name: string;
|
|
143
|
+
}[];
|
|
144
|
+
/**
|
|
145
|
+
* Analytics Engine datasets every one of the app's Workers writes to, by
|
|
146
|
+
* binding: `dataset` as written, else `<app worker>--<binding>`.
|
|
147
|
+
* Nothing to create; `writeDataPoint()` does nothing in development.
|
|
148
|
+
*/
|
|
149
|
+
analyticsEngine?: readonly AnalyticsEngineResource[];
|
|
43
150
|
};
|
|
44
151
|
/**
|
|
45
152
|
* Helper Workers deployed beside the app's Worker as
|
|
@@ -148,6 +255,21 @@ export interface HyperdriveBinding {
|
|
|
148
255
|
connectionString?: string;
|
|
149
256
|
};
|
|
150
257
|
}
|
|
258
|
+
/** A producer binding to one of the app's queues. */
|
|
259
|
+
export interface QueueBinding {
|
|
260
|
+
type: "queue";
|
|
261
|
+
name: string;
|
|
262
|
+
}
|
|
263
|
+
/** A JSON value the Worker reads as it is: `env.<NAME>` is `value`. */
|
|
264
|
+
export interface JsonBinding<T = unknown> {
|
|
265
|
+
type: "json";
|
|
266
|
+
value: T;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* An AI Gateway of the app's own (`resources.aiGateway`): its id, account
|
|
270
|
+
* and URL, which the Worker reads as `env.<NAME>.id` and `env.<NAME>.url`.
|
|
271
|
+
*/
|
|
272
|
+
export type AiGatewayBinding = JsonBinding<AiGatewayValue>;
|
|
151
273
|
/**
|
|
152
274
|
* Workers AI (`env.AI.run()`), which cf types as `Ai`. Deployed, it calls
|
|
153
275
|
* the account's Workers AI. Miniflare has none locally: in development the
|
|
@@ -162,6 +284,78 @@ export interface AiBinding {
|
|
|
162
284
|
remote?: boolean;
|
|
163
285
|
};
|
|
164
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Browser Rendering (`env.BROWSER`, for `@cloudflare/puppeteer` or
|
|
289
|
+
* `@cloudflare/playwright`), which cf types as `BrowserRun`. Deployed, it
|
|
290
|
+
* drives a headless Chrome on Cloudflare (Workers Paid). In development
|
|
291
|
+
* the same binding reaches Miniflare's local stand-in: the first session
|
|
292
|
+
* downloads a Chrome into the global `.wrangler` cache and starts it.
|
|
293
|
+
*/
|
|
294
|
+
export interface BrowserBinding {
|
|
295
|
+
type: "browser";
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Cloudflare Images (`env.IMAGES.input(stream).transform(…).output(…)`,
|
|
299
|
+
* `env.IMAGES.info(stream)`), which cf types as the runtime's
|
|
300
|
+
* `ImagesBinding`. Deployed, it runs on Cloudflare and bills the account's
|
|
301
|
+
* Images transformations. In development Miniflare answers it locally with
|
|
302
|
+
* sharp, which ships with it.
|
|
303
|
+
*/
|
|
304
|
+
export interface ImagesBinding {
|
|
305
|
+
type: "images";
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* A Vectorize index, by name. `dev.remote` sends development calls to the
|
|
309
|
+
* account's index: Cloudflare has no local Vectorize.
|
|
310
|
+
*/
|
|
311
|
+
export interface VectorizeBinding {
|
|
312
|
+
type: "vectorize";
|
|
313
|
+
name: string;
|
|
314
|
+
dev?: {
|
|
315
|
+
remote?: boolean;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* A `send_email` binding (cf's `SendEmailBindingOptions`): one destination,
|
|
320
|
+
* a list of them, or neither, and the senders it may use.
|
|
321
|
+
*/
|
|
322
|
+
type SendEmailDestination = {
|
|
323
|
+
destinationAddress: string;
|
|
324
|
+
allowedDestinationAddresses?: never;
|
|
325
|
+
} | {
|
|
326
|
+
destinationAddress?: never;
|
|
327
|
+
allowedDestinationAddresses: string[];
|
|
328
|
+
} | {
|
|
329
|
+
destinationAddress?: never;
|
|
330
|
+
allowedDestinationAddresses?: never;
|
|
331
|
+
};
|
|
332
|
+
export type SendEmailBinding = SendEmailDestination & {
|
|
333
|
+
type: "send-email";
|
|
334
|
+
allowedSenderAddresses?: string[];
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* A Secrets Store secret (`await env.STRIPE_KEY.get()`), which cf types as
|
|
338
|
+
* `SecretsStoreSecret`. Deployed, the secret the deploy made in the
|
|
339
|
+
* account's store; in development, the local store `local` that Miniflare
|
|
340
|
+
* keeps under `.cloudflare/state`, where `get()` throws `Secret "<name>"
|
|
341
|
+
* not found` until the secret is seeded there (`.dev.vars` doesn't reach
|
|
342
|
+
* this binding).
|
|
343
|
+
*/
|
|
344
|
+
export interface SecretsStoreSecretBinding {
|
|
345
|
+
type: "secrets-store-secret";
|
|
346
|
+
storeId: string;
|
|
347
|
+
secretName: string;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* An Analytics Engine dataset (`env.EVENTS.writeDataPoint({ blobs,
|
|
351
|
+
* doubles, indexes })`), which cf types as `AnalyticsEngineDataset`.
|
|
352
|
+
* Deployed, the dataset exists once written to. In development Miniflare
|
|
353
|
+
* accepts every write and keeps none. cf's shape takes no `dev` options.
|
|
354
|
+
*/
|
|
355
|
+
export interface AnalyticsEngineDatasetBinding {
|
|
356
|
+
type: "analytics-engine-dataset";
|
|
357
|
+
name: string;
|
|
358
|
+
}
|
|
165
359
|
/**
|
|
166
360
|
* The app's own Worker, as the bindings of the Durable Objects it defines
|
|
167
361
|
* name it when its entrypoint is a `cf-worker` module import. cf reads each
|
|
@@ -205,7 +399,15 @@ export interface ServiceBinding {
|
|
|
205
399
|
export interface VersionMetadataBinding {
|
|
206
400
|
type: "version-metadata";
|
|
207
401
|
}
|
|
208
|
-
|
|
402
|
+
/**
|
|
403
|
+
* A binding of any Worker these helpers build, each one `InputWorkerConfig`
|
|
404
|
+
* accepts, so a helper Worker's definition passes as the Vite plugin's
|
|
405
|
+
* `auxiliaryWorkers` config. A Durable Object binding names its Worker by
|
|
406
|
+
* name; only the app's own Worker names itself by definition (see
|
|
407
|
+
* {@link EveryAppWorkerReference}), in its typed `env`, which
|
|
408
|
+
* `defineConfig()` takes.
|
|
409
|
+
*/
|
|
410
|
+
export type EveryAppBinding = TextBinding | SecretBinding | D1Binding | KvBinding | R2Binding | HyperdriveBinding | QueueBinding | AiBinding | BrowserBinding | ImagesBinding | VectorizeBinding | AiGatewayBinding | SendEmailBinding | SecretsStoreSecretBinding | AnalyticsEngineDatasetBinding | DurableObjectBinding | WorkflowBinding | GatewayBinding | ServiceBinding | VersionMetadataBinding;
|
|
209
411
|
export interface DurableObjectExport {
|
|
210
412
|
type: "durable-object";
|
|
211
413
|
storage: "sqlite";
|
|
@@ -234,6 +436,37 @@ type AiNames<M> = M extends {
|
|
|
234
436
|
ai: readonly (infer B)[];
|
|
235
437
|
};
|
|
236
438
|
} ? B & string : never;
|
|
439
|
+
type BrowserNames<M> = M extends {
|
|
440
|
+
resources: {
|
|
441
|
+
browser: readonly (infer B)[];
|
|
442
|
+
};
|
|
443
|
+
} ? B & string : never;
|
|
444
|
+
type ImagesNames<M> = M extends {
|
|
445
|
+
resources: {
|
|
446
|
+
images: readonly (infer B)[];
|
|
447
|
+
};
|
|
448
|
+
} ? B & string : never;
|
|
449
|
+
type VectorizeNames<M> = M extends {
|
|
450
|
+
resources: {
|
|
451
|
+
vectorize: readonly (infer V)[];
|
|
452
|
+
};
|
|
453
|
+
} ? V extends {
|
|
454
|
+
name: infer N extends string;
|
|
455
|
+
} ? N : never : never;
|
|
456
|
+
type AiGatewayNames<M> = M extends {
|
|
457
|
+
resources: {
|
|
458
|
+
aiGateway: readonly (infer G)[];
|
|
459
|
+
};
|
|
460
|
+
} ? G extends {
|
|
461
|
+
name: infer N extends string;
|
|
462
|
+
} ? N : never : never;
|
|
463
|
+
type AnalyticsEngineNames<M> = M extends {
|
|
464
|
+
resources: {
|
|
465
|
+
analyticsEngine: readonly (infer A)[];
|
|
466
|
+
};
|
|
467
|
+
} ? A extends {
|
|
468
|
+
name: infer N extends string;
|
|
469
|
+
} ? N : never : never;
|
|
237
470
|
type DurableObjects<M> = M extends {
|
|
238
471
|
resources: {
|
|
239
472
|
durableObjects: readonly (infer D)[];
|
|
@@ -244,6 +477,27 @@ type Workflows<M> = M extends {
|
|
|
244
477
|
workflows: readonly (infer W)[];
|
|
245
478
|
};
|
|
246
479
|
} ? W : never;
|
|
480
|
+
type QueueNames<M> = M extends {
|
|
481
|
+
resources: {
|
|
482
|
+
queues: readonly (infer Q)[];
|
|
483
|
+
};
|
|
484
|
+
} ? Q extends {
|
|
485
|
+
name: infer N extends string;
|
|
486
|
+
} ? N : never : never;
|
|
487
|
+
type SendEmailNames<M> = M extends {
|
|
488
|
+
resources: {
|
|
489
|
+
sendEmail: readonly (infer S)[];
|
|
490
|
+
};
|
|
491
|
+
} ? S extends {
|
|
492
|
+
name: infer N extends string;
|
|
493
|
+
} ? N : never : never;
|
|
494
|
+
type SecretsStoreNames<M> = M extends {
|
|
495
|
+
resources: {
|
|
496
|
+
secretsStore: readonly (infer S)[];
|
|
497
|
+
};
|
|
498
|
+
} ? S extends {
|
|
499
|
+
name: infer N extends string;
|
|
500
|
+
} ? N : never : never;
|
|
247
501
|
type HelperWorkers<M> = M extends {
|
|
248
502
|
workers: readonly (infer H)[];
|
|
249
503
|
} ? H : never;
|
|
@@ -380,8 +634,24 @@ type ResourceEnv<M, TEntrypoint> = {
|
|
|
380
634
|
[B in KvNames<M>]: KvBinding;
|
|
381
635
|
} & {
|
|
382
636
|
[B in R2Names<M>]: R2Binding;
|
|
637
|
+
} & {
|
|
638
|
+
[B in QueueNames<M>]: QueueBinding;
|
|
383
639
|
} & {
|
|
384
640
|
[B in AiNames<M>]: AiBinding;
|
|
641
|
+
} & {
|
|
642
|
+
[B in BrowserNames<M>]: BrowserBinding;
|
|
643
|
+
} & {
|
|
644
|
+
[B in ImagesNames<M>]: ImagesBinding;
|
|
645
|
+
} & {
|
|
646
|
+
[B in VectorizeNames<M>]: VectorizeBinding;
|
|
647
|
+
} & {
|
|
648
|
+
[B in AiGatewayNames<M>]: AiGatewayBinding;
|
|
649
|
+
} & {
|
|
650
|
+
[B in SendEmailNames<M>]: SendEmailBinding;
|
|
651
|
+
} & {
|
|
652
|
+
[B in SecretsStoreNames<M>]: SecretsStoreSecretBinding;
|
|
653
|
+
} & {
|
|
654
|
+
[B in AnalyticsEngineNames<M>]: AnalyticsEngineDatasetBinding;
|
|
385
655
|
} & {
|
|
386
656
|
[D in DurableObjects<M> as D extends {
|
|
387
657
|
name: infer N extends string;
|
|
@@ -425,6 +695,8 @@ export type EveryAppDevEnv<M, TEntrypoint = string> = ResourceEnv<M, TEntrypoint
|
|
|
425
695
|
EVERYAPP_DEV_PROVIDERS?: TextBinding;
|
|
426
696
|
EVERYAPP_IDENTITY_PUBLIC_KEYS: TextBinding;
|
|
427
697
|
EVERYAPP_IDENTITY_ISSUER: TextBinding;
|
|
698
|
+
/** The stub dev gateway's organization (`dev-org`), so `withOrganization(env.EVERY_APP_ORG_ID, …)` works in development as deployed. */
|
|
699
|
+
EVERY_APP_ORG_ID: TextBinding;
|
|
428
700
|
} & {
|
|
429
701
|
[K in DevGatewayKeys<M>]: SecretBinding;
|
|
430
702
|
};
|
|
@@ -482,6 +754,23 @@ export interface ScheduledTrigger {
|
|
|
482
754
|
type: "scheduled";
|
|
483
755
|
schedule: string;
|
|
484
756
|
}
|
|
757
|
+
/**
|
|
758
|
+
* Structural copy of cf's queue consumer trigger: the Worker consumes the
|
|
759
|
+
* named queue (its `queue(batch, env)` handler), with these settings.
|
|
760
|
+
*/
|
|
761
|
+
export interface QueueConsumerTrigger {
|
|
762
|
+
type: "queue";
|
|
763
|
+
name: string;
|
|
764
|
+
deadLetterQueue?: string;
|
|
765
|
+
maxBatchSize?: number;
|
|
766
|
+
maxBatchTimeout?: number;
|
|
767
|
+
maxConcurrency?: number | null;
|
|
768
|
+
maxRetries?: number;
|
|
769
|
+
retryDelay?: number;
|
|
770
|
+
visibilityTimeoutMs?: number;
|
|
771
|
+
}
|
|
772
|
+
/** A trigger one of the app's Workers may have: its crons, the queues it consumes. */
|
|
773
|
+
export type EveryAppTrigger = ScheduledTrigger | QueueConsumerTrigger;
|
|
485
774
|
export interface EveryAppWorkerConfig<M, TEntrypoint> {
|
|
486
775
|
name: string;
|
|
487
776
|
entrypoint: TEntrypoint;
|
|
@@ -489,8 +778,8 @@ export interface EveryAppWorkerConfig<M, TEntrypoint> {
|
|
|
489
778
|
compatibilityFlags: string[];
|
|
490
779
|
workersDev: false;
|
|
491
780
|
previewUrls: false;
|
|
492
|
-
/** The `crons` option's schedules; absent without any. */
|
|
493
|
-
triggers?:
|
|
781
|
+
/** The `crons` option's schedules and the queues it consumes; absent without any. */
|
|
782
|
+
triggers?: EveryAppTrigger[];
|
|
494
783
|
/** Near the manifest's `database.region`, once deployed. */
|
|
495
784
|
placement?: EveryAppPlacement;
|
|
496
785
|
/** The manifest's `limits`. */
|
|
@@ -537,7 +826,7 @@ export interface EveryAppAuxiliaryWorkerConfig<TEntrypoint> {
|
|
|
537
826
|
compatibilityFlags: string[];
|
|
538
827
|
workersDev: false;
|
|
539
828
|
previewUrls: false;
|
|
540
|
-
triggers?:
|
|
829
|
+
triggers?: EveryAppTrigger[];
|
|
541
830
|
placement?: EveryAppPlacement;
|
|
542
831
|
limits?: {
|
|
543
832
|
cpuMs?: number;
|
|
@@ -550,7 +839,10 @@ export interface EveryAppAuxiliaryWorkerConfig<TEntrypoint> {
|
|
|
550
839
|
* Build the definition of one of the app's helper Workers (the manifest's
|
|
551
840
|
* `workers`), e.g. one that runs a memory-hungry job away from the app's
|
|
552
841
|
* Worker. It is named `<app worker>--<worker>`, is private like the app, and
|
|
553
|
-
* binds the app's
|
|
842
|
+
* binds the app's and Analytics Engine datasets, the classes it defines, and
|
|
843
|
+
* binds the app's D1 databases, KV namespaces, R2 buckets, Workers AI,
|
|
844
|
+
* Browser Rendering, Images, Vectorize indexes, AI Gateways, `send_email`
|
|
845
|
+
* bindings and Secrets Store secrets, the classes it defines, and
|
|
554
846
|
* the gateway (with the app's identity, for capabilities). Only the app's
|
|
555
847
|
* Worker reaches it. Pass it to the Vite plugin:
|
|
556
848
|
*
|