Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wix/motion-edm-autogen-transformations

Package Overview
Dependencies
Maintainers
22
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/motion-edm-autogen-transformations - npm Package Compare versions

Comparing version 1.45.0 to 1.46.0

21

dist/esm/__tests__/converters.spec.js

@@ -34,7 +34,13 @@ import { anObject, aString } from '@wix/motion-runtime-test-context';

test(`adds an ${renamedKey} property with the same value as the ${key} property`, () => {
const requestPayload = Object.assign(Object.assign({}, otherPayloadFields), { [key]: value });
expect(fromCorvidEntity(requestPayload)).toStrictEqual(Object.assign(Object.assign({}, otherPayloadFields), { [renamedKey]: value }));
const requestPayload = { ...otherPayloadFields, [key]: value };
expect(fromCorvidEntity(requestPayload)).toStrictEqual({
...otherPayloadFields,
[renamedKey]: value,
});
});
test(`recursively adds ${renamedKey} to nested objects and arrays`, () => {
const objectWithUnderscoreId = Object.assign(Object.assign({}, otherPayloadFields), { [key]: value });
const objectWithUnderscoreId = {
...otherPayloadFields,
[key]: value,
};
const requestPayload = {

@@ -46,3 +52,3 @@ someArray: [otherPayloadFields, objectWithUnderscoreId],

otherPayloadFields,
Object.assign(Object.assign({}, otherPayloadFields), { [renamedKey]: value }),
{ ...otherPayloadFields, [renamedKey]: value },
],

@@ -68,3 +74,6 @@ });

const someUnaffectedObject = anObject();
const objectWithUnderscoreId = Object.assign(Object.assign({}, otherPayloadFields), { [key]: value });
const objectWithUnderscoreId = {
...otherPayloadFields,
[key]: value,
};
const responsePayload = {

@@ -76,3 +85,3 @@ someArray: [someUnaffectedObject, objectWithUnderscoreId],

someUnaffectedObject,
Object.assign(Object.assign({}, otherPayloadFields), { [renamedKey]: value }),
{ ...otherPayloadFields, [renamedKey]: value },
],

@@ -79,0 +88,0 @@ });

@@ -13,3 +13,6 @@ import { anObject, aString } from '@wix/motion-runtime-test-context';

