@voltro/protocol 0.83.1 → 0.85.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/session.d.ts CHANGED
@@ -170,53 +170,51 @@ export declare type SessionPayload = typeof SessionPayload_2.Type;
170
170
 
171
171
  declare const SessionPayload_2: Schema.Struct<{
172
172
  /** Payload format version. Required and pinned — see the header. */
173
- v: Schema.Literal<[2]>;
173
+ readonly v: Schema.Literal<2>;
174
174
  /** WHO, never WHAT-THEY-MAY-DO. `SubjectIdentity` has no `scopes` field. */
175
- subject: Schema.Union<[Schema.Struct<{
176
- type: Schema.Literal<["user"]>;
177
- id: typeof Schema.String;
178
- tenantId: typeof Schema.String;
179
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
175
+ readonly subject: Schema.Union<readonly [Schema.Struct<{
176
+ readonly type: Schema.Literal<"user">;
177
+ readonly id: Schema.String;
178
+ readonly tenantId: Schema.String;
179
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
180
180
  }>, Schema.Struct<{
181
- type: Schema.Literal<["apiKey"]>;
182
- id: typeof Schema.String;
183
- tenantId: typeof Schema.String;
184
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
181
+ readonly type: Schema.Literal<"apiKey">;
182
+ readonly id: Schema.String;
183
+ readonly tenantId: Schema.String;
184
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
185
185
  }>, Schema.Struct<{
186
- type: Schema.Literal<["serviceAccount"]>;
187
- id: typeof Schema.String;
188
- tenantId: typeof Schema.String;
189
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
190
- auditActorId: Schema.optionalWith<Schema.NullOr<typeof Schema.String>, {
191
- exact: true;
192
- }>;
186
+ readonly type: Schema.Literal<"serviceAccount">;
187
+ readonly id: Schema.String;
188
+ readonly tenantId: Schema.String;
189
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
190
+ readonly auditActorId: Schema.optionalKey<Schema.NullOr<Schema.String>>;
193
191
  }>, Schema.Struct<{
194
- type: Schema.Literal<["anonymous"]>;
195
- id: typeof Schema.Null;
196
- tenantId: Schema.NullOr<typeof Schema.String>;
197
- credentialRejected: Schema.optional<typeof Schema.String>;
192
+ readonly type: Schema.Literal<"anonymous">;
193
+ readonly id: Schema.Null;
194
+ readonly tenantId: Schema.NullOr<Schema.String>;
195
+ readonly credentialRejected: Schema.optional<Schema.String>;
198
196
  }>, Schema.Struct<{
199
- type: Schema.Literal<["system"]>;
200
- id: typeof Schema.String;
201
- tenantId: typeof Schema.Null;
202
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
197
+ readonly type: Schema.Literal<"system">;
198
+ readonly id: Schema.String;
199
+ readonly tenantId: Schema.Null;
200
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
203
201
  }>, Schema.Struct<{
204
- type: Schema.Literal<["service"]>;
205
- id: typeof Schema.String;
206
- tenantId: typeof Schema.Null;
207
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
208
- service: typeof Schema.String;
202
+ readonly type: Schema.Literal<"service">;
203
+ readonly id: Schema.String;
204
+ readonly tenantId: Schema.Null;
205
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
206
+ readonly service: Schema.String;
209
207
  }>]>;
210
208
  /** Unix seconds when this session expires. Verify rejects past expiry. */
211
- exp: typeof Schema.Number;
209
+ readonly exp: Schema.Number;
212
210
  /** Unix seconds when this session was issued. Drives sliding-window
213
211
  * auto-renewal: verify signals a renew once `now - iat` passes the
214
212
  * renewal threshold (default 70% of the session's lifetime). */
215
- iat: typeof Schema.Number;
213
+ readonly iat: Schema.Number;
216
214
  /** Key id of the signing secret. Stamped from the current key on sign;
217
215
  * read on verify to pick which secret to check first. Absent on
218
216
  * values minted with a bare-string secret (single-key path). */
219
- kid: Schema.optional<typeof Schema.String>;
217
+ readonly kid: Schema.optional<Schema.String>;
220
218
  }>;
221
219
 
222
220
  declare type SessionPayload = typeof SessionPayload_2.Type;
@@ -278,33 +276,31 @@ export declare interface SignOptions {
278
276
  */
279
277
  export declare const signSession: (subject: Subject | SubjectIdentity, secret: string | KeyedSecret, options?: SignOptions) => string;
280
278
 
281
- declare const Subject: Schema.Union<[Schema.Struct<{
282
- type: Schema.Literal<["user"]>;
283
- id: typeof Schema.String;
284
- tenantId: typeof Schema.String;
285
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
286
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
279
+ declare const Subject: Schema.Union<readonly [Schema.Struct<{
280
+ readonly type: Schema.Literal<"user">;
281
+ readonly id: Schema.String;
282
+ readonly tenantId: Schema.String;
283
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
284
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
287
285
  }>, Schema.Struct<{
288
- type: Schema.Literal<["apiKey"]>;
289
- id: typeof Schema.String;
290
- tenantId: typeof Schema.String;
291
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
292
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
286
+ readonly type: Schema.Literal<"apiKey">;
287
+ readonly id: Schema.String;
288
+ readonly tenantId: Schema.String;
289
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
290
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
293
291
  }>, Schema.Struct<{
294
- type: Schema.Literal<["serviceAccount"]>;
295
- id: typeof Schema.String;
296
- tenantId: typeof Schema.String;
292
+ readonly type: Schema.Literal<"serviceAccount">;
293
+ readonly id: Schema.String;
294
+ readonly tenantId: Schema.String;
297
295
  /** Application actor used for audit columns; null means machine work with
298
296
  * no application actor. Identity only, never a permission grant. */
299
- auditActorId: Schema.optionalWith<Schema.NullOr<typeof Schema.String>, {
300
- exact: true;
301
- }>;
302
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
303
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
297
+ readonly auditActorId: Schema.optionalKey<Schema.NullOr<Schema.String>>;
298
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
299
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
304
300
  }>, Schema.Struct<{
305
- type: Schema.Literal<["anonymous"]>;
306
- id: typeof Schema.Null;
307
- tenantId: Schema.NullOr<typeof Schema.String>;
301
+ readonly type: Schema.Literal<"anonymous">;
302
+ readonly id: Schema.Null;
303
+ readonly tenantId: Schema.NullOr<Schema.String>;
308
304
  /**
309
305
  * Set when this caller PRESENTED a credential and it was rejected — an
310
306
  * expired token above all. Absent when they presented none.
@@ -321,47 +317,45 @@ declare const Subject: Schema.Union<[Schema.Struct<{
321
317
  * must not break an `openAccess` procedure that needs no session at all. The
322
318
  * fact travels, and only a guard that actually refuses spends it.
323
319
  */
324
- credentialRejected: Schema.optional<typeof Schema.String>;
320
+ readonly credentialRejected: Schema.optional<Schema.String>;
325
321
  }>, Schema.Struct<{
326
- type: Schema.Literal<["system"]>;
327
- id: typeof Schema.String;
328
- tenantId: typeof Schema.Null;
329
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
330
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
322
+ readonly type: Schema.Literal<"system">;
323
+ readonly id: Schema.String;
324
+ readonly tenantId: Schema.Null;
325
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
326
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
331
327
  }>, Schema.Struct<{
332
- type: Schema.Literal<["service"]>;
333
- id: typeof Schema.String;
328
+ readonly type: Schema.Literal<"service">;
329
+ readonly id: Schema.String;
334
330
  /** The calling app's name, as the callee lists it in `serviceCallers`. */
335
- service: typeof Schema.String;
336
- tenantId: typeof Schema.Null;
337
- scopes: Schema.optional<Schema.Array$<typeof Schema.String>>;
338
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
331
+ readonly service: Schema.String;
332
+ readonly tenantId: Schema.Null;
333
+ readonly scopes: Schema.optional<Schema.$Array<Schema.String>>;
334
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
339
335
  }>]>;
340
336
 
341
337
  declare type Subject = typeof Subject.Type;
342
338
 
343
- declare const SubjectIdentity: Schema.Union<[Schema.Struct<{
344
- type: Schema.Literal<["user"]>;
345
- id: typeof Schema.String;
346
- tenantId: typeof Schema.String;
347
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
339
+ declare const SubjectIdentity: Schema.Union<readonly [Schema.Struct<{
340
+ readonly type: Schema.Literal<"user">;
341
+ readonly id: Schema.String;
342
+ readonly tenantId: Schema.String;
343
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
348
344
  }>, Schema.Struct<{
349
- type: Schema.Literal<["apiKey"]>;
350
- id: typeof Schema.String;
351
- tenantId: typeof Schema.String;
352
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
345
+ readonly type: Schema.Literal<"apiKey">;
346
+ readonly id: Schema.String;
347
+ readonly tenantId: Schema.String;
348
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
353
349
  }>, Schema.Struct<{
354
- type: Schema.Literal<["serviceAccount"]>;
355
- id: typeof Schema.String;
356
- tenantId: typeof Schema.String;
357
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
358
- auditActorId: Schema.optionalWith<Schema.NullOr<typeof Schema.String>, {
359
- exact: true;
360
- }>;
350
+ readonly type: Schema.Literal<"serviceAccount">;
351
+ readonly id: Schema.String;
352
+ readonly tenantId: Schema.String;
353
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
354
+ readonly auditActorId: Schema.optionalKey<Schema.NullOr<Schema.String>>;
361
355
  }>, Schema.Struct<{
362
- type: Schema.Literal<["anonymous"]>;
363
- id: typeof Schema.Null;
364
- tenantId: Schema.NullOr<typeof Schema.String>;
356
+ readonly type: Schema.Literal<"anonymous">;
357
+ readonly id: Schema.Null;
358
+ readonly tenantId: Schema.NullOr<Schema.String>;
365
359
  /**
366
360
  * Set when this caller PRESENTED a credential and it was rejected — an
367
361
  * expired token above all. Absent when they presented none.
@@ -378,18 +372,18 @@ declare const SubjectIdentity: Schema.Union<[Schema.Struct<{
378
372
  * must not break an `openAccess` procedure that needs no session at all. The
379
373
  * fact travels, and only a guard that actually refuses spends it.
380
374
  */
381
- credentialRejected: Schema.optional<typeof Schema.String>;
375
+ readonly credentialRejected: Schema.optional<Schema.String>;
382
376
  }>, Schema.Struct<{
383
- type: Schema.Literal<["system"]>;
384
- id: typeof Schema.String;
385
- tenantId: typeof Schema.Null;
386
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
377
+ readonly type: Schema.Literal<"system">;
378
+ readonly id: Schema.String;
379
+ readonly tenantId: Schema.Null;
380
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
387
381
  }>, Schema.Struct<{
388
- type: Schema.Literal<["service"]>;
389
- id: typeof Schema.String;
390
- tenantId: typeof Schema.Null;
391
- metadata: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
392
- service: typeof Schema.String;
382
+ readonly type: Schema.Literal<"service">;
383
+ readonly id: Schema.String;
384
+ readonly tenantId: Schema.Null;
385
+ readonly metadata: Schema.optional<Schema.$Record<Schema.String, Schema.Unknown>>;
386
+ readonly service: Schema.String;
393
387
  }>]>;
394
388
 
395
389
  declare type SubjectIdentity = typeof SubjectIdentity.Type;
package/dist/session.js CHANGED
@@ -1,4 +1,4 @@
1
- import { j as e, nt as t, z as n } from "./scopes-Di756ENh.js";
1
+ import { j as e, nt as t, z as n } from "./scopes-ClywBij8.js";
2
2
  import { n as r, t as i } from "./sessionHeader-DriTZhmv.js";
3
3
  import { Schema as a } from "effect";
4
4
  import { createHmac as o, timingSafeEqual as s } from "node:crypto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/protocol",
3
- "version": "0.83.1",
3
+ "version": "0.85.0",
4
4
  "description": "The Voltro wire + plugin contract — defineQuery/Mutation/Action/Stream, definePlugin, sessions / JWT / API-keys, and the RPC protocol.",
5
5
  "keywords": [
6
6
  "voltro",
@@ -63,16 +63,12 @@
63
63
  "node": ">=24.0.0"
64
64
  },
65
65
  "dependencies": {
66
- "@effect/experimental": "^0.61.1",
67
- "@effect/sql": "^0.52.1",
68
- "@voltro/database": "0.83.1",
69
- "@voltro/logger": "0.83.1",
66
+ "@voltro/database": "0.85.0",
67
+ "@voltro/logger": "0.85.0",
70
68
  "jose": "^6.2.12"
71
69
  },
72
70
  "peerDependencies": {
73
- "@effect/platform": "^0.97.2",
74
- "@effect/rpc": "^0.76.2",
75
- "effect": "^3.22.2"
71
+ "effect": "4.0.1"
76
72
  },
77
73
  "publishConfig": {
78
74
  "access": "public"