@rotorsoft/act 1.37.3 → 1.37.5
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 +11 -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 +39 -0
- package/dist/@types/internal/zod.d.ts.map +1 -0
- package/dist/@types/sensitive.d.ts +4 -3
- package/dist/@types/sensitive.d.ts.map +1 -1
- package/dist/@types/types/ports.d.ts +5 -7
- package/dist/@types/types/ports.d.ts.map +1 -1
- package/dist/{chunk-TCADE3WY.cjs → chunk-H6KVPVP4.cjs} +54 -16
- package/dist/chunk-H6KVPVP4.cjs.map +1 -0
- package/dist/{chunk-WRFJWSKN.js → chunk-HXW3TPP6.js} +2 -2
- package/dist/{chunk-BYTYS2LB.cjs → chunk-PRDX3HP6.cjs} +13 -13
- package/dist/{chunk-BYTYS2LB.cjs.map → chunk-PRDX3HP6.cjs.map} +1 -1
- package/dist/{chunk-RQ4BFFBX.js → chunk-V5ZB54DC.js} +52 -14
- package/dist/chunk-V5ZB54DC.js.map +1 -0
- package/dist/index.cjs +205 -215
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -41
- 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-RQ4BFFBX.js.map +0 -1
- package/dist/chunk-TCADE3WY.cjs.map +0 -1
- /package/dist/{chunk-WRFJWSKN.js.map → chunk-HXW3TPP6.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
sleep,
|
|
41
41
|
store,
|
|
42
42
|
validate
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-HXW3TPP6.js";
|
|
44
44
|
import {
|
|
45
45
|
ActorSchema,
|
|
46
46
|
CausationEventSchema,
|
|
@@ -68,10 +68,13 @@ import {
|
|
|
68
68
|
TargetSchema,
|
|
69
69
|
ValidationError,
|
|
70
70
|
ZodEmpty,
|
|
71
|
+
def_of,
|
|
72
|
+
inner_of,
|
|
73
|
+
output_of,
|
|
71
74
|
pii_fields,
|
|
72
75
|
pii_schemas,
|
|
73
76
|
sensitive
|
|
74
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-V5ZB54DC.js";
|
|
75
78
|
|
|
76
79
|
// src/signals.ts
|
|
77
80
|
process.once("SIGINT", async (arg) => {
|
|
@@ -4414,7 +4417,6 @@ import { z as z4 } from "zod";
|
|
|
4414
4417
|
|
|
4415
4418
|
// src/internal/date-reviver.ts
|
|
4416
4419
|
import { z as z3 } from "zod";
|
|
4417
|
-
var def_of = (schema) => schema._zod?.def ?? schema.def;
|
|
4418
4420
|
function variant_schema(schema) {
|
|
4419
4421
|
const shape = def_of(schema)?.shape;
|
|
4420
4422
|
if (!shape) {
|
|
@@ -4465,15 +4467,10 @@ function date_reviver_schema(schema) {
|
|
|
4465
4467
|
}
|
|
4466
4468
|
case "nullable":
|
|
4467
4469
|
return inner()?.nullable();
|
|
4468
|
-
case "
|
|
4469
|
-
|
|
4470
|
-
case "readonly":
|
|
4471
|
-
case "default":
|
|
4472
|
-
case "prefault":
|
|
4473
|
-
case "catch":
|
|
4474
|
-
return inner();
|
|
4470
|
+
case "pipe":
|
|
4471
|
+
return date_reviver_schema(def.out);
|
|
4475
4472
|
default:
|
|
4476
|
-
return void 0;
|
|
4473
|
+
return inner_of(def) ? inner() : void 0;
|
|
4477
4474
|
}
|
|
4478
4475
|
}
|
|
4479
4476
|
|
|
@@ -4492,13 +4489,14 @@ function event_tags(schema) {
|
|
|
4492
4489
|
};
|
|
4493
4490
|
const dated_pii = Object.keys(pii_dates).length > 0;
|
|
4494
4491
|
return {
|
|
4495
|
-
sensitive:
|
|
4492
|
+
sensitive: pii,
|
|
4496
4493
|
date_reviver: data_reviver_schema && revive(data_reviver_schema),
|
|
4497
4494
|
pii_date_reviver: dated_pii ? revive(z4.looseObject(pii_dates)) : void 0
|
|
4498
4495
|
};
|
|
4499
4496
|
}
|
|
4500
4497
|
function make_event_reader(tags, disclosure, predicate = null) {
|
|
4501
|
-
const {
|
|
4498
|
+
const { date_reviver, pii_date_reviver } = tags;
|
|
4499
|
+
const sensitive2 = Object.keys(tags.sensitive);
|
|
4502
4500
|
if (!date_reviver && sensitive2.length === 0) return void 0;
|
|
4503
4501
|
const gate = sensitive2.length === 0 ? IDENTITY_GATE : disclosure === "strip" ? ((event) => pii_strip(event, sensitive2)) : make_gate(sensitive2, predicate);
|
|
4504
4502
|
if (!date_reviver) return gate;
|
|
@@ -4540,7 +4538,8 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4540
4538
|
}
|
|
4541
4539
|
const event = event_tags(def.schema);
|
|
4542
4540
|
tags.set(event_name, event);
|
|
4543
|
-
|
|
4541
|
+
const fields = Object.keys(event.sensitive);
|
|
4542
|
+
if (fields.length > 0) sensitive2.set(event_name, fields);
|
|
4544
4543
|
const query_reader = make_event_reader(event, "redact", null);
|
|
4545
4544
|
if (query_reader) query_readers.set(event_name, query_reader);
|
|
4546
4545
|
const handler_reader = make_event_reader(event, "strip");
|
|
@@ -4556,11 +4555,21 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4556
4555
|
}
|
|
4557
4556
|
}
|
|
4558
4557
|
if (lane_errors.length > 0) throw new Error(lane_errors[0]);
|
|
4558
|
+
const advised = /* @__PURE__ */ new Set();
|
|
4559
4559
|
for (const state2 of states.values()) {
|
|
4560
|
+
const shape = state2.state.shape ?? {};
|
|
4560
4561
|
const state_fields = /* @__PURE__ */ new Map();
|
|
4561
4562
|
for (const event_name of Object.keys(state2.events)) {
|
|
4562
4563
|
const fields = sensitive2.get(event_name);
|
|
4563
|
-
if (fields)
|
|
4564
|
+
if (!fields) continue;
|
|
4565
|
+
state_fields.set(event_name, fields);
|
|
4566
|
+
const event = tags.get(event_name);
|
|
4567
|
+
for (const field of fields) {
|
|
4568
|
+
if (!reads_as_string(event.sensitive[field]))
|
|
4569
|
+
advised.add(`${event_name}.${field}`);
|
|
4570
|
+
if (shape[field] && !reads_as_string(shape[field]))
|
|
4571
|
+
advised.add(`${state2.name}.${field}`);
|
|
4572
|
+
}
|
|
4564
4573
|
}
|
|
4565
4574
|
if (state_fields.size > 0) {
|
|
4566
4575
|
if (state2.snap)
|
|
@@ -4584,7 +4593,12 @@ function build_events(registry, states, lanes, owners) {
|
|
|
4584
4593
|
if (readers.size === 0) continue;
|
|
4585
4594
|
state2.view = (event, actor) => (readers.get(event.name) ?? IDENTITY_GATE)(event, actor);
|
|
4586
4595
|
}
|
|
4587
|
-
|
|
4596
|
+
const advisory = advised.size > 0 ? `Act has ${advised.size} sensitive field(s) whose type isn't a string: ${[...advised].join(", ")}. A caller who may not see one reads "[REDACTED]" or "[SHREDDED]" there instead, which its type doesn't allow. Declare sensitive fields as strings. See docs/docs/guides/sensitive-data.md.` : void 0;
|
|
4597
|
+
return { sensitive: sensitive2, advisory, query_readers, handler_readers };
|
|
4598
|
+
}
|
|
4599
|
+
function reads_as_string(schema) {
|
|
4600
|
+
const type = def_of(output_of(schema))?.type;
|
|
4601
|
+
return type === "string" || type === "transform";
|
|
4588
4602
|
}
|
|
4589
4603
|
|
|
4590
4604
|
// src/builders/act-builder.ts
|
|
@@ -4639,24 +4653,6 @@ function act() {
|
|
|
4639
4653
|
const fold_specs = [];
|
|
4640
4654
|
const lanes = [];
|
|
4641
4655
|
let _built = false;
|
|
4642
|
-
const advise_pii_types = () => {
|
|
4643
|
-
const fields = /* @__PURE__ */ new Set();
|
|
4644
|
-
for (const state2 of states.values()) {
|
|
4645
|
-
const shape = state2.state.shape ?? {};
|
|
4646
|
-
for (const [event, schema] of Object.entries(state2.events))
|
|
4647
|
-
for (const [field, field_schema] of Object.entries(
|
|
4648
|
-
pii_schemas(schema)
|
|
4649
|
-
)) {
|
|
4650
|
-
if (!reads_as_string(field_schema)) fields.add(`${event}.${field}`);
|
|
4651
|
-
if (shape[field] && !reads_as_string(shape[field]))
|
|
4652
|
-
fields.add(`${state2.name}.${field}`);
|
|
4653
|
-
}
|
|
4654
|
-
}
|
|
4655
|
-
if (fields.size > 0)
|
|
4656
|
-
log().warn(
|
|
4657
|
-
`Act has ${fields.size} sensitive field(s) whose type isn't a string: ${[...fields].join(", ")}. A caller who may not see one reads "[REDACTED]" or "[SHREDDED]" there instead, which its type doesn't allow. Declare sensitive fields as strings. See docs/docs/guides/sensitive-data.md.`
|
|
4658
|
-
);
|
|
4659
|
-
};
|
|
4660
4656
|
const read_wrap = (original) => {
|
|
4661
4657
|
const wrapped = async (events, stream) => {
|
|
4662
4658
|
const read = events.map((e) => _hr.get(e.name)?.(e) ?? e);
|
|
@@ -4795,7 +4791,7 @@ function act() {
|
|
|
4795
4791
|
for (const [name, gate] of built.query_readers) _qg.set(name, gate);
|
|
4796
4792
|
for (const [name, gate] of built.handler_readers) _hr.set(name, gate);
|
|
4797
4793
|
finalize_deprecations();
|
|
4798
|
-
|
|
4794
|
+
if (built.advisory) log().warn(built.advisory);
|
|
4799
4795
|
for (const state2 of states.values()) {
|
|
4800
4796
|
if (state2.disclose) _dp.set(state2.name, state2.disclose);
|
|
4801
4797
|
if (state2.autoclose) _ac.set(state2.name, state2.autoclose);
|
|
@@ -4826,12 +4822,6 @@ function act() {
|
|
|
4826
4822
|
};
|
|
4827
4823
|
return builder;
|
|
4828
4824
|
}
|
|
4829
|
-
function reads_as_string(schema) {
|
|
4830
|
-
const def = schema._zod.def;
|
|
4831
|
-
if (def.type === "string" || def.type === "transform") return true;
|
|
4832
|
-
if (def.out) return reads_as_string(def.out);
|
|
4833
|
-
return def.innerType ? reads_as_string(def.innerType) : false;
|
|
4834
|
-
}
|
|
4835
4825
|
|
|
4836
4826
|
// src/builders/projection-builder.ts
|
|
4837
4827
|
function _projection(target) {
|