@every-app/sdk 0.3.0-rc.3 → 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 +1 -1
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/sentinel.d.ts +21 -4
- package/dist/cloudflare/sentinel.d.ts.map +1 -1
- package/dist/cloudflare/sentinel.js +8 -4
- package/dist/cloudflare/worker.d.ts +181 -6
- package/dist/cloudflare/worker.d.ts.map +1 -1
- package/dist/cloudflare/worker.js +194 -11
- 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/capabilities.d.ts +1 -1
- package/dist/internal/catalog/index.d.ts +1 -1
- package/dist/internal/catalog/inference.d.ts +1 -1
- package/dist/internal/catalog/inference.js +3 -3
- package/dist/internal/events.d.ts +1 -1
- package/dist/internal/events.d.ts.map +1 -1
- package/dist/internal/events.js +23 -1
- 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 +1 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/members.d.ts +3 -2
- package/dist/internal/members.d.ts.map +1 -1
- package/dist/internal/protocol.d.ts +25 -1
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +21 -1
- 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/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 +6 -3
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -1
- package/dist/server/integrationFetch.d.ts +17 -7
- package/dist/server/integrationFetch.d.ts.map +1 -1
- package/dist/server/integrationFetch.js +22 -6
- 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
|
@@ -2,7 +2,7 @@ import { createHash, createHmac } from "node:crypto";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { parseEnv } from "node:util";
|
|
5
|
-
import { DEV_ISSUER, DEV_PUBLIC_KEY_PEM } from "../dev/keypair.js";
|
|
5
|
+
import { DEV_ISSUER, DEV_ORG_ID, DEV_PUBLIC_KEY_PEM } from "../dev/keypair.js";
|
|
6
6
|
import { sentinelDeployTarget, } from "./sentinel.js";
|
|
7
7
|
/** The names of the manifest's `secrets`, whichever form each took. */
|
|
8
8
|
function manifestSecretNames(manifest) {
|
|
@@ -256,6 +256,11 @@ function devProviderKeys(manifest, root) {
|
|
|
256
256
|
}
|
|
257
257
|
/** Cloudflare's limit on a Workflow's name. */
|
|
258
258
|
const MAX_WORKFLOW_NAME_LENGTH = 64;
|
|
259
|
+
/**
|
|
260
|
+
* The store development binds Secrets Store secrets in: Miniflare keeps
|
|
261
|
+
* one per id under `.cloudflare/state`, and any id works locally.
|
|
262
|
+
*/
|
|
263
|
+
const LOCAL_SECRETS_STORE_ID = "local";
|
|
259
264
|
/** Cloudflare's limit on a Vectorize index's name. */
|
|
260
265
|
const MAX_VECTORIZE_NAME_LENGTH = 64;
|
|
261
266
|
/** Cloudflare's limit on a Worker's name. */
|
|
@@ -312,13 +317,22 @@ export function everyAppWorker(options) {
|
|
|
312
317
|
value: JSON.stringify([DEV_PUBLIC_KEY_PEM]),
|
|
313
318
|
};
|
|
314
319
|
env["EVERYAPP_IDENTITY_ISSUER"] = { type: "text", value: DEV_ISSUER };
|
|
320
|
+
// The stub gateway's organization, as the deploy's secret would be, so
|
|
321
|
+
// background work's withOrganization(env.EVERY_APP_ORG_ID, …) runs
|
|
322
|
+
// here too. Not a pin: under the dev opt-in everyApp() enforces none,
|
|
323
|
+
// so `everyapp dev --mode mirror`'s real organizations still open.
|
|
324
|
+
env["EVERY_APP_ORG_ID"] = { type: "text", value: DEV_ORG_ID };
|
|
315
325
|
addDevProviders(env, options.root);
|
|
316
326
|
}
|
|
317
327
|
Object.assign(env, storageBindings(manifest, name, deploy));
|
|
328
|
+
addQueueBindings(env, manifest, name, deploy);
|
|
318
329
|
addAiBindings(env, manifest, deploy);
|
|
319
330
|
addBrowserBindings(env, manifest);
|
|
320
331
|
addImagesBindings(env, manifest);
|
|
321
332
|
addAiGatewayBindings(env, manifest, name, deploy);
|
|
333
|
+
addSendEmailBindings(env, manifest);
|
|
334
|
+
addSecretsStoreBindings(env, manifest, name, deploy);
|
|
335
|
+
addAnalyticsEngineBindings(env, manifest, name);
|
|
322
336
|
addDatabaseBindings(env, options, name, undefined, deploy);
|
|
323
337
|
// The app binds every class, a helper Worker's in that Worker, and
|
|
324
338
|
// exports only its own.
|
|
@@ -336,13 +350,19 @@ export function everyAppWorker(options) {
|
|
|
336
350
|
};
|
|
337
351
|
}
|
|
338
352
|
addSecrets(env, options, deploy);
|
|
339
|
-
const triggers =
|
|
353
|
+
const triggers = [
|
|
354
|
+
...cronTriggers(options.crons),
|
|
355
|
+
...queueTriggers(manifest, name, undefined, deploy),
|
|
356
|
+
];
|
|
340
357
|
const compatibilityDate = manifest.compatibilityDate ?? DEFAULT_COMPATIBILITY_DATE;
|
|
341
358
|
// cf types a Durable Object namespace with its class only when the binding
|
|
342
359
|
// names the defining Worker by a definition whose module it can read, so
|
|
343
360
|
// the classes this Worker defines name it that way; cf resolves the
|
|
344
361
|
// reference to the Worker's name. A path entrypoint gives cf no module.
|
|
362
|
+
// Only here: `EveryAppBinding` names Workers by name, as the Vite
|
|
363
|
+
// plugin's `auxiliaryWorkers` require.
|
|
345
364
|
const { entrypoint } = options;
|
|
365
|
+
const ownClasses = {};
|
|
346
366
|
if (typeof entrypoint === "object") {
|
|
347
367
|
const self = {
|
|
348
368
|
name,
|
|
@@ -352,7 +372,7 @@ export function everyAppWorker(options) {
|
|
|
352
372
|
for (const durableObject of manifest.resources?.durableObjects ?? []) {
|
|
353
373
|
if (durableObject.worker !== undefined)
|
|
354
374
|
continue;
|
|
355
|
-
|
|
375
|
+
ownClasses[durableObject.name] = {
|
|
356
376
|
type: "durable-object",
|
|
357
377
|
worker: self,
|
|
358
378
|
exportName: durableObject.className,
|
|
@@ -369,7 +389,8 @@ export function everyAppWorker(options) {
|
|
|
369
389
|
...(triggers.length ? { triggers } : {}),
|
|
370
390
|
...runtimeSettings(manifest, manifest.limits, deploy),
|
|
371
391
|
observability: observability(),
|
|
372
|
-
env
|
|
392
|
+
// Each class keeps its key's place in `env`: classBindings bound it by name.
|
|
393
|
+
env: { ...env, ...ownClasses },
|
|
373
394
|
exports: exports,
|
|
374
395
|
};
|
|
375
396
|
}
|
|
@@ -377,8 +398,10 @@ export function everyAppWorker(options) {
|
|
|
377
398
|
* Build the definition of one of the app's helper Workers (the manifest's
|
|
378
399
|
* `workers`), e.g. one that runs a memory-hungry job away from the app's
|
|
379
400
|
* Worker. It is named `<app worker>--<worker>`, is private like the app, and
|
|
380
|
-
* binds the app's
|
|
381
|
-
* binds the app's D1 databases, KV namespaces, R2 buckets, Workers AI,
|
|
401
|
+
* binds the app's and Analytics Engine datasets, the classes it defines, and
|
|
402
|
+
* binds the app's D1 databases, KV namespaces, R2 buckets, Workers AI,
|
|
403
|
+
* Browser Rendering, Images, Vectorize indexes, AI Gateways, `send_email`
|
|
404
|
+
* bindings and Secrets Store secrets, the classes it defines, and
|
|
382
405
|
* the gateway (with the app's identity, for capabilities). Only the app's
|
|
383
406
|
* Worker reaches it. Pass it to the Vite plugin:
|
|
384
407
|
*
|
|
@@ -400,6 +423,8 @@ export function everyAppAuxiliaryWorker(options) {
|
|
|
400
423
|
EVERYAPP_APP_ID: { type: "text", value: manifest.id },
|
|
401
424
|
...storageBindings(manifest, appWorker, deploy),
|
|
402
425
|
};
|
|
426
|
+
addQueueBindings(env, manifest, appWorker, deploy);
|
|
427
|
+
addSendEmailBindings(env, manifest);
|
|
403
428
|
if (deploy) {
|
|
404
429
|
// The app's identity: the gateway treats its helper Workers as the app.
|
|
405
430
|
env["EVERY_APP_GATEWAY"] = gatewayBinding(deploy, manifest.id, appWorker);
|
|
@@ -411,17 +436,23 @@ export function everyAppAuxiliaryWorker(options) {
|
|
|
411
436
|
else {
|
|
412
437
|
env["EVERYAPP_DEV"] = { type: "text", value: "1" };
|
|
413
438
|
env["EVERYAPP_DEV_CAPABILITIES"] = devCapabilities(manifest);
|
|
439
|
+
env["EVERY_APP_ORG_ID"] = { type: "text", value: DEV_ORG_ID };
|
|
414
440
|
addDevProviders(env, options.root);
|
|
415
441
|
}
|
|
416
442
|
addAiBindings(env, manifest, deploy);
|
|
417
443
|
addBrowserBindings(env, manifest);
|
|
418
444
|
addImagesBindings(env, manifest);
|
|
419
445
|
addAiGatewayBindings(env, manifest, appWorker, deploy);
|
|
446
|
+
addSecretsStoreBindings(env, manifest, appWorker, deploy);
|
|
447
|
+
addAnalyticsEngineBindings(env, manifest, appWorker);
|
|
420
448
|
addDatabaseBindings(env, options, appWorker, worker, deploy);
|
|
421
449
|
const { bindings, exports } = classBindings(manifest, appWorker, worker, env);
|
|
422
450
|
Object.assign(env, bindings);
|
|
423
451
|
addSecrets(env, options, deploy);
|
|
424
|
-
const triggers =
|
|
452
|
+
const triggers = [
|
|
453
|
+
...cronTriggers(options.crons),
|
|
454
|
+
...queueTriggers(manifest, appWorker, worker, deploy),
|
|
455
|
+
];
|
|
425
456
|
return {
|
|
426
457
|
name,
|
|
427
458
|
entrypoint: options.entrypoint,
|
|
@@ -455,7 +486,7 @@ function appWorkerName(options, builder) {
|
|
|
455
486
|
let deploy;
|
|
456
487
|
if (ctx.mode === "production") {
|
|
457
488
|
if (process.env[BUILD_ENV] !== "1") {
|
|
458
|
-
throw new Error(`
|
|
489
|
+
throw new Error(`EveryApp Workers are built for production only by \`everyapp deploy\` (\`pnpm run deploy\`), which sets ${BUILD_ENV}=1 and installs the build: ` +
|
|
459
490
|
"a bare `cf build` or `cf deploy` would ship a Worker whose name, identity keys, gateway binding and resources are placeholders. " +
|
|
460
491
|
"For a local build, run Vite in development mode (`vite build --mode development`).");
|
|
461
492
|
}
|
|
@@ -557,6 +588,23 @@ function storageBindings(manifest, appWorker, deploy) {
|
|
|
557
588
|
}
|
|
558
589
|
return env;
|
|
559
590
|
}
|
|
591
|
+
/**
|
|
592
|
+
* A producer binding to each of the app's queues, which every one of its
|
|
593
|
+
* Workers gets. Deployed, each names the queue the deploy provisioned (a
|
|
594
|
+
* placeholder until installed); in development, the queue its rule gives
|
|
595
|
+
* (Miniflare makes it, shared by the Workers of one `cf dev`).
|
|
596
|
+
*/
|
|
597
|
+
function addQueueBindings(env, manifest, appWorker, deploy) {
|
|
598
|
+
for (const { name: binding } of manifest.resources?.queues ?? []) {
|
|
599
|
+
if (env[binding]) {
|
|
600
|
+
throw new Error(`queues: ${binding} reuses a binding name the Worker already has.`);
|
|
601
|
+
}
|
|
602
|
+
env[binding] = {
|
|
603
|
+
type: "queue",
|
|
604
|
+
name: queueName(appWorker, binding, deploy),
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
}
|
|
560
608
|
/**
|
|
561
609
|
* The manifest's Workers AI bindings, which every one of the app's Workers
|
|
562
610
|
* gets: `{ type: "ai" }` deployed (account-wide, nothing to provision), and
|
|
@@ -574,6 +622,51 @@ function addAiBindings(env, manifest, deploy) {
|
|
|
574
622
|
: { type: "ai", dev: { remote: true } };
|
|
575
623
|
}
|
|
576
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
* The consumer triggers of one of the app's Workers: each queue whose
|
|
627
|
+
* `consumer` is this Worker (`true`, or no `worker`, for the app's own;
|
|
628
|
+
* `forWorker` for a helper), with its settings and its dead-letter queue,
|
|
629
|
+
* another of the app's queues, by name.
|
|
630
|
+
*/
|
|
631
|
+
function queueTriggers(manifest, appWorker, forWorker, deploy) {
|
|
632
|
+
const triggers = [];
|
|
633
|
+
for (const queue of manifest.resources?.queues ?? []) {
|
|
634
|
+
if (queue.consumer === undefined)
|
|
635
|
+
continue;
|
|
636
|
+
const settings = queue.consumer === true ? {} : queue.consumer;
|
|
637
|
+
if (settings.worker !== forWorker)
|
|
638
|
+
continue;
|
|
639
|
+
const { deadLetterQueue } = settings;
|
|
640
|
+
if (deadLetterQueue !== undefined &&
|
|
641
|
+
!manifest.resources?.queues?.some((other) => other.name === deadLetterQueue)) {
|
|
642
|
+
throw new Error(`queues: ${queue.name}'s deadLetterQueue "${deadLetterQueue}" isn't one of resources.queues.`);
|
|
643
|
+
}
|
|
644
|
+
triggers.push({
|
|
645
|
+
type: "queue",
|
|
646
|
+
name: queueName(appWorker, queue.name, deploy),
|
|
647
|
+
...(deadLetterQueue !== undefined
|
|
648
|
+
? { deadLetterQueue: queueName(appWorker, deadLetterQueue, deploy) }
|
|
649
|
+
: {}),
|
|
650
|
+
...Object.fromEntries(QUEUE_CONSUMER_SETTINGS.flatMap((key) => settings[key] === undefined ? [] : [[key, settings[key]]])),
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
return triggers;
|
|
654
|
+
}
|
|
655
|
+
/** The consumer settings a queue trigger carries, in the order it lists them. */
|
|
656
|
+
const QUEUE_CONSUMER_SETTINGS = [
|
|
657
|
+
"maxBatchSize",
|
|
658
|
+
"maxBatchTimeout",
|
|
659
|
+
"maxRetries",
|
|
660
|
+
"maxConcurrency",
|
|
661
|
+
"retryDelay",
|
|
662
|
+
"visibilityTimeoutMs",
|
|
663
|
+
];
|
|
664
|
+
/** A queue binding's queue: the deploy's placeholder, or in development its rule. */
|
|
665
|
+
function queueName(appWorker, binding, deploy) {
|
|
666
|
+
return deploy
|
|
667
|
+
? provisioned(deploy.resources.queues, binding).name
|
|
668
|
+
: queueNameFor(appWorker, binding);
|
|
669
|
+
}
|
|
577
670
|
/**
|
|
578
671
|
* The manifest's Browser Rendering bindings, which every one of the app's
|
|
579
672
|
* Workers gets: `{ type: "browser" }` in both modes (account-wide,
|
|
@@ -618,6 +711,91 @@ function addAiGatewayBindings(env, manifest, appWorker, deploy) {
|
|
|
618
711
|
env[binding] = { type: "json", value };
|
|
619
712
|
}
|
|
620
713
|
}
|
|
714
|
+
/**
|
|
715
|
+
* The manifest's `send_email` bindings, the same on every one of the
|
|
716
|
+
* app's Workers in both modes: Cloudflare's binding with the addresses
|
|
717
|
+
* the manifest lists (the deploy's policy holds the built lists to them).
|
|
718
|
+
* Deployed, Cloudflare checks a message against them and the account's
|
|
719
|
+
* Email Sending domains when the Worker sends; in development Miniflare
|
|
720
|
+
* logs the message and checks the senders.
|
|
721
|
+
*/
|
|
722
|
+
function addSendEmailBindings(env, manifest) {
|
|
723
|
+
for (const entry of manifest.resources?.sendEmail ?? []) {
|
|
724
|
+
if (env[entry.name]) {
|
|
725
|
+
throw new Error(`sendEmail: ${entry.name} reuses a binding name the Worker already has.`);
|
|
726
|
+
}
|
|
727
|
+
const senders = entry.allowedSenderAddresses
|
|
728
|
+
? { allowedSenderAddresses: [...entry.allowedSenderAddresses] }
|
|
729
|
+
: {};
|
|
730
|
+
if (entry.destinationAddress !== undefined &&
|
|
731
|
+
entry.allowedDestinationAddresses !== undefined) {
|
|
732
|
+
throw new Error(`sendEmail: ${entry.name} sets both destinationAddress and allowedDestinationAddresses; set one.`);
|
|
733
|
+
}
|
|
734
|
+
env[entry.name] =
|
|
735
|
+
entry.destinationAddress !== undefined
|
|
736
|
+
? {
|
|
737
|
+
type: "send-email",
|
|
738
|
+
...senders,
|
|
739
|
+
destinationAddress: entry.destinationAddress,
|
|
740
|
+
}
|
|
741
|
+
: entry.allowedDestinationAddresses !== undefined
|
|
742
|
+
? {
|
|
743
|
+
type: "send-email",
|
|
744
|
+
...senders,
|
|
745
|
+
allowedDestinationAddresses: [
|
|
746
|
+
...entry.allowedDestinationAddresses,
|
|
747
|
+
],
|
|
748
|
+
}
|
|
749
|
+
: { type: "send-email", ...senders };
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* The manifest's Secrets Store secrets, which every one of the app's
|
|
754
|
+
* Workers binds. Deployed, the store and secret the deploy provisioned
|
|
755
|
+
* (placeholders until installed); in development the local store `local`,
|
|
756
|
+
* under the name the deploy would give the secret, so a seeded local
|
|
757
|
+
* secret is named like a deployed one.
|
|
758
|
+
*/
|
|
759
|
+
function addSecretsStoreBindings(env, manifest, appWorker, deploy) {
|
|
760
|
+
for (const { name: binding } of manifest.resources?.secretsStore ?? []) {
|
|
761
|
+
if (env[binding]) {
|
|
762
|
+
throw new Error(`secretsStore: ${binding} reuses a binding name the Worker already has.`);
|
|
763
|
+
}
|
|
764
|
+
if (deploy) {
|
|
765
|
+
const secret = provisioned(deploy.resources.secretsStore, binding);
|
|
766
|
+
env[binding] = {
|
|
767
|
+
type: "secrets-store-secret",
|
|
768
|
+
storeId: secret.storeId,
|
|
769
|
+
secretName: secret.secretName,
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
env[binding] = {
|
|
774
|
+
type: "secrets-store-secret",
|
|
775
|
+
storeId: LOCAL_SECRETS_STORE_ID,
|
|
776
|
+
secretName: suffixedName(appWorker, binding),
|
|
777
|
+
};
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
/**
|
|
782
|
+
* The manifest's Analytics Engine datasets, which every one of the app's
|
|
783
|
+
* Workers writes to: the `dataset` an entry names, or
|
|
784
|
+
* `<app worker>--<binding>`. Deployed, the app's Worker name is the build's
|
|
785
|
+
* placeholder, which the install rewrites like every other; a named
|
|
786
|
+
* dataset holds none and stays as written.
|
|
787
|
+
*/
|
|
788
|
+
function addAnalyticsEngineBindings(env, manifest, appWorker) {
|
|
789
|
+
for (const entry of manifest.resources?.analyticsEngine ?? []) {
|
|
790
|
+
if (env[entry.name]) {
|
|
791
|
+
throw new Error(`analyticsEngine: ${entry.name} reuses a binding name the Worker already has.`);
|
|
792
|
+
}
|
|
793
|
+
env[entry.name] = {
|
|
794
|
+
type: "analytics-engine-dataset",
|
|
795
|
+
name: entry.dataset ?? suffixedName(appWorker, entry.name),
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
}
|
|
621
799
|
/**
|
|
622
800
|
* DATABASE_PROVIDER and the Hyperdrive configs one of the app's Workers
|
|
623
801
|
* binds: each config every Worker shares, and those a helper (`forWorker`)
|
|
@@ -864,9 +1042,10 @@ function workerNameFor(appId) {
|
|
|
864
1042
|
}
|
|
865
1043
|
/**
|
|
866
1044
|
* Copies of the gateway's naming rules (@every-app/perimeter/manifest's
|
|
867
|
-
* resourceNameFor, bucketNameFor and
|
|
868
|
-
* for a bucket) take the Worker's name, any other
|
|
869
|
-
* Vectorize index)
|
|
1045
|
+
* resourceNameFor, bucketNameFor, vectorizeNameFor and storeSecretNameFor):
|
|
1046
|
+
* `DB` and `KV` (`R2` for a bucket) take the Worker's name, any other
|
|
1047
|
+
* binding (and every Vectorize index and Secrets Store secret)
|
|
1048
|
+
* `<worker>--<binding>`.
|
|
870
1049
|
*/
|
|
871
1050
|
function resourceNameFor(workerName, binding) {
|
|
872
1051
|
return binding === "DB" || binding === "KV"
|
|
@@ -876,6 +1055,10 @@ function resourceNameFor(workerName, binding) {
|
|
|
876
1055
|
function bucketNameFor(workerName, binding) {
|
|
877
1056
|
return binding === "R2" ? workerName : suffixedName(workerName, binding);
|
|
878
1057
|
}
|
|
1058
|
+
/** A copy of @every-app/perimeter/manifest's queueNameFor: `<worker>--<binding>`. */
|
|
1059
|
+
function queueNameFor(workerName, binding) {
|
|
1060
|
+
return suffixedName(workerName, binding);
|
|
1061
|
+
}
|
|
879
1062
|
function suffixedName(workerName, binding) {
|
|
880
1063
|
return `${workerName}--${binding.toLowerCase().replaceAll("_", "-")}`;
|
|
881
1064
|
}
|
package/dist/dev/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* signs with, its issuer and its key id. For the platform's local dev tools
|
|
4
4
|
* (the CLI, `@every-app/perimeter/dev`); never imported by a Worker.
|
|
5
5
|
*/
|
|
6
|
-
export { DEV_ISSUER, DEV_PRIVATE_KEY_PEM, DEV_PUBLIC_KEY_PEM, } from "./keypair.js";
|
|
6
|
+
export { DEV_ISSUER, DEV_ORG_ID, DEV_PRIVATE_KEY_PEM, DEV_PUBLIC_KEY_PEM, } from "./keypair.js";
|
|
7
7
|
export { IDENTITY_DEV_KEY_ID } from "../internal/protocol.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/dev/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dev/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dev/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/dev/index.js
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* signs with, its issuer and its key id. For the platform's local dev tools
|
|
4
4
|
* (the CLI, `@every-app/perimeter/dev`); never imported by a Worker.
|
|
5
5
|
*/
|
|
6
|
-
export { DEV_ISSUER, DEV_PRIVATE_KEY_PEM, DEV_PUBLIC_KEY_PEM, } from "./keypair.js";
|
|
6
|
+
export { DEV_ISSUER, DEV_ORG_ID, DEV_PRIVATE_KEY_PEM, DEV_PUBLIC_KEY_PEM, } from "./keypair.js";
|
|
7
7
|
export { IDENTITY_DEV_KEY_ID } from "../internal/protocol.js";
|
package/dist/dev/keypair.d.ts
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
/** Issuer of locally minted dev identity tokens. */
|
|
19
19
|
export declare const DEV_ISSUER = "https://gateway.dev.localhost";
|
|
20
|
+
/** The organization the dev gateway's seeded user belongs to (`everyAppWorker()` sets it as `EVERY_APP_ORG_ID` in dev). */
|
|
21
|
+
export declare const DEV_ORG_ID = "dev-org";
|
|
20
22
|
/** SPKI PEM public half of the dev keypair. */
|
|
21
23
|
export declare const DEV_PUBLIC_KEY_PEM = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh40zWf+QK3rJdMTNoy+X\nF9iydV5raWSeEt4DXyeY98c8IZHRjy2UXaaYejweebRsv9Az+bZuL3cfJ0E7pOGd\n4VCOiSG1BjJglmTC1whV4Md6qhLDVOP6iztUJSxDwnlR85UtOyNJ4G5dYY6RrAWl\nPMMXPSYdGWqAP4n5QXAw+7uTFmJMdWy1W8KLbTj//NSGn3DCm+EZJIC8q9yDhMSc\nM0ejJnBVColvp4T8k8dt2kYGu2Wd7dCMrHv/lxUoqD58avpdMOzbaZtwsQ7BAaIa\nmIeQ1AKxmnCj1np23uWvYQmoaZocvupLSALK7fWGUyVDZ+RW4HtN5KqzZypfiyZ8\nkQIDAQAB\n-----END PUBLIC KEY-----\n";
|
|
22
24
|
/** PKCS#8 PEM private half of the dev keypair. Public, see above. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keypair.d.ts","sourceRoot":"","sources":["../../src/dev/keypair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,UAAU,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"keypair.d.ts","sourceRoot":"","sources":["../../src/dev/keypair.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,UAAU,kCAAkC,CAAC;AAC1D,2HAA2H;AAC3H,eAAO,MAAM,UAAU,YAAY,CAAC;AAEpC,+CAA+C;AAC/C,eAAO,MAAM,kBAAkB,idAS9B,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,mBAAmB,ysDA4B/B,CAAC"}
|
package/dist/dev/keypair.js
CHANGED
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
/** Issuer of locally minted dev identity tokens. */
|
|
19
19
|
export const DEV_ISSUER = "https://gateway.dev.localhost";
|
|
20
|
+
/** The organization the dev gateway's seeded user belongs to (`everyAppWorker()` sets it as `EVERY_APP_ORG_ID` in dev). */
|
|
21
|
+
export const DEV_ORG_ID = "dev-org";
|
|
20
22
|
/** SPKI PEM public half of the dev keypair. */
|
|
21
23
|
export const DEV_PUBLIC_KEY_PEM = `-----BEGIN PUBLIC KEY-----
|
|
22
24
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh40zWf+QK3rJdMTNoy+X
|
|
@@ -945,7 +945,7 @@ export declare const CAPABILITIES: {
|
|
|
945
945
|
readonly 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.";
|
|
946
946
|
readonly secrets: readonly [{
|
|
947
947
|
readonly name: "ANTHROPIC_API_KEY";
|
|
948
|
-
readonly hint: "A key scoped to one workspace
|
|
948
|
+
readonly hint: "A key scoped to one workspace; the Gateway strips any anthropic-workspace-id header an app sends, so the key alone decides the workspace.";
|
|
949
949
|
}];
|
|
950
950
|
readonly smoke: {
|
|
951
951
|
readonly method: "GET";
|
|
@@ -420,7 +420,7 @@ export declare const CATALOG_ENTRIES: {
|
|
|
420
420
|
readonly 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.";
|
|
421
421
|
readonly secrets: readonly [{
|
|
422
422
|
readonly name: "ANTHROPIC_API_KEY";
|
|
423
|
-
readonly hint: "A key scoped to one workspace
|
|
423
|
+
readonly hint: "A key scoped to one workspace; the Gateway strips any anthropic-workspace-id header an app sends, so the key alone decides the workspace.";
|
|
424
424
|
}];
|
|
425
425
|
readonly smoke: {
|
|
426
426
|
readonly method: "GET";
|
|
@@ -23,7 +23,7 @@ export declare const INFERENCE: {
|
|
|
23
23
|
readonly 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.";
|
|
24
24
|
readonly secrets: readonly [{
|
|
25
25
|
readonly name: "ANTHROPIC_API_KEY";
|
|
26
|
-
readonly hint: "A key scoped to one workspace
|
|
26
|
+
readonly hint: "A key scoped to one workspace; the Gateway strips any anthropic-workspace-id header an app sends, so the key alone decides the workspace.";
|
|
27
27
|
}];
|
|
28
28
|
readonly smoke: {
|
|
29
29
|
readonly method: "GET";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const INFERENCE = {
|
|
2
|
-
// Bearer is the documented header today; x-api-key is the legacy fallback.
|
|
2
|
+
// Bearer is the documented header today; x-api-key is the legacy fallback. The Gateway strips anthropic-workspace-id (and x-api-key), so the key alone decides the workspace.
|
|
3
3
|
anthropic: {
|
|
4
4
|
mode: "ai",
|
|
5
5
|
label: "Anthropic",
|
|
@@ -28,7 +28,7 @@ export const INFERENCE = {
|
|
|
28
28
|
secrets: [
|
|
29
29
|
{
|
|
30
30
|
name: "ANTHROPIC_API_KEY",
|
|
31
|
-
hint: "A key scoped to one workspace
|
|
31
|
+
hint: "A key scoped to one workspace; the Gateway strips any anthropic-workspace-id header an app sends, so the key alone decides the workspace.",
|
|
32
32
|
},
|
|
33
33
|
],
|
|
34
34
|
smoke: {
|
|
@@ -420,7 +420,7 @@ export const INFERENCE = {
|
|
|
420
420
|
},
|
|
421
421
|
tags: ["ai", "images", "video", "audio"],
|
|
422
422
|
},
|
|
423
|
-
// The
|
|
423
|
+
// The Gateway strips X-HF-Bill-To, so calls bill the token's own account, never another organization the token's user belongs to.
|
|
424
424
|
huggingface: {
|
|
425
425
|
mode: "api_key",
|
|
426
426
|
label: "Hugging Face Inference",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* apps/every-app-gateway/src/server/events/catalogue.ts; this module knows
|
|
10
10
|
* the names, versions and one-line descriptions only.
|
|
11
11
|
*/
|
|
12
|
-
export type EventGroup = "member" | "app" | "cap" | "tool" | "connection" | "token" | "access" | "signin_provider" | "mcp_app" | "provider" | "ai" | "ping";
|
|
12
|
+
export type EventGroup = "member" | "organization" | "app" | "cap" | "group" | "tool" | "connection" | "token" | "access" | "signin_provider" | "mcp_app" | "provider" | "subscription" | "ai" | "ping";
|
|
13
13
|
export interface EventTypeInfo {
|
|
14
14
|
/** `member.joined`, `cap.reached`, … */
|
|
15
15
|
readonly type: string;
|
|
@@ -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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EAAE,oBAAoB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,cAAc,GACtB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC3B,CAAC;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
|
@@ -24,16 +24,29 @@ export const EVENT_TYPES = [
|
|
|
24
24
|
entry("member", "member.reactivated", "A member was reactivated"),
|
|
25
25
|
entry("member", "member.removed", "A member was removed"),
|
|
26
26
|
entry("member", "member.password_reset", "A member reset their password"),
|
|
27
|
+
entry("member", "member.invitation_cancelled", "A pending invitation was cancelled"),
|
|
28
|
+
entry("organization", "organization.renamed", "The workspace was renamed"),
|
|
27
29
|
entry("app", "app.installed", "An app was installed on the Gateway"),
|
|
28
30
|
entry("app", "app.updated", "An app was redeployed"),
|
|
31
|
+
entry("app", "app.live", "An app went live on the Gateway"),
|
|
29
32
|
entry("app", "app.removed", "An app was removed from the Gateway"),
|
|
30
33
|
entry("app", "app.needs_setup", "An app needs a setting before it opens"),
|
|
31
34
|
entry("app", "app.ready", "An app has every setting it needs"),
|
|
32
35
|
entry("app", "app.paused_cap", "An app is paused: its monthly cap is reached"),
|
|
33
36
|
entry("app", "app.tools_changed", "An app's AI tools changed"),
|
|
37
|
+
entry("app", "app.renamed", "An app's name or description changed"),
|
|
38
|
+
entry("app", "app.settings_changed", "An app's settings were set or unset (names only)"),
|
|
39
|
+
entry("app", "app.access_changed", "Who can open an app changed"),
|
|
40
|
+
entry("app", "app.email_changed", "An app's email senders or inbound changed"),
|
|
34
41
|
entry("cap", "cap.warning", "An app is at 80% of its monthly cap"),
|
|
35
42
|
entry("cap", "cap.reached", "An app reached its monthly cap"),
|
|
36
43
|
entry("cap", "cap.raised", "An app's monthly cap, or the workspace default, was raised or removed"),
|
|
44
|
+
entry("cap", "cap.changed", "An app's monthly cap, or the workspace default, was set or lowered"),
|
|
45
|
+
entry("group", "group.created", "A group was created"),
|
|
46
|
+
entry("group", "group.updated", "A group was renamed or described"),
|
|
47
|
+
entry("group", "group.removed", "A group was removed"),
|
|
48
|
+
entry("group", "group.members_changed", "A group's members changed"),
|
|
49
|
+
entry("group", "group.apps_changed", "The apps a group opens changed"),
|
|
37
50
|
entry("tool", "tool.blocked", "An AI client's tool call was blocked"),
|
|
38
51
|
entry("tool", "tool.error", "An AI client's tool call failed"),
|
|
39
52
|
entry("connection", "connection.created", "An AI app was connected"),
|
|
@@ -47,12 +60,18 @@ export const EVENT_TYPES = [
|
|
|
47
60
|
entry("mcp_app", "mcp_app.removed", "An MCP app was removed"),
|
|
48
61
|
entry("mcp_app", "mcp_app.enabled", "An MCP app is being served again"),
|
|
49
62
|
entry("mcp_app", "mcp_app.disabled", "An MCP app stopped being served"),
|
|
63
|
+
entry("mcp_app", "mcp_app.updated", "An MCP app's risk default, name or description changed"),
|
|
64
|
+
entry("mcp_app", "mcp_app.tool_changed", "One tool of an MCP app was overridden: its risk, or on/off"),
|
|
50
65
|
entry("provider", "provider.added", "A provider was registered"),
|
|
51
66
|
entry("provider", "provider.removed", "A provider was removed"),
|
|
52
67
|
entry("provider", "provider.updated", "A provider's spec or OAuth client was replaced"),
|
|
53
68
|
entry("provider", "provider.connected", "Someone connected an account at an OAuth provider"),
|
|
54
69
|
entry("provider", "provider.disconnected", "An OAuth provider account was disconnected"),
|
|
55
70
|
entry("provider", "provider.connection_expired", "An OAuth provider refused to refresh a connection; it needs reconnecting"),
|
|
71
|
+
entry("subscription", "subscription.created", "An event subscription was added"),
|
|
72
|
+
entry("subscription", "subscription.updated", "An event subscription was changed, paused or resumed"),
|
|
73
|
+
entry("subscription", "subscription.removed", "An event subscription was removed"),
|
|
74
|
+
entry("subscription", "subscription.redelivered", "A delivery was queued again by hand"),
|
|
56
75
|
entry("ai", "ai.default_changed", "The default model provider changed"),
|
|
57
76
|
entry("ping", "ping", "A test event, sent to one subscription on request"),
|
|
58
77
|
];
|
|
@@ -190,8 +209,11 @@ export const EVENT_EMAIL_RECIPIENTS = ["owners", "admins"];
|
|
|
190
209
|
* gateway's app events and every app's own.
|
|
191
210
|
*/
|
|
192
211
|
export function eventPatternMatches(pattern, type) {
|
|
212
|
+
// Everything but a test ping and the bus's own housekeeping: a webhook
|
|
213
|
+
// hears about subscriptions only when it names `subscription.*`, so a
|
|
214
|
+
// catch-all's first delivery is the event it was made for, not itself.
|
|
193
215
|
if (pattern === "*")
|
|
194
|
-
return type !== "ping";
|
|
216
|
+
return type !== "ping" && !type.startsWith("subscription.");
|
|
195
217
|
if (pattern.endsWith(".*")) {
|
|
196
218
|
return type.startsWith(pattern.slice(0, -1));
|
|
197
219
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, type SystemClaims, type SystemTokenPurpose } from "./protocol.js";
|
|
2
|
-
export { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, };
|
|
1
|
+
import { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, ORG_ID_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, type SystemClaims, type SystemTokenPurpose } from "./protocol.js";
|
|
2
|
+
export { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, ORG_ID_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, };
|
|
3
3
|
export declare class IdentityError extends Error {
|
|
4
4
|
readonly status = 401;
|
|
5
5
|
constructor(message: string);
|
|
@@ -35,6 +35,25 @@ export interface VerifyOptions {
|
|
|
35
35
|
* claims).
|
|
36
36
|
*/
|
|
37
37
|
export declare function verifyIdentityJwt(token: string, options: VerifyOptions): Promise<EveryAppUser>;
|
|
38
|
+
/** A verified identity, with when it stops being one. */
|
|
39
|
+
export interface VerifiedIdentity {
|
|
40
|
+
user: EveryAppUser;
|
|
41
|
+
/** The token's `exp`, in epoch milliseconds. */
|
|
42
|
+
expiresAt: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* {@link verifyIdentityJwt}, keeping the token's expiry: the SDK's request
|
|
46
|
+
* context stops forwarding an identity shortly before it, and goes on as
|
|
47
|
+
* the organization's background work.
|
|
48
|
+
*/
|
|
49
|
+
export declare function verifyIdentity(token: string, options: VerifyOptions): Promise<VerifiedIdentity>;
|
|
50
|
+
/**
|
|
51
|
+
* The organization pin: a deployed Worker serves one organization
|
|
52
|
+
* (`EVERY_APP_ORG_ID`), and an identity for any other is refused, whatever
|
|
53
|
+
* its audience says. Throws {@link IdentityError} on a mismatch; a Worker
|
|
54
|
+
* with no pin (a shared app's) accepts every organization.
|
|
55
|
+
*/
|
|
56
|
+
export declare function assertOrganizationPin(user: EveryAppUser, organizationId: string | undefined): void;
|
|
38
57
|
/**
|
|
39
58
|
* Verify the gateway's system token (the value of `x-everyapp-system`)
|
|
40
59
|
* fail-closed, for exactly one purpose. A user identity or public marker is
|
|
@@ -56,9 +75,16 @@ export interface IdentityResult {
|
|
|
56
75
|
user: EveryAppUser | null;
|
|
57
76
|
/** True when the gateway marked this request as a public route. */
|
|
58
77
|
isPublic: boolean;
|
|
78
|
+
/** When the identity expires (epoch ms); null on a public route. */
|
|
79
|
+
expiresAt: number | null;
|
|
59
80
|
}
|
|
60
81
|
export interface RequestIdentityOptions {
|
|
61
82
|
audience: string;
|
|
83
|
+
/**
|
|
84
|
+
* The organization this Worker is pinned to ({@link ORG_ID_ENV}): an
|
|
85
|
+
* identity for another is refused. Undefined accepts every organization.
|
|
86
|
+
*/
|
|
87
|
+
organizationId?: string;
|
|
62
88
|
/** Provide keys directly, or let {@link getIdentityFromRequest} read env. */
|
|
63
89
|
publicKeys?: string[];
|
|
64
90
|
/** Env bag to read {@link PUBLIC_KEYS_ENV} / {@link DEV_ENV} from. */
|
|
@@ -84,5 +110,5 @@ export declare function resolveVerifyOptions(options: RequestIdentityOptions): V
|
|
|
84
110
|
* problem — including a bare/forged public header — so a re-exposed worker
|
|
85
111
|
* fails closed.
|
|
86
112
|
*/
|
|
87
|
-
export declare function getIdentityFromRequest(request: Request, options: RequestIdentityOptions): Promise<IdentityResult>;
|
|
113
|
+
export declare function getIdentityFromRequest(request: Request | Headers, options: RequestIdentityOptions): Promise<IdentityResult>;
|
|
88
114
|
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -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,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,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;gBACV,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,EAAE,CA8B7E;AAYD,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,0BAA0B;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAeD;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,YAAY,CAAC,
|
|
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;gBACV,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,EAAE,CA8B7E;AAYD,MAAM,WAAW,aAAa;IAC5B,6CAA6C;IAC7C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,sCAAsC;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