const fieldsToOmit = Object.keys(objectToOmit);
const source = sourceFactory(set({}, sourceObjectPath, Object.assign(Object.assign({}, objectToKeep), objectToOmit)));
const source = sourceFactory(set({}, sourceObjectPath, {
...objectToKeep,
...objectToOmit,
}));
const topLevelOmitTransformation = {

@@ -89,4 +92,4 @@ '@source': expression,

transformationFunction | transformation | source | expectedFactory
${transformToRequestMessage} | ${{ id: '$[0]', '*': '$[1]' }} | ${[aString(), anObject()]} | ${(source) => (Object.assign({ id: source[0] }, source[1]))}
${transformResponseMessage} | ${{ id: '$.id', '*': '$.resource' }} | ${{ id: aString(), resource: anObject() }} | ${(source) => (Object.assign({ id: source.id }, source.resource))}
${transformToRequestMessage} | ${{ id: '$[0]', '*': '$[1]' }} | ${[aString(), anObject()]} | ${(source) => ({ id: source[0], ...source[1] })}
${transformResponseMessage} | ${{ id: '$.id', '*': '$.resource' }} | ${{ id: aString(), resource: anObject() }} | ${(source) => ({ id: source.id, ...source.resource })}
`(

@@ -100,4 +103,4 @@ /* eslint-enable max-len */

transformationFunction | transformation | source | expectedFactory
${transformToRequestMessage} | ${{ id: '$[0]', '*': ['$[1]', '$[2]'] }} | ${[aString(), anObject(), anObject()]} | ${(source) => (Object.assign(Object.assign({ id: source[0] }, source[1]), source[2]))}
${transformResponseMessage} | ${{ id: '$.id', '*': ['$.resource', '$.resource2'] }} | ${{ id: aString(), resource: anObject(), resource2: anObject() }} | ${(source) => (Object.assign(Object.assign({ id: source.id }, source.resource), source.resource2))}
${transformToRequestMessage} | ${{ id: '$[0]', '*': ['$[1]', '$[2]'] }} | ${[aString(), anObject(), anObject()]} | ${(source) => ({ id: source[0], ...source[1], ...source[2] })}
${transformResponseMessage} | ${{ id: '$.id', '*': ['$.resource', '$.resource2'] }} | ${{ id: aString(), resource: anObject(), resource2: anObject() }} | ${(source) => ({ id: source.id, ...source.resource, ...source.resource2 })}
`(

@@ -111,4 +114,4 @@ /* eslint-enable max-len */

transformationFunction | transformation | source | expectedFactory
${transformToRequestMessage} | ${{ id: '$[0]', b: { '*': ['$[1]', '$[2]'] } }} | ${[aString(), anObject(), anObject()]} | ${(source) => ({ id: source[0], b: Object.assign(Object.assign({}, source[1]), source[2]) })}
${transformResponseMessage} | ${{ id: '$.id', b: { '*': ['$.resource', '$.resource2'] } }} | ${{ id: aString(), resource: anObject(), resource2: anObject() }} | ${(source) => ({ id: source.id, b: Object.assign(Object.assign({}, source.resource), source.resource2) })}
${transformToRequestMessage} | ${{ id: '$[0]', b: { '*': ['$[1]', '$[2]'] } }} | ${[aString(), anObject(), anObject()]} | ${(source) => ({ id: source[0], b: { ...source[1], ...source[2] } })}
${transformResponseMessage} | ${{ id: '$.id', b: { '*': ['$.resource', '$.resource2'] } }} | ${{ id: aString(), resource: anObject(), resource2: anObject() }} | ${(source) => ({ id: source.id, b: { ...source.resource, ...source.resource2 } })}
`(

@@ -115,0 +118,0 @@ /* eslint-enable max-len */

@@ -31,3 +31,3 @@ import { isJsonPathExpression, reduceTransformation, runCustomFunctionCallExpression, } from '@wix/motion-edm-autogen-transformations-core';

const existing = get(acc, path, {});
set(acc, path, Object.assign(Object.assign({}, existing), valueToSpread));
set(acc, path, { ...existing, ...valueToSpread });
},

@@ -34,0 +34,0 @@ TopLevelSpreadExpression: (acc, expressionOfValueToSpread, spreadOperatorSiblingKeys) => {

@@ -101,5 +101,9 @@ import { constantCase } from 'constant-case';

message,
extraProperties: Object.assign({ requestId: ambassadorHTTPError.requestId, code }, (ambassadorHTTPError.runtimeError && {
runtimeError: ambassadorHTTPError.runtimeError,
})),
extraProperties: {
requestId: ambassadorHTTPError.requestId,
code,
...(ambassadorHTTPError.runtimeError && {
runtimeError: ambassadorHTTPError.runtimeError,
}),
},
});

@@ -106,0 +110,0 @@ };

@@ -37,3 +37,6 @@ import { reduceTransformation, transformations, } from '@wix/motion-edm-autogen-transformations-core';

const { spreadPathsToArguments, explicitPathsToArguments } = collectArgumentExpressions(transformation);
const allPathsToArguments = Object.assign(Object.assign({}, spreadPathsToArguments), explicitPathsToArguments);
const allPathsToArguments = {
...spreadPathsToArguments,
...explicitPathsToArguments,
};
const allPathsToArgumentsKeys = Object.keys(allPathsToArguments);

@@ -55,3 +58,6 @@ return _(fieldViolations)

if (exactMatchArgumentExpression) {
return Object.assign(Object.assign({}, fieldViolation), { field: withRenamedArgument(exactMatchArgumentExpression, argumentNames) });
return {
...fieldViolation,
field: withRenamedArgument(exactMatchArgumentExpression, argumentNames),
};
}

@@ -69,6 +75,12 @@ const longestPartialPathMatch = chain(allPathsToArgumentsKeys)

if (partialMatchArgumentExpression) {
return Object.assign(Object.assign({}, fieldViolation), { field: fieldViolation.field.replace(longestPartialPathMatch, withRenamedArgument(partialMatchArgumentExpression, argumentNames)) });
return {
...fieldViolation,
field: fieldViolation.field.replace(longestPartialPathMatch, withRenamedArgument(partialMatchArgumentExpression, argumentNames)),
};
}
if (transformation === JS_SINGLE_ARG_UNCHANGED) {
return Object.assign(Object.assign({}, fieldViolation), { field: `${argumentNames[0]}.${fieldViolation.field}` });
return {
...fieldViolation,
field: `${argumentNames[0]}.${fieldViolation.field}`,
};
}

@@ -75,0 +87,0 @@ return fieldViolation;

{
"name": "@wix/motion-edm-autogen-transformations",
"version": "1.45.0",
"version": "1.46.0",
"license": "UNLICENSED",

@@ -40,4 +40,4 @@ "author": {

"@rushstack/eslint-patch": "^1.1.0",
"@wix/motion-edm-autogen-common": "1.38.0",
"@wix/motion-edm-autogen-transformations-core": "1.42.0",
"@wix/motion-edm-autogen-common": "1.39.0",
"@wix/motion-edm-autogen-transformations-core": "1.43.0",
"constant-case": "~3.0.0",

@@ -55,5 +55,5 @@ "deep-for-each": "~3.0.0",

"@types/node": "^14.0.0",
"@wix/jest-yoshi-preset": "^6.88.1",
"@wix/jest-yoshi-preset": "^6.89.0",
"@wix/motion-runtime-test-context": "~1.0.0",
"@wix/yoshi-flow-library": "^6.88.1",
"@wix/yoshi-flow-library": "^6.89.0",
"dedent-js": "~1.0.0",

@@ -78,3 +78,3 @@ "eslint-plugin-simple-import-sort": "^10.0.0",

},
"falconPackageHash": "122916fe7b46067035ba836b0a9a01b8470586de9f825fb9aaec6c79"
"falconPackageHash": "941a2bf147224199d40116cbc1f5b997fd63935211042f62a7510bd1"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc