@theoremjs/web 0.3.5-next.967.gd19ced6 → 0.3.5-next.970.g11bd0cf

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/web",
3
- "version": "0.3.5-next.967.gd19ced6",
3
+ "version": "0.3.5-next.970.g11bd0cf",
4
4
  "description": "Theorem on the web platform, with no UI framework: Web-standard server handlers that serve a profile, and the browser client that talks to them.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,6 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^4.6.5",
28
- "@theoremjs/agents": "^0.3.5-next.967.gd19ced6"
28
+ "@theoremjs/agents": "^0.3.5-next.970.g11bd0cf"
29
29
  }
30
30
  }
package/server/handler.js CHANGED
@@ -262,6 +262,9 @@ function sessionCredentials(ctx, sessionId) {
262
262
  return {
263
263
  get: async (slot) => (await ctx.credentials.read(sessionId))[slot],
264
264
  set: (slot, credential) => saveCredential(ctx, sessionId, slot, credential),
265
+ delete: (slot) => ctx.credentials.mutate(sessionId, (saved) => {
266
+ delete saved[slot];
267
+ }),
265
268
  };
266
269
  }
267
270
  /** An OAuth gate given the host's sign-in URL. */
@@ -36,5 +36,6 @@ export declare function stagesInOrder(app: StageHandler | undefined, own: StageH
36
36
  /**
37
37
  * The application's credentials, then the session's. A credential is saved where the slot
38
38
  * already lives: a refreshed token back to the application, a sign-in at a gate to the session.
39
+ * A delete forgets the slot in both, so neither copy answers after it.
39
40
  */
40
41
  export declare function credentialsInOrder(app: ToolCredentialSource | undefined, session: ToolCredentialSource): ToolCredentialSource;
@@ -73,6 +73,7 @@ export function stagesInOrder(app, own) {
73
73
  /**
74
74
  * The application's credentials, then the session's. A credential is saved where the slot
75
75
  * already lives: a refreshed token back to the application, a sign-in at a gate to the session.
76
+ * A delete forgets the slot in both, so neither copy answers after it.
76
77
  */
77
78
  export function credentialsInOrder(app, session) {
78
79
  if (!app)
@@ -82,6 +83,10 @@ export function credentialsInOrder(app, session) {
82
83
  return {
83
84
  get: async (slot) => (await app.get(slot)) ?? (await session.get(slot)),
84
85
  set: async (slot, credential) => (await app.get(slot)) ? await app.set(slot, credential) : await session.set(slot, credential),
86
+ delete: async (slot) => {
87
+ await app.delete(slot);
88
+ await session.delete(slot);
89
+ },
85
90
  ...(secrets.clientSecret
86
91
  ? { clientSecret: async (clientId) => await secrets.clientSecret?.(clientId) }
87
92
  : {}),