@rotorsoft/act 1.37.2 → 1.37.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/dist/.tsbuildinfo +1 -1
- package/dist/@types/builders/act-builder.d.ts.map +1 -1
- package/dist/@types/builders/event-builder.d.ts +12 -2
- package/dist/@types/builders/event-builder.d.ts.map +1 -1
- package/dist/@types/internal/date-reviver.d.ts +3 -1
- package/dist/@types/internal/date-reviver.d.ts.map +1 -1
- package/dist/@types/internal/zod.d.ts +36 -0
- package/dist/@types/internal/zod.d.ts.map +1 -0
- package/dist/@types/sensitive.d.ts +9 -20
- package/dist/@types/sensitive.d.ts.map +1 -1
- package/dist/@types/types/schemas.d.ts +3 -2
- package/dist/@types/types/schemas.d.ts.map +1 -1
- package/dist/{chunk-2H5MBVSQ.js → chunk-CB2OLGJK.js} +75 -52
- package/dist/chunk-CB2OLGJK.js.map +1 -0
- package/dist/{chunk-SIOPY6HT.js → chunk-FBZY2F5W.js} +2 -2
- package/dist/{chunk-J6G7UKZA.cjs → chunk-PN5GNW6E.cjs} +43 -20
- package/dist/chunk-PN5GNW6E.cjs.map +1 -0
- package/dist/{chunk-5OU5CTJZ.cjs → chunk-UPKDCTS2.cjs} +13 -13
- package/dist/{chunk-5OU5CTJZ.cjs.map → chunk-UPKDCTS2.cjs.map} +1 -1
- package/dist/index.cjs +203 -207
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +29 -33
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +4 -4
- package/dist/test/index.js +2 -2
- package/dist/types/index.cjs +2 -2
- package/dist/types/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-2H5MBVSQ.js.map +0 -1
- package/dist/chunk-J6G7UKZA.cjs.map +0 -1
- /package/dist/{chunk-SIOPY6HT.js.map → chunk-FBZY2F5W.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act-builder.d.ts","sourceRoot":"","sources":["../../../src/builders/act-builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"act-builder.d.ts","sourceRoot":"","sources":["../../../src/builders/act-builder.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAEV,KAAK,EAIL,MAAM,EACN,cAAc,EACd,OAAO,EAER,MAAM,mBAAmB,CAAC;AA4B3B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,GAAG,CAEjB,UAAU,SAAS,cAAc,CAAC,QAAQ,CAAC,GAAG,EAAE,EAChD,OAAO,SAAS,OAAO,GAAG,EAAE,EAC5B,QAAQ,SAAS,OAAO,GAAG,EAAE,EAC7B,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,EAC7C,MAAM,SAAS,KAAK,GAAG,KAAK,KACzB,UAAU,CAAC,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAgVhE"}
|
|
@@ -35,8 +35,11 @@ import { type EventGate } from "../internal/pii.js";
|
|
|
35
35
|
import type { LaneConfig, Registry } from "../types/index.js";
|
|
36
36
|
/** What one pass over an event's schema resolves. @internal */
|
|
37
37
|
export type EventTags = {
|
|
38
|
-
/**
|
|
39
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Keys marked `sensitive(...)`, top level (and across union variants), with
|
|
40
|
+
* the schema each declares.
|
|
41
|
+
*/
|
|
42
|
+
readonly sensitive: Readonly<Record<string, z.ZodType>>;
|
|
40
43
|
/**
|
|
41
44
|
* Revives the dates in a stored `data` payload, or `undefined` when the
|
|
42
45
|
* schema declares none.
|
|
@@ -85,6 +88,13 @@ export type Disclosure = "redact" | "strip";
|
|
|
85
88
|
export type BuiltEvents = {
|
|
86
89
|
/** Backs `registry.sensitive_fields`. */
|
|
87
90
|
readonly sensitive: Map<string, readonly string[]>;
|
|
91
|
+
/** The sensitive `Event.field`s, and `State.field`s of their name, a redaction marker doesn't fit. */
|
|
92
|
+
/**
|
|
93
|
+
* The sensitive-type advisory, naming each sensitive `Event.field`, and
|
|
94
|
+
* `State.field` of its name, that a redaction marker doesn't fit; or
|
|
95
|
+
* `undefined` when there are none. The builder logs it once.
|
|
96
|
+
*/
|
|
97
|
+
readonly advisory: string | undefined;
|
|
88
98
|
/** Backs `registry.query_gate` — the actor-less read surfaces. */
|
|
89
99
|
readonly query_readers: Map<string, EventGate>;
|
|
90
100
|
/** Readers for handlers — sensitive keys removed, payload typed. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-builder.d.ts","sourceRoot":"","sources":["../../../src/builders/event-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"event-builder.d.ts","sourceRoot":"","sources":["../../../src/builders/event-builder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EAAS,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrE,+DAA+D;AAC/D,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACxD;;;OAGG;IACH,QAAQ,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;IAChE;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACpE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,CA2BvD;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAsD5C;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,yCAAyC;IACzC,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IACnD,sGAAsG;IACtG;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,kEAAkE;IAClE,QAAQ,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAC/C,oEAAoE;IACpE,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAClD,CAAC;AAEF,8EAA8E;AAC9E,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C,kFAAkF;IAClF,QAAQ,CAAC,oBAAoB,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;CACrD,CAAC;AAOF;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACjC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,EAChC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,EAChC,MAAM,EAAE,YAAY,GACnB,WAAW,CA0Ib"}
|
|
@@ -29,7 +29,9 @@ import { z } from "zod";
|
|
|
29
29
|
* Zod does the walking, so nesting, arrays, records, unions and the wrappers
|
|
30
30
|
* are handled by the engine rather than by a traversal of our own that would
|
|
31
31
|
* drift as Zod grows constructs. A construct this doesn't recognise
|
|
32
|
-
* contributes no date, which is the documented fallthrough.
|
|
32
|
+
* contributes no date, which is the documented fallthrough. `z.lazy()` is one
|
|
33
|
+
* on purpose: this walk descends into shapes, so a recursive schema would
|
|
34
|
+
* never end.
|
|
33
35
|
*/
|
|
34
36
|
export declare function date_reviver_schema(schema: unknown): z.ZodType | undefined;
|
|
35
37
|
//# sourceMappingURL=date-reviver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-reviver.d.ts","sourceRoot":"","sources":["../../../src/internal/date-reviver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"date-reviver.d.ts","sourceRoot":"","sources":["../../../src/internal/date-reviver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAyCxB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,CAAC,OAAO,GAAG,SAAS,CA4D1E"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one place that reads Zod's internals.
|
|
3
|
+
*
|
|
4
|
+
* Several features look inside a field's schema: whether it was marked
|
|
5
|
+
* `sensitive(...)`, whether its value is a string, whether it holds a date to
|
|
6
|
+
* revive. They must agree on which wrappers they see through, so they all ask
|
|
7
|
+
* this module rather than each walking the schema its own way.
|
|
8
|
+
* `architecture.spec` keeps every other file away from `_zod`.
|
|
9
|
+
*/
|
|
10
|
+
import type { z } from "zod";
|
|
11
|
+
/** A Zod schema's definition, which every wrapper and marker lives on. */
|
|
12
|
+
type Def = Record<PropertyKey, any>;
|
|
13
|
+
/** The schema's definition (Zod 4 keeps it under `_zod.def`). */
|
|
14
|
+
export declare const def_of: (schema: unknown) => Def | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* The schemas a wrapper holds, or none for anything that isn't one:
|
|
17
|
+
* - `.optional()`, `.nullable()`, `.default()`, `.prefault()`,
|
|
18
|
+
* `.nonoptional()`, `.readonly()` and `.catch()` hold one inner schema;
|
|
19
|
+
* - a pipe holds its input and its output: `.transform()`, `.pipe()` and
|
|
20
|
+
* `z.preprocess()` all build one;
|
|
21
|
+
* - `z.lazy()` holds what its getter returns.
|
|
22
|
+
*/
|
|
23
|
+
export declare function wrapped(schema: unknown): z.ZodType[];
|
|
24
|
+
/**
|
|
25
|
+
* True when `test` holds for the schema or any schema it wraps, at any depth.
|
|
26
|
+
* Each schema is visited once, so a lazy schema that returns itself ends.
|
|
27
|
+
*/
|
|
28
|
+
export declare function some_layer(schema: unknown, test: (def: Def) => boolean): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* The schema that describes the value a schema produces: through every
|
|
31
|
+
* wrapper to its innermost schema, taking a pipe's output side. A transform's
|
|
32
|
+
* output can't be known, so the walk stops at it.
|
|
33
|
+
*/
|
|
34
|
+
export declare function output_of(schema: unknown): unknown;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../src/internal/zod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,0EAA0E;AAC1E,KAAK,GAAG,GAAG,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;AAEpC,iEAAiE;AACjE,eAAO,MAAM,MAAM,WAAY,OAAO,KAAG,GAAG,GAAG,SACc,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,CAMpD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,GAC1B,OAAO,CAST;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAalD"}
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The sensitive-data marker: the
|
|
3
|
-
* and the lookups that read it. The public
|
|
4
|
-
* sentinels live in `types/schemas.ts`, which
|
|
5
|
-
* here. The transforms that apply the marker at
|
|
6
|
-
* live in `internal/pii.ts`.
|
|
2
|
+
* The sensitive-data marker: the symbol `sensitive(zodType)` stamps on a
|
|
3
|
+
* schema's definition, and the lookups that read it. The public
|
|
4
|
+
* `sensitive()` and the two sentinels live in `types/schemas.ts`, which
|
|
5
|
+
* re-exports `pii_fields` from here. The transforms that apply the marker at
|
|
6
|
+
* commit, load and dispatch live in `internal/pii.ts`.
|
|
7
7
|
*/
|
|
8
|
-
import { z } from "zod";
|
|
8
|
+
import type { z } from "zod";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* the registry doesn't track; the field walker handles those via unwrap.
|
|
14
|
-
*
|
|
15
|
-
* Exported so the public `sensitive(zodType)` wrapper can call `_registry.add`.
|
|
16
|
-
* Underscore prefix marks "framework-private, don't touch from user code."
|
|
17
|
-
*/
|
|
18
|
-
export declare const _registry: z.core.$ZodRegistry<{
|
|
19
|
-
sensitive: true;
|
|
20
|
-
}, z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>>;
|
|
21
|
-
/**
|
|
22
|
-
* Stamp the def-level marker. Called by the public `sensitive()` alongside
|
|
23
|
-
* `_registry.add`.
|
|
10
|
+
* Stamp the def-level marker. Called by the public `sensitive()`. Throws on a
|
|
11
|
+
* schema with no Zod 4 definition: marking nothing would store the field in
|
|
12
|
+
* plain text.
|
|
24
13
|
*/
|
|
25
14
|
export declare function _mark_sensitive(schema: z.ZodType): void;
|
|
26
15
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sensitive.d.ts","sourceRoot":"","sources":["../../src/sensitive.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"sensitive.d.ts","sourceRoot":"","sources":["../../src/sensitive.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAa7B;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,IAAI,CAIvD;AAUD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAmBxE;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,GAAG,SAAS,MAAM,EAAE,CAE/D"}
|
|
@@ -25,8 +25,9 @@ export declare const REDACTED: "[REDACTED]";
|
|
|
25
25
|
export declare const SHREDDED: "[SHREDDED]";
|
|
26
26
|
/**
|
|
27
27
|
* Mark a Zod schema as sensitive. Returns the same schema instance — the
|
|
28
|
-
* marker is
|
|
29
|
-
* call site reads as a pure annotation
|
|
28
|
+
* marker is stamped on the schema's definition, so the static type is
|
|
29
|
+
* preserved, the call site reads as a pure annotation, and the marker
|
|
30
|
+
* survives any refinement chained after the call.
|
|
30
31
|
*
|
|
31
32
|
* Idempotent: re-wrapping an already-sensitive schema is a no-op.
|
|
32
33
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/types/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG1D;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ,sCAAkC,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAG,YAAqB,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAG,YAAqB,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../../src/types/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG1D;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,QAAQ,sCAAkC,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,EAAG,YAAqB,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAG,YAAqB,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAM3D;AAED;;GAEG;AACH,eAAO,MAAM,WAAW;;;kBAMX,CAAC;AAEd;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;kBAOZ,CAAC;AAEd;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;iBAI/B,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;kBAQf,CAAC;AAEd;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;kBAQnB,CAAC;AAEd;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,OAAO,QAAQ,CAAC,CAAC;IACjE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,OAAO,QAAQ,CAAC,CAAC;IAClE,KAAK,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;CAC/B,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;kBAeX,CAAC"}
|
|
@@ -130,28 +130,50 @@ var TOMBSTONE_EVENT = "__tombstone__";
|
|
|
130
130
|
var DEFAULT_LANE = "default";
|
|
131
131
|
|
|
132
132
|
// src/types/schemas.ts
|
|
133
|
-
import { z as z2 } from "zod";
|
|
134
|
-
|
|
135
|
-
// src/sensitive.ts
|
|
136
133
|
import { z } from "zod";
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
|
|
135
|
+
// src/internal/zod.ts
|
|
136
|
+
var def_of = (schema) => schema?._zod?.def;
|
|
137
|
+
function wrapped(schema) {
|
|
138
|
+
const def = def_of(schema);
|
|
139
|
+
if (!def) return [];
|
|
140
|
+
if (def.type === "pipe") return [def.in, def.out];
|
|
141
|
+
if (def.type === "lazy") return [def.getter()];
|
|
142
|
+
return def.innerType ? [def.innerType] : [];
|
|
143
|
+
}
|
|
144
|
+
function some_layer(schema, test) {
|
|
145
|
+
const seen = /* @__PURE__ */ new Set();
|
|
146
|
+
const visit = (s) => {
|
|
147
|
+
if (seen.has(s)) return false;
|
|
148
|
+
seen.add(s);
|
|
149
|
+
const def = def_of(s);
|
|
150
|
+
return !!def && (test(def) || wrapped(s).some(visit));
|
|
151
|
+
};
|
|
152
|
+
return visit(schema);
|
|
142
153
|
}
|
|
143
|
-
function
|
|
154
|
+
function output_of(schema) {
|
|
155
|
+
const seen = /* @__PURE__ */ new Set();
|
|
144
156
|
let cur = schema;
|
|
145
|
-
while (
|
|
146
|
-
|
|
147
|
-
const def = cur
|
|
148
|
-
if (def
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
if (
|
|
152
|
-
|
|
157
|
+
while (!seen.has(cur)) {
|
|
158
|
+
seen.add(cur);
|
|
159
|
+
const def = def_of(cur);
|
|
160
|
+
if (!def) return cur;
|
|
161
|
+
if (def.type === "pipe") cur = def.out;
|
|
162
|
+
else if (def.type === "lazy") cur = def.getter();
|
|
163
|
+
else if (def.innerType) cur = def.innerType;
|
|
164
|
+
else return cur;
|
|
153
165
|
}
|
|
166
|
+
return cur;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/sensitive.ts
|
|
170
|
+
var _SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
|
|
171
|
+
function _mark_sensitive(schema) {
|
|
172
|
+
const def = def_of(schema);
|
|
173
|
+
if (!def) throw new Error("sensitive() takes a Zod 4 schema");
|
|
174
|
+
def[_SENSITIVE] = true;
|
|
154
175
|
}
|
|
176
|
+
var is_pii = (schema) => some_layer(schema, (def) => def[_SENSITIVE] === true);
|
|
155
177
|
function pii_schemas(schema) {
|
|
156
178
|
const shape = schema.shape;
|
|
157
179
|
if (shape && typeof shape === "object") {
|
|
@@ -177,55 +199,54 @@ function pii_fields(schema) {
|
|
|
177
199
|
}
|
|
178
200
|
|
|
179
201
|
// src/types/schemas.ts
|
|
180
|
-
var ZodEmpty =
|
|
202
|
+
var ZodEmpty = z.record(z.string(), z.never());
|
|
181
203
|
var REDACTED = "[REDACTED]";
|
|
182
204
|
var SHREDDED = "[SHREDDED]";
|
|
183
205
|
function sensitive(schema) {
|
|
184
|
-
_registry.add(schema, { sensitive: true });
|
|
185
206
|
_mark_sensitive(schema);
|
|
186
207
|
return schema;
|
|
187
208
|
}
|
|
188
|
-
var ActorSchema =
|
|
189
|
-
id:
|
|
190
|
-
name:
|
|
209
|
+
var ActorSchema = z.object({
|
|
210
|
+
id: z.string(),
|
|
211
|
+
name: z.string()
|
|
191
212
|
}).loose().readonly();
|
|
192
|
-
var TargetSchema =
|
|
193
|
-
stream:
|
|
213
|
+
var TargetSchema = z.object({
|
|
214
|
+
stream: z.string(),
|
|
194
215
|
actor: ActorSchema,
|
|
195
|
-
expectedVersion:
|
|
216
|
+
expectedVersion: z.number().optional()
|
|
196
217
|
}).loose().readonly();
|
|
197
|
-
var CausationEventSchema =
|
|
198
|
-
id:
|
|
199
|
-
name:
|
|
200
|
-
stream:
|
|
218
|
+
var CausationEventSchema = z.object({
|
|
219
|
+
id: z.number(),
|
|
220
|
+
name: z.string(),
|
|
221
|
+
stream: z.string()
|
|
201
222
|
});
|
|
202
|
-
var EventMetaSchema =
|
|
203
|
-
correlation:
|
|
204
|
-
causation:
|
|
205
|
-
action: TargetSchema.and(
|
|
223
|
+
var EventMetaSchema = z.object({
|
|
224
|
+
correlation: z.string(),
|
|
225
|
+
causation: z.object({
|
|
226
|
+
action: TargetSchema.and(z.object({ name: z.string() })).optional(),
|
|
206
227
|
event: CausationEventSchema.optional()
|
|
207
228
|
})
|
|
208
229
|
}).readonly();
|
|
209
|
-
var CommittedMetaSchema =
|
|
210
|
-
id:
|
|
211
|
-
stream:
|
|
212
|
-
version:
|
|
213
|
-
created:
|
|
230
|
+
var CommittedMetaSchema = z.object({
|
|
231
|
+
id: z.number(),
|
|
232
|
+
stream: z.string(),
|
|
233
|
+
version: z.number(),
|
|
234
|
+
created: z.date(),
|
|
214
235
|
meta: EventMetaSchema
|
|
215
236
|
}).readonly();
|
|
216
|
-
var QuerySchema =
|
|
217
|
-
stream:
|
|
218
|
-
names:
|
|
219
|
-
before:
|
|
220
|
-
after:
|
|
221
|
-
limit:
|
|
222
|
-
created_before:
|
|
223
|
-
created_after:
|
|
224
|
-
backward:
|
|
225
|
-
correlation:
|
|
226
|
-
with_snaps:
|
|
227
|
-
with_pii:
|
|
228
|
-
stream_exact:
|
|
237
|
+
var QuerySchema = z.object({
|
|
238
|
+
stream: z.string().optional(),
|
|
239
|
+
names: z.string().array().optional(),
|
|
240
|
+
before: z.number().optional(),
|
|
241
|
+
after: z.number().optional(),
|
|
242
|
+
limit: z.number().optional(),
|
|
243
|
+
created_before: z.date().optional(),
|
|
244
|
+
created_after: z.date().optional(),
|
|
245
|
+
backward: z.boolean().optional(),
|
|
246
|
+
correlation: z.string().optional(),
|
|
247
|
+
with_snaps: z.boolean().optional(),
|
|
248
|
+
with_pii: z.boolean().optional(),
|
|
249
|
+
stream_exact: z.boolean().optional()
|
|
229
250
|
}).readonly();
|
|
230
251
|
|
|
231
252
|
// src/types/index.ts
|
|
@@ -260,6 +281,8 @@ export {
|
|
|
260
281
|
SNAP_EVENT,
|
|
261
282
|
TOMBSTONE_EVENT,
|
|
262
283
|
DEFAULT_LANE,
|
|
284
|
+
def_of,
|
|
285
|
+
output_of,
|
|
263
286
|
pii_schemas,
|
|
264
287
|
pii_fields,
|
|
265
288
|
ZodEmpty,
|
|
@@ -276,4 +299,4 @@ export {
|
|
|
276
299
|
LogLevels,
|
|
277
300
|
ExitCodes
|
|
278
301
|
};
|
|
279
|
-
//# sourceMappingURL=chunk-
|
|
302
|
+
//# sourceMappingURL=chunk-CB2OLGJK.js.map
|