@aws-lambda-powertools/jmespath
Version:
A type safe and modern jmespath module to parse and extract data from JSON documents using JMESPath
36 lines • 1.27 kB
TypeScript
import type { JSONValue } from '@aws-lambda-powertools/commons/types';
import { Functions } from './Functions.js';
/**
* Custom functions for the Powertools for AWS Lambda JMESPath module.
*
* Built-in JMESPath functions include: `powertools_json`, `powertools_base64`, `powertools_base64_gzip`
*
* You can use these functions to decode and/or deserialize JSON objects when using the {@link index.search | search} function.
*
* @example
* ```typescript
* import { search } from '@aws-lambda-powertools/jmespath';
* import { PowertoolsFunctions } from '@aws-lambda-powertools/jmespath/functions';
*
* const data = {
* body: "{\"foo\": \"bar\"}"
* };
*
* const result = search(
* 'powertools_json(body)',
* data,
* { customFunctions: new PowertoolsFunctions() }
* );
* console.log(result); // { foo: 'bar' }
* ```
*
* When using the {@link envelopes.extractDataFromEnvelope} function, the PowertoolsFunctions class is automatically used.
*
*/
declare class PowertoolsFunctions extends Functions {
funcPowertoolsBase64(value: string): string;
funcPowertoolsBase64Gzip(value: string): string;
funcPowertoolsJson(value: string): JSONValue;
}
export { PowertoolsFunctions, Functions };
//# sourceMappingURL=PowertoolsFunctions.d.ts.map