@grwnd/pi-governance 1.4.2 → 1.5.1

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
@@ -191,705 +191,12 @@ var require_types = __commonJS({
191
191
  }
192
192
  });
193
193
 
194
- // node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js
195
- var require_lodash = __commonJS({
196
- "node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js"(exports, module) {
194
+ // node_modules/.pnpm/lodash-isequal-shim@file+packages+lodash-isequal-shim/node_modules/lodash-isequal-shim/index.cjs
195
+ var require_lodash_isequal_shim = __commonJS({
196
+ "node_modules/.pnpm/lodash-isequal-shim@file+packages+lodash-isequal-shim/node_modules/lodash-isequal-shim/index.cjs"(exports, module) {
197
197
  "use strict";
198
- var LARGE_ARRAY_SIZE = 200;
199
- var HASH_UNDEFINED = "__lodash_hash_undefined__";
200
- var COMPARE_PARTIAL_FLAG = 1;
201
- var COMPARE_UNORDERED_FLAG = 2;
202
- var MAX_SAFE_INTEGER = 9007199254740991;
203
- var argsTag = "[object Arguments]";
204
- var arrayTag = "[object Array]";
205
- var asyncTag = "[object AsyncFunction]";
206
- var boolTag = "[object Boolean]";
207
- var dateTag = "[object Date]";
208
- var errorTag = "[object Error]";
209
- var funcTag = "[object Function]";
210
- var genTag = "[object GeneratorFunction]";
211
- var mapTag = "[object Map]";
212
- var numberTag = "[object Number]";
213
- var nullTag = "[object Null]";
214
- var objectTag = "[object Object]";
215
- var promiseTag = "[object Promise]";
216
- var proxyTag = "[object Proxy]";
217
- var regexpTag = "[object RegExp]";
218
- var setTag = "[object Set]";
219
- var stringTag = "[object String]";
220
- var symbolTag = "[object Symbol]";
221
- var undefinedTag = "[object Undefined]";
222
- var weakMapTag = "[object WeakMap]";
223
- var arrayBufferTag = "[object ArrayBuffer]";
224
- var dataViewTag = "[object DataView]";
225
- var float32Tag = "[object Float32Array]";
226
- var float64Tag = "[object Float64Array]";
227
- var int8Tag = "[object Int8Array]";
228
- var int16Tag = "[object Int16Array]";
229
- var int32Tag = "[object Int32Array]";
230
- var uint8Tag = "[object Uint8Array]";
231
- var uint8ClampedTag = "[object Uint8ClampedArray]";
232
- var uint16Tag = "[object Uint16Array]";
233
- var uint32Tag = "[object Uint32Array]";
234
- var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
235
- var reIsHostCtor = /^\[object .+?Constructor\]$/;
236
- var reIsUint = /^(?:0|[1-9]\d*)$/;
237
- var typedArrayTags = {};
238
- typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
239
- typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
240
- var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
241
- var freeSelf = typeof self == "object" && self && self.Object === Object && self;
242
- var root = freeGlobal || freeSelf || Function("return this")();
243
- var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
244
- var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
245
- var moduleExports = freeModule && freeModule.exports === freeExports;
246
- var freeProcess = moduleExports && freeGlobal.process;
247
- var nodeUtil = (function() {
248
- try {
249
- return freeProcess && freeProcess.binding && freeProcess.binding("util");
250
- } catch (e) {
251
- }
252
- })();
253
- var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
254
- function arrayFilter(array, predicate) {
255
- var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
256
- while (++index < length) {
257
- var value = array[index];
258
- if (predicate(value, index, array)) {
259
- result[resIndex++] = value;
260
- }
261
- }
262
- return result;
263
- }
264
- function arrayPush(array, values) {
265
- var index = -1, length = values.length, offset = array.length;
266
- while (++index < length) {
267
- array[offset + index] = values[index];
268
- }
269
- return array;
270
- }
271
- function arraySome(array, predicate) {
272
- var index = -1, length = array == null ? 0 : array.length;
273
- while (++index < length) {
274
- if (predicate(array[index], index, array)) {
275
- return true;
276
- }
277
- }
278
- return false;
279
- }
280
- function baseTimes(n, iteratee) {
281
- var index = -1, result = Array(n);
282
- while (++index < n) {
283
- result[index] = iteratee(index);
284
- }
285
- return result;
286
- }
287
- function baseUnary(func) {
288
- return function(value) {
289
- return func(value);
290
- };
291
- }
292
- function cacheHas(cache, key) {
293
- return cache.has(key);
294
- }
295
- function getValue(object, key) {
296
- return object == null ? void 0 : object[key];
297
- }
298
- function mapToArray(map) {
299
- var index = -1, result = Array(map.size);
300
- map.forEach(function(value, key) {
301
- result[++index] = [key, value];
302
- });
303
- return result;
304
- }
305
- function overArg(func, transform) {
306
- return function(arg) {
307
- return func(transform(arg));
308
- };
309
- }
310
- function setToArray(set) {
311
- var index = -1, result = Array(set.size);
312
- set.forEach(function(value) {
313
- result[++index] = value;
314
- });
315
- return result;
316
- }
317
- var arrayProto = Array.prototype;
318
- var funcProto = Function.prototype;
319
- var objectProto = Object.prototype;
320
- var coreJsData = root["__core-js_shared__"];
321
- var funcToString = funcProto.toString;
322
- var hasOwnProperty = objectProto.hasOwnProperty;
323
- var maskSrcKey = (function() {
324
- var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
325
- return uid ? "Symbol(src)_1." + uid : "";
326
- })();
327
- var nativeObjectToString = objectProto.toString;
328
- var reIsNative = RegExp(
329
- "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
330
- );
331
- var Buffer2 = moduleExports ? root.Buffer : void 0;
332
- var Symbol2 = root.Symbol;
333
- var Uint8Array2 = root.Uint8Array;
334
- var propertyIsEnumerable = objectProto.propertyIsEnumerable;
335
- var splice = arrayProto.splice;
336
- var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
337
- var nativeGetSymbols = Object.getOwnPropertySymbols;
338
- var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
339
- var nativeKeys = overArg(Object.keys, Object);
340
- var DataView = getNative(root, "DataView");
341
- var Map2 = getNative(root, "Map");
342
- var Promise2 = getNative(root, "Promise");
343
- var Set2 = getNative(root, "Set");
344
- var WeakMap2 = getNative(root, "WeakMap");
345
- var nativeCreate = getNative(Object, "create");
346
- var dataViewCtorString = toSource(DataView);
347
- var mapCtorString = toSource(Map2);
348
- var promiseCtorString = toSource(Promise2);
349
- var setCtorString = toSource(Set2);
350
- var weakMapCtorString = toSource(WeakMap2);
351
- var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
352
- var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
353
- function Hash(entries) {
354
- var index = -1, length = entries == null ? 0 : entries.length;
355
- this.clear();
356
- while (++index < length) {
357
- var entry = entries[index];
358
- this.set(entry[0], entry[1]);
359
- }
360
- }
361
- function hashClear() {
362
- this.__data__ = nativeCreate ? nativeCreate(null) : {};
363
- this.size = 0;
364
- }
365
- function hashDelete(key) {
366
- var result = this.has(key) && delete this.__data__[key];
367
- this.size -= result ? 1 : 0;
368
- return result;
369
- }
370
- function hashGet(key) {
371
- var data = this.__data__;
372
- if (nativeCreate) {
373
- var result = data[key];
374
- return result === HASH_UNDEFINED ? void 0 : result;
375
- }
376
- return hasOwnProperty.call(data, key) ? data[key] : void 0;
377
- }
378
- function hashHas(key) {
379
- var data = this.__data__;
380
- return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
381
- }
382
- function hashSet(key, value) {
383
- var data = this.__data__;
384
- this.size += this.has(key) ? 0 : 1;
385
- data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
386
- return this;
387
- }
388
- Hash.prototype.clear = hashClear;
389
- Hash.prototype["delete"] = hashDelete;
390
- Hash.prototype.get = hashGet;
391
- Hash.prototype.has = hashHas;
392
- Hash.prototype.set = hashSet;
393
- function ListCache(entries) {
394
- var index = -1, length = entries == null ? 0 : entries.length;
395
- this.clear();
396
- while (++index < length) {
397
- var entry = entries[index];
398
- this.set(entry[0], entry[1]);
399
- }
400
- }
401
- function listCacheClear() {
402
- this.__data__ = [];
403
- this.size = 0;
404
- }
405
- function listCacheDelete(key) {
406
- var data = this.__data__, index = assocIndexOf(data, key);
407
- if (index < 0) {
408
- return false;
409
- }
410
- var lastIndex = data.length - 1;
411
- if (index == lastIndex) {
412
- data.pop();
413
- } else {
414
- splice.call(data, index, 1);
415
- }
416
- --this.size;
417
- return true;
418
- }
419
- function listCacheGet(key) {
420
- var data = this.__data__, index = assocIndexOf(data, key);
421
- return index < 0 ? void 0 : data[index][1];
422
- }
423
- function listCacheHas(key) {
424
- return assocIndexOf(this.__data__, key) > -1;
425
- }
426
- function listCacheSet(key, value) {
427
- var data = this.__data__, index = assocIndexOf(data, key);
428
- if (index < 0) {
429
- ++this.size;
430
- data.push([key, value]);
431
- } else {
432
- data[index][1] = value;
433
- }
434
- return this;
435
- }
436
- ListCache.prototype.clear = listCacheClear;
437
- ListCache.prototype["delete"] = listCacheDelete;
438
- ListCache.prototype.get = listCacheGet;
439
- ListCache.prototype.has = listCacheHas;
440
- ListCache.prototype.set = listCacheSet;
441
- function MapCache(entries) {
442
- var index = -1, length = entries == null ? 0 : entries.length;
443
- this.clear();
444
- while (++index < length) {
445
- var entry = entries[index];
446
- this.set(entry[0], entry[1]);
447
- }
448
- }
449
- function mapCacheClear() {
450
- this.size = 0;
451
- this.__data__ = {
452
- "hash": new Hash(),
453
- "map": new (Map2 || ListCache)(),
454
- "string": new Hash()
455
- };
456
- }
457
- function mapCacheDelete(key) {
458
- var result = getMapData(this, key)["delete"](key);
459
- this.size -= result ? 1 : 0;
460
- return result;
461
- }
462
- function mapCacheGet(key) {
463
- return getMapData(this, key).get(key);
464
- }
465
- function mapCacheHas(key) {
466
- return getMapData(this, key).has(key);
467
- }
468
- function mapCacheSet(key, value) {
469
- var data = getMapData(this, key), size = data.size;
470
- data.set(key, value);
471
- this.size += data.size == size ? 0 : 1;
472
- return this;
473
- }
474
- MapCache.prototype.clear = mapCacheClear;
475
- MapCache.prototype["delete"] = mapCacheDelete;
476
- MapCache.prototype.get = mapCacheGet;
477
- MapCache.prototype.has = mapCacheHas;
478
- MapCache.prototype.set = mapCacheSet;
479
- function SetCache(values) {
480
- var index = -1, length = values == null ? 0 : values.length;
481
- this.__data__ = new MapCache();
482
- while (++index < length) {
483
- this.add(values[index]);
484
- }
485
- }
486
- function setCacheAdd(value) {
487
- this.__data__.set(value, HASH_UNDEFINED);
488
- return this;
489
- }
490
- function setCacheHas(value) {
491
- return this.__data__.has(value);
492
- }
493
- SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
494
- SetCache.prototype.has = setCacheHas;
495
- function Stack(entries) {
496
- var data = this.__data__ = new ListCache(entries);
497
- this.size = data.size;
498
- }
499
- function stackClear() {
500
- this.__data__ = new ListCache();
501
- this.size = 0;
502
- }
503
- function stackDelete(key) {
504
- var data = this.__data__, result = data["delete"](key);
505
- this.size = data.size;
506
- return result;
507
- }
508
- function stackGet(key) {
509
- return this.__data__.get(key);
510
- }
511
- function stackHas(key) {
512
- return this.__data__.has(key);
513
- }
514
- function stackSet(key, value) {
515
- var data = this.__data__;
516
- if (data instanceof ListCache) {
517
- var pairs = data.__data__;
518
- if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
519
- pairs.push([key, value]);
520
- this.size = ++data.size;
521
- return this;
522
- }
523
- data = this.__data__ = new MapCache(pairs);
524
- }
525
- data.set(key, value);
526
- this.size = data.size;
527
- return this;
528
- }
529
- Stack.prototype.clear = stackClear;
530
- Stack.prototype["delete"] = stackDelete;
531
- Stack.prototype.get = stackGet;
532
- Stack.prototype.has = stackHas;
533
- Stack.prototype.set = stackSet;
534
- function arrayLikeKeys(value, inherited) {
535
- var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
536
- for (var key in value) {
537
- if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
538
- (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
539
- isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
540
- isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
541
- isIndex(key, length)))) {
542
- result.push(key);
543
- }
544
- }
545
- return result;
546
- }
547
- function assocIndexOf(array, key) {
548
- var length = array.length;
549
- while (length--) {
550
- if (eq(array[length][0], key)) {
551
- return length;
552
- }
553
- }
554
- return -1;
555
- }
556
- function baseGetAllKeys(object, keysFunc, symbolsFunc) {
557
- var result = keysFunc(object);
558
- return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
559
- }
560
- function baseGetTag(value) {
561
- if (value == null) {
562
- return value === void 0 ? undefinedTag : nullTag;
563
- }
564
- return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
565
- }
566
- function baseIsArguments(value) {
567
- return isObjectLike(value) && baseGetTag(value) == argsTag;
568
- }
569
- function baseIsEqual(value, other, bitmask, customizer, stack) {
570
- if (value === other) {
571
- return true;
572
- }
573
- if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
574
- return value !== value && other !== other;
575
- }
576
- return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
577
- }
578
- function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
579
- var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
580
- objTag = objTag == argsTag ? objectTag : objTag;
581
- othTag = othTag == argsTag ? objectTag : othTag;
582
- var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
583
- if (isSameTag && isBuffer(object)) {
584
- if (!isBuffer(other)) {
585
- return false;
586
- }
587
- objIsArr = true;
588
- objIsObj = false;
589
- }
590
- if (isSameTag && !objIsObj) {
591
- stack || (stack = new Stack());
592
- return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
593
- }
594
- if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
595
- var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
596
- if (objIsWrapped || othIsWrapped) {
597
- var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
598
- stack || (stack = new Stack());
599
- return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
600
- }
601
- }
602
- if (!isSameTag) {
603
- return false;
604
- }
605
- stack || (stack = new Stack());
606
- return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
607
- }
608
- function baseIsNative(value) {
609
- if (!isObject(value) || isMasked(value)) {
610
- return false;
611
- }
612
- var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
613
- return pattern.test(toSource(value));
614
- }
615
- function baseIsTypedArray(value) {
616
- return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
617
- }
618
- function baseKeys(object) {
619
- if (!isPrototype(object)) {
620
- return nativeKeys(object);
621
- }
622
- var result = [];
623
- for (var key in Object(object)) {
624
- if (hasOwnProperty.call(object, key) && key != "constructor") {
625
- result.push(key);
626
- }
627
- }
628
- return result;
629
- }
630
- function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
631
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
632
- if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
633
- return false;
634
- }
635
- var stacked = stack.get(array);
636
- if (stacked && stack.get(other)) {
637
- return stacked == other;
638
- }
639
- var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
640
- stack.set(array, other);
641
- stack.set(other, array);
642
- while (++index < arrLength) {
643
- var arrValue = array[index], othValue = other[index];
644
- if (customizer) {
645
- var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
646
- }
647
- if (compared !== void 0) {
648
- if (compared) {
649
- continue;
650
- }
651
- result = false;
652
- break;
653
- }
654
- if (seen) {
655
- if (!arraySome(other, function(othValue2, othIndex) {
656
- if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
657
- return seen.push(othIndex);
658
- }
659
- })) {
660
- result = false;
661
- break;
662
- }
663
- } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
664
- result = false;
665
- break;
666
- }
667
- }
668
- stack["delete"](array);
669
- stack["delete"](other);
670
- return result;
671
- }
672
- function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
673
- switch (tag) {
674
- case dataViewTag:
675
- if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
676
- return false;
677
- }
678
- object = object.buffer;
679
- other = other.buffer;
680
- case arrayBufferTag:
681
- if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
682
- return false;
683
- }
684
- return true;
685
- case boolTag:
686
- case dateTag:
687
- case numberTag:
688
- return eq(+object, +other);
689
- case errorTag:
690
- return object.name == other.name && object.message == other.message;
691
- case regexpTag:
692
- case stringTag:
693
- return object == other + "";
694
- case mapTag:
695
- var convert = mapToArray;
696
- case setTag:
697
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
698
- convert || (convert = setToArray);
699
- if (object.size != other.size && !isPartial) {
700
- return false;
701
- }
702
- var stacked = stack.get(object);
703
- if (stacked) {
704
- return stacked == other;
705
- }
706
- bitmask |= COMPARE_UNORDERED_FLAG;
707
- stack.set(object, other);
708
- var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
709
- stack["delete"](object);
710
- return result;
711
- case symbolTag:
712
- if (symbolValueOf) {
713
- return symbolValueOf.call(object) == symbolValueOf.call(other);
714
- }
715
- }
716
- return false;
717
- }
718
- function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
719
- var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
720
- if (objLength != othLength && !isPartial) {
721
- return false;
722
- }
723
- var index = objLength;
724
- while (index--) {
725
- var key = objProps[index];
726
- if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
727
- return false;
728
- }
729
- }
730
- var stacked = stack.get(object);
731
- if (stacked && stack.get(other)) {
732
- return stacked == other;
733
- }
734
- var result = true;
735
- stack.set(object, other);
736
- stack.set(other, object);
737
- var skipCtor = isPartial;
738
- while (++index < objLength) {
739
- key = objProps[index];
740
- var objValue = object[key], othValue = other[key];
741
- if (customizer) {
742
- var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
743
- }
744
- if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
745
- result = false;
746
- break;
747
- }
748
- skipCtor || (skipCtor = key == "constructor");
749
- }
750
- if (result && !skipCtor) {
751
- var objCtor = object.constructor, othCtor = other.constructor;
752
- if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
753
- result = false;
754
- }
755
- }
756
- stack["delete"](object);
757
- stack["delete"](other);
758
- return result;
759
- }
760
- function getAllKeys(object) {
761
- return baseGetAllKeys(object, keys, getSymbols);
762
- }
763
- function getMapData(map, key) {
764
- var data = map.__data__;
765
- return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
766
- }
767
- function getNative(object, key) {
768
- var value = getValue(object, key);
769
- return baseIsNative(value) ? value : void 0;
770
- }
771
- function getRawTag(value) {
772
- var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
773
- try {
774
- value[symToStringTag] = void 0;
775
- var unmasked = true;
776
- } catch (e) {
777
- }
778
- var result = nativeObjectToString.call(value);
779
- if (unmasked) {
780
- if (isOwn) {
781
- value[symToStringTag] = tag;
782
- } else {
783
- delete value[symToStringTag];
784
- }
785
- }
786
- return result;
787
- }
788
- var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
789
- if (object == null) {
790
- return [];
791
- }
792
- object = Object(object);
793
- return arrayFilter(nativeGetSymbols(object), function(symbol) {
794
- return propertyIsEnumerable.call(object, symbol);
795
- });
796
- };
797
- var getTag = baseGetTag;
798
- if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
799
- getTag = function(value) {
800
- var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
801
- if (ctorString) {
802
- switch (ctorString) {
803
- case dataViewCtorString:
804
- return dataViewTag;
805
- case mapCtorString:
806
- return mapTag;
807
- case promiseCtorString:
808
- return promiseTag;
809
- case setCtorString:
810
- return setTag;
811
- case weakMapCtorString:
812
- return weakMapTag;
813
- }
814
- }
815
- return result;
816
- };
817
- }
818
- function isIndex(value, length) {
819
- length = length == null ? MAX_SAFE_INTEGER : length;
820
- return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
821
- }
822
- function isKeyable(value) {
823
- var type = typeof value;
824
- return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
825
- }
826
- function isMasked(func) {
827
- return !!maskSrcKey && maskSrcKey in func;
828
- }
829
- function isPrototype(value) {
830
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
831
- return value === proto;
832
- }
833
- function objectToString(value) {
834
- return nativeObjectToString.call(value);
835
- }
836
- function toSource(func) {
837
- if (func != null) {
838
- try {
839
- return funcToString.call(func);
840
- } catch (e) {
841
- }
842
- try {
843
- return func + "";
844
- } catch (e) {
845
- }
846
- }
847
- return "";
848
- }
849
- function eq(value, other) {
850
- return value === other || value !== value && other !== other;
851
- }
852
- var isArguments = baseIsArguments(/* @__PURE__ */ (function() {
853
- return arguments;
854
- })()) ? baseIsArguments : function(value) {
855
- return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
856
- };
857
- var isArray = Array.isArray;
858
- function isArrayLike(value) {
859
- return value != null && isLength(value.length) && !isFunction(value);
860
- }
861
- var isBuffer = nativeIsBuffer || stubFalse;
862
- function isEqual(value, other) {
863
- return baseIsEqual(value, other);
864
- }
865
- function isFunction(value) {
866
- if (!isObject(value)) {
867
- return false;
868
- }
869
- var tag = baseGetTag(value);
870
- return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
871
- }
872
- function isLength(value) {
873
- return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
874
- }
875
- function isObject(value) {
876
- var type = typeof value;
877
- return value != null && (type == "object" || type == "function");
878
- }
879
- function isObjectLike(value) {
880
- return value != null && typeof value == "object";
881
- }
882
- var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
883
- function keys(object) {
884
- return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
885
- }
886
- function stubArray() {
887
- return [];
888
- }
889
- function stubFalse() {
890
- return false;
891
- }
892
- module.exports = isEqual;
198
+ var { isDeepStrictEqual } = __require("util");
199
+ module.exports = isDeepStrictEqual;
893
200
  }
