@rotorsoft/act 1.23.7 → 1.23.8

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.js CHANGED
@@ -20,7 +20,7 @@ import {
20
20
  sleep,
21
21
  store,
22
22
  validate
23
- } from "./chunk-C7H3GARW.js";
23
+ } from "./chunk-7PG2SR37.js";
24
24
  import {
25
25
  ActorSchema,
26
26
  CausationEventSchema,
@@ -29,6 +29,7 @@ import {
29
29
  Environments,
30
30
  Errors,
31
31
  EventMetaSchema,
32
+ IDENTITY_GATE,
32
33
  InvariantError,
33
34
  LogLevels,
34
35
  NonRetryableError,
@@ -40,12 +41,12 @@ import {
40
41
  TargetSchema,
41
42
  ValidationError,
42
43
  ZodEmpty,
44
+ make_gate,
43
45
  pii_fields,
44
- pii_gate,
45
46
  pii_split,
46
47
  pii_strip,
47
48
  sensitive
48
- } from "./chunk-LDWS6I2C.js";
49
+ } from "./chunk-RLM4M5UV.js";
49
50
 
50
51
  // src/signals.ts
51
52
  process.once("SIGINT", async (arg) => {
@@ -3502,9 +3503,10 @@ var Act = class {
3502
3503
  let first;
3503
3504
  let last;
3504
3505
  const count = await store().query((e) => {
3505
- if (!first) first = e;
3506
- last = e;
3507
- callback?.(e);
3506
+ const gated = this.registry.query_gate(e.name)(e);
3507
+ if (!first) first = gated;
3508
+ last = gated;
3509
+ callback?.(gated);
3508
3510
  }, query);
3509
3511
  return { first, last, count };
3510
3512
  });
@@ -3538,7 +3540,10 @@ var Act = class {
3538
3540
  async query_array(query) {
3539
3541
  return this._scoped(async () => {
3540
3542
  const events = [];
3541
- await store().query((e) => events.push(e), query);
3543
+ await store().query(
3544
+ (e) => events.push(this.registry.query_gate(e.name)(e)),
3545
+ query
3546
+ );
3542
3547
  return events;
3543
3548
  });
3544
3549
  }
@@ -4205,6 +4210,7 @@ function validate_lane_references(registry, lanes) {
4205
4210
  function act() {
4206
4211
  const states = /* @__PURE__ */ new Map();
4207
4212
  const _sf = /* @__PURE__ */ new Map();
4213
+ const _qg = /* @__PURE__ */ new Map();
4208
4214
  const _dp = /* @__PURE__ */ new Map();
4209
4215
  const _de = /* @__PURE__ */ new Map();
4210
4216
  const _ac = /* @__PURE__ */ new Map();
@@ -4214,6 +4220,7 @@ function act() {
4214
4220
  actions: {},
4215
4221
  events: {},
4216
4222
  sensitive_fields: (event_name) => _sf.get(event_name) ?? [],
4223
+ query_gate: (event_name) => _qg.get(event_name) ?? IDENTITY_GATE,
4217
4224
  disclosure_predicate: (state_name) => _dp.get(state_name) ?? null,
4218
4225
  deprecated_events: (state_name) => _de.get(state_name) ?? EMPTY_DEPRECATED,
4219
4226
  autoclose_policy: (state_name) => _ac.get(state_name) ?? null,
@@ -4332,6 +4339,7 @@ function act() {
4332
4339
  const fields = pii_fields(reg.schema);
4333
4340
  if (fields.length === 0) continue;
4334
4341
  _sf.set(event_name, fields);
4342
+ _qg.set(event_name, make_gate(fields, null));
4335
4343
  for (const [name, reaction] of reg.reactions) {
4336
4344
  const inner = reaction.handler;
4337
4345
  const wrapped = (event, stream, app) => inner(pii_strip(event, fields), stream, app);
@@ -4358,10 +4366,12 @@ function act() {
4358
4366
  }
4359
4367
  const disclose = state2.disclose ?? null;
4360
4368
  state2.pii_aware = true;
4361
- state2.view = (event, actor) => pii_gate(
4369
+ const view_gates = /* @__PURE__ */ new Map();
4370
+ for (const [event_name, fields] of fields_by_event) {
4371
+ view_gates.set(event_name, make_gate(fields, disclose));
4372
+ }
4373
+ state2.view = (event, actor) => (view_gates.get(event.name) ?? IDENTITY_GATE)(
4362
4374
  event,
4363
- fields_by_event.get(event.name) ?? [],
4364
- disclose,
4365
4375
  actor
4366
4376
  );
4367
4377
  state2.message = (validated) => {