Skip to content

Commit a7afb58

Browse files
committed
chore: update types
1 parent bbb0141 commit a7afb58

42 files changed

Lines changed: 255 additions & 145 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎dist/Safe-Script.d.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ export type AssignmentExpression = any;
22
export type Substitution = any;
33
export type AnyParameter = any;
44
export type Substitutions = Record<string, Substitution>;
5+
export type OperatorTable = Record<string, (a: AnyParameter, b: AnyParameter) => UnknownResult>;
6+
export type UnaryOperatorTable = {
7+
[key: string]: (a: AnyParameter) => UnknownResult;
8+
};
59
/**
610
* A replacement for NodeJS' VM.Script which is also {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP | Content Security Policy} friendly.
711
*/
@@ -19,4 +23,5 @@ export class SafeScript {
1923
*/
2024
runInNewContext(context: object): EvaluatedResult;
2125
}
26+
import type { UnknownResult } from './jsonpath.js';
2227
import type { EvaluatedResult } from './jsonpath.js';

‎dist/jsonpath.d.ts‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export type ReturnObject = {
1818
pointer?: string | undefined;
1919
};
2020
export type JSONPathCallback = (preferredOutput: any, type: "value" | "property", fullRetObj: ReturnObject) => void;
21-
export type OtherTypeCallback = (val: unknown, path: ExpressionArray, parent: ParentValue, parentPropName: string | null) => boolean | null;
21+
export type OtherTypeCallback = (val: unknown, path: ExpressionArray, parent: ParentValue, parentPropName: string | number | null) => boolean | null;
2222
export type ContextItem = any;
2323
export type EvaluatedResult = any;
2424
export type EvalCallback = (code: string, context: ContextItem) => EvaluatedResult;
@@ -60,6 +60,11 @@ export type JSONPathOptions = {
6060
* function which throws on encountering `@other`
6161
*/
6262
otherTypeCallback?: OtherTypeCallback | undefined;
63+
/**
64+
* Map of custom
65+
* type operator names to their evaluation callbacks
66+
*/
67+
customTypes?: Record<string, OtherTypeCallback> | undefined;
6368
autostart?: boolean | undefined;
6469
ignoreEvalErrors?: boolean | undefined;
6570
};
@@ -99,7 +104,11 @@ export function JSONPath(opts: JSONPathOptions & {
99104
*/
100105
export function JSONPath(opts: JSONPathOptions): unknown;
101106
export namespace JSONPath {
102-
let cache: Record<string, unknown>;
107+
/**
108+
* Clears cached parsed paths and compiled scripts.
109+
* @returns {void}
110+
*/
111+
function clearCache(): void;
103112
/**
104113
* @param {string[]} pathArr Array to convert
105114
* @returns {string} The path string
@@ -148,6 +157,8 @@ export class JSONPathClass {
148157
currEval: EvalValue | undefined;
149158
/** @type {OtherTypeCallback|undefined} */
150159
currOtherTypeCallback: OtherTypeCallback | undefined;
160+
/** @type {Record<string, OtherTypeCallback>|undefined} */
161+
currCustomTypes: Record<string, OtherTypeCallback> | undefined;
151162
/** @type {SandboxType|undefined} */
152163
currSandbox: SandboxType | undefined;
153164
_hasParentSelector: boolean;
@@ -163,6 +174,7 @@ export class JSONPathClass {
163174
parentProperty: ParentProperty | undefined;
164175
callback: JSONPathCallback;
165176
otherTypeCallback: OtherTypeCallback;
177+
customTypes: Record<string, OtherTypeCallback>;
166178
/**
167179
* @overload
168180
* @param {JSONPathOptions} [expr]

‎docs/ts/assets/hierarchy.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzytWsqqurQUAmx4Kpg=="
1+
window.hierarchyData = "eJyrVirKzy8pVrKKjtVRKkpNy0lNLsnMzwMKVNfWAgCbHgqm"

‎docs/ts/assets/navigation.js‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)