@wix/motion-edm-autogen-transformations-core 1.17.0 → 1.18.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 (61) hide show
  1. package/dist/cjs/__tests__/corvid-entity.spec.js +1 -4
  2. package/dist/cjs/__tests__/corvid-entity.spec.js.map +1 -1
  3. package/dist/cjs/__tests__/getArgumentCardinality.spec.js +6 -5
  4. package/dist/cjs/__tests__/getArgumentCardinality.spec.js.map +1 -1
  5. package/dist/cjs/__tests__/helpers.spec.js +2 -6
  6. package/dist/cjs/__tests__/helpers.spec.js.map +1 -1
  7. package/dist/cjs/__tests__/reduceTransformation.spec.js +10 -11
  8. package/dist/cjs/__tests__/reduceTransformation.spec.js.map +1 -1
  9. package/dist/cjs/__tests__/transformations/custom-functions.spec.js +1 -10
  10. package/dist/cjs/__tests__/transformations/custom-functions.spec.js.map +1 -1
  11. package/dist/cjs/__tests__/transformations/preset/create-transformation.spec.js +2 -5
  12. package/dist/cjs/__tests__/transformations/preset/create-transformation.spec.js.map +1 -1
  13. package/dist/cjs/__tests__/transformations/preset/delete-transformation.spec.js +4 -7
  14. package/dist/cjs/__tests__/transformations/preset/delete-transformation.spec.js.map +1 -1
  15. package/dist/cjs/__tests__/transformations/preset/get-transformation.spec.js +2 -5
  16. package/dist/cjs/__tests__/transformations/preset/get-transformation.spec.js.map +1 -1
  17. package/dist/cjs/__tests__/transformations/preset/list-transformation.spec.js +2 -4
  18. package/dist/cjs/__tests__/transformations/preset/list-transformation.spec.js.map +1 -1
  19. package/dist/cjs/__tests__/transformations/preset/query-transformation.spec.js +6 -9
  20. package/dist/cjs/__tests__/transformations/preset/query-transformation.spec.js.map +1 -1
  21. package/dist/cjs/__tests__/transformations/preset/update-transformation.spec.js +4 -7
  22. package/dist/cjs/__tests__/transformations/preset/update-transformation.spec.js.map +1 -1
  23. package/dist/cjs/__tests__/validations/validateRequestTransformation.spec.js +5 -11
  24. package/dist/cjs/__tests__/validations/validateRequestTransformation.spec.js.map +1 -1
  25. package/dist/cjs/__tests__/validations/validateResponseTransformation.spec.js +1 -9
  26. package/dist/cjs/__tests__/validations/validateResponseTransformation.spec.js.map +1 -1
  27. package/dist/cjs/index.js +7 -27
  28. package/dist/cjs/index.js.map +1 -1
  29. package/dist/cjs/lib/corvid-entity/index.js +0 -10
  30. package/dist/cjs/lib/corvid-entity/index.js.map +1 -1
  31. package/dist/cjs/lib/getArgumentCardinality.js +0 -9
  32. package/dist/cjs/lib/getArgumentCardinality.js.map +1 -1
  33. package/dist/cjs/lib/helpers.js +8 -48
  34. package/dist/cjs/lib/helpers.js.map +1 -1
  35. package/dist/cjs/lib/transformations/common.js +0 -3
  36. package/dist/cjs/lib/transformations/common.js.map +1 -1
  37. package/dist/cjs/lib/transformations/constants.js.map +1 -1
  38. package/dist/cjs/lib/transformations/custom-functions.js +0 -10
  39. package/dist/cjs/lib/transformations/custom-functions.js.map +1 -1
  40. package/dist/cjs/lib/transformations/preset/create.js +0 -5
  41. package/dist/cjs/lib/transformations/preset/create.js.map +1 -1
  42. package/dist/cjs/lib/transformations/preset/delete.js +0 -12
  43. package/dist/cjs/lib/transformations/preset/delete.js.map +1 -1
  44. package/dist/cjs/lib/transformations/preset/get.js +0 -5
  45. package/dist/cjs/lib/transformations/preset/get.js.map +1 -1
  46. package/dist/cjs/lib/transformations/preset/list.js +0 -4
  47. package/dist/cjs/lib/transformations/preset/list.js.map +1 -1
  48. package/dist/cjs/lib/transformations/preset/query.js +1 -8
  49. package/dist/cjs/lib/transformations/preset/query.js.map +1 -1
  50. package/dist/cjs/lib/transformations/preset/update.js +0 -9
  51. package/dist/cjs/lib/transformations/preset/update.js.map +1 -1
  52. package/dist/cjs/lib/transformations/reduceTransformation.js +28 -64
  53. package/dist/cjs/lib/transformations/reduceTransformation.js.map +1 -1
  54. package/dist/cjs/lib/transformations/validations/common.js +3 -13
  55. package/dist/cjs/lib/transformations/validations/common.js.map +1 -1
  56. package/dist/cjs/lib/transformations/validations/validateRequestTransformation.js +2 -23
  57. package/dist/cjs/lib/transformations/validations/validateRequestTransformation.js.map +1 -1
  58. package/dist/cjs/lib/transformations/validations/validateResponseTransformation.js +10 -36
  59. package/dist/cjs/lib/transformations/validations/validateResponseTransformation.js.map +1 -1
  60. package/dist/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +3 -3
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
-
5
4
  var _lodash = require("lodash");
6
-
7
5
  var _ = require("../../..");
8
-
9
6
  const RESPONSE_OBJECT_UNCHANGED = _.transformations.RESPONSE_OBJECT_UNCHANGED;
10
7
  const _preset$delete = _.preset.delete,
