@wix/motion-edm-autogen-transformations-core 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/dist/cjs/__tests__/corvid-entity.spec.js +68 -0
  2. package/dist/cjs/__tests__/corvid-entity.spec.js.map +1 -0
  3. package/dist/cjs/__tests__/getArgumentCardinality.spec.js +58 -0
  4. package/dist/cjs/__tests__/getArgumentCardinality.spec.js.map +1 -0
  5. package/dist/cjs/__tests__/helpers.spec.js +90 -0
  6. package/dist/cjs/__tests__/helpers.spec.js.map +1 -0
  7. package/dist/cjs/__tests__/reduceTransformation.spec.js +478 -0
  8. package/dist/cjs/__tests__/reduceTransformation.spec.js.map +1 -0
  9. package/dist/cjs/__tests__/transformations/custom-functions.spec.js +111 -0
  10. package/dist/cjs/__tests__/transformations/custom-functions.spec.js.map +1 -0
  11. package/dist/cjs/__tests__/transformations/preset/create-transformation.spec.js +47 -0
  12. package/dist/cjs/__tests__/transformations/preset/create-transformation.spec.js.map +1 -0
  13. package/dist/cjs/__tests__/transformations/preset/delete-transformation.spec.js +75 -0
  14. package/dist/cjs/__tests__/transformations/preset/delete-transformation.spec.js.map +1 -0
  15. package/dist/cjs/__tests__/transformations/preset/get-transformation.spec.js +46 -0
  16. package/dist/cjs/__tests__/transformations/preset/get-transformation.spec.js.map +1 -0
  17. package/dist/cjs/__tests__/transformations/preset/list-transformation.spec.js +28 -0
  18. package/dist/cjs/__tests__/transformations/preset/list-transformation.spec.js.map +1 -0
  19. package/dist/cjs/__tests__/transformations/preset/query-transformation.spec.js +66 -0
  20. package/dist/cjs/__tests__/transformations/preset/query-transformation.spec.js.map +1 -0
  21. package/dist/cjs/__tests__/transformations/preset/update-transformation.spec.js +90 -0
  22. package/dist/cjs/__tests__/transformations/preset/update-transformation.spec.js.map +1 -0
  23. package/dist/cjs/__tests__/validations/validateRequestTransformation.spec.js +291 -0
  24. package/dist/cjs/__tests__/validations/validateRequestTransformation.spec.js.map +1 -0
  25. package/dist/cjs/__tests__/validations/validateResponseTransformation.spec.js +370 -0
  26. package/dist/cjs/__tests__/validations/validateResponseTransformation.spec.js.map +1 -0
  27. package/dist/cjs/index.js +102 -0
  28. package/dist/cjs/index.js.map +1 -0
  29. package/dist/cjs/lib/corvid-entity/index.js +32 -0
  30. package/dist/cjs/lib/corvid-entity/index.js.map +1 -0
  31. package/dist/cjs/lib/getArgumentCardinality.js +34 -0
  32. package/dist/cjs/lib/getArgumentCardinality.js.map +1 -0
  33. package/dist/cjs/lib/helpers.js +111 -0
  34. package/dist/cjs/lib/helpers.js.map +1 -0
  35. package/dist/cjs/lib/transformations/common.js +24 -0
  36. package/dist/cjs/lib/transformations/common.js.map +1 -0
  37. package/dist/cjs/lib/transformations/constants.js +23 -0
  38. package/dist/cjs/lib/transformations/constants.js.map +1 -0
  39. package/dist/cjs/lib/transformations/custom-functions.js +46 -0
  40. package/dist/cjs/lib/transformations/custom-functions.js.map +1 -0
  41. package/dist/cjs/lib/transformations/preset/create.js +17 -0
  42. package/dist/cjs/lib/transformations/preset/create.js.map +1 -0
  43. package/dist/cjs/lib/transformations/preset/delete.js +42 -0
  44. package/dist/cjs/lib/transformations/preset/delete.js.map +1 -0
  45. package/dist/cjs/lib/transformations/preset/get.js +17 -0
  46. package/dist/cjs/lib/transformations/preset/get.js.map +1 -0
  47. package/dist/cjs/lib/transformations/preset/list.js +13 -0
  48. package/dist/cjs/lib/transformations/preset/list.js.map +1 -0
  49. package/dist/cjs/lib/transformations/preset/query.js +40 -0
  50. package/dist/cjs/lib/transformations/preset/query.js.map +1 -0
  51. package/dist/cjs/lib/transformations/preset/update.js +37 -0
  52. package/dist/cjs/lib/transformations/preset/update.js.map +1 -0
  53. package/dist/cjs/lib/transformations/reduceTransformation.js +180 -0
  54. package/dist/cjs/lib/transformations/reduceTransformation.js.map +1 -0
  55. package/dist/cjs/lib/transformations/validations/common.js +50 -0
  56. package/dist/cjs/lib/transformations/validations/common.js.map +1 -0
  57. package/dist/cjs/lib/transformations/validations/validateRequestTransformation.js +118 -0
  58. package/dist/cjs/lib/transformations/validations/validateRequestTransformation.js.map +1 -0
  59. package/dist/cjs/lib/transformations/validations/validateResponseTransformation.js +161 -0
  60. package/dist/cjs/lib/transformations/validations/validateResponseTransformation.js.map +1 -0
  61. package/dist/esm/__tests__/corvid-entity.spec.js +58 -0
  62. package/dist/esm/__tests__/corvid-entity.spec.js.map +1 -0
  63. package/dist/esm/__tests__/getArgumentCardinality.spec.js +42 -0
  64. package/dist/esm/__tests__/getArgumentCardinality.spec.js.map +1 -0
  65. package/dist/esm/__tests__/helpers.spec.js +61 -0
  66. package/dist/esm/__tests__/helpers.spec.js.map +1 -0
  67. package/dist/esm/__tests__/reduceTransformation.spec.js +416 -0
  68. package/dist/esm/__tests__/reduceTransformation.spec.js.map +1 -0
  69. package/dist/esm/__tests__/transformations/custom-functions.spec.js +87 -0
  70. package/dist/esm/__tests__/transformations/custom-functions.spec.js.map +1 -0
  71. package/dist/esm/__tests__/transformations/preset/create-transformation.spec.js +40 -0
  72. package/dist/esm/__tests__/transformations/preset/create-transformation.spec.js.map +1 -0
  73. package/dist/esm/__tests__/transformations/preset/delete-transformation.spec.js +65 -0
  74. package/dist/esm/__tests__/transformations/preset/delete-transformation.spec.js.map +1 -0
  75. package/dist/esm/__tests__/transformations/preset/get-transformation.spec.js +39 -0
  76. package/dist/esm/__tests__/transformations/preset/get-transformation.spec.js.map +1 -0
  77. package/dist/esm/__tests__/transformations/preset/list-transformation.spec.js +22 -0
  78. package/dist/esm/__tests__/transformations/preset/list-transformation.spec.js.map +1 -0
  79. package/dist/esm/__tests__/transformations/preset/query-transformation.spec.js +57 -0
  80. package/dist/esm/__tests__/transformations/preset/query-transformation.spec.js.map +1 -0
  81. package/dist/esm/__tests__/transformations/preset/update-transformation.spec.js +85 -0
  82. package/dist/esm/__tests__/transformations/preset/update-transformation.spec.js.map +1 -0
  83. package/dist/esm/__tests__/validations/validateRequestTransformation.spec.js +200 -0
  84. package/dist/esm/__tests__/validations/validateRequestTransformation.spec.js.map +1 -0
  85. package/dist/esm/__tests__/validations/validateResponseTransformation.spec.js +246 -0
  86. package/dist/esm/__tests__/validations/validateResponseTransformation.spec.js.map +1 -0
  87. package/dist/esm/index.js +47 -0
  88. package/dist/esm/index.js.map +1 -0
  89. package/dist/esm/lib/corvid-entity/index.js +17 -0
  90. package/dist/esm/lib/corvid-entity/index.js.map +1 -0
  91. package/dist/esm/lib/getArgumentCardinality.js +30 -0
  92. package/dist/esm/lib/getArgumentCardinality.js.map +1 -0
  93. package/dist/esm/lib/helpers.js +56 -0
  94. package/dist/esm/lib/helpers.js.map +1 -0
  95. package/dist/esm/lib/transformations/common.js +17 -0
  96. package/dist/esm/lib/transformations/common.js.map +1 -0
  97. package/dist/esm/lib/transformations/constants.js +18 -0
  98. package/dist/esm/lib/transformations/constants.js.map +1 -0
  99. package/dist/esm/lib/transformations/custom-functions.js +34 -0
  100. package/dist/esm/lib/transformations/custom-functions.js.map +1 -0
  101. package/dist/esm/lib/transformations/preset/create.js +8 -0
  102. package/dist/esm/lib/transformations/preset/create.js.map +1 -0
  103. package/dist/esm/lib/transformations/preset/delete.js +25 -0
  104. package/dist/esm/lib/transformations/preset/delete.js.map +1 -0
  105. package/dist/esm/lib/transformations/preset/get.js +8 -0
  106. package/dist/esm/lib/transformations/preset/get.js.map +1 -0
  107. package/dist/esm/lib/transformations/preset/list.js +6 -0
  108. package/dist/esm/lib/transformations/preset/list.js.map +1 -0
  109. package/dist/esm/lib/transformations/preset/query.js +28 -0
  110. package/dist/esm/lib/transformations/preset/query.js.map +1 -0
  111. package/dist/esm/lib/transformations/preset/update.js +18 -0
  112. package/dist/esm/lib/transformations/preset/update.js.map +1 -0
  113. package/dist/esm/lib/transformations/reduceTransformation.js +122 -0
  114. package/dist/esm/lib/transformations/reduceTransformation.js.map +1 -0
  115. package/dist/esm/lib/transformations/validations/common.js +35 -0
  116. package/dist/esm/lib/transformations/validations/common.js.map +1 -0
  117. package/dist/esm/lib/transformations/validations/validateRequestTransformation.js +107 -0
  118. package/dist/esm/lib/transformations/validations/validateRequestTransformation.js.map +1 -0
  119. package/dist/esm/lib/transformations/validations/validateResponseTransformation.js +142 -0
  120. package/dist/esm/lib/transformations/validations/validateResponseTransformation.js.map +1 -0
  121. package/dist/tsconfig.tsbuildinfo +1 -0
  122. package/dist/types/__tests__/corvid-entity.spec.d.ts +2 -0
  123. package/dist/types/__tests__/corvid-entity.spec.d.ts.map +1 -0
  124. package/dist/types/__tests__/getArgumentCardinality.spec.d.ts +2 -0
  125. package/dist/types/__tests__/getArgumentCardinality.spec.d.ts.map +1 -0
  126. package/dist/types/__tests__/helpers.spec.d.ts +2 -0
  127. package/dist/types/__tests__/helpers.spec.d.ts.map +1 -0
  128. package/dist/types/__tests__/reduceTransformation.spec.d.ts +2 -0
  129. package/dist/types/__tests__/reduceTransformation.spec.d.ts.map +1 -0
  130. package/dist/types/__tests__/transformations/custom-functions.spec.d.ts +2 -0
  131. package/dist/types/__tests__/transformations/custom-functions.spec.d.ts.map +1 -0
  132. package/dist/types/__tests__/transformations/preset/create-transformation.spec.d.ts +2 -0
  133. package/dist/types/__tests__/transformations/preset/create-transformation.spec.d.ts.map +1 -0
  134. package/dist/types/__tests__/transformations/preset/delete-transformation.spec.d.ts +2 -0
  135. package/dist/types/__tests__/transformations/preset/delete-transformation.spec.d.ts.map +1 -0
  136. package/dist/types/__tests__/transformations/preset/get-transformation.spec.d.ts +2 -0
  137. package/dist/types/__tests__/transformations/preset/get-transformation.spec.d.ts.map +1 -0
  138. package/dist/types/__tests__/transformations/preset/list-transformation.spec.d.ts +2 -0
  139. package/dist/types/__tests__/transformations/preset/list-transformation.spec.d.ts.map +1 -0
  140. package/dist/types/__tests__/transformations/preset/query-transformation.spec.d.ts +2 -0
  141. package/dist/types/__tests__/transformations/preset/query-transformation.spec.d.ts.map +1 -0
  142. package/dist/types/__tests__/transformations/preset/update-transformation.spec.d.ts +2 -0
  143. package/dist/types/__tests__/transformations/preset/update-transformation.spec.d.ts.map +1 -0
  144. package/dist/types/__tests__/validations/validateRequestTransformation.spec.d.ts +2 -0
  145. package/dist/types/__tests__/validations/validateRequestTransformation.spec.d.ts.map +1 -0
  146. package/dist/types/__tests__/validations/validateResponseTransformation.spec.d.ts +2 -0
  147. package/dist/types/__tests__/validations/validateResponseTransformation.spec.d.ts.map +1 -0
  148. package/dist/types/index.d.ts +55 -0
  149. package/dist/types/index.d.ts.map +1 -0
  150. package/dist/types/lib/corvid-entity/index.d.ts +13 -0
  151. package/dist/types/lib/corvid-entity/index.d.ts.map +1 -0
  152. package/dist/types/lib/getArgumentCardinality.d.ts +3 -0
  153. package/dist/types/lib/getArgumentCardinality.d.ts.map +1 -0
  154. package/dist/types/lib/helpers.d.ts +28 -0
  155. package/dist/types/lib/helpers.d.ts.map +1 -0
  156. package/dist/types/lib/transformations/common.d.ts +15 -0
  157. package/dist/types/lib/transformations/common.d.ts.map +1 -0
  158. package/dist/types/lib/transformations/constants.d.ts +18 -0
  159. package/dist/types/lib/transformations/constants.d.ts.map +1 -0
  160. package/dist/types/lib/transformations/custom-functions.d.ts +13 -0
  161. package/dist/types/lib/transformations/custom-functions.d.ts.map +1 -0
  162. package/dist/types/lib/transformations/preset/create.d.ts +6 -0
  163. package/dist/types/lib/transformations/preset/create.d.ts.map +1 -0
  164. package/dist/types/lib/transformations/preset/delete.d.ts +7 -0
  165. package/dist/types/lib/transformations/preset/delete.d.ts.map +1 -0
  166. package/dist/types/lib/transformations/preset/get.d.ts +6 -0
  167. package/dist/types/lib/transformations/preset/get.d.ts.map +1 -0
  168. package/dist/types/lib/transformations/preset/list.d.ts +4 -0
  169. package/dist/types/lib/transformations/preset/list.d.ts.map +1 -0
  170. package/dist/types/lib/transformations/preset/query.d.ts +20 -0
  171. package/dist/types/lib/transformations/preset/query.d.ts.map +1 -0
  172. package/dist/types/lib/transformations/preset/update.d.ts +8 -0
  173. package/dist/types/lib/transformations/preset/update.d.ts.map +1 -0
  174. package/dist/types/lib/transformations/reduceTransformation.d.ts +6 -0
  175. package/dist/types/lib/transformations/reduceTransformation.d.ts.map +1 -0
  176. package/dist/types/lib/transformations/validations/common.d.ts +13 -0
  177. package/dist/types/lib/transformations/validations/common.d.ts.map +1 -0
  178. package/dist/types/lib/transformations/validations/validateRequestTransformation.d.ts +6 -0
  179. package/dist/types/lib/transformations/validations/validateRequestTransformation.d.ts.map +1 -0
  180. package/dist/types/lib/transformations/validations/validateResponseTransformation.d.ts +6 -0
  181. package/dist/types/lib/transformations/validations/validateResponseTransformation.d.ts.map +1 -0
  182. package/package.json +72 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/__tests__/transformations/custom-functions.spec.ts"],"names":["describe","test","each","argumentExpressions","expectedArgumentExpressions","functionName","functionExpression","expect","toStrictEqual","expression","expectedResult","value","transformationParentPath","joinWithDots","args","join","argumentValues","customFunctions","result","toThrow","Error","t","RegExp"],"mappings":";;AAAA;;AACA;;AACA;;AACA;;AAEAA,QAAQ,CAAC,yBAAD,EAA4B,MAAM;AACxC;AACAC,EAAAA,IAAI,CAACC,IAAK;AACZ;AACA,MAAM,mBAAoB,wBAAuB,gBAAiB,2BAA0B,CAAC,gBAAD,CAAmB;AAC/G,MAAM,oBAAqB,uBAAsB,2BAA4B,gBAAe,CAAC,gBAAD,EAAmB,YAAnB,CAAiC;AAC7H,MAAM,qCAAsC,MAAK,qCAAsC,MAAK,CAAC,gBAAD,EAAmB,YAAnB,EAAiC,MAAjC,CAAyC;AACrI,MAAM,cAAe,6BAA4B,EAAG,yCAAwC,EAAG;AAC/F,GANE;AAOE;AACA,6DARF,EASE,CAAC;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,GAAD,KAA0D;AACxD,UAAMC,YAAY,GAAG,wCAArB;AACA,UAAMC,kBAAkB,GAAI,IAAGD,YAAa,IAAGF,mBAAoB,GAAnE;AAEAI,IAAAA,MAAM,CAAC,+BAAwBD,kBA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M,CAACc,CAAD,CAAN,CAAUF,OAAV,CAAkBC,KAAlB;AACAb,MAAAA,MAAM,CAACc,CAAD,CAAN,CAAUF,OAAV,CACE,IAAIG,MAAJ,CACG,gBAAeV,wBAAyB,aAAYP,YAAa,yEADpE,CADF;AAKD,KAvBG,CAAJ;AAwBD,GAxCO,CAAR;AAyCD,CA3EO,CAAR","sourcesContent":["import { aString } from '@wix/motion-runtime-test-context';\nimport { set, times } from 'lodash';\nimport { parseCustomFunctionCall, isFunctionCallExpression } from '../..';\nimport { runCustomFunctionCallExpression } from '../../lib/transformations/custom-functions';\n\ndescribe('parseCustomFunctionCall', () => {\n /* eslint-disable max-len */\n test.each`\n argumentCount | argumentExpressions | expectedArgumentExpressions\n ${'a single argument'} | ${'$[0].some.path'} | ${['$[0].some.path']}\n ${'multiple arguments'} | ${'$[0].some.path,someString'} | ${['$[0].some.path', 'someString']}\n ${'multiple arguments with whitespaces'} | ${'$[0].some.path, someString , $[1]'} | ${['$[0].some.path', 'someString', '$[1]']}\n ${'no arguments'} | ${''} | ${[]}\n `(\n /* eslint-enable max-len */\n 'parses a custom-function call applied with $argumentCount',\n ({ argumentExpressions, expectedArgumentExpressions }) => {\n const functionName = aString();\n const functionExpression = `#${functionName}(${argumentExpressions})`;\n\n expect(parseCustomFunctionCall(functionExpression)).toStrictEqual({\n functionName,\n argumentExpressions: expectedArgumentExpressions,\n });\n },\n );\n});\n\ndescribe('isFunctionCallExpression', () => {\n test.each`\n description | expression | expectedResult\n ${'a #-prefixed with a valid function name'} | ${'#someInvalidName$#@#>'} | ${true}\n ${'a non-# prefixed with a valid function name'} | ${'someFunctions($[1])'} | ${false}\n ${'a non-string value'} | ${[1, 2, 3]} | ${false}\n `(\n 'returns $expectedResult when $description function call expression is provided',\n ({ expression, expectedResult }) => {\n expect(isFunctionCallExpression(expression)).toStrictEqual(\n expectedResult,\n );\n },\n );\n});\n\ndescribe('runCustomFunctionCallExpression', () => {\n const value = aString();\n const transformationParentPath = aString();\n const joinWithDots = (...args) => args.join('|');\n\n describe.each`\n argumentCount | argumentValues | expectedResult\n ${'single'} | ${[value]} | ${value}\n ${'multi'} | ${[value, value]} | ${`${value}|${value}`}\n ${'no'} | ${[]} | ${''}\n `(\n '$argumentCount-argument expression',\n ({ argumentValues, expectedResult }) => {\n describe.each`\n functionName | description\n ${'someFunction'} | ${'an unscoped'}\n ${'someScope.someFunction'} | ${'a scoped'}\n `('$description custom function', ({ functionName }) => {\n const customFunctions = set({}, functionName, joinWithDots);\n\n test('runs it and returns its result', () => {\n const result = runCustomFunctionCallExpression({\n functionName,\n customFunctions,\n argumentValues,\n transformationParentPath,\n });\n\n expect(result).toStrictEqual(expectedResult);\n });\n });\n },\n );\n\n describe('error handling', () => {\n const argumentValues = times(2, () => aString());\n\n test('throws when the function is not recognized', () => {\n const customFunctions = {};\n\n expect(() =>\n runCustomFunctionCallExpression({\n functionName: 'someNonexistentFunction',\n customFunctions,\n argumentValues,\n transformationParentPath,\n }),\n ).toThrow(`unrecognized custom function \"someNonexistentFunction\"`);\n });\n\n test('throws an error when the function call throws an error', () => {\n const functionName = aString();\n\n const customFunctions = {\n [functionName]: () => {\n throw new Error('Something went wrong in the custom function');\n },\n };\n\n const t = () =>\n runCustomFunctionCallExpression({\n functionName,\n customFunctions,\n argumentValues,\n transformationParentPath,\n });\n\n expect(t).toThrow(Error);\n expect(t).toThrow(\n new RegExp(\n `Transforming ${transformationParentPath} failed, #${functionName} threw: \"Something went wrong in the custom function\" for arguments: .+`,\n ),\n );\n });\n });\n});\n"]}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+