894
201
  });
895
202
 
@@ -905,7 +212,7 @@ var require_helpers = __commonJS({
905
212
  var fs_1 = __require("fs");
906
213
  var errors_1 = require_errors();
907
214
  var types_1 = require_types();
908
- var isEqual = require_lodash();
215
+ var isEqual = require_lodash_isequal_shim();
909
216
  function ancestors(cls) {
910
217
  if (!isConstructor(cls))
911
218
  return [];
@@ -1530,18 +837,18 @@ var require_Query = __commonJS({
1530
837
  if (receiver === null || receiver === void 0)
1531
838
  throw new (args ? errors_1.InvalidCallError : errors_1.InvalidAttributeError)(receiver, attr);
1532
839
  const rel = (_b = (_a = __classPrivateFieldGet(this, _Query_host, "f").getType(receiver.constructor)) === null || _a === void 0 ? void 0 : _a.fields) === null || _b === void 0 ? void 0 : _b.get(attr);
1533
- const self2 = receiver;
840
+ const self = receiver;
1534
841
  if (rel instanceof filter_1.Relation)
1535
- value = await this.handleRelation(self2, rel);
842
+ value = await this.handleRelation(self, rel);
1536
843
  else if (args) {
1537
- if (typeof self2[attr] !== "function")
844
+ if (typeof self[attr] !== "function")
1538
845
  throw new errors_1.InvalidCallError(receiver, attr);
1539
846
  const jsArgs = await Promise.all(args.map((a) => __classPrivateFieldGet(this, _Query_host, "f").toJs(a)));
1540
- value = self2[attr](...jsArgs);
1541
- } else if (!(attr in self2))
847
+ value = self[attr](...jsArgs);
848
+ } else if (!(attr in self))
1542
849
  throw new errors_1.InvalidAttributeError(receiver, attr);
1543
850
  else
1544
- value = self2[attr];
851
+ value = self[attr];
1545
852
  } catch (e) {
1546
853
  if (e instanceof TypeError || e instanceof errors_1.InvalidCallError || e instanceof errors_1.InvalidAttributeError) {
1547
854
  this.applicationError(e.message);
@@ -3831,12 +3138,78 @@ var OrgUnitOverride = Type.Object({
3831
3138
  })
3832
3139
  )
3833
3140
  });
3141
+ var DlpMaskingConfig = Type.Object({
3142
+ strategy: Type.Union([Type.Literal("partial"), Type.Literal("full"), Type.Literal("hash")], {
3143
+ default: "partial"
3144
+ }),
3145
+ show_chars: Type.Optional(Type.Number({ default: 4, minimum: 0 })),
3146
+ placeholder: Type.Optional(Type.String({ default: "***" }))
3147
+ });
3148
+ var DlpCustomPatternConfig = Type.Object({
3149
+ name: Type.String(),
3150
+ pattern: Type.String(),
3151
+ severity: Type.Union([
3152
+ Type.Literal("low"),
3153
+ Type.Literal("medium"),
3154
+ Type.Literal("high"),
3155
+ Type.Literal("critical")
3156
+ ]),
3157
+ action: Type.Optional(
3158
+ Type.Union([Type.Literal("audit"), Type.Literal("mask"), Type.Literal("block")])
3159
+ )
3160
+ });
3161
+ var DlpAllowlistEntryConfig = Type.Object({
3162
+ pattern: Type.String()
3163
+ });
3164
+ var DlpRoleOverrideConfig = Type.Object({
3165
+ enabled: Type.Optional(Type.Boolean()),
3166
+ mode: Type.Optional(
3167
+ Type.Union([Type.Literal("audit"), Type.Literal("mask"), Type.Literal("block")])
3168
+ ),
3169
+ on_input: Type.Optional(
3170
+ Type.Union([Type.Literal("audit"), Type.Literal("mask"), Type.Literal("block")])
3171
+ ),
3172
+ on_output: Type.Optional(
3173
+ Type.Union([Type.Literal("audit"), Type.Literal("mask"), Type.Literal("block")])
3174
+ )
3175
+ });
3176
+ var DlpConfig = Type.Object({
3177
+ enabled: Type.Boolean({ default: false }),
3178
+ mode: Type.Optional(
3179
+ Type.Union([Type.Literal("audit"), Type.Literal("mask"), Type.Literal("block")], {
3180
+ default: "audit"
3181
+ })
3182
+ ),
3183
+ on_input: Type.Optional(
3184
+ Type.Union([Type.Literal("audit"), Type.Literal("mask"), Type.Literal("block")])
3185
+ ),
3186
+ on_output: Type.Optional(
3187
+ Type.Union([Type.Literal("audit"), Type.Literal("mask"), Type.Literal("block")])
3188
+ ),
3189
+ masking: Type.Optional(DlpMaskingConfig),
3190
+ severity_threshold: Type.Optional(
3191
+ Type.Union(
3192
+ [Type.Literal("low"), Type.Literal("medium"), Type.Literal("high"), Type.Literal("critical")],
3193
+ { default: "low" }
3194
+ )
3195
+ ),
3196
+ built_in: Type.Optional(
3197
+ Type.Object({
3198
+ secrets: Type.Boolean({ default: true }),
3199
+ pii: Type.Boolean({ default: true })
3200
+ })
3201
+ ),
3202
+ custom_patterns: Type.Optional(Type.Array(DlpCustomPatternConfig)),
3203
+ allowlist: Type.Optional(Type.Array(DlpAllowlistEntryConfig)),
3204
+ role_overrides: Type.Optional(Type.Record(Type.String(), DlpRoleOverrideConfig))
3205
+ });
3834
3206
  var GovernanceConfigSchema = Type.Object({
3835
3207
  auth: Type.Optional(AuthConfig),
3836
3208
  policy: Type.Optional(PolicyConfig),
3837
3209
  templates: Type.Optional(TemplatesConfig),
3838
3210
  hitl: Type.Optional(HitlConfig),
3839
3211
  audit: Type.Optional(AuditConfig),
3212
+ dlp: Type.Optional(DlpConfig),
3840
3213
  org_units: Type.Optional(Type.Record(Type.String(), OrgUnitOverride))
3841
3214
  });
3842
3215
 
@@ -3867,6 +3240,9 @@ var DEFAULTS = {
3867
3240
  },
3868
3241
  audit: {
3869
3242
  sinks: [{ type: "jsonl", path: "~/.pi/agent/audit.jsonl" }]
3243
+ },
3244
+ dlp: {
3245
+ enabled: false
3870
3246
  }
3871
3247
  };
3872
3248
 
@@ -4338,6 +3714,300 @@ var BashClassifier = class {
4338
3714
  }
4339
3715
  };
