@langchain/core
Version:
Core LangChain.js abstractions and schemas
1 lines • 6.98 kB
Source Map (JSON)
{"version":3,"file":"core.d.ts","names":["PatchError","_deepClone","JsonPatchError","deepClone","Operation","AddOperation","RemoveOperation","ReplaceOperation","MoveOperation","CopyOperation","TestOperation","GetOperation","Validator","T","OperationResult","BaseOperation","PatchResult","Array","getValueByPointer","applyOperation","applyPatch","ReadonlyArray","applyReducer","validator","validate","_areEquals"],"sources":["../../../../src/utils/fast-json-patch/src/core.d.ts"],"sourcesContent":["import { PatchError, _deepClone } from \"./helpers.js\";\nexport declare const JsonPatchError: typeof PatchError;\nexport declare const deepClone: typeof _deepClone;\nexport type Operation = AddOperation<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;\nexport interface Validator<T> {\n (operation: Operation, index: number, document: T, existingPathFragment: string): void;\n}\nexport interface OperationResult<T> {\n removed?: any;\n test?: boolean;\n newDocument: T;\n}\nexport interface BaseOperation {\n path: string;\n}\nexport interface AddOperation<T> extends BaseOperation {\n op: \"add\";\n value: T;\n}\nexport interface RemoveOperation extends BaseOperation {\n op: \"remove\";\n}\nexport interface ReplaceOperation<T> extends BaseOperation {\n op: \"replace\";\n value: T;\n}\nexport interface MoveOperation extends BaseOperation {\n op: \"move\";\n from: string;\n}\nexport interface CopyOperation extends BaseOperation {\n op: \"copy\";\n from: string;\n}\nexport interface TestOperation<T> extends BaseOperation {\n op: \"test\";\n value: T;\n}\nexport interface GetOperation<T> extends BaseOperation {\n op: \"_get\";\n value: T;\n}\nexport interface PatchResult<T> extends Array<OperationResult<T>> {\n newDocument: T;\n}\n/**\n * Retrieves a value from a JSON document by a JSON pointer.\n * Returns the value.\n *\n * @param document The document to get the value from\n * @param pointer an escaped JSON pointer\n * @return The retrieved value\n */\nexport declare function getValueByPointer(document: any, pointer: string): any;\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the {newDocument, result} of the operation.\n * It modifies the `document` and `operation` objects - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return `{newDocument, result}` after the operation\n */\nexport declare function applyOperation<T>(document: T, operation: Operation, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean, index?: number): OperationResult<T>;\n/**\n * Apply a full JSON Patch array on a JSON document.\n * Returns the {newDocument, result} of the patch.\n * It modifies the `document` object and `patch` - it gets the values by reference.\n * If you would like to avoid touching your values, clone them:\n * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.\n *\n * @param document The document to patch\n * @param patch The patch to apply\n * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.\n * @param mutateDocument Whether to mutate the original document or clone it before applying\n * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.\n * @return An array of `{newDocument, result}` after the patch\n */\nexport declare function applyPatch<T>(document: T, patch: ReadonlyArray<Operation>, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean): PatchResult<T>;\n/**\n * Apply a single JSON Patch Operation on a JSON document.\n * Returns the updated document.\n * Suitable as a reducer.\n *\n * @param document The document to patch\n * @param operation The operation to apply\n * @return The updated document\n */\nexport declare function applyReducer<T>(document: T, operation: Operation, index: number): T;\n/**\n * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.\n * @param {object} operation - operation object (patch)\n * @param {number} index - index of operation in the sequence\n * @param {object} [document] - object where the operation is supposed to be applied\n * @param {string} [existingPathFragment] - comes along with `document`\n */\nexport declare function validator(operation: Operation, index: number, document?: any, existingPathFragment?: string): void;\n/**\n * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.\n * If error is encountered, returns a JsonPatchError object\n * @param sequence\n * @param document\n * @returns {JsonPatchError|undefined}\n */\nexport declare function validate<T>(sequence: ReadonlyArray<Operation>, document?: T, externalValidator?: Validator<T>): PatchError;\nexport declare function _areEquals(a: any, b: any): boolean;\n//# sourceMappingURL=core.d.ts.map"],"mappings":";;AAG4CM,KAAhCF,SAAAA,GAAYC,YAAoBC,CAAAA,GAAAA,CAAAA,GAAAA,eAAAA,GAAkBC,gBAAlBD,CAAAA,GAAAA,CAAAA,GAA0CE,aAA1CF,GAA0DG,aAA1DH,GAA0EI,aAA1EJ,CAAAA,GAAAA,CAAAA,GAA+FK,YAA/FL,CAAAA,GAAAA,CAAAA;AAAkBC,UAC7CK,SAD6CL,CAAAA,CAAAA,CAAAA,CAAAA;EAAwBC,CAAAA,SAAAA,EAEtEJ,SAFsEI,EAAAA,KAAAA,EAAAA,MAAAA,EAAAA,QAAAA,EAElCK,CAFkCL,EAAAA,oBAAAA,EAAAA,MAAAA,CAAAA,EAAAA,IAAAA;;AAAgCE,UAIrGI,eAJqGJ,CAAAA,CAAAA,CAAAA,CAAAA;EAAqBC,OAAAA,CAAAA,EAAAA,GAAAA;EAAY,IAAA,CAAA,EAAA,OAAA;EACtIC,WAAAA,EAMAC,CANS;AAG1B;AAKiBE,UAAAA,aAAAA,CAAa;EAGbV,IAAAA,EAAAA,MAAAA;AAIjB;AAGiBE,UAPAF,YAOgBQ,CAAAA,CAAAA,CAAAA,SAPQE,aAOiB,CAAA;EAIzCP,EAAAA,EAAAA,KAAAA;EAIAC,KAAAA,EAbNI,CAaMJ;AAIjB;AAIiBE,UAnBAL,eAAAA,SAAwBS,aAmBa,CAAA;EAIrCC,EAAAA,EAAAA,QAAAA;;AAA6BF,UApB7BP,gBAoB6BO,CAAAA,CAAAA,CAAAA,SApBDC,aAoBCD,CAAAA;EAC7BD,EAAAA,EAAAA,SAAAA;EADuBI,KAAAA,EAlB7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