3
+ var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
+
5
+ var _lodash = require("lodash");
6
+
7
+ var _ = require("../../..");
8
+
9
+ const _preset$create = _.preset.create,
10
+ buildRequestTransformation = _preset$create.buildRequestTransformation,
11
+ buildResponseTransformation = _preset$create.buildResponseTransformation;
12
+ describe('create-method transformations', () => {
13
+ describe('buildRequestTransformation', () => {
14
+ test('creates a transformation that maps the first argument into requestMessageEntityPath', () => {
15
+ const requestMessageEntityPath = (0, _motionRuntimeTestContext.aString)();
16
+ const tranformationObject = buildRequestTransformation({
17
+ requestMessageEntityPath
18
+ });
19
+ expect(tranformationObject).toStrictEqual({
20
+ [requestMessageEntityPath]: '$[0]'
21
+ });
22
+ });
23
+ test('supports nested paths', () => {
24
+ // @ts-expect-error
25
+ const entityPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
26
+ const requestMessageEntityPath = entityPathSegments.join('.');
27
+ const tranformationObject = buildRequestTransformation({
28
+ requestMessageEntityPath
29
+ });
30
+ expect(tranformationObject).toStrictEqual({
31
+ [entityPathSegments[0]]: {
32
+ [entityPathSegments[1]]: '$[0]'
33
+ }
34
+ });
35
+ });
36
+ });
37
+ describe('buildResponseTransformation', () => {
38
+ test('unwraps the value of the provided property-path', () => {
39
+ const responseMessageResultPath = (0, _motionRuntimeTestContext.aString)();
40
+ const tranformationString = buildResponseTransformation({
41
+ responseMessageResultPath
42
+ });
43
+ expect(tranformationString).toStrictEqual(`$.${responseMessageResultPath}`);
44
+ });
45
+ });
46
+ });
47
+ //# sourceMappingURL=create-transformation.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/__tests__/transformations/preset/create-transformation.spec.ts"],"names":["preset","create","buildRequestTransformation","buildResponseTransformation","describe","test","requestMessageEntityPath","tranformationObject","expect","toStrictEqual","entityPathSegments","aString","join","responseMessageResultPath","tranformationString"],"mappings":";;AAAA;;AACA;;AACA;;AAEA,uBAEIA,QAFJ,CACEC,MADF;AAAA,MACYC,0BADZ,kBACYA,0BADZ;AAAA,MACwCC,2BADxC,kBACwCA,2BADxC;AAIAC,QAAQ,CAAC,+BAAD,EAAkC,MAAM;AAC9CA,EAAAA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;AAC3CC,IAAAA,IAAI,CAAC,qFAAD,EAAwF,MAAM;AAChG,YAAMC,wBAAwB,GAAG,wCAAjC;AAEA,YAAMC,mBAAmB,GAAGL,0BAA0B,CAAC;AACrDI,QAAAA;AADqD,OAAD,CAAtD;AAIAE,MAAAA,MAAM,CAACD,mBAAD,CAAN,CAA4BE,aAA5B,CAA0C;AACxC,SAACH,wBAAD,GAA4B;AADY,OAA1C;AAGD,KAVG,CAAJ;AAYAD,IAAAA,IAAI,CAAC,uBAAD,EAA0B,MAAM;AAClC;AACA,YAAMK,kBAAkB,GAAG,mBAAM,CAAN,EAASC,iCAAT,CAA3B;AACA,YAAML,wBAAwB,GAAGI,kBAAkB,CAACE,IAAnB,CAAwB,GAAxB,CAAjC;AAEA,YAAML,mBAAmB,GAAGL,0BAA0B,CAAC;AACrDI,QAAAA;AADqD,OAAD,CAAtD;AAIAE,MAAAA,MAAM,CAACD,mBAAD,CAAN,CAA4BE,aAA5B,CAA0C;AACxC,SAACC,kBAAkB,CAAC,CAAD,CAAnB,GAAyB;AAAE,WAACA,kBAAkB,CAAC,CAAD,CAAnB,GAAyB;AAA3B;AADe,OAA1C;AAGD,KAZG,CAAJ;AAaD,GA1BO,CAAR;AA4BAN,EAAAA,QAAQ,CAAC,6BAAD,EAAgC,MAAM;AAC5CC,IAAAA,IAAI,CAAC,iDAAD,EAAoD,MAAM;AAC5D,YAAMQ,yBAAyB,GAAG,wCAAlC;AAEA,YAAMC,mBAAmB,GAAGX,2BAA2B,CAAC;AACtDU,QAAAA;AADsD,OAAD,CAAvD;AAIAL,MAAAA,MAAM,CAACM,mBAAD,CAAN,CAA4BL,aAA5B,CACG,KAAII,yBAA0B,EADjC;AAGD,KAVG,CAAJ;AAWD,GAZO,CAAR;AAaD,CA1CO,CAAR","sourcesContent":["import { aString } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\nimport { preset } from '../../..';\n\nconst {\n create: { buildRequestTransformation, buildResponseTransformation },\n} = preset;\n\ndescribe('create-method transformations', () => {\n describe('buildRequestTransformation', () => {\n test('creates a transformation that maps the first argument into requestMessageEntityPath', () => {\n const requestMessageEntityPath = aString();\n\n const tranformationObject = buildRequestTransformation({\n requestMessageEntityPath,\n });\n\n expect(tranformationObject).toStrictEqual({\n [requestMessageEntityPath]: '$[0]',\n });\n });\n\n test('supports nested paths', () => {\n // @ts-expect-error\n const entityPathSegments = times(2, aString);\n const requestMessageEntityPath = entityPathSegments.join('.');\n\n const tranformationObject = buildRequestTransformation({\n requestMessageEntityPath,\n });\n\n expect(tranformationObject).toStrictEqual({\n [entityPathSegments[0]]: { [entityPathSegments[1]]: '$[0]' },\n });\n });\n });\n\n describe('buildResponseTransformation', () => {\n test('unwraps the value of the provided property-path', () => {\n const responseMessageResultPath = aString();\n\n const tranformationString = buildResponseTransformation({\n responseMessageResultPath,\n });\n\n expect(tranformationString).toStrictEqual(\n `$.${responseMessageResultPath}`,\n );\n });\n });\n});\n"]}
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+
3
+ var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
+
5
+ var _lodash = require("lodash");
6
+
7
+ var _ = require("../../..");
8
+
9
+ const RESPONSE_OBJECT_UNCHANGED = _.transformations.RESPONSE_OBJECT_UNCHANGED;
10
+ const _preset$delete = _.preset.delete,
11
+ buildRequestTransformation = _preset$delete.buildRequestTransformation,
12
+ buildResponseTransformation = _preset$delete.buildResponseTransformation;
13
+ describe('delete-method transformations', () => {
14
+ describe('buildRequestTransformation', () => {
15
+ const requestMessageIdentifierPath = (0, _motionRuntimeTestContext.aString)();
16
+ test('creates a transformation that maps the first argument into requestMessageIdentifierPath', () => {
17
+ const transformationObject = buildRequestTransformation({
18
+ requestMessageIdentifierPath
19
+ });
20
+ expect(transformationObject).toStrictEqual({
21
+ [requestMessageIdentifierPath]: '$[0]'
22
+ });
23
+ });
24
+ test(`creates a transformation that maps the 2nd argument into requestMessageOptionsPath when provided`, () => {
25
+ const requestMessageOptionsPath = (0, _motionRuntimeTestContext.aString)();
26
+ const transformationObject = buildRequestTransformation({
27
+ requestMessageIdentifierPath,
28
+ requestMessageOptionsPath
29
+ });
30
+ expect(transformationObject).toStrictEqual({
31
+ [requestMessageIdentifierPath]: '$[0]',
32
+ [requestMessageOptionsPath]: '$[1]'
33
+ });
34
+ });
35
+ test('supports shared paths for requestMessageIdentifierPath and requestMessageOptionsPath', () => {
36
+ const sharedPath = (0, _motionRuntimeTestContext.aString)();
37
+ const identifierPathSegment = (0, _motionRuntimeTestContext.aString)();
38
+ const transformationObject = buildRequestTransformation({
39
+ requestMessageIdentifierPath: `${sharedPath}.${identifierPathSegment}`,
40
+ requestMessageOptionsPath: sharedPath
41
+ });
42
+ expect(transformationObject).toStrictEqual({
43
+ [sharedPath]: {
44
+ [identifierPathSegment]: '$[0]',
45
+ '*': '$[1]'
46
+ }
47
+ });
48
+ });
49
+ test('supports nested paths', () => {
50
+ // @ts-expect-error
51
+ const idPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString); // @ts-expect-error
52
+
53
+ const optionsPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
54
+ const transformationObject = buildRequestTransformation({
55
+ requestMessageIdentifierPath: idPathSegments.join('.'),
56
+ requestMessageOptionsPath: optionsPathSegments.join('.')
57
+ });
58
+ expect(transformationObject).toStrictEqual({
59
+ [idPathSegments[0]]: {
60
+ [idPathSegments[1]]: '$[0]'
61
+ },
62
+ [optionsPathSegments[0]]: {
63
+ [optionsPathSegments[1]]: '$[1]'
64
+ }
65
+ });
66
+ });
67
+ });
68
+ describe('buildResponseTransformation', () => {
69
+ test('returns the identity transformation', () => {
70
+ const trasformationString = buildResponseTransformation();
71
+ expect(trasformationString).toStrictEqual(RESPONSE_OBJECT_UNCHANGED);
72
+ });
73
+ });
74
+ });
75
+ //# sourceMappingURL=delete-transformation.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/__tests__/transformations/preset/delete-transformation.spec.ts"],"names":["RESPONSE_OBJECT_UNCHANGED","transformations","preset","delete","buildRequestTransformation","buildResponseTransformation","describe","requestMessageIdentifierPath","test","transformationObject","expect","toStrictEqual","requestMessageOptionsPath","sharedPath","identifierPathSegment","idPathSegments","aString","optionsPathSegments","join","trasformationString"],"mappings":";;AAAA;;AACA;;AACA;;AAEA,MAAQA,yBAAR,GAAsCC,iBAAtC,CAAQD,yBAAR;AACA,uBAEIE,QAFJ,CACEC,MADF;AAAA,MACYC,0BADZ,kBACYA,0BADZ;AAAA,MACwCC,2BADxC,kBACwCA,2BADxC;AAIAC,QAAQ,CAAC,+BAAD,EAAkC,MAAM;AAC9CA,EAAAA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;AAC3C,UAAMC,4BAA4B,GAAG,wCAArC;AAEAC,IAAAA,IAAI,CAAC,yFAAD,EAA4F,MAAM;AACpG,YAAMC,oBAAoB,GAAGL,0BAA0B,CAAC;AACtDG,QAAAA;AADsD,OAAD,CAAvD;AAIAG,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;AACzC,SAACJ,4BAAD,GAAgC;AADS,OAA3C;AAGD,KARG,CAAJ;AAUAC,IAAAA,IAAI,CAAE,kGAAF,EAAqG,MAAM;AAC7G,YAAMI,yBAAyB,GAAG,wCAAlC;AACA,YAAMH,oBAAoB,GAAGL,0BAA0B,CAAC;AACtDG,QAAAA,4BADsD;AAEtDK,QAAAA;AAFsD,OAAD,CAAvD;AAKAF,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;AACzC,SAACJ,4BAAD,GAAgC,MADS;AAEzC,SAACK,yBAAD,GAA6B;AAFY,OAA3C;AAID,KAXG,CAAJ;AAaAJ,IAAAA,IAAI,CAAC,sFAAD,EAAyF,MAAM;AACjG,YAAMK,UAAU,GAAG,wCAAnB;AACA,YAAMC,qBAAqB,GAAG,wCAA9B;AACA,YAAML,oBAAoB,GAAGL,0BAA0B,CAAC;AACtDG,QAAAA,4BAA4B,EAAG,GAAEM,UAAW,IAAGC,qBAAsB,EADf;AAEtDF,QAAAA,yBAAyB,EAAEC;AAF2B,OAAD,CAAvD;AAKAH,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;AACzC,SAACE,UAAD,GAAc;AAAE,WAACC,qBAAD,GAAyB,MAA3B;AAAmC,eAAK;AAAxC;AAD2B,OAA3C;AAGD,KAXG,CAAJ;AAaAN,IAAAA,IAAI,CAAC,uBAAD,EAA0B,MAAM;AAClC;AACA,YAAMO,cAAc,GAAG,mBAAM,CAAN,EAASC,iCAAT,CAAvB,CAFkC,CAGlC;;AACA,YAAMC,mBAAmB,GAAG,mBAAM,CAAN,EAASD,iCAAT,CAA5B;AAEA,YAAMP,oBAAoB,GAAGL,0BAA0B,CAAC;AACtDG,QAAAA,4BAA4B,EAAEQ,cAAc,CAACG,IAAf,CAAoB,GAApB,CADwB;AAEtDN,QAAAA,yBAAyB,EAAEK,mBAAmB,CAACC,IAApB,CAAyB,GAAzB;AAF2B,OAAD,CAAvD;AAKAR,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;AACzC,SAACI,cAAc,CAAC,CAAD,CAAf,GAAqB;AAAE,WAACA,cAAc,CAAC,CAAD,CAAf,GAAqB;AAAvB,SADoB;AAEzC,SAACE,mBAAmB,CAAC,CAAD,CAApB,GAA0B;AAAE,WAACA,mBAAmB,CAAC,CAAD,CAApB,GAA0B;AAA5B;AAFe,OAA3C;AAID,KAfG,CAAJ;AAgBD,GAvDO,CAAR;AAyDAX,EAAAA,QAAQ,CAAC,6BAAD,EAAgC,MAAM;AAC5CE,IAAAA,IAAI,CAAC,qCAAD,EAAwC,MAAM;AAChD,YAAMW,mBAAmB,GAAGd,2BAA2B,EAAvD;AAEAK,MAAAA,MAAM,CAACS,mBAAD,CAAN,CAA4BR,aAA5B,CAA0CX,yBAA1C;AACD,KAJG,CAAJ;AAKD,GANO,CAAR;AAOD,CAjEO,CAAR","sourcesContent":["import { aString } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\nimport { transformations, preset } from '../../..';\n\nconst { RESPONSE_OBJECT_UNCHANGED } = transformations;\nconst {\n delete: { buildRequestTransformation, buildResponseTransformation },\n} = preset;\n\ndescribe('delete-method transformations', () => {\n describe('buildRequestTransformation', () => {\n const requestMessageIdentifierPath = aString();\n\n test('creates a transformation that maps the first argument into requestMessageIdentifierPath', () => {\n const transformationObject = buildRequestTransformation({\n requestMessageIdentifierPath,\n });\n\n expect(transformationObject).toStrictEqual({\n [requestMessageIdentifierPath]: '$[0]',\n });\n });\n\n test(`creates a transformation that maps the 2nd argument into requestMessageOptionsPath when provided`, () => {\n const requestMessageOptionsPath = aString();\n const transformationObject = buildRequestTransformation({\n requestMessageIdentifierPath,\n requestMessageOptionsPath,\n });\n\n expect(transformationObject).toStrictEqual({\n [requestMessageIdentifierPath]: '$[0]',\n [requestMessageOptionsPath]: '$[1]',\n });\n });\n\n test('supports shared paths for requestMessageIdentifierPath and requestMessageOptionsPath', () => {\n const sharedPath = aString();\n const identifierPathSegment = aString();\n const transformationObject = buildRequestTransformation({\n requestMessageIdentifierPath: `${sharedPath}.${identifierPathSegment}`,\n requestMessageOptionsPath: sharedPath,\n });\n\n expect(transformationObject).toStrictEqual({\n [sharedPath]: { [identifierPathSegment]: '$[0]', '*': '$[1]' },\n });\n });\n\n test('supports nested paths', () => {\n // @ts-expect-error\n const idPathSegments = times(2, aString);\n // @ts-expect-error\n const optionsPathSegments = times(2, aString);\n\n const transformationObject = buildRequestTransformation({\n requestMessageIdentifierPath: idPathSegments.join('.'),\n requestMessageOptionsPath: optionsPathSegments.join('.'),\n });\n\n expect(transformationObject).toStrictEqual({\n [idPathSegments[0]]: { [idPathSegments[1]]: '$[0]' },\n [optionsPathSegments[0]]: { [optionsPathSegments[1]]: '$[1]' },\n });\n });\n });\n\n describe('buildResponseTransformation', () => {\n test('returns the identity transformation', () => {\n const trasformationString = buildResponseTransformation();\n\n expect(trasformationString).toStrictEqual(RESPONSE_OBJECT_UNCHANGED);\n });\n });\n});\n"]}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+
3
+ var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
+
5
+ var _lodash = require("lodash");
6
+
7
+ var _ = require("../../..");
8
+
9
+ const _preset$get = _.preset.get,
10
+ buildRequestTransformation = _preset$get.buildRequestTransformation,
11
+ buildResponseTransformation = _preset$get.buildResponseTransformation;
12
+ describe('get-method transformations', () => {
13
+ describe('buildRequestTransformation', () => {
14
+ const requestMessageIdentifierPath = (0, _motionRuntimeTestContext.aString)();
15
+ test('creates a transformation that maps the first argument into requestMessageIdentifierPath', () => {
16
+ const transformationObject = buildRequestTransformation({
17
+ requestMessageIdentifierPath
18
+ });
19
+ expect(transformationObject).toStrictEqual({
20
+ [requestMessageIdentifierPath]: '$[0]'
21
+ });
22
+ });
23
+ test('supports a nested path', () => {
24
+ // @ts-expect-errora
25
+ const idPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
26
+ const transformationObject = buildRequestTransformation({
27
+ requestMessageIdentifierPath: idPathSegments.join('.')
28
+ });
29
+ expect(transformationObject).toStrictEqual({
30
+ [idPathSegments[0]]: {
31
+ [idPathSegments[1]]: '$[0]'
32
+ }
33
+ });
34
+ });
35
+ });
36
+ describe('buildResponseTransformation', () => {
37
+ test('unwraps the value of the provided property-path', () => {
38
+ const responseMessageResultPath = (0, _motionRuntimeTestContext.aString)();
39
+ const transformationString = buildResponseTransformation({
40
+ responseMessageResultPath
41
+ });
42
+ expect(transformationString).toStrictEqual(`$.${responseMessageResultPath}`);
43
+ });
44
+ });
45
+ });
46
+ //# sourceMappingURL=get-transformation.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/__tests__/transformations/preset/get-transformation.spec.ts"],"names":["preset","get","buildRequestTransformation","buildResponseTransformation","describe","requestMessageIdentifierPath","test","transformationObject","expect","toStrictEqual","idPathSegments","aString","join","responseMessageResultPath","transformationString"],"mappings":";;AAAA;;AACA;;AACA;;AAEA,oBAEIA,QAFJ,CACEC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AR","sourcesContent":["import { aString } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\nimport { preset } from '../../..';\n\nconst {\n get: { buildRequestTransformation, buildResponseTransformation },\n} = preset;\n\ndescribe('get-method transformations', () => {\n describe('buildRequestTransformation', () => {\n const requestMessageIdentifierPath = aString();\n\n test('creates a transformation that maps the first argument into requestMessageIdentifierPath', () => {\n const transformationObject = buildRequestTransformation({\n requestMessageIdentifierPath,\n });\n\n expect(transformationObject).toStrictEqual({\n [requestMessageIdentifierPath]: '$[0]',\n });\n });\n\n test('supports a nested path', () => {\n // @ts-expect-errora\n const idPathSegments = times(2, aString);\n\n const transformationObject = buildRequestTransformation({\n requestMessageIdentifierPath: idPathSegments.join('.'),\n });\n\n expect(transformationObject).toStrictEqual({\n [idPathSegments[0]]: { [idPathSegments[1]]: '$[0]' },\n });\n });\n });\n\n describe('buildResponseTransformation', () => {\n test('unwraps the value of the provided property-path', () => {\n const responseMessageResultPath = aString();\n\n const transformationString = buildResponseTransformation({\n responseMessageResultPath,\n });\n\n expect(transformationString).toStrictEqual(\n `$.${responseMessageResultPath}`,\n );\n });\n });\n});\n"]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
+
5
+ var _ = require("../../..");
6
+
7
+ const _preset$list = _.preset.list,
8
+ buildRequestTransformation = _preset$list.buildRequestTransformation,
9
+ buildResponseTransformation = _preset$list.buildResponseTransformation;
10
+ describe('list-method transformations', () => {
11
+ describe('buildRequestTransformation', () => {
12
+ // eslint-disable-next-line max-len
13
+ test('returns the passthrough request transformation', () => {
14
+ const transformationString = buildRequestTransformation();
15
+ expect(transformationString).toStrictEqual('$[0]');
16
+ });
17
+ });
18
+ describe('buildResponseTransformation', () => {
19
+ test('unwraps the value of the provided property-path', () => {
20
+ const responseMessageResultPath = (0, _motionRuntimeTestContext.aString)();
21
+ const transformationString = buildResponseTransformation({
22
+ responseMessageResultPath
23
+ });
24
+ expect(transformationString).toStrictEqual(`$.${responseMessageResultPath}`);
25
+ });
26
+ });
27
+ });
28
+ //# sourceMappingURL=list-transformation.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/__tests__/transformations/preset/list-transformation.spec.ts"],"names":["preset","list","buildRequestTransformation","buildResponseTransformation","describe","test","transformationString","expect","toStrictEqual","responseMessageResultPath"],"mappings":";;AAAA;;AACA;;AAEA,qBAEIA,QAFJ,CACEC,IADF;AAAA,MACUC,0BADV,gBACUA,0BADV;AAAA,MACsCC,2BADtC,gBACsCA,2BADtC;AAIAC,QAAQ,CAAC,6BAAD,EAAgC,MAAM;AAC5CA,EAAAA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;AAC3C;AACAC,IAAAA,IAAI,CAAC,gDAAD,EAAmD,MAAM;AAC3D,YAAMC,oBAAoB,GAAGJ,0BAA0B,EAAvD;AAEAK,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C,MAA3C;AACD,KAJG,CAAJ;AAKD,GAPO,CAAR;AASAJ,EAAAA,QAAQ,CAAC,6BAAD,EAAgC,MAAM;AAC5CC,IAAAA,IAAI,CAAC,iDAAD,EAAoD,MAAM;AAC5D,YAAMI,yBAAyB,GAAG,wCAAlC;AAEA,YAAMH,oBAAoB,GAAGH,2BAA2B,CAAC;AACvDM,QAAAA;AADuD,OAAD,CAAxD;AAIAF,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CACG,KAAIC,yBAA0B,EADjC;AAGD,KAVG,CAAJ;AAWD,GAZO,CAAR;AAaD,CAvBO,CAAR","sourcesContent":["import { aString } from '@wix/motion-runtime-test-context';\nimport { preset } from '../../..';\n\nconst {\n list: { buildRequestTransformation, buildResponseTransformation },\n} = preset;\n\ndescribe('list-method transformations', () => {\n describe('buildRequestTransformation', () => {\n // eslint-disable-next-line max-len\n test('returns the passthrough request transformation', () => {\n const transformationString = buildRequestTransformation();\n\n expect(transformationString).toStrictEqual('$[0]');\n });\n });\n\n describe('buildResponseTransformation', () => {\n test('unwraps the value of the provided property-path', () => {\n const responseMessageResultPath = aString();\n\n const transformationString = buildResponseTransformation({\n responseMessageResultPath,\n });\n\n expect(transformationString).toStrictEqual(\n `$.${responseMessageResultPath}`,\n );\n });\n });\n});\n"]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
+
5
+ var _lodash = require("lodash");
6
+
7
+ var _ = require("../../..");
8
+
9
+ const _preset$query = _.preset.query,
10
+ buildRequestTransformation = _preset$query.buildRequestTransformation,
11
+ buildResponseTransformation = _preset$query.buildResponseTransformation;
12
+ describe('query-method transformations', () => {
13
+ describe('buildRequestTransformation', () => {
14
+ // eslint-disable-next-line max-len
15
+ test('sets the query object as a property named via requestQueryObjectPropertyName, and spreads the 2nd argument', () => {
16
+ const requestQueryObjectPropertyName = (0, _motionRuntimeTestContext.aString)();
17
+ const transformationString = buildRequestTransformation({
18
+ requestQueryObjectPropertyName
19
+ });
20
+ expect(transformationString).toStrictEqual({
21
+ [requestQueryObjectPropertyName]: '$[0]',
22
+ '*': '$[1]'
23
+ });
24
+ }); // eslint-disable-next-line max-len
25
+
26
+ test("sets the given query tree under the 'query' property as a default, with the second argument spread into the payload", () => {
27
+ const transformationString = buildRequestTransformation();
28
+ expect(transformationString).toStrictEqual({
29
+ query: '$[0]',
30
+ '*': '$[1]'
31
+ });
32
+ });
33
+ });
34
+ describe('buildResponseTransformation', () => {
35
+ const _times = (0, _lodash.times)(2, () => (0, _motionRuntimeTestContext.aString)()),
36
+ responseMessageResultPath = _times[0],
37
+ responseMessagePagingMetadataPath = _times[1];
38
+
39
+ test('unwraps the value of the provided property-path', () => {
40
+ const transformationObject = buildResponseTransformation({
41
+ responseMessageResultPath,
42
+ responseMessagePagingMetadataPath
43
+ });
44
+ expect(transformationObject).toStrictEqual({
45
+ items: `$.${responseMessageResultPath}`,
46
+ pagingMetadata: `$.${responseMessagePagingMetadataPath}`
47
+ });
48
+ });
49
+ test('adds an item-transformation when provided', () => {
50
+ const itemTransformation = `$.some.path.${(0, _motionRuntimeTestContext.aString)()}`;
51
+ const transformationObject = buildResponseTransformation({
52
+ responseMessageResultPath,
53
+ responseMessagePagingMetadataPath,
54
+ itemTransformation
55
+ });
56
+ expect(transformationObject).toStrictEqual({
57
+ items: {
58
+ '@path': `$.${responseMessageResultPath}`,
59
+ '@itemTransformation': itemTransformation
60
+ },
61
+ pagingMetadata: `$.${responseMessagePagingMetadataPath}`
62
+ });
63
+ });
64
+ });
65
+ });
66
+ //# sourceMappingURL=query-transformation.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/__tests__/transformations/preset/query-transformation.spec.ts"],"names":["preset","query","buildRequestTransformation","buildResponseTransformation","describe","test","requestQueryObjectPropertyName","transformationString","expect","toStrictEqual","responseMessageResultPath","responseMessagePagingMetadataPath","transformationObject","items","pagingMetadata","itemTransformation"],"mappings":";;AAAA;;AACA;;AACA;;AAEA,sBAEIA,QAFJ,CACEC,KADF;AAAA,MACWC,0BADX,iBACWA,0BADX;AAAA,MACuCC,2BADvC,iBACuCA,2BADvC;AAIAC,QAAQ,CAAC,8BAAD,EAAiC,MAAM;AAC7CA,EAAAA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;AAC3C;AACAC,IAAAA,IAAI,CAAC,4GAAD,EAA+G,MAAM;AACvH,YAAMC,8BAA8B,GAAG,wCAAvC;AACA,YAAMC,oBAAoB,GAAGL,0BAA0B,CAAC;AACtDI,QAAAA;AADsD,OAAD,CAAvD;AAIAE,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;AACzC,SAACH,8BAAD,GAAkC,MADO;AAEzC,aAAK;AAFoC,OAA3C;AAID,KAVG,CAAJ,CAF2C,CAc3C;;AACAD,IAAAA,IAAI,CAAC,qHAAD,EAAwH,MAAM;AAChI,YAAME,oBAAoB,GAAGL,0BAA0B,EAAvD;AAEAM,MAAAA,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;AACzCR,QAAAA,KAAK,EAAE,MADkC;AAEzC,aAAK;AAFoC,OAA3C;AAID,KAPG,CAAJ;AAQD,GAvBO,CAAR;AAyBAG,EAAAA,QAAQ,CAAC,6BAAD,EAAgC,MAAM;AAC5C,mBACE,mBAAM,CAAN,EAAS,MAAM,wCAAf,CADF;AAAA,UAAOM,yBAAP;AAAA,UAAkCC,iCAAlC;;AAGAN,IAAAA,IAAI,CAAC,iDAAD,EAAoD,MAAM;AAC5D,YAAMO,oBAAoB,GAAGT,2BAA2B,CAAC;AACvDO,QAAAA,yBADuD;AAEvDC,QAAAA;AAFuD,OAAD,CAAxD;AAKAH,MAAAA,MAAM,CAACI,oBAAD,CAAN,CAA6BH,aAA7B,CAA2C;AACzCI,QAAAA,KAAK,EAAG,KAAIH,yBAA0B,EADG;AAEzCI,QAAAA,cAAc,EAAG,KAAIH,iCAAkC;AAFd,OAA3C;AAID,KAVG,CAAJ;AAYAN,IAAAA,IAAI,CAAC,2CAAD,EAA8C,MAAM;AACtD,YAAMU,kBAAkB,GAAI,eAAc,wCAAU,EAApD;AACA,YAAMH,oBAAoB,GAAGT,2BAA2B,CAAC;AACvDO,QAAAA,yBADuD;AAEvDC,QAAAA,iCAFuD;AAGvDI,QAAAA;AAHuD,OAAD,CAAxD;AAMAP,MAAAA,MAAM,CAACI,oBAAD,CAAN,CAA6BH,aAA7B,CAA2C;AACzCI,QAAAA,KAAK,EAAE;AACL,mBAAU,KAAIH,yBAA0B,EADnC;AAEL,iCAAuBK;AAFlB,SADkC;AAKzCD,QAAAA,cAAc,EAAG,KAAIH,iCAAkC;AALd,OAA3C;AAOD,KAfG,CAAJ;AAgBD,GAhCO,CAAR;AAiCD,CA3DO,CAAR","sourcesContent":["import { aString } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\nimport { preset } from '../../..';\n\nconst {\n query: { buildRequestTransformation, buildResponseTransformation },\n} = preset;\n\ndescribe('query-method transformations', () => {\n describe('buildRequestTransformation', () => {\n // eslint-disable-next-line max-len\n test('sets the query object as a property named via requestQueryObjectPropertyName, and spreads the 2nd argument', () => {\n const requestQueryObjectPropertyName = aString();\n const transformationString = buildRequestTransformation({\n requestQueryObjectPropertyName,\n });\n\n expect(transformationString).toStrictEqual({\n [requestQueryObjectPropertyName]: '$[0]',\n '*': '$[1]',\n });\n });\n\n // eslint-disable-next-line max-len\n test(\"sets the given query tree under the 'query' property as a default, with the second argument spread into the payload\", () => {\n const transformationString = buildRequestTransformation();\n\n expect(transformationString).toStrictEqual({\n query: '$[0]',\n '*': '$[1]',\n });\n });\n });\n\n describe('buildResponseTransformation', () => {\n const [responseMessageResultPath, responseMessagePagingMetadataPath] =\n times(2, () => aString());\n\n test('unwraps the value of the provided property-path', () => {\n const transformationObject = buildResponseTransformation({\n responseMessageResultPath,\n responseMessagePagingMetadataPath,\n });\n\n expect(transformationObject).toStrictEqual({\n items: `$.${responseMessageResultPath}`,\n pagingMetadata: `$.${responseMessagePagingMetadataPath}`,\n });\n });\n\n test('adds an item-transformation when provided', () => {\n const itemTransformation = `$.some.path.${aString()}`;\n const transformationObject = buildResponseTransformation({\n responseMessageResultPath,\n responseMessagePagingMetadataPath,\n itemTransformation,\n });\n\n expect(transformationObject).toStrictEqual({\n items: {\n '@path': `$.${responseMessageResultPath}`,\n '@itemTransformation': itemTransformation,\n },\n pagingMetadata: `$.${responseMessagePagingMetadataPath}`,\n });\n });\n });\n});\n"]}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
+
5
+ var _lodash = require("lodash");
6
+
7
+ var _ = require("../../..");
8
+
9
+ const _preset$update = _.preset.update,
10
+ buildRequestTransformation = _preset$update.buildRequestTransformation,
11
+ buildResponseTransformation = _preset$update.buildResponseTransformation;
12
+ describe('update-method transformations', () => {
13
+ describe('buildRequestTransformation', () => {
14
+ const requestMessageOptionsPath = (0, _motionRuntimeTestContext.aString)();
15
+ const requestMessageEntityPath = (0, _motionRuntimeTestContext.aString)();
16
+ const requestMessageEntityIdentifierField = (0, _motionRuntimeTestContext.aString)();
17
+ test('creates a transformation mapping args into requestMessageIdentifierPath and requestMessageEntityPath', () => {
18
+ const transformedObject = buildRequestTransformation({
19
+ requestMessageEntityIdentifierField,
20
+ requestMessageEntityPath
21
+ });
22
+ expect(transformedObject).toStrictEqual({
23
+ [requestMessageEntityPath]: {
24
+ [requestMessageEntityIdentifierField]: '$[0]',
25
+ '*': '$[1]'
26
+ }
27
+ });
28
+ });
29
+ test(`creates a transformation that maps the 3rd argument into requestMessageOptionsPath when provided`, () => {
30
+ const transformedObject = buildRequestTransformation({
31
+ requestMessageEntityIdentifierField,
32
+ requestMessageEntityPath,
33
+ requestMessageOptionsPath
34
+ });
35
+ expect(transformedObject).toStrictEqual({
36
+ [requestMessageEntityPath]: {
37
+ [requestMessageEntityIdentifierField]: '$[0]',
38
+ '*': '$[1]'
39
+ },
40
+ [requestMessageOptionsPath]: '$[2]'
41
+ });
42
+ });
43
+ test('supports nested paths for requestMessageEntityPath and requestMessageOptionsPath', () => {
44
+ // @ts-expect-error
45
+ const requestMessageEntityPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString); // @ts-expect-error
46
+
47
+ const optionsPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
48
+ const transformationObject = buildRequestTransformation({
49
+ requestMessageEntityIdentifierField,
50
+ requestMessageEntityPath: requestMessageEntityPathSegments.join('.'),
51
+ requestMessageOptionsPath: optionsPathSegments.join('.')
52
+ });
53
+ expect(transformationObject).toStrictEqual({
54
+ [requestMessageEntityPathSegments[0]]: {
55
+ [requestMessageEntityPathSegments[1]]: {
56
+ [requestMessageEntityIdentifierField]: '$[0]',
57
+ '*': '$[1]'
58
+ }
59
+ },
60
+ [optionsPathSegments[0]]: {
61
+ [optionsPathSegments[1]]: '$[2]'
62
+ }
63
+ });
64
+ });
65
+ test('supports shared paths for requestMessageEntityPath and requestMessageOptionsPath', () => {
66
+ const sharedPath = (0, _motionRuntimeTestContext.aString)();
67
+ const transformationObject = buildRequestTransformation({
68
+ requestMessageEntityIdentifierField,
69
+ requestMessageEntityPath: sharedPath,
70
+ requestMessageOptionsPath: sharedPath
71
+ });
72
+ expect(transformationObject).toStrictEqual({
73
+ [sharedPath]: {
74
+ [requestMessageEntityIdentifierField]: '$[0]',
75
+ '*': ['$[1]', '$[2]']
76
+ }
77
+ });
78
+ });
79
+ });
80
+ describe('buildResponseTransformation', () => {
81
+ test('unwraps the value of the provided property-path', () => {
82
+ const responseMessageResultPath = (0, _motionRuntimeTestContext.aString)();
83
+ const transformationString = buildResponseTransformation({
84
+ responseMessageResultPath
85
+ });
86
+ expect(transformationString).toStrictEqual(`$.${responseMessageResultPath}`);
87
+ });
88
+ });
89
+ });
90
+ //# sourceMappingURL=update-transformation.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../src/__tests__/transformations/preset/update-transformation.spec.ts"],"names":["preset","update","buildRequestTransformation","buildResponseTransformation","describe","requestMessageOptionsPath","requestMessageEntityPath","requestMessageEntityIdentifierField","test","transformedObject","expect","toStrictEqual","requestMessageEntityPathSegments","aString","optionsPathSegments","transformationObject","join","sharedPath","responseMessageResultPath","transformationString"],"mappings":";;AAAA;;AACA;;AACA;;AAEA,uBAEIA,QAFJ,CACEC,MADF;AAAA,MACYC,0BADZ,kBACYA,0BADZ;AAAA,MACwCC,2BADxC,kBACwCA,2BADxC;AAIAC,QAAQ,CAAC,+BAAD,EAAkC,MAAM;AAC9CA,EAAAA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;AAC3C,UAAMC,yBAAyB,GAAG,wCAAlC;AACA,UAAMC,wBAAwB,GAAG,wCAAjC;AACA,UAAMC,mCAAmC,GAAG,wCAA5C;AAEAC,IAAAA,IAAI,CAAC,sGAAD,EAAyG,MAAM;AACjH,YAAMC,iBAAiB,GA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AErC,iBAAK;AAFgC;AADF,SADE;AAOzC,SAACO,mBAAmB,CAAC,CAAD,CAApB,GAA0B;AAAE,WAACA,mBAAmB,CAAC,CAAD,CAApB,GAA0B;AAA5B;AAPe,OAA3C;AASD,KArBG,CAAJ;AAuBAN,IAAAA,IAAI,CAAC,kFAAD,EAAqF,MAAM;AAC7F,YAAMS,UAAU,GAAG,wCAAnB;AAEA,YAAMF,oBAAoB,GAAGb,0BAA0B,CAAC;AACtDK,QAAAA,mCADsD;AAEtDD,QAAAA,wBAAwB,EAAEW,UAF4B;AAGtDZ,QAAAA,yBAAyB,EAAEY;AAH2B,OAAD,CAAvD;AAMAP,MAAAA,MAAM,CAACK,oBAAD,CAAN,CAA6BJ,aAA7B,CAA2C;AACzC,SAACM,UAAD,GAAc;AACZ,WAACV,mCAAD,GAAuC,MAD3B;AAEZ,eAAK,CAAC,MAAD,EAAS,MAAT;AAFO;AAD2B,OAA3C;AAMD,KAfG,CAAJ;AAgBD,GA1EO,CAAR;AA4EAH,EAAAA,QAAQ,CAAC,6BAAD,EAAgC,MAAM;AAC5CI,IAAAA,IAAI,CAAC,iDAAD,EAAoD,MAAM;AAC5D,YAAMU,yBAAyB,GAAG,wCAAlC;AAEA,YAAMC,oBAAoB,GAAGhB,2BAA2B,CAAC;AACvDe,QAAAA;AADuD,OAAD,CAAxD;AAIAR,MAAAA,MAAM,CAACS,oBAAD,CAAN,CAA6BR,aAA7B,CACG,KAAIO,yBAA0B,EADjC;AAGD,KAVG,CAAJ;AAWD,GAZO,CAAR;AAaD,CA1FO,CAAR","sourcesContent":["import { aString } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\nimport { preset } from '../../..';\n\nconst {\n update: { buildRequestTransformation, buildResponseTransformation },\n} = preset;\n\ndescribe('update-method transformations', () => {\n describe('buildRequestTransformation', () => {\n const requestMessageOptionsPath = aString();\n const requestMessageEntityPath = aString();\n const requestMessageEntityIdentifierField = aString();\n\n test('creates a transformation mapping args into requestMessageIdentifierPath and requestMessageEntityPath', () => {\n const transformedObject = buildRequestTransformation({\n requestMessageEntityIdentifierField,\n requestMessageEntityPath,\n });\n\n expect(transformedObject).toStrictEqual({\n [requestMessageEntityPath]: {\n [requestMessageEntityIdentifierField]: '$[0]',\n '*': '$[1]',\n },\n });\n });\n\n test(`creates a transformation that maps the 3rd argument into requestMessageOptionsPath when provided`, () => {\n const transformedObject = buildRequestTransformation({\n requestMessageEntityIdentifierField,\n requestMessageEntityPath,\n requestMessageOptionsPath,\n });\n\n expect(transformedObject).toStrictEqual({\n [requestMessageEntityPath]: {\n [requestMessageEntityIdentifierField]: '$[0]',\n '*': '$[1]',\n },\n [requestMessageOptionsPath]: '$[2]',\n });\n });\n\n test('supports nested paths for requestMessageEntityPath and requestMessageOptionsPath', () => {\n // @ts-expect-error\n const requestMessageEntityPathSegments = times(2, aString);\n // @ts-expect-error\n const optionsPathSegments = times(2, aString);\n\n const transformationObject = buildRequestTransformation({\n requestMessageEntityIdentifierField,\n requestMessageEntityPath: requestMessageEntityPathSegments.join('.'),\n requestMessageOptionsPath: optionsPathSegments.join('.'),\n });\n\n expect(transformationObject).toStrictEqual({\n [requestMessageEntityPathSegments[0]]: {\n [requestMessageEntityPathSegments[1]]: {\n [requestMessageEntityIdentifierField]: '$[0]',\n '*': '$[1]',\n },\n },\n [optionsPathSegments[0]]: { [optionsPathSegments[1]]: '$[2]' },\n });\n });\n\n test('supports shared paths for requestMessageEntityPath and requestMessageOptionsPath', () => {\n const sharedPath = aString();\n\n const transformationObject = buildRequestTransformation({\n requestMessageEntityIdentifierField,\n requestMessageEntityPath: sharedPath,\n requestMessageOptionsPath: sharedPath,\n });\n\n expect(transformationObject).toStrictEqual({\n [sharedPath]: {\n [requestMessageEntityIdentifierField]: '$[0]',\n '*': ['$[1]', '$[2]'],\n },\n });\n });\n });\n\n describe('buildResponseTransformation', () => {\n test('unwraps the value of the provided property-path', () => {\n const responseMessageResultPath = aString();\n\n const transformationString = buildResponseTransformation({\n responseMessageResultPath,\n });\n\n expect(transformationString).toStrictEqual(\n `$.${responseMessageResultPath}`,\n );\n });\n });\n});\n"]}