4340
3716
 
3717
+ // src/lib/dlp/patterns.ts
3718
+ var SECRET_PATTERNS = [
3719
+ // AWS
3720
+ {
3721
+ name: "aws_access_key",
3722
+ pattern: /\b(AKIA[0-9A-Z]{16})\b/g,
3723
+ severity: "critical",
3724
+ category: "secret"
3725
+ },
3726
+ {
3727
+ name: "aws_secret_key",
3728
+ pattern: /\b([A-Za-z0-9/+=]{40})(?=\s|$|"|')/g,
3729
+ severity: "critical",
3730
+ category: "secret"
3731
+ },
3732
+ // GitHub
3733
+ {
3734
+ name: "github_pat",
3735
+ pattern: /\b(ghp_[A-Za-z0-9]{36,})\b/g,
3736
+ severity: "critical",
3737
+ category: "secret"
3738
+ },
3739
+ {
3740
+ name: "github_oauth",
3741
+ pattern: /\b(gho_[A-Za-z0-9]{36,})\b/g,
3742
+ severity: "high",
3743
+ category: "secret"
3744
+ },
3745
+ {
3746
+ name: "github_app_token",
3747
+ pattern: /\b(ghu_[A-Za-z0-9]{36,})\b/g,
3748
+ severity: "high",
3749
+ category: "secret"
3750
+ },
3751
+ // Anthropic
3752
+ {
3753
+ name: "anthropic_api_key",
3754
+ pattern: /\b(sk-ant-api03-[A-Za-z0-9_-]{90,})\b/g,
3755
+ severity: "critical",
3756
+ category: "secret"
3757
+ },
3758
+ // OpenAI
3759
+ {
3760
+ name: "openai_api_key",
3761
+ pattern: /\b(sk-[A-Za-z0-9]{20,}T3BlbkFJ[A-Za-z0-9]{20,})\b/g,
3762
+ severity: "critical",
3763
+ category: "secret"
3764
+ },
3765
+ // JWT
3766
+ {
3767
+ name: "jwt_token",
3768
+ pattern: /\b(eyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,})\b/g,
3769
+ severity: "high",
3770
+ category: "secret"
3771
+ },
3772
+ // Private key headers
3773
+ {
3774
+ name: "private_key",
3775
+ pattern: /-----BEGIN\s+(RSA |EC |DSA |OPENSSH )?PRIVATE KEY-----/g,
3776
+ severity: "critical",
3777
+ category: "secret"
3778
+ },
3779
+ // Database connection strings
3780
+ {
3781
+ name: "database_url",
3782
+ pattern: /\b((?:postgres|mysql|mongodb|redis):\/\/[^\s'"]{10,})\b/g,
3783
+ severity: "high",
3784
+ category: "secret"
3785
+ },
3786
+ // Slack
3787
+ {
3788
+ name: "slack_token",
3789
+ pattern: /\b(xox[bpras]-[A-Za-z0-9-]{10,})\b/g,
3790
+ severity: "high",
3791
+ category: "secret"
3792
+ },
3793
+ // Stripe
3794
+ {
3795
+ name: "stripe_key",
3796
+ pattern: /\b([rs]k_(?:live|test)_[A-Za-z0-9]{20,})\b/g,
3797
+ severity: "critical",
3798
+ category: "secret"
3799
+ },
3800
+ // npm
3801
+ {
3802
+ name: "npm_token",
3803
+ pattern: /\b(npm_[A-Za-z0-9]{36,})\b/g,
3804
+ severity: "high",
3805
+ category: "secret"
3806
+ },
3807
+ // SendGrid
3808
+ {
3809
+ name: "sendgrid_key",
3810
+ pattern: /\b(SG\.[A-Za-z0-9_-]{22,}\.[A-Za-z0-9_-]{22,})\b/g,
3811
+ severity: "high",
3812
+ category: "secret"
3813
+ },
3814
+ // Generic API key patterns (env-var style assignments)
3815
+ {
3816
+ name: "generic_api_key",
3817
+ pattern: /\b(?:API_KEY|API_SECRET|ACCESS_TOKEN|AUTH_TOKEN|SECRET_KEY)\s*[=:]\s*['"]?([A-Za-z0-9_-]{16,})['"]?/gi,
3818
+ severity: "medium",
3819
+ category: "secret"
3820
+ },
3821
+ // High-entropy string near keyword context
3822
+ {
3823
+ name: "generic_secret_assignment",
3824
+ pattern: /\b(?:password|passwd|secret|token|credential)\s*[=:]\s*['"]([^'"]{8,})['"]?/gi,
3825
+ severity: "medium",
3826
+ category: "secret"
3827
+ }
3828
+ ];
3829
+ var PII_PATTERNS = [
3830
+ // SSN (US)
3831
+ {
3832
+ name: "ssn",
3833
+ pattern: /\b(\d{3}-\d{2}-\d{4})\b/g,
3834
+ severity: "critical",
3835
+ category: "pii"
3836
+ },
3837
+ // Credit card numbers
3838
+ {
3839
+ name: "credit_card",
3840
+ pattern: /\b(4\d{3}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}|5[1-5]\d{2}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}|3[47]\d{2}[\s-]?\d{6}[\s-]?\d{5}|6(?:011|5\d{2})[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4})\b/g,
3841
+ severity: "critical",
3842
+ category: "pii"
3843
+ },
3844
+ // Email address
3845
+ {
3846
+ name: "email",
3847
+ pattern: /\b([A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,})\b/g,
3848
+ severity: "low",
3849
+ category: "pii"
3850
+ },
3851
+ // US phone number
3852
+ {
3853
+ name: "phone_us",
3854
+ pattern: /\b(\+?1?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4})\b/g,
3855
+ severity: "medium",
3856
+ category: "pii"
3857
+ },
3858
+ // IPv4 address
3859
+ {
3860
+ name: "ipv4",
3861
+ pattern: /\b((?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.(?:25[0-5]|2[0-4]\d|[01]?\d\d?))\b/g,
3862
+ severity: "low",
3863
+ category: "pii"
3864
+ }
3865
+ ];
3866
+
3867
+ // src/lib/dlp/scanner.ts
3868
+ var SEVERITY_ORDER = {
3869
+ low: 0,
3870
+ medium: 1,
3871
+ high: 2,
3872
+ critical: 3
3873
+ };
3874
+ var DlpScanner = class {
3875
+ patterns;
3876
+ allowlistRegexps;
3877
+ severityThreshold;
3878
+ config;
3879
+ constructor(config) {
3880
+ this.config = config;
3881
+ this.severityThreshold = SEVERITY_ORDER[config.severity_threshold];
3882
+ this.patterns = [];
3883
+ this.allowlistRegexps = [];
3884
+ if (config.built_in.secrets) {
3885
+ for (const def of SECRET_PATTERNS) {
3886
+ this.patterns.push({ def });
3887
+ }
3888
+ }
3889
+ if (config.built_in.pii) {
3890
+ for (const def of PII_PATTERNS) {
3891
+ this.patterns.push({ def });
3892
+ }
3893
+ }
3894
+ for (const cp of config.custom_patterns) {
3895
+ const def = {
3896
+ name: cp.name,
3897
+ pattern: new RegExp(cp.pattern, "g"),
3898
+ severity: cp.severity,
3899
+ category: "custom"
3900
+ };
3901
+ this.patterns.push({ def, action: cp.action });
3902
+ }
3903
+ for (const compiled of this.patterns) {
3904
+ const override = config.pattern_overrides.get(compiled.def.name);
3905
+ if (override) {
3906
+ compiled.action = override;
3907
+ }
3908
+ }
3909
+ for (const entry of config.allowlist) {
3910
+ this.allowlistRegexps.push(new RegExp(entry.pattern));
3911
+ }
3912
+ }
3913
+ scan(text) {
3914
+ if (!this.config.enabled || text.length === 0) {
3915
+ return { hasMatches: false, matches: [] };
3916
+ }
3917
+ const matches = [];
3918
+ for (const compiled of this.patterns) {
3919
+ if (SEVERITY_ORDER[compiled.def.severity] < this.severityThreshold) {
3920
+ continue;
3921
+ }
3922
+ const regex = new RegExp(compiled.def.pattern.source, compiled.def.pattern.flags);
3923
+ let match;
3924
+ while ((match = regex.exec(text)) !== null) {
3925
+ const matched = match[1] ?? match[0];
3926
+ const start = match[1] ? match.index + match[0].indexOf(match[1]) : match.index;
3927
+ const end = start + matched.length;
3928
+ if (this.isAllowlisted(matched)) {
3929
+ continue;
3930
+ }
3931
+ matches.push({
3932
+ patternName: compiled.def.name,
3933
+ category: compiled.def.category,
3934
+ severity: compiled.def.severity,
3935
+ start,
3936
+ end,
3937
+ matched
3938
+ });
3939
+ }
3940
+ }
3941
+ return { hasMatches: matches.length > 0, matches };
3942
+ }
3943
+ getAction(direction) {
3944
+ if (direction === "input" && this.config.on_input) {
3945
+ return this.config.on_input;
3946
+ }
3947
+ if (direction === "output" && this.config.on_output) {
3948
+ return this.config.on_output;
3949
+ }
3950
+ return this.config.mode;
3951
+ }
3952
+ getPatternAction(match, direction) {
3953
+ const compiled = this.patterns.find((p) => p.def.name === match.patternName);
3954
+ if (compiled?.action) {
3955
+ return compiled.action;
3956
+ }
3957
+ return this.getAction(direction);
3958
+ }
3959
+ isAllowlisted(value) {
3960
+ for (const re of this.allowlistRegexps) {
3961
+ if (re.test(value)) return true;
3962
+ }
3963
+ return false;
3964
+ }
3965
+ };
3966
+ function compareSeverity(a, b) {
3967
+ return SEVERITY_ORDER[a] - SEVERITY_ORDER[b];
3968
+ }
3969
+
3970
+ // src/lib/dlp/masker.ts
3971
+ import { createHash } from "crypto";
3972
+ var DEFAULT_CONFIG = {
3973
+ strategy: "partial",
3974
+ show_chars: 4,
3975
+ placeholder: "***"
3976
+ };
3977
+ var DlpMasker = class {
3978
+ config;
3979
+ constructor(config) {
3980
+ this.config = { ...DEFAULT_CONFIG, ...config };
3981
+ }
3982
+ maskValue(value) {
3983
+ switch (this.config.strategy) {
3984
+ case "full":
3985
+ return this.config.placeholder;
3986
+ case "hash": {
3987
+ const hash = createHash("sha256").update(value).digest("hex").slice(0, 8);
3988
+ return `[REDACTED:${hash}]`;
3989
+ }
3990
+ case "partial":
3991
+ default: {
3992
+ if (value.length <= this.config.show_chars) {
3993
+ return this.config.placeholder;
3994
+ }
3995
+ return this.config.placeholder + value.slice(-this.config.show_chars);
3996
+ }
3997
+ }
3998
+ }
3999
+ maskText(text, matches) {
4000
+ if (matches.length === 0) return text;
4001
+ const sorted = [...matches].sort((a, b) => b.start - a.start);
4002
+ let result = text;
4003
+ for (const match of sorted) {
4004
+ const masked = this.maskValue(match.matched);
4005
+ result = result.slice(0, match.start) + masked + result.slice(match.end);
4006
+ }
4007
+ return result;
4008
+ }
4009
+ };
4010
+
4341
4011
  // src/lib/budget/tracker.ts
4342
4012
  var BudgetTracker = class {
4343
4013
  _used = 0;
@@ -4682,6 +4352,10 @@ export {
4682
4352
  ConfigValidationError,
4683
4353
  ConfigWatcher,
4684
4354
  DANGEROUS_PATTERNS,
4355
+ PII_PATTERNS as DLP_PII_PATTERNS,
4356
+ SECRET_PATTERNS as DLP_SECRET_PATTERNS,
4357
+ DlpMasker,
4358
+ DlpScanner,
4685
4359
  EnvIdentityProvider,
4686
4360
  IdentityChain,
4687
4361
  JsonlAuditSink,
@@ -4693,6 +4367,7 @@ export {
4693
4367
  WebhookAuditSink,
4694
4368
  YamlFactStore,
4695
4369
  YamlPolicyEngine,
4370
+ compareSeverity,
4696
4371
  createApprovalFlow,
4697
4372
  createIdentityChain,
4698
4373
  createPolicyEngine,