@voltro/protocol 0.37.0 → 0.39.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/index.d.ts CHANGED
@@ -2181,6 +2181,21 @@ export declare interface IdempotencyStore {
2181
2181
  * corrupt the pointer. */
2182
2182
  export declare const idToPath: (id: RowId) => string;
2183
2183
 
2184
+ /**
2185
+ * `Subject.metadata` is the APP's bag — opaque to the framework, stored
2186
+ * verbatim — with exactly one reserved key: this one. It carries the mark that
2187
+ * says the session is an impersonated one.
2188
+ *
2189
+ * **Why it lives in protocol and not in `@voltro/plugin-auth`, which mints it.**
2190
+ * Two packages need the answer to "is this session impersonated" and they must
2191
+ * not depend on each other: plugin-auth WRITES the mark, and plugin-audit reads
2192
+ * it to stamp `AuditEvent.impersonation` before redaction runs. A key spelled
2193
+ * out in both is a second definition that no guard is watching — the shape this
2194
+ * repo has been bitten by often enough to have a rule about it. `Subject` is
2195
+ * protocol's type, so its reserved key is protocol's too.
2196
+ */
2197
+ export declare const IMPERSONATION_METADATA_KEY: "impersonation";
2198
+
2184
2199
  export declare interface InsertTarget<Input = unknown, Row = unknown, Item = Record<string, unknown>> extends NestedTargetFields<Input> {
2185
2200
  readonly table: string;
2186
2201
  readonly op: 'insert';
@@ -3591,6 +3606,18 @@ export declare const queryToRpc: <Name extends string, Input extends Schema.Sche
3591
3606
  revision: Schema.optional<typeof Schema.Number>;
3592
3607
  }>]>, Schema.Schema.All>, typeof Schema.Never, never>;
3593
3608
 
3609
+ /**
3610
+ * The RAW mark, unvalidated, or `null`.
3611
+ *
3612
+ * Deliberately `unknown`: protocol owns the key, not the payload's shape.
3613
+ * `@voltro/plugin-auth` mints the mark and validates it back into an
3614
+ * `ImpersonationMark`; an auditor only needs to copy it out before a redactor
3615
+ * can reach it, and giving protocol an opinion about the fields would make the
3616
+ * shape need to agree in two places again — the exact thing the key moved here
3617
+ * to avoid.
3618
+ */
3619
+ export declare const rawImpersonationMark: (subject: Subject) => unknown;
3620
+
3594
3621
  /** The `channel:` namespace. Every channel key starts with it. */
3595
3622
  export declare const REACTIVITY_CHANNEL_PREFIX = "channel:";
3596
3623
 
@@ -4068,7 +4095,7 @@ export declare const streamToRpc: <Name extends string, Input extends Schema.Sch
4068
4095
  * non-struct payload (`Schema.Void`, a scalar) is unaffected — there is no
4069
4096
  * excess property for it to have.
4070
4097
  */
4071
- export declare const strictInput: <S extends Schema.Schema.Any>(input: S) => S;
4098
+ export declare const strictInput: <S extends Schema.Schema.Any>(input: S, procedure?: string) => S;
4072
4099
 
4073
4100
  export declare const Subject: Schema.Union<[Schema.Struct<{
4074
4101
  type: Schema.Literal<["user"]>;