@rotorsoft/act 2.1.15 → 2.1.16

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
@@ -1152,6 +1152,11 @@ function wrapped(schema) {
1152
1152
  return inner ? [inner] : [];
1153
1153
  }
1154
1154
  __name(wrapped, "wrapped");
1155
+ function parts_of(schema) {
1156
+ const def = def_of(schema);
1157
+ return def?.type === "intersection" ? [def.left, def.right] : wrapped(schema);
1158
+ }
1159
+ __name(parts_of, "parts_of");
1155
1160
  function some_layer(schema, test) {
1156
1161
  const seen = /* @__PURE__ */ new Set();
1157
1162
  const visit = /* @__PURE__ */ __name((s) => {
@@ -4804,24 +4809,19 @@ import { z as z2 } from "zod";
4804
4809
  var SENSITIVE = /* @__PURE__ */ Symbol.for("act.sensitive");
4805
4810
  var is_pii = /* @__PURE__ */ __name((schema) => some_layer(schema, (def) => def[SENSITIVE] === true), "is_pii");
4806
4811
  function pii_schemas(schema) {
4812
+ const fields = {};
4807
4813
  const shape = schema.shape;
4808
4814
  if (shape && typeof shape === "object") {
4809
- const fields = {};
4810
4815
  for (const key of Object.keys(shape))
4811
4816
  if (is_pii(shape[key])) fields[key] = shape[key];
4812
4817
  return fields;
4813
4818
  }
4814
4819
  const options = schema.options;
4815
- if (Array.isArray(options)) {
4816
- const fields = {};
4817
- for (const option of options)
4818
- for (const [key, field] of Object.entries(
4819
- pii_schemas(option)
4820
- ))
4821
- fields[key] ??= field;
4822
- return fields;
4823
- }
4824
- return {};
4820
+ const parts = Array.isArray(options) ? options : parts_of(schema);
4821
+ for (const part of parts)
4822
+ for (const [key, field] of Object.entries(pii_schemas(part)))
4823
+ fields[key] ??= field;
4824
+ return fields;
4825
4825
  }
4826
4826
  __name(pii_schemas, "pii_schemas");
4827
4827