@empathyco/x-adapter
Advanced tools
Comparing version 8.0.0-alpha.13 to 8.0.0-alpha.14
@@ -7,3 +7,2 @@ "use strict"; | ||
const utils_1 = require("../schemas/utils"); | ||
const extract_value_1 = require("../utils/extract-value"); | ||
/** | ||
@@ -41,3 +40,3 @@ * The 'schemaMapperFactory' function creates a {@link Mapper | mapper function} for a given | ||
if (typeof transformer === 'string' && (0, x_utils_1.isPath)(source, transformer)) { | ||
target[key] = (0, extract_value_1.extractValue)(source, transformer); | ||
target[key] = (0, x_utils_1.getSafePropertyChain)(source, transformer); | ||
} | ||
@@ -74,3 +73,3 @@ else if ((0, x_utils_1.isFunction)(transformer) && !(0, utils_1.isInternalMethod)(transformer.name)) { | ||
function applySubSchemaTransformer(source, { $subSchema, $path, $context }, rawContext, schema) { | ||
const subSource = (0, extract_value_1.extractValue)(source, $path); | ||
const subSource = (0, x_utils_1.getSafePropertyChain)(source, $path); | ||
if (!subSource) { | ||
@@ -87,3 +86,3 @@ return; | ||
? value(source) | ||
: (0, extract_value_1.extractValue)(source, value); | ||
: (0, x_utils_1.getSafePropertyChain)(source, value); | ||
}); | ||
@@ -90,0 +89,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./extract-value"), exports); | ||
tslib_1.__exportStar(require("./interpolate"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.interpolate = void 0; | ||
const extract_value_1 = require("./extract-value"); | ||
const x_utils_1 = require("@empathyco/x-utils"); | ||
/** | ||
@@ -95,3 +95,3 @@ * Syntax to detect and extract string parameters. A string parameter contains a property name | ||
return string.replace(STRING_PARAMETERS, (_match, propertyToReplace) => propertyToReplace.replace(STRING_PARAMETER_CONTENT, (_match, head = '', property, tail = '') => { | ||
const value = (0, extract_value_1.extractValue)(parameters, property); | ||
const value = (0, x_utils_1.getSafePropertyChain)(parameters, property); | ||
/* As the replacer function has a very dynamic signature, it is typed as a function with | ||
@@ -98,0 +98,0 @@ * `any` arguments. This makes it impossible for TS to infer the correct `string` |
import { deepMerge } from '@empathyco/x-deep-merge'; | ||
import { isArray, isFunction, isObject, isPath, reduce } from '@empathyco/x-utils'; | ||
import { getSafePropertyChain, isArray, isFunction, isObject, isPath, reduce } from '@empathyco/x-utils'; | ||
import { createMutableSchema, isInternalMethod } from '../schemas/utils'; | ||
import { extractValue } from '../utils/extract-value'; | ||
/** | ||
@@ -36,3 +35,3 @@ * The 'schemaMapperFactory' function creates a {@link Mapper | mapper function} for a given | ||
if (typeof transformer === 'string' && isPath(source, transformer)) { | ||
target[key] = extractValue(source, transformer); | ||
target[key] = getSafePropertyChain(source, transformer); | ||
} | ||
@@ -69,3 +68,3 @@ else if (isFunction(transformer) && !isInternalMethod(transformer.name)) { | ||
function applySubSchemaTransformer(source, { $subSchema, $path, $context }, rawContext, schema) { | ||
const subSource = extractValue(source, $path); | ||
const subSource = getSafePropertyChain(source, $path); | ||
if (!subSource) { | ||
@@ -82,3 +81,3 @@ return; | ||
? value(source) | ||
: extractValue(source, value); | ||
: getSafePropertyChain(source, value); | ||
}); | ||
@@ -85,0 +84,0 @@ } |
@@ -1,3 +0,2 @@ | ||
export * from './extract-value'; | ||
export * from './interpolate'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { extractValue } from './extract-value'; | ||
import { getSafePropertyChain } from '@empathyco/x-utils'; | ||
/** | ||
@@ -92,3 +92,3 @@ * Syntax to detect and extract string parameters. A string parameter contains a property name | ||
return string.replace(STRING_PARAMETERS, (_match, propertyToReplace) => propertyToReplace.replace(STRING_PARAMETER_CONTENT, (_match, head = '', property, tail = '') => { | ||
const value = extractValue(parameters, property); | ||
const value = getSafePropertyChain(parameters, property); | ||
/* As the replacer function has a very dynamic signature, it is typed as a function with | ||
@@ -95,0 +95,0 @@ * `any` arguments. This makes it impossible for TS to infer the correct `string` |
@@ -1,2 +0,1 @@ | ||
export * from './extract-value'; | ||
export * from './interpolate'; |
{ | ||
"name": "@empathyco/x-adapter", | ||
"version": "8.0.0-alpha.13", | ||
"version": "8.0.0-alpha.14", | ||
"description": "A utils library to create a client for any API", | ||
@@ -38,8 +38,7 @@ "author": "Empathy Systems Corporation S.L.", | ||
"dependencies": { | ||
"@empathyco/x-deep-merge": "^1.3.0-alpha.25", | ||
"@empathyco/x-get-safe-property-chain": "^1.3.0-alpha.4", | ||
"@empathyco/x-deep-merge": "^1.3.0-alpha.26", | ||
"@empathyco/x-utils": "^1.0.0-alpha.12", | ||
"tslib": "~2.3.0" | ||
}, | ||
"devDependencies": { | ||
"@empathyco/x-utils": "^1.0.0-alpha.11", | ||
"@types/jest": "~27.0.3", | ||
@@ -55,3 +54,3 @@ "concurrently": "~7.6.0", | ||
}, | ||
"gitHead": "a13c2eda0e02f1d2352d26d15eb1a2ef86be09a4" | ||
"gitHead": "9a22f6f8727bf2874f275ae2a564f40f2901c590" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
161635
103
1591
- Removed@empathyco/x-get-safe-property-chain@^1.3.0-alpha.4
- Removed@empathyco/x-get-safe-property-chain@1.3.0-alpha.4(transitive)