11
- buildRequestTransformation = _preset$delete.buildRequestTransformation,
12
- buildResponseTransformation = _preset$delete.buildResponseTransformation;
8
+ buildRequestTransformation = _preset$delete.buildRequestTransformation,
9
+ buildResponseTransformation = _preset$delete.buildResponseTransformation;
13
10
  describe('delete-method transformations', () => {
14
11
  describe('buildRequestTransformation', () => {
15
12
  const requestMessageIdentifierPath = (0, _motionRuntimeTestContext.aString)();
@@ -48,8 +45,8 @@ describe('delete-method transformations', () => {
48
45
  });
49
46
  test('supports nested paths', () => {
50
47
  // @ts-expect-error
51
- const idPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString); // @ts-expect-error
52
-
48
+ const idPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
49
+ // @ts-expect-error
53
50
  const optionsPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
54
51
  const transformationObject = buildRequestTransformation({
55
52
  requestMessageIdentifierPath: idPathSegments.join('.'),
@@ -1 +1 @@
1
- {"version":3,"names":["RESPONSE_OBJECT_UNCHANGED","transformations","preset","delete","buildRequestTransformation","buildResponseTransformation","describe","requestMessageIdentifierPath","aString","test","transformationObject","expect","toStrictEqual","requestMessageOptionsPath","sharedPath","identifierPathSegment","idPathSegments","times","optionsPathSegments","join","trasformationString"],"sources":["../../../../../src/__tests__/transformations/preset/delete-transformation.spec.ts"],"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"],"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;EAC9CA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;IAC3C,MAAMC,4BAA4B,GAAG,IAAAC,iCAAA,GAArC;IAEAC,IAAI,CAAC,yFAAD,EAA4F,MAAM;MACpG,MAAMC,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG;MADsD,CAAD,CAAvD;MAIAI,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzC,CAACL,4BAAD,GAAgC;MADS,CAA3C;IAGD,CARG,CAAJ;IAUAE,IAAI,CAAE,kGAAF,EAAqG,MAAM;MAC7G,MAAMI,yBAAyB,GAAG,IAAAL,iCAAA,GAAlC;MACA,MAAME,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG,4BADsD;QAEtDM;MAFsD,CAAD,CAAvD;MAKAF,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzC,CAACL,4BAAD,GAAgC,MADS;QAEzC,CAACM,yBAAD,GAA6B;MAFY,CAA3C;IAID,CAXG,CAAJ;IAaAJ,IAAI,CAAC,sFAAD,EAAyF,MAAM;MACjG,MAAMK,UAAU,GAAG,IAAAN,iCAAA,GAAnB;MACA,MAAMO,qBAAqB,GAAG,IAAAP,iCAAA,GAA9B;MACA,MAAME,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG,4BAA4B,EAAG,GAAEO,UAAW,IAAGC,qBAAsB,EADf;QAEtDF,yBAAyB,EAAEC;MAF2B,CAAD,CAAvD;MAKAH,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzC,CAACE,UAAD,GAAc;UAAE,CAACC,qBAAD,GAAyB,MAA3B;UAAmC,KAAK;QAAxC;MAD2B,CAA3C;IAGD,CAXG,CAAJ;IAaAN,IAAI,CAAC,uBAAD,EAA0B,MAAM;MAClC;MACA,MAAMO,cAAc,GAAG,IAAAC,aAAA,EAAM,CAAN,EAAST,iCAAT,CAAvB,CAFkC,CAGlC;;MACA,MAAMU,mBAAmB,GAAG,IAAAD,aAAA,EAAM,CAAN,EAAST,iCAAT,CAA5B;MAEA,MAAME,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG,4BAA4B,EAAES,cAAc,CAACG,IAAf,CAAoB,GAApB,CADwB;QAEtDN,yBAAyB,EAAEK,mBAAmB,CAACC,IAApB,CAAyB,GAAzB;MAF2B,CAAD,CAAvD;MAKAR,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzC,CAACI,cAAc,CAAC,CAAD,CAAf,GAAqB;UAAE,CAACA,cAAc,CAAC,CAAD,CAAf,GAAqB;QAAvB,CADoB;QAEzC,CAACE,mBAAmB,CAAC,CAAD,CAApB,GAA0B;UAAE,CAACA,mBAAmB,CAAC,CAAD,CAApB,GAA0B;QAA5B;MAFe,CAA3C;IAID,CAfG,CAAJ;EAgBD,CAvDO,CAAR;EAyDAZ,QAAQ,CAAC,6BAAD,EAAgC,MAAM;IAC5CG,IAAI,CAAC,qCAAD,EAAwC,MAAM;MAChD,MAAMW,mBAAmB,GAAGf,2BAA2B,EAAvD;MAEAM,MAAM,CAACS,mBAAD,CAAN,CAA4BR,aAA5B,CAA0CZ,yBAA1C;IACD,CAJG,CAAJ;EAKD,CANO,CAAR;AAOD,CAjEO,CAAR"}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","RESPONSE_OBJECT_UNCHANGED","transformations","_preset$delete","preset","delete","buildRequestTransformation","buildResponseTransformation","describe","requestMessageIdentifierPath","aString","test","transformationObject","expect","toStrictEqual","requestMessageOptionsPath","sharedPath","identifierPathSegment","idPathSegments","times","optionsPathSegments","join","trasformationString"],"sources":["../../../../../src/__tests__/transformations/preset/delete-transformation.spec.ts"],"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"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAQG,yBAAyB,GAAKC,iBAAe,CAA7CD,yBAAyB;AACjC,MAAAE,cAAA,GAEIC,QAAM,CADRC,MAAM;EAAIC,0BAA0B,GAAAH,cAAA,CAA1BG,0BAA0B;EAAEC,2BAA2B,GAAAJ,cAAA,CAA3BI,2BAA2B;AAGnEC,QAAQ,CAAC,+BAA+B,EAAE,MAAM;EAC9CA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IAC3C,MAAMC,4BAA4B,GAAG,IAAAC,iCAAO,EAAC,CAAC;IAE9CC,IAAI,CAAC,yFAAyF,EAAE,MAAM;MACpG,MAAMC,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG;MACF,CAAC,CAAC;MAEFI,MAAM,CAACD,oBAAoB,CAAC,CAACE,aAAa,CAAC;QACzC,CAACL,4BAA4B,GAAG;MAClC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFE,IAAI,CAAE,kGAAiG,EAAE,MAAM;MAC7G,MAAMI,yBAAyB,GAAG,IAAAL,iCAAO,EAAC,CAAC;MAC3C,MAAME,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG,4BAA4B;QAC5BM;MACF,CAAC,CAAC;MAEFF,MAAM,CAACD,oBAAoB,CAAC,CAACE,aAAa,CAAC;QACzC,CAACL,4BAA4B,GAAG,MAAM;QACtC,CAACM,yBAAyB,GAAG;MAC/B,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFJ,IAAI,CAAC,s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;MAEzDM,MAAM,CAACS,mBAAmB,CAAC,CAACR,aAAa,CAACb,yBAAyB,CAAC;IACtE,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
-
5
4
  var _lodash = require("lodash");
6
-
7
5
  var _ = require("../../..");
8
-
9
6
  const _preset$get = _.preset.get,
10
- buildRequestTransformation = _preset$get.buildRequestTransformation,
11
- buildResponseTransformation = _preset$get.buildResponseTransformation;
7
+ buildRequestTransformation = _preset$get.buildRequestTransformation,
8
+ buildResponseTransformation = _preset$get.buildResponseTransformation;
12
9
  describe('get-method transformations', () => {
13
10
  describe('buildRequestTransformation', () => {
14
11
  const requestMessageIdentifierPath = (0, _motionRuntimeTestContext.aString)();
@@ -1 +1 @@
1
- {"version":3,"names":["preset","get","buildRequestTransformation","buildResponseTransformation","describe","requestMessageIdentifierPath","aString","test","transformationObject","expect","toStrictEqual","idPathSegments","times","join","responseMessageResultPath","transformationString"],"sources":["../../../../../src/__tests__/transformations/preset/get-transformation.spec.ts"],"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"],"mappings":";;AAAA;;AACA;;AACA;;AAEA,oBAEIA,QAFJ,CACEC,GADF;AAAA,MACSC,0BADT,eACSA,0BADT;AAAA,MACqCC,2BADrC,eACqCA,2BADrC;AAIAC,QAAQ,CAAC,4BAAD,EAA+B,MAAM;EAC3CA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;IAC3C,MAAMC,4BAA4B,GAAG,IAAAC,iCAAA,GAArC;IAEAC,IAAI,CAAC,yFAAD,EAA4F,MAAM;MACpG,MAAMC,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG;MADsD,CAAD,CAAvD;MAIAI,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzC,CAACL,4BAAD,GAAgC;MADS,CAA3C;IAGD,CARG,CAAJ;IAUAE,IAAI,CAAC,wBAAD,EAA2B,MAAM;MACnC;MACA,MAAMI,cAAc,GAAG,IAAAC,aAAA,EAAM,CAAN,EAASN,iCAAT,CAAvB;MAEA,MAAME,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDG,4BAA4B,EAAEM,cAAc,CAACE,IAAf,CAAoB,GAApB;MADwB,CAAD,CAAvD;MAIAJ,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzC,CAACC,cAAc,CAAC,CAAD,CAAf,GAAqB;UAAE,CAACA,cAAc,CAAC,CAAD,CAAf,GAAqB;QAAvB;MADoB,CAA3C;IAGD,CAXG,CAAJ;EAYD,CAzBO,CAAR;EA2BAP,QAAQ,CAAC,6BAAD,EAAgC,MAAM;IAC5CG,IAAI,CAAC,iDAAD,EAAoD,MAAM;MAC5D,MAAMO,yBAAyB,GAAG,IAAAR,iCAAA,GAAlC;MAEA,MAAMS,oBAAoB,GAAGZ,2BAA2B,CAAC;QACvDW;MADuD,CAAD,CAAxD;MAIAL,MAAM,CAACM,oBAAD,CAAN,CAA6BL,aAA7B,CACG,KAAII,yBAA0B,EADjC;IAGD,CAVG,CAAJ;EAWD,CAZO,CAAR;AAaD,CAzCO,CAAR"}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","_preset$get","preset","get","buildRequestTransformation","buildResponseTransformation","describe","requestMessageIdentifierPath","aString","test","transformationObject","expect","toStrictEqual","idPathSegments","times","join","responseMessageResultPath","transformationString"],"sources":["../../../../../src/__tests__/transformations/preset/get-transformation.spec.ts"],"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"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAAG,WAAA,G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AAC,CAAC"}
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
-
5
4
  var _ = require("../../..");
6
-
7
5
  const _preset$list = _.preset.list,
8
- buildRequestTransformation = _preset$list.buildRequestTransformation,
9
- buildResponseTransformation = _preset$list.buildResponseTransformation;
6
+ buildRequestTransformation = _preset$list.buildRequestTransformation,
7
+ buildResponseTransformation = _preset$list.buildResponseTransformation;
10
8
  describe('list-method transformations', () => {
11
9
  describe('buildRequestTransformation', () => {
12
10
  // eslint-disable-next-line max-len
@@ -1 +1 @@
1
- {"version":3,"names":["preset","list","buildRequestTransformation","buildResponseTransformation","describe","test","transformationString","expect","toStrictEqual","responseMessageResultPath","aString"],"sources":["../../../../../src/__tests__/transformations/preset/list-transformation.spec.ts"],"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"],"mappings":";;AAAA;;AACA;;AAEA,qBAEIA,QAFJ,CACEC,IADF;AAAA,MACUC,0BADV,gBACUA,0BADV;AAAA,MACsCC,2BADtC,gBACsCA,2BADtC;AAIAC,QAAQ,CAAC,6BAAD,EAAgC,MAAM;EAC5CA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;IAC3C;IACAC,IAAI,CAAC,gDAAD,EAAmD,MAAM;MAC3D,MAAMC,oBAAoB,GAAGJ,0BAA0B,EAAvD;MAEAK,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C,MAA3C;IACD,CAJG,CAAJ;EAKD,CAPO,CAAR;EASAJ,QAAQ,CAAC,6BAAD,EAAgC,MAAM;IAC5CC,IAAI,CAAC,iDAAD,EAAoD,MAAM;MAC5D,MAAMI,yBAAyB,GAAG,IAAAC,iCAAA,GAAlC;MAEA,MAAMJ,oBAAoB,GAAGH,2BAA2B,CAAC;QACvDM;MADuD,CAAD,CAAxD;MAIAF,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CACG,KAAIC,yBAA0B,EADjC;IAGD,CAVG,CAAJ;EAWD,CAZO,CAAR;AAaD,CAvBO,CAAR"}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_","_preset$list","preset","list","buildRequestTransformation","buildResponseTransformation","describe","test","transformationString","expect","toStrictEqual","responseMessageResultPath","aString"],"sources":["../../../../../src/__tests__/transformations/preset/list-transformation.spec.ts"],"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"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AAEA,MAAAE,YAAA,GAEIC,QAAM,CADRC,IAAI;EAAIC,0BAA0B,GAAAH,YAAA,CAA1BG,0BAA0B;EAAEC,2BAA2B,GAAAJ,YAAA,CAA3BI,2BAA2B;AAGjEC,QAAQ,CAAC,6BAA6B,EAAE,MAAM;EAC5CA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IAC3C;IACAC,IAAI,CAAC,gDAAgD,EAAE,MAAM;MAC3D,MAAMC,oBAAoB,GAAGJ,0BAA0B,CAAC,CAAC;MAEzDK,MAAM,CAACD,oBAAoB,CAAC,CAACE,aAAa,CAAC,MAAM,CAAC;IACpD,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFJ,QAAQ,CAAC,6BAA6B,EAAE,MAAM;IAC5CC,IAAI,CAAC,iDAAiD,EAAE,MAAM;MAC5D,MAAMI,yBAAyB,GAAG,IAAAC,iCAAO,EAAC,CAAC;MAE3C,MAAMJ,oBAAoB,GAAGH,2BAA2B,CAAC;QACvDM;MACF,CAAC,CAAC;MAEFF,MAAM,CAACD,oBAAoB,CAAC,CAACE,aAAa,CACvC,KAAIC,yBAA0B,EACjC,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
-
5
4
  var _lodash = require("lodash");
6
-
7
5
  var _ = require("../../..");
8
-
9
6
  const _preset$query = _.preset.query,
10
- buildRequestTransformation = _preset$query.buildRequestTransformation,
11
- buildResponseTransformation = _preset$query.buildResponseTransformation;
7
+ buildRequestTransformation = _preset$query.buildRequestTransformation,
8
+ buildResponseTransformation = _preset$query.buildResponseTransformation;
12
9
  describe('query-method transformations', () => {
13
10
  describe('buildRequestTransformation', () => {
14
11
  // eslint-disable-next-line max-len
@@ -21,8 +18,9 @@ describe('query-method transformations', () => {
21
18
  [requestQueryObjectPropertyName]: '$[0]',
22
19
  '*': '$[1]'
23
20
  });
24
- }); // eslint-disable-next-line max-len
21
+ });
25
22
 
23
+ // eslint-disable-next-line max-len
26
24
  test("sets the given query tree under the 'query' property as a default, with the second argument spread into the payload", () => {
27
25
  const transformationString = buildRequestTransformation();
28
26
  expect(transformationString).toStrictEqual({
@@ -33,9 +31,8 @@ describe('query-method transformations', () => {
33
31
  });
34
32
  describe('buildResponseTransformation', () => {
35
33
  const _times = (0, _lodash.times)(2, () => (0, _motionRuntimeTestContext.aString)()),
36
- responseMessageResultPath = _times[0],
37
- responseMessagePagingMetadataPath = _times[1];
38
-
34
+ responseMessageResultPath = _times[0],
35
+ responseMessagePagingMetadataPath = _times[1];
39
36
  test('unwraps the value of the provided property-path', () => {
40
37
  const transformationObject = buildResponseTransformation({
41
38
  responseMessageResultPath,
@@ -1 +1 @@
1
- {"version":3,"names":["preset","query","buildRequestTransformation","buildResponseTransformation","describe","test","requestQueryObjectPropertyName","aString","transformationString","expect","toStrictEqual","times","responseMessageResultPath","responseMessagePagingMetadataPath","transformationObject","items","pagingMetadata","itemTransformation"],"sources":["../../../../../src/__tests__/transformations/preset/query-transformation.spec.ts"],"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"],"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;EAC7CA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;IAC3C;IACAC,IAAI,CAAC,4GAAD,EAA+G,MAAM;MACvH,MAAMC,8BAA8B,GAAG,IAAAC,iCAAA,GAAvC;MACA,MAAMC,oBAAoB,GAAGN,0BAA0B,CAAC;QACtDI;MADsD,CAAD,CAAvD;MAIAG,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzC,CAACJ,8BAAD,GAAkC,MADO;QAEzC,KAAK;MAFoC,CAA3C;IAID,CAVG,CAAJ,CAF2C,CAc3C;;IACAD,IAAI,CAAC,qHAAD,EAAwH,MAAM;MAChI,MAAMG,oBAAoB,GAAGN,0BAA0B,EAAvD;MAEAO,MAAM,CAACD,oBAAD,CAAN,CAA6BE,aAA7B,CAA2C;QACzCT,KAAK,EAAE,MADkC;QAEzC,KAAK;MAFoC,CAA3C;IAID,CAPG,CAAJ;EAQD,CAvBO,CAAR;EAyBAG,QAAQ,CAAC,6BAAD,EAAgC,MAAM;IAC5C,eACE,IAAAO,aAAA,EAAM,CAAN,EAAS,MAAM,IAAAJ,iCAAA,GAAf,CADF;IAAA,MAAOK,yBAAP;IAAA,MAAkCC,iCAAlC;;IAGAR,IAAI,CAAC,iDAAD,EAAoD,MAAM;MAC5D,MAAMS,oBAAoB,GAAGX,2BAA2B,CAAC;QACvDS,yBADuD;QAEvDC;MAFuD,CAAD,CAAxD;MAKAJ,MAAM,CAACK,oBAAD,CAAN,CAA6BJ,aAA7B,CAA2C;QACzCK,KAAK,EAAG,KAAIH,yBAA0B,EADG;QAEzCI,cAAc,EAAG,KAAIH,iCAAkC;MAFd,CAA3C;IAID,CAVG,CAAJ;IAYAR,IAAI,CAAC,2CAAD,EAA8C,MAAM;MACtD,MAAMY,kBAAkB,GAAI,eAAc,IAAAV,iCAAA,GAAU,EAApD;MACA,MAAMO,oBAAoB,GAAGX,2BAA2B,CAAC;QACvDS,yBADuD;QAEvDC,iCAFuD;QAGvDI;MAHuD,CAAD,CAAxD;MAMAR,MAAM,CAACK,oBAAD,CAAN,CAA6BJ,aAA7B,CAA2C;QACzCK,KAAK,EAAE;UACL,SAAU,KAAIH,yBAA0B,EADnC;UAEL,uBAAuBK;QAFlB,CADkC;QAKzCD,cAAc,EAAG,KAAIH,iCAAkC;MALd,CAA3C;IAOD,CAfG,CAAJ;EAgBD,CAhCO,CAAR;AAiCD,CA3DO,CAAR"}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","_preset$query","preset","query","buildRequestTransformation","buildResponseTransformation","describe","test","requestQueryObjectPropertyName","aString","transformationString","expect","toStrictEqual","_times","times","responseMessageResultPath","responseMessagePagingMetadataPath","transformationObject","items","pagingMetadata","itemTransformation"],"sources":["../../../../../src/__tests__/transformations/preset/query-transformation.spec.ts"],"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"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAAG,aAAA,GAEIC,QAAM,CADRC,KAAK;EAAIC,0BAA0B,GAAAH,aAAA,CAA1BG,0BAA0B;EAAEC,2BAA2B,GAAAJ,aAAA,CAA3BI,2BAA2B;AAGlEC,QAAQ,CAAC,8BAA8B,EAAE,MAAM;EAC7CA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IAC3C;IACAC,IAAI,CAAC,4GAA4G,EAAE,MAAM;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,aAAa,CAAC;QACzCM,KAAK,EAAE;UACL,OAAO,EAAG,KAAIH,yBAA0B,EAAC;UACzC,qBAAqB,EAAEK;QACzB,CAAC;QACDD,cAAc,EAAG,KAAIH,iCAAkC;MACzD,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
-
5
4
  var _lodash = require("lodash");
6
-
7
5
  var _ = require("../../..");
8
-
9
6
  const _preset$update = _.preset.update,
10
- buildRequestTransformation = _preset$update.buildRequestTransformation,
11
- buildResponseTransformation = _preset$update.buildResponseTransformation;
7
+ buildRequestTransformation = _preset$update.buildRequestTransformation,
8
+ buildResponseTransformation = _preset$update.buildResponseTransformation;
12
9
  describe('update-method transformations', () => {
13
10
  describe('buildRequestTransformation', () => {
14
11
  const requestMessageOptionsPath = (0, _motionRuntimeTestContext.aString)();
@@ -42,8 +39,8 @@ describe('update-method transformations', () => {
42
39
  });
43
40
  test('supports nested paths for requestMessageEntityPath and requestMessageOptionsPath', () => {
44
41
  // @ts-expect-error
45
- const requestMessageEntityPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString); // @ts-expect-error
46
-
42
+ const requestMessageEntityPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
43
+ // @ts-expect-error
47
44
  const optionsPathSegments = (0, _lodash.times)(2, _motionRuntimeTestContext.aString);
48
45
  const transformationObject = buildRequestTransformation({
49
46
  requestMessageEntityIdentifierField,
@@ -1 +1 @@
1
- {"version":3,"names":["preset","update","buildRequestTransformation","buildResponseTransformation","describe","requestMessageOptionsPath","aString","requestMessageEntityPath","requestMessageEntityIdentifierField","test","transformedObject","expect","toStrictEqual","requestMessageEntityPathSegments","times","optionsPathSegments","transformationObject","join","sharedPath","responseMessageResultPath","transformationString"],"sources":["../../../../../src/__tests__/transformations/preset/update-transformation.spec.ts"],"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"],"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;EAC9CA,QAAQ,CAAC,4BAAD,EAA+B,MAAM;IAC3C,MAAMC,yBAAyB,GAAG,IAAAC,iCAAA,GAAlC;IACA,MAAMC,wBAAwB,GAAG,IAAAD,iCAAA,GAAjC;IACA,MAAME,mCAAmC,GAAG,IAAAF,iCAAA,GAA5C;IAEAG,IAAI,CAAC,sGAAD,EAAyG,MAAM;MACjH,MAAMC,iBAAiB,GAAGR,0BAA0B,CAAC;QACnDM,mCADmD;QAEnDD;MAFmD,CAAD,CAApD;MAKAI,MAAM,CAACD,iBAAD,CAAN,CAA0BE,aAA1B,CAAwC;QACtC,CAACL,wBAAD,GAA4B;UAC1B,CAACC,mCAAD,GAAuC,MADb;UAE1B,KAAK;QAFqB;MADU,CAAxC;IAMD,CAZG,CAAJ;IAcAC,IAAI,CAAE,kGAAF,EAAqG,MAAM;MAC7G,MAAMC,iBAAiB,GAAGR,0BAA0B,CAAC;QACnDM,mCADmD;QAEnDD,wBAFmD;QAGnDF;MAHmD,CAAD,CAApD;MAMAM,MAAM,CAACD,iBAAD,CAAN,CAA0BE,aAA1B,CAAwC;QACtC,CAACL,wBAAD,GAA4B;UAC1B,CAACC,mCAAD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O;MAD2B,CAA3C;IAMD,CAfG,CAAJ;EAgBD,CA1EO,CAAR;EA4EAJ,QAAQ,CAAC,6BAAD,EAAgC,MAAM;IAC5CK,IAAI,CAAC,iDAAD,EAAoD,MAAM;MAC5D,MAAMU,yBAAyB,GAAG,IAAAb,iCAAA,GAAlC;MAEA,MAAMc,oBAAoB,GAAGjB,2BAA2B,CAAC;QACvDgB;MADuD,CAAD,CAAxD;MAIAR,MAAM,CAACS,oBAAD,CAAN,CAA6BR,aAA7B,CACG,KAAIO,yBAA0B,EADjC;IAGD,CAVG,CAAJ;EAWD,CAZO,CAAR;AAaD,CA1FO,CAAR"}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","_preset$update","preset","update","buildRequestTransformation","buildResponseTransformation","describe","requestMessageOptionsPath","aString","requestMessageEntityPath","requestMessageEntityIdentifierField","test","transformedObject","expect","toStrictEqual","requestMessageEntityPathSegments","times","optionsPathSegments","transformationObject","join","sharedPath","responseMessageResultPath","transformationString"],"sources":["../../../../../src/__tests__/transformations/preset/update-transformation.spec.ts"],"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"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAAG,cAAA,GAEIC,QAAM,CADRC,MAAM;EAAIC,0BAA0B,GAAAH,cAAA,CAA1BG,0BAA0B;EAAEC,2BAA2B,GAAAJ,cAAA,CAA3BI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imeTestContext = require("@wix/motion-runtime-test-context");
4
-
5
4
  var _lodash = require("lodash");
6
-
7
5
  var _ = require("../..");
8
-
9
6
  const validateRequestTransformation = _.validation.validateRequestTransformation;
10
7
  describe('validateRequestTransformation', () => {
11
8
  describe('valid transformations', () => {
@@ -37,7 +34,6 @@ describe('validateRequestTransformation', () => {
37
34
  description
38
35
  })])
39
36
  });
40
-
41
37
  describe('invalid complex-transformation keys', () => {
42
38
  test.each`
43
39
  description | transformationKey | expectedValidationMessage
@@ -95,7 +91,6 @@ describe('validateRequestTransformation', () => {
95
91
  '@source': '$[0].a.b.c',
96
92
  '@omit': value
97
93
  });
98
-
99
94
  const nonArray = (0, _motionRuntimeTestContext.aString)();
100
95
  const nonStringArray = (0, _lodash.times)(2, () => (0, _motionRuntimeTestContext.aNumber)());
101
96
  const arrayWithInvalidPaths = ['a.b.c', (0, _motionRuntimeTestContext.aString)()];
@@ -135,8 +130,8 @@ describe('validateRequestTransformation', () => {
135
130
  }));
136
131
  });
137
132
  });
138
- /* eslint-disable max-len */
139
133
 
134
+ /* eslint-disable max-len */
140
135
  describe.each`
141
136
  description | invalidTransformation | expectedParentPath
142
137
  ${'top level'} | ${transformationWithOmitValue(arrayWithInvalidPaths)} | ${'@omit'}
@@ -221,16 +216,15 @@ describe('validateRequestTransformation', () => {
221
216
  });
222
217
  });
223
218
  });
224
- /* eslint-disable max-len */
225
219
 
220
+ /* eslint-disable max-len */
226
221
  describe.each`
227
222
  description | transformationValue | expectedValidationMessage
228
223
  ${'does not start with $[N] where N is a numeric index'} | ${'$[x].a.b.c'} | ${'must start with $[N] where N is an index'}
229
224
  ${'is not a valid json-path'} | ${'@'} | ${'must start with $[N] where N is an index'}
230
225
  ${'has several arguments referred to in the transformation'} | ${'$[0].$[1]'} | ${'must have a single argument-index as the first path segment'}
231
226
  ${'refers to * in the path'} | ${'$[0].a.b.*'} | ${'cannot refer to the * operator'}
232
- `(
233
- /* eslint-enable max-len */
227
+ `( /* eslint-enable max-len */
234
228
  'returns a validation error when a transformation value segment $description', ({
235
229
  transformationValue,
236
230
  expectedValidationMessage
@@ -259,8 +253,8 @@ describe('validateRequestTransformation', () => {
259
253
  });
260
254
  describe('special fields', () => {
261
255
  describe.each(['id', 'createdDate', 'updatedDate'])('%s', specialField => {
262
- const transformationValue = `$[0].a.b.${specialField}`; // eslint-disable-next-line max-len
263
-
256
+ const transformationValue = `$[0].a.b.${specialField}`;
257
+ // eslint-disable-next-line max-len
264
258
  const expectedValidationMessage = `cannot refer to ${specialField} field, consider using _${specialField} instead`;
265
259
  test('simple transformation', () => {
266
260
  expect(validateRequestTransformation(transformationValue)).toStrictEqual(validationErrorWith({
@@ -1 +1 @@
1
- {"version":3,"names":["validateRequestTransformation","validation","describe","validResults","isValid","validationErrors","test","validTransformation","expect","toStrictEqual","a","validationErrorWith","parentPath","invalidValue","description","arrayContaining","objectContaining","each","transformationKey","expectedValidationMessage","transformation","d","e","f","parentKey","aString","invalidSourceValue","invalidSourceTransformation","times","invalidTransformation","expectedParentPath","transformationWithOmitValue","value","nonArray","nonStringArray","aNumber","arrayWithInvalidPaths","invalidCustomFunctionCallExpression","b","c","invalidCustomFunctionExpression","transformationValue","specialField"],"sources":["../../../../src/__tests__/validations/validateRequestTransformation.spec.ts"],"sourcesContent":["import { aString, aNumber } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\nimport { validation } from '../..';\n\nconst { validateRequestTransformation } = validation;\n\ndescribe('validateRequestTransformation', () => {\n describe('valid transformations', () => {\n const validResults = { isValid: true, validationErrors: [] };\n\n test('returns valid transformation response for a valid simple transformation', () => {\n const validTransformation = '$[0].a.b.c';\n\n expect(validateRequestTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n\n test('returns valid transformation response for a valid complex transformation', () => {\n const validTransformation = { a: '$[0].a.b.c' };\n\n expect(validateRequestTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n });\n\n describe('invalid transformations', () => {\n const validationErrorWith = ({\n parentPath,\n invalidValue,\n description,\n }) => ({\n isValid: false,\n validationErrors: expect.arrayContaining([\n expect.objectContaining({\n parentPath,\n invalidValue,\n description,\n }),\n ]),\n });\n\n describe('invalid complex-transformation keys', () => {\n test.each`\n description | transformationKey | expectedValidationMessage\n ${'refers to an argument index'} | ${'$[0]'} | ${\"must start with '$.'\"}\n ${'refers to a custom function'} | ${'#someFunction'} | ${'cannot be a custom function call'}\n `(\n 'returns a validation error when a transformation value segment $description',\n ({ transformationKey, expectedValidationMessage }) => {\n const transformation = {\n d: { e: { f: { [transformationKey]: '$[0].a.b.c' } } },\n '*': '$[1]',\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\n invalidValue: transformationKey,\n description: expectedValidationMessage,\n }),\n );\n },\n );\n });\n\n describe('invalid transformations values', () => {\n describe('omit transformation', () => {\n const parentKey = aString();\n\n describe('invalid source', () => {\n const invalidSourceValue = '$[x].a.b.c';\n const invalidSourceTransformation = {\n '@source': invalidSourceValue,\n '@omit': times(2, () => aString()),\n };\n\n test.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${invalidSourceTransformation} | ${'@source'}\n ${'nested'} | ${{ [parentKey]: invalidSourceTransformation }} | ${`${parentKey}.@source`}\n `(\n 'returns a validation error when the @source value is invalid',\n ({ invalidTransformation, expectedParentPath }) => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: invalidSourceValue,\n description: 'must start with $[N] where N is an index',\n }),\n );\n },\n );\n });\n\n describe('invalid @omit', () => {\n const transformationWithOmitValue = (value) => ({\n '@source': '$[0].a.b.c',\n '@omit': value,\n });\n\n const nonArray = aString();\n const nonStringArray = times(2, () => aNumber());\n const arrayWithInvalidPaths = ['a.b.c', aString()];\n\n describe.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${transformationWithOmitValue(nonArray)} | ${'@omit'}\n ${'nested'} | ${{ [parentKey]: transformationWithOmitValue(nonArray) }} | ${`${parentKey}.@omit`}\n `(\n '@omit is not an array',\n ({ invalidTransformation, expectedParentPath }) => {\n test('returns a validation error', () => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: nonArray,\n description: 'must be an array of strings',\n }),\n );\n });\n },\n );\n\n describe.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${transformationWithOmitValue(nonStringArray)} | ${'@omit'}\n ${'nested'} | ${{ [parentKey]: transformationWithOmitValue(nonStringArray) }} | ${`${parentKey}.@omit`}\n `(\n '@omit is an array of non-strings',\n ({ invalidTransformation, expectedParentPath }) => {\n test('return a validation error', () => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: nonStringArray,\n description: 'must be an array of strings',\n }),\n );\n });\n },\n );\n\n /* eslint-disable max-len */\n describe.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${transformationWithOmitValue(arrayWithInvalidPaths)} | ${'@omit'}\n ${'nested'} | ${{ [parentKey]: transformationWithOmitValue(arrayWithInvalidPaths) }} | ${`${parentKey}.@omit`}\n `(\n '@omit is an array with invalid string paths',\n ({ description, invalidTransformation, expectedParentPath }) => {\n /* eslint-enable max-len */\n test(`returns a validation error for invalid ${description} transformation`, () => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: arrayWithInvalidPaths,\n description: 'must contain non-nested paths only',\n }),\n );\n });\n },\n );\n });\n });\n\n describe('custom function expressions', () => {\n test('returns a validation error when an invalid custom function-name is used', () => {\n const invalidCustomFunctionCallExpression = '#1a';\n const transformation = {\n a: { b: { c: invalidCustomFunctionCallExpression } },\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: invalidCustomFunctionCallExpression,\n description: 'contains an invalid custom function expression',\n }),\n );\n });\n\n test('returns a validation error when a custom function argument is invalid for request transformation', () => {\n const invalidCustomFunctionExpression = '#someFunction($.id)';\n const transformation = {\n a: { b: { c: invalidCustomFunctionExpression } },\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: '$.id',\n description: 'must start with $[N] where N is an index',\n }),\n );\n });\n\n describe('#constant function', () => {\n test('returns a validation error when passed value is not a valid json value', () => {\n const invalidCustomFunctionExpression = '#constant(not-json)';\n const transformation = {\n a: { b: { c: invalidCustomFunctionExpression } },\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: 'not-json',\n description: 'must be a valid json value',\n }),\n );\n });\n\n test('allows passing non json-path arguments to the #constant function', () => {\n const transformation = { a: { b: { c: '#constant(\"abc\")' } } };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n {\n isValid: true,\n validationErrors: [],\n },\n );\n });\n });\n });\n\n /* eslint-disable max-len */\n describe.each`\n description | transformationValue | expectedValidationMessage\n ${'does not start with $[N] where N is a numeric index'} | ${'$[x].a.b.c'} | ${'must start with $[N] where N is an index'}\n ${'is not a valid json-path'} | ${'@'} | ${'must start with $[N] where N is an index'}\n ${'has several arguments referred to in the transformation'} | ${'$[0].$[1]'} | ${'must have a single argument-index as the first path segment'}\n ${'refers to * in the path'} | ${'$[0].a.b.*'} | ${'cannot refer to the * operator'}\n `(\n /* eslint-enable max-len */\n 'returns a validation error when a transformation value segment $description',\n ({ transformationValue, expectedValidationMessage }) => {\n test('simple transformation', () => {\n expect(\n validateRequestTransformation(transformationValue),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n\n test('complex transformation', () => {\n const transformation = { a: { b: { c: transformationValue } } };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n },\n );\n\n describe('special fields', () => {\n describe.each(['id', 'createdDate', 'updatedDate'])(\n '%s',\n (specialField) => {\n const transformationValue = `$[0].a.b.${specialField}`;\n // eslint-disable-next-line max-len\n const expectedValidationMessage = `cannot refer to ${specialField} field, consider using _${specialField} instead`;\n\n test('simple transformation', () => {\n expect(\n validateRequestTransformation(transformationValue),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n\n test('complex transformation', () => {\n const transformation = { a: { b: { c: transformationValue } } };\n\n expect(\n validateRequestTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n },\n );\n });\n });\n });\n});\n"],"mappings":";;AAAA;;AACA;;AACA;;AAEA,MAAQA,6BAAR,GAA0CC,YAA1C,CAAQD,6BAAR;AAEAE,QAAQ,CAAC,+BAAD,EAAkC,MAAM;EAC9CA,QAAQ,CAAC,uBAAD,EAA0B,MAAM;IACtC,MAAMC,YAAY,GAAG;MAAEC,OAAO,EAAE,IAAX;MAAiBC,gBAAgB,EAAE;IAAnC,CAArB;IAEAC,IAAI,CAAC,yEAAD,EAA4E,MAAM;MACpF,MAAMC,mBAAmB,GAAG,YAA5B;MAEAC,MAAM,CAACR,6BAA6B,CAACO,mBAAD,CAA9B,CAAN,CAA2DE,aAA3D,CACEN,YADF;IAGD,CANG,CAAJ;IAQAG,IAAI,CAAC,0EAAD,EAA6E,MAAM;MACrF,MAAMC,mBAAmB,GAAG;QAAEG,CAAC,EAAE;MAAL,CAA5B;MAEAF,MAAM,CAACR,6BAA6B,CAACO,mBAAD,CAA9B,CAAN,CAA2DE,aAA3D,CACEN,YADF;IAGD,CANG,CAAJ;EAOD,CAlBO,CAAR;EAoBAD,QAAQ,CAAC,yBAAD,E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odash","_","validateRequestTransformation","validation","describe","validResults","isValid","validationErrors","test","validTransformation","expect","toStrictEqual","a","validationErrorWith","parentPath","invalidValue","description","arrayContaining","objectContaining","each","transformationKey","expectedValidationMessage","transformation","d","e","f","parentKey","aString","invalidSourceValue","invalidSourceTransformation","times","invalidTransformation","expectedParentPath","transformationWithOmitValue","value","nonArray","nonStringArray","aNumber","arrayWithInvalidPaths","invalidCustomFunctionCallExpression","b","c","invalidCustomFunctionExpression","transformationValue","specialField"],"sources":["../../../../src/__tests__/validations/validateRequestTransformation.spec.ts"],"sourcesContent":["import { aString, aNumber } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\nimport { validation } from '../..';\n\nconst { validateRequestTransformation } = validation;\n\ndescribe('validateRequestTransformation', () => {\n describe('valid transformations', () => {\n const validResults = { isValid: true, validationErrors: [] };\n\n test('returns valid transformation response for a valid simple transformation', () => {\n const validTransformation = '$[0].a.b.c';\n\n expect(validateRequestTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n\n test('returns valid transformation response for a valid complex transformation', () => {\n const validTransformation = { a: '$[0].a.b.c' };\n\n expect(validateRequestTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n });\n\n describe('invalid transformations', () => {\n const validationErrorWith = ({\n parentPath,\n invalidValue,\n description,\n }) => ({\n isValid: false,\n validationErrors: expect.arrayContaining([\n expect.objectContaining({\n parentPath,\n invalidValue,\n description,\n }),\n ]),\n });\n\n describe('invalid complex-transformation keys', () => {\n test.each`\n description | transformationKey | expectedValidationMessage\n ${'refers to an argument index'} | ${'$[0]'} | ${\"must start with '$.'\"}\n ${'refers to a custom function'} | ${'#someFunction'} | ${'cannot be a custom function call'}\n `(\n 'returns a validation error when a transformation value segment $description',\n ({ transformationKey, expectedValidationMessage }) => {\n const transformation = {\n d: { e: { f: { [transformationKey]: '$[0].a.b.c' } } },\n '*': '$[1]',\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\n invalidValue: transformationKey,\n description: expectedValidationMessage,\n }),\n );\n },\n );\n });\n\n describe('invalid transformations values', () => {\n describe('omit transformation', () => {\n const parentKey = aString();\n\n describe('invalid source', () => {\n const invalidSourceValue = '$[x].a.b.c';\n const invalidSourceTransformation = {\n '@source': invalidSourceValue,\n '@omit': times(2, () => aString()),\n };\n\n test.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${invalidSourceTransformation} | ${'@source'}\n ${'nested'} | ${{ [parentKey]: invalidSourceTransformation }} | ${`${parentKey}.@source`}\n `(\n 'returns a validation error when the @source value is invalid',\n ({ invalidTransformation, expectedParentPath }) => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: invalidSourceValue,\n description: 'must start with $[N] where N is an index',\n }),\n );\n },\n );\n });\n\n describe('invalid @omit', () => {\n const transformationWithOmitValue = (value) => ({\n '@source': '$[0].a.b.c',\n '@omit': value,\n });\n\n const nonArray = aString();\n const nonStringArray = times(2, () => aNumber());\n const arrayWithInvalidPaths = ['a.b.c', aString()];\n\n describe.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${transformationWithOmitValue(nonArray)} | ${'@omit'}\n ${'nested'} | ${{ [parentKey]: transformationWithOmitValue(nonArray) }} | ${`${parentKey}.@omit`}\n `(\n '@omit is not an array',\n ({ invalidTransformation, expectedParentPath }) => {\n test('returns a validation error', () => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: nonArray,\n description: 'must be an array of strings',\n }),\n );\n });\n },\n );\n\n describe.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${transformationWithOmitValue(nonStringArray)} | ${'@omit'}\n ${'nested'} | ${{ [parentKey]: transformationWithOmitValue(nonStringArray) }} | ${`${parentKey}.@omit`}\n `(\n '@omit is an array of non-strings',\n ({ invalidTransformation, expectedParentPath }) => {\n test('return a validation error', () => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: nonStringArray,\n description: 'must be an array of strings',\n }),\n );\n });\n },\n );\n\n /* eslint-disable max-len */\n describe.each`\n description | invalidTransformation | expectedParentPath\n ${'top level'} | ${transformationWithOmitValue(arrayWithInvalidPaths)} | ${'@omit'}\n ${'nested'} | ${{ [parentKey]: transformationWithOmitValue(arrayWithInvalidPaths) }} | ${`${parentKey}.@omit`}\n `(\n '@omit is an array with invalid string paths',\n ({ description, invalidTransformation, expectedParentPath }) => {\n /* eslint-enable max-len */\n test(`returns a validation error for invalid ${description} transformation`, () => {\n expect(\n validateRequestTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: arrayWithInvalidPaths,\n description: 'must contain non-nested paths only',\n }),\n );\n });\n },\n );\n });\n });\n\n describe('custom function expressions', () => {\n test('returns a validation error when an invalid custom function-name is used', () => {\n const invalidCustomFunctionCallExpression = '#1a';\n const transformation = {\n a: { b: { c: invalidCustomFunctionCallExpression } },\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: invalidCustomFunctionCallExpression,\n description: 'contains an invalid custom function expression',\n }),\n );\n });\n\n test('returns a validation error when a custom function argument is invalid for request transformation', () => {\n const invalidCustomFunctionExpression = '#someFunction($.id)';\n const transformation = {\n a: { b: { c: invalidCustomFunctionExpression } },\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: '$.id',\n description: 'must start with $[N] where N is an index',\n }),\n );\n });\n\n describe('#constant function', () => {\n test('returns a validation error when passed value is not a valid json value', () => {\n const invalidCustomFunctionExpression = '#constant(not-json)';\n const transformation = {\n a: { b: { c: invalidCustomFunctionExpression } },\n };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: 'not-json',\n description: 'must be a valid json value',\n }),\n );\n });\n\n test('allows passing non json-path arguments to the #constant function', () => {\n const transformation = { a: { b: { c: '#constant(\"abc\")' } } };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n {\n isValid: true,\n validationErrors: [],\n },\n );\n });\n });\n });\n\n /* eslint-disable max-len */\n describe.each`\n description | transformationValue | expectedValidationMessage\n ${'does not start with $[N] where N is a numeric index'} | ${'$[x].a.b.c'} | ${'must start with $[N] where N is an index'}\n ${'is not a valid json-path'} | ${'@'} | ${'must start with $[N] where N is an index'}\n ${'has several arguments referred to in the transformation'} | ${'$[0].$[1]'} | ${'must have a single argument-index as the first path segment'}\n ${'refers to * in the path'} | ${'$[0].a.b.*'} | ${'cannot refer to the * operator'}\n `(\n /* eslint-enable max-len */\n 'returns a validation error when a transformation value segment $description',\n ({ transformationValue, expectedValidationMessage }) => {\n test('simple transformation', () => {\n expect(\n validateRequestTransformation(transformationValue),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n\n test('complex transformation', () => {\n const transformation = { a: { b: { c: transformationValue } } };\n\n expect(validateRequestTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n },\n );\n\n describe('special fields', () => {\n describe.each(['id', 'createdDate', 'updatedDate'])(\n '%s',\n (specialField) => {\n const transformationValue = `$[0].a.b.${specialField}`;\n // eslint-disable-next-line max-len\n const expectedValidationMessage = `cannot refer to ${specialField} field, consider using _${specialField} instead`;\n\n test('simple transformation', () => {\n expect(\n validateRequestTransformation(transformationValue),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n\n test('complex transformation', () => {\n const transformation = { a: { b: { c: transformationValue } } };\n\n expect(\n validateRequestTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'a.b.c',\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n },\n );\n });\n });\n });\n});\n"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAQG,6BAA6B,GAAKC,YAAU,CAA5CD,6BAA6B;AAErCE,QAAQ,CAAC,+BAA+B,EAAE,MAAM;EAC9CA,QAAQ,CAAC,uBAAuB,EAAE,MAAM;IACtC,MAAMC,YAAY,GAAG;MAAEC,OAAO,EAAE,IAAI;MAAEC,gBAAgB,EAAE;IAAG,CAAC;IAE5DC,IAAI,CAAC,yEAAyE,EAAE,MAAM;MACpF,MAAMC,mBAAmB,GAAG,YAAY;MAExCC,MAAM,CAACR,6BAA6B,CAACO,mBAAmB,CAAC,CAAC,CAACE,aAAa,CACtEN,YACF,CAAC;IACH,CAAC,CAAC;IAEFG,IAAI,CAAC,0EAA0E,EAAE,MAAM;MACrF,MAAMC,mBAAmB,GAAG;QAAEG,CAAC,EAAE;MAAa,CAAC;MAE/CF,MAAM,CAACR,6BAA6B,CAACO,mBAAmB,CAAC,CAAC,CAACE,aAAa,CACtEN,YACF,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFD,QAAQ,CAAC,yBAAyB,EAAE,MAAM;IACxC,MAAMS,mBAAmB,GAAGA,CAAC;MAC3BC,UAAU;MACVC,YAAY;MACZC;IACF,CAAC,MAAM;MACLV,OAAO,EAAE,KAAK;MACdC,gBAAgB,EAAEG,MAAM,CAACO,eAAe,CAAC,CACvCP,MAAM,CAACQ,gBAAgB,CAAC;QACtBJ,UAAU;QACVC,YAAY;QACZC;MACF,CAAC,CAAC,CACH;IACH,CAAC,CAAC;IAEFZ,QAAQ,CAAC,qCAAqC,EAAE,MAAM;MACpDI,IAAI,CAACW,IAAK;AAChB;AACA,UAAU,6BA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,EAAE,aAAa,CAAC,CAAC,CACjD,IAAI,EACHyB,YAAY,IAAK;UAChB,MAAMD,mBAAmB,GAAI,YAAWC,YAAa,EAAC;UACtD;UACA,MAAMvB,yBAAyB,GAAI,mBAAkBuB,YAAa,2BAA0BA,YAAa,UAAS;UAElHpC,IAAI,CAAC,uBAAuB,EAAE,MAAM;YAClCE,MAAM,CACJR,6BAA6B,CAACyC,mBAAmB,CACnD,CAAC,CAAChC,aAAa,CACbE,mBAAmB,CAAC;cAClBC,UAAU,EAAE,IAAI;cAChBC,YAAY,EAAE4B,mBAAmB;cACjC3B,WAAW,EAAEK;YACf,CAAC,CACH,CAAC;UACH,CAAC,CAAC;UAEFb,IAAI,CAAC,wBAAwB,EAAE,MAAM;YACnC,MAAMc,cAAc,GAAG;cAAEV,CAAC,EAAE;gBAAE4B,CAAC,EAAE;kBAAEC,CAAC,EAAEE;gBAAoB;cAAE;YAAE,CAAC;YAE/DjC,MAAM,CACJR,6BAA6B,CAACoB,cAAc,CAC9C,CAAC,CAACX,aAAa,CACbE,mBAAmB,CAAC;cAClBC,UAAU,EAAE,OAAO;cACnBC,YAAY,EAAE4B,mBAAmB;cACjC3B,WAAW,EAAEK;YACf,CAAC,CACH,CAAC;UACH,CAAC,CAAC;QACJ,CACF,CAAC;MACH,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC"}
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
-
5
4
  var _lodash = require("lodash");
6
-
7
5
  var _ = require("../..");
8
-
9
6
  const validateResponseTransformation = _.validation.validateResponseTransformation;
10
7
  describe('validateResponseTransformation', () => {
11
8
  describe('valid transformations', () => {
@@ -26,7 +23,6 @@ describe('validateResponseTransformation', () => {
26
23
  });
27
24
  describe('invalid transformations', () => {
28
25
  const parentKey = (0, _motionRuntimeTestContext.aString)();
29
-
30
26
  const validationErrorWith = ({
31
27
  parentPath,
32
28
  invalidValue,
@@ -39,7 +35,6 @@ describe('validateResponseTransformation', () => {
39
35
  description
40
36
  })])
41
37
  });
42
-
43
38
  describe('invalid simple transformations', () => {
44
39
  test('returns a validation error when the transformation starts with an index argument', () => {
45
40
  const transformation = '$[0].a.b.c';
@@ -243,7 +238,6 @@ describe('validateResponseTransformation', () => {
243
238
  '@source': '$.a.b.c',
244
239
  '@omit': value
245
240
  });
246
-
247
241
  const nonArray = (0, _motionRuntimeTestContext.aString)();
248
242
  const nonStringArray = (0, _lodash.times)(2, () => (0, _motionRuntimeTestContext.aNumber)());
249
243
  const arrayWithInvalidPaths = ['a.b.c', (0, _motionRuntimeTestContext.aString)()];
@@ -285,8 +279,8 @@ describe('validateResponseTransformation', () => {
285
279
  }));
286
280
  });
287
281
  });
288
- /* eslint-disable max-len */
289
282
 
283
+ /* eslint-disable max-len */
290
284
  describe.each`
291
285
  description | invalidTransformation | expectedParentPath
292
286
  ${'top level'} | ${transformationWithOmitValue(arrayWithInvalidPaths)} | ${'@omit'}
@@ -311,12 +305,10 @@ describe('validateResponseTransformation', () => {
311
305
  });
312
306
  describe('array-item transformation', () => {
313
307
  const validValue = '$.d.e.f';
314
-
315
308
  const invalidPathTransformationWith = invalidPathValue => ({
316
309
  '@path': invalidPathValue,
317
310
  '@itemTransformation': validValue
318
311
  });
319
-
320
312
  describe.each`
321
313
  invalidValue | description
322
314
  ${'$[0].should.fail'} | ${'invalid path value'}