lucid-extension-sdk 0.0.446 → 0.0.447
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/core/defer.js
CHANGED
|
@@ -24,7 +24,7 @@ function defer() {
|
|
|
24
24
|
then: promise.then.bind(promise),
|
|
25
25
|
catch: promise.catch.bind(promise),
|
|
26
26
|
finally: promise.finally.bind(promise),
|
|
27
|
-
[Symbol.toStringTag]:
|
|
27
|
+
[Symbol.toStringTag]: 'DeferredPromise',
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
exports.defer = defer;
|
|
@@ -101,6 +101,20 @@ export declare function getObjectOfValidatorAndPruner<T, K extends string | numb
|
|
|
101
101
|
* @param element The data that failed validation and needs pruning.
|
|
102
102
|
*/
|
|
103
103
|
export declare const pruneElement: (element: unknown) => PrunerResult;
|
|
104
|
+
/**
|
|
105
|
+
* Wraps a pruner to get detailed validation failure paths while still
|
|
106
|
+
* removing invalid elements. Used for diagnostic logging.
|
|
107
|
+
*
|
|
108
|
+
* The inner pruner recurses into the element to identify which specific
|
|
109
|
+
* field failed validation. We preserve those detailed paths in invalidFields,
|
|
110
|
+
* but still return undefined to remove the invalid element from the array.
|
|
111
|
+
*
|
|
112
|
+
* We only keep the keys (field paths) and discard the actual values to avoid
|
|
113
|
+
* accidentally logging sensitive customer data.
|
|
114
|
+
*
|
|
115
|
+
* @param innerPruner The pruner to wrap that provides detailed field paths.
|
|
116
|
+
*/
|
|
117
|
+
export declare function createDiagnosticPruneElement(innerPruner: Pruner): Pruner;
|
|
104
118
|
/**
|
|
105
119
|
* Selects and applies one of two pruners based on whether the input data is an array.
|
|
106
120
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getValidatorPrunerConfig = exports.selectPrunerByObjectType = exports.selectPrunerByArrayType = exports.pruneElement = exports.getObjectOfValidatorAndPruner = exports.getArrayValidatorAndPruner = exports.getObjectValidatorAndPruner = void 0;
|
|
3
|
+
exports.getValidatorPrunerConfig = exports.selectPrunerByObjectType = exports.selectPrunerByArrayType = exports.createDiagnosticPruneElement = exports.pruneElement = exports.getObjectOfValidatorAndPruner = exports.getArrayValidatorAndPruner = exports.getObjectValidatorAndPruner = void 0;
|
|
4
4
|
const checks_1 = require("../checks");
|
|
5
5
|
function getValidatorFromConfig(validatorConfig) {
|
|
6
6
|
if ('validator' in validatorConfig) {
|
|
@@ -181,6 +181,31 @@ const pruneElement = (element) => {
|
|
|
181
181
|
return { prunerResult: undefined, invalidFields: createElementInvalidField(element) };
|
|
182
182
|
};
|
|
183
183
|
exports.pruneElement = pruneElement;
|
|
184
|
+
/**
|
|
185
|
+
* Wraps a pruner to get detailed validation failure paths while still
|
|
186
|
+
* removing invalid elements. Used for diagnostic logging.
|
|
187
|
+
*
|
|
188
|
+
* The inner pruner recurses into the element to identify which specific
|
|
189
|
+
* field failed validation. We preserve those detailed paths in invalidFields,
|
|
190
|
+
* but still return undefined to remove the invalid element from the array.
|
|
191
|
+
*
|
|
192
|
+
* We only keep the keys (field paths) and discard the actual values to avoid
|
|
193
|
+
* accidentally logging sensitive customer data.
|
|
194
|
+
*
|
|
195
|
+
* @param innerPruner The pruner to wrap that provides detailed field paths.
|
|
196
|
+
*/
|
|
197
|
+
function createDiagnosticPruneElement(innerPruner) {
|
|
198
|
+
return (element) => {
|
|
199
|
+
const diagnosticResult = innerPruner(element);
|
|
200
|
+
// Only keep the keys (field paths), set values to true to avoid logging sensitive data
|
|
201
|
+
const keysOnly = new Map([...diagnosticResult.invalidFields.keys()].map((k) => [k, true]));
|
|
202
|
+
return {
|
|
203
|
+
prunerResult: undefined,
|
|
204
|
+
invalidFields: keysOnly,
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
exports.createDiagnosticPruneElement = createDiagnosticPruneElement;
|
|
184
209
|
/**
|
|
185
210
|
* Selects and applies one of two pruners based on whether the input data is an array.
|
|
186
211
|
*
|