@wix/motion-edm-autogen-transformations-core 1.70.0 → 1.71.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 (117) hide show
  1. package/dist/cjs/__tests__/corvid-entity.spec.js +7 -7
  2. package/dist/cjs/__tests__/corvid-entity.spec.js.map +1 -1
  3. package/dist/cjs/__tests__/getArgumentCardinality.spec.js +6 -6
  4. package/dist/cjs/__tests__/getArgumentCardinality.spec.js.map +1 -1
  5. package/dist/cjs/__tests__/helpers.spec.js +1 -1
  6. package/dist/cjs/__tests__/helpers.spec.js.map +1 -1
  7. package/dist/cjs/__tests__/reduceTransformation.spec.js +1 -1
  8. package/dist/cjs/__tests__/reduceTransformation.spec.js.map +1 -1
  9. package/dist/cjs/__tests__/transformations/custom-functions.spec.js +4 -4
  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 -2
  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 +3 -3
  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 -2
  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 -2
  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 +2 -2
  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 +2 -2
  22. package/dist/cjs/__tests__/transformations/preset/update-transformation.spec.js.map +1 -1
  23. package/dist/cjs/__tests__/validations/validateRequestTransformation.spec.js +2 -2
  24. package/dist/cjs/__tests__/validations/validateRequestTransformation.spec.js.map +1 -1
  25. package/dist/cjs/__tests__/validations/validateResponseTransformation.spec.js +2 -2
  26. package/dist/cjs/__tests__/validations/validateResponseTransformation.spec.js.map +1 -1
  27. package/dist/cjs/index.js +16 -16
  28. package/dist/cjs/index.js.map +1 -1
  29. package/dist/cjs/lib/helpers.js +2 -2
  30. package/dist/cjs/lib/helpers.js.map +1 -1
  31. package/dist/cjs/lib/transformations/common.js +1 -1
  32. package/dist/cjs/lib/transformations/common.js.map +1 -1
  33. package/dist/cjs/lib/transformations/preset/create.js +1 -1
  34. package/dist/cjs/lib/transformations/preset/create.js.map +1 -1
  35. package/dist/cjs/lib/transformations/preset/delete.js +1 -1
  36. package/dist/cjs/lib/transformations/preset/delete.js.map +1 -1
  37. package/dist/cjs/lib/transformations/preset/get.js +1 -1
  38. package/dist/cjs/lib/transformations/preset/get.js.map +1 -1
  39. package/dist/cjs/lib/transformations/preset/list.js +1 -1
  40. package/dist/cjs/lib/transformations/preset/list.js.map +1 -1
  41. package/dist/cjs/lib/transformations/preset/query.js +1 -1
  42. package/dist/cjs/lib/transformations/preset/query.js.map +1 -1
  43. package/dist/cjs/lib/transformations/preset/update.js +1 -1
  44. package/dist/cjs/lib/transformations/preset/update.js.map +1 -1
  45. package/dist/cjs/lib/transformations/reduceTransformation.js +4 -4
  46. package/dist/cjs/lib/transformations/reduceTransformation.js.map +1 -1
  47. package/dist/cjs/lib/transformations/validations/common.js +1 -1
  48. package/dist/cjs/lib/transformations/validations/common.js.map +1 -1
  49. package/dist/cjs/lib/transformations/validations/validateRequestTransformation.js +6 -6
  50. package/dist/cjs/lib/transformations/validations/validateRequestTransformation.js.map +1 -1
  51. package/dist/cjs/lib/transformations/validations/validateResponseTransformation.js +8 -8
  52. package/dist/cjs/lib/transformations/validations/validateResponseTransformation.js.map +1 -1
  53. package/dist/esm/__tests__/corvid-entity.spec.js +2 -2
  54. package/dist/esm/__tests__/corvid-entity.spec.js.map +1 -1
  55. package/dist/esm/__tests__/getArgumentCardinality.spec.js +1 -1
  56. package/dist/esm/__tests__/getArgumentCardinality.spec.js.map +1 -1
  57. package/dist/esm/__tests__/helpers.spec.js +1 -1
  58. package/dist/esm/__tests__/helpers.spec.js.map +1 -1
  59. package/dist/esm/__tests__/reduceTransformation.spec.js +1 -1
  60. package/dist/esm/__tests__/reduceTransformation.spec.js.map +1 -1
  61. package/dist/esm/__tests__/transformations/custom-functions.spec.js +2 -2
  62. package/dist/esm/__tests__/transformations/custom-functions.spec.js.map +1 -1
  63. package/dist/esm/__tests__/transformations/preset/create-transformation.spec.js +1 -1
  64. package/dist/esm/__tests__/transformations/preset/create-transformation.spec.js.map +1 -1
  65. package/dist/esm/__tests__/transformations/preset/delete-transformation.spec.js +1 -1
  66. package/dist/esm/__tests__/transformations/preset/delete-transformation.spec.js.map +1 -1
  67. package/dist/esm/__tests__/transformations/preset/get-transformation.spec.js +1 -1
  68. package/dist/esm/__tests__/transformations/preset/get-transformation.spec.js.map +1 -1
  69. package/dist/esm/__tests__/transformations/preset/list-transformation.spec.js +1 -1
  70. package/dist/esm/__tests__/transformations/preset/list-transformation.spec.js.map +1 -1
  71. package/dist/esm/__tests__/transformations/preset/query-transformation.spec.js +1 -1
  72. package/dist/esm/__tests__/transformations/preset/query-transformation.spec.js.map +1 -1
  73. package/dist/esm/__tests__/transformations/preset/update-transformation.spec.js +1 -1
  74. package/dist/esm/__tests__/transformations/preset/update-transformation.spec.js.map +1 -1
  75. package/dist/esm/__tests__/validations/validateRequestTransformation.spec.js +1 -1
  76. package/dist/esm/__tests__/validations/validateRequestTransformation.spec.js.map +1 -1
  77. package/dist/esm/__tests__/validations/validateResponseTransformation.spec.js +1 -1
  78. package/dist/esm/__tests__/validations/validateResponseTransformation.spec.js.map +1 -1
  79. package/dist/esm/index.js +14 -14
  80. package/dist/esm/index.js.map +1 -1
  81. package/dist/esm/lib/helpers.js +2 -2
  82. package/dist/esm/lib/helpers.js.map +1 -1
  83. package/dist/esm/lib/transformations/common.js +1 -1
  84. package/dist/esm/lib/transformations/common.js.map +1 -1
  85. package/dist/esm/lib/transformations/preset/create.js +1 -1
  86. package/dist/esm/lib/transformations/preset/create.js.map +1 -1
  87. package/dist/esm/lib/transformations/preset/delete.js +1 -1
  88. package/dist/esm/lib/transformations/preset/delete.js.map +1 -1
  89. package/dist/esm/lib/transformations/preset/get.js +1 -1
  90. package/dist/esm/lib/transformations/preset/get.js.map +1 -1
  91. package/dist/esm/lib/transformations/preset/list.js +1 -1
  92. package/dist/esm/lib/transformations/preset/list.js.map +1 -1
  93. package/dist/esm/lib/transformations/preset/query.js +1 -1
  94. package/dist/esm/lib/transformations/preset/query.js.map +1 -1
  95. package/dist/esm/lib/transformations/preset/update.js +1 -1
  96. package/dist/esm/lib/transformations/preset/update.js.map +1 -1
  97. package/dist/esm/lib/transformations/reduceTransformation.js +4 -4
  98. package/dist/esm/lib/transformations/reduceTransformation.js.map +1 -1
  99. package/dist/esm/lib/transformations/validations/common.js +1 -1
  100. package/dist/esm/lib/transformations/validations/common.js.map +1 -1
  101. package/dist/esm/lib/transformations/validations/validateRequestTransformation.js +5 -5
  102. package/dist/esm/lib/transformations/validations/validateRequestTransformation.js.map +1 -1
  103. package/dist/esm/lib/transformations/validations/validateResponseTransformation.js +6 -6
  104. package/dist/esm/lib/transformations/validations/validateResponseTransformation.js.map +1 -1
  105. package/dist/tsconfig.tsbuildinfo +1 -1
  106. package/dist/types/index.d.ts +6 -6
  107. package/dist/types/index.d.ts.map +1 -1
  108. package/dist/types/lib/transformations/preset/create.d.ts +1 -1
  109. package/dist/types/lib/transformations/preset/create.d.ts.map +1 -1
  110. package/dist/types/lib/transformations/preset/get.d.ts +1 -1
  111. package/dist/types/lib/transformations/preset/get.d.ts.map +1 -1
  112. package/dist/types/lib/transformations/preset/list.d.ts +1 -1
  113. package/dist/types/lib/transformations/preset/list.d.ts.map +1 -1
  114. package/dist/types/lib/transformations/preset/update.d.ts +1 -1
  115. package/dist/types/lib/transformations/preset/update.d.ts.map +1 -1
  116. package/dist/types/lib/transformations/validations/validateRequestTransformation.d.ts.map +1 -1
  117. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"names":["_motionRuntimeTestContext","require","_","list","buildRequestTransformation","buildResponseTransformation","preset","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';\n\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;AAEA,IAAAC,CAAA,GAAAD,OAAA;AAEA,MAAM;EACJE,IAAI,EAAE;IAAEC,0BAA0B;IAAEC;EAA4B;AAClE,CAAC,GAAGC,QAAM;AAEVC,QAAQ,CAAC,6BAA6B,EAAE,MAAM;EAC5CA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IAC3C;IACAC,IAAI,CAAC,gDAAgD,EAAE,MAAM;MAC3D,MAAMC,oBAAoB,GAAGL,0BAA0B,CAAC,CAAC;MAEzDM,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,GAAGJ,2BAA2B,CAAC;QACvDO;MACF,CAAC,CAAC;MAEFF,MAAM,CAACD,oBAAoB,CAAC,CAACE,aAAa,CACxC,KAAKC,yBAAyB,EAChC,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_index","list","buildRequestTransformation","buildResponseTransformation","preset","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';\n\nimport { preset } from '../../../index.js';\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;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAEA,MAAM;EACJE,IAAI,EAAE;IAAEC,0BAA0B;IAAEC;EAA4B;AAClE,CAAC,GAAGC,aAAM;AAEVC,QAAQ,CAAC,6BAA6B,EAAE,MAAM;EAC5CA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IAC3C;IACAC,IAAI,CAAC,gDAAgD,EAAE,MAAM;MAC3D,MAAMC,oBAAoB,GAAGL,0BAA0B,CAAC,CAAC;MAEzDM,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,GAAGJ,2BAA2B,CAAC;QACvDO;MACF,CAAC,CAAC;MAEFF,MAAM,CAACD,oBAAoB,CAAC,CAACE,aAAa,CACxC,KAAKC,yBAAyB,EAChC,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -2,13 +2,13 @@
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
4
  var _lodash = require("lodash");
5
- var _ = require("../../..");
5
+ var _index = require("../../../index.js");
6
6
  const {
7
7
  query: {
8
8
  buildRequestTransformation,
9
9
  buildResponseTransformation
10
10
  }
11
- } = _.preset;
11
+ } = _index.preset;
12
12
  describe('query-method transformations', () => {
13
13
  describe('buildRequestTransformation', () => {
14
14
  // eslint-disable-next-line max-len
@@ -1 +1 @@
1
- {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","query","buildRequestTransformation","buildResponseTransformation","preset","describe","test","requestQueryObjectPropertyName","aString","transformationString","expect","toStrictEqual","responseMessageResultPath","responseMessagePagingMetadataPath","times","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';\n\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;AAEA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAM;EACJG,KAAK,EAAE;IAAEC,0BAA0B;IAAEC;EAA4B;AACnE,CAAC,GAAGC,QAAM;AAEVC,QAAQ,CAAC,8BAA8B,EAAE,MAAM;EAC7CA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IAC3C;IACAC,IAAI,CAAC,4GAA4G,EAAE,MAAM;MACvH,MAAMC,8BAA8B,GAAG,IAAAC,iCAAO,EAAC,CAAC;MAChD,MAAMC,oBAAoB,GAAGP,0BAA0B,CAAC;QACtDK;MACF,CAAC,CAAC;MAEFG,MAAM,CAACD,oBAAoB,CAAC,CAACE,aAAa,CAAC;QACzC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CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_index","query","buildRequestTransformation","buildResponseTransformation","preset","describe","test","requestQueryObjectPropertyName","aString","transformationString","expect","toStrictEqual","responseMessageResultPath","responseMessagePagingMetadataPath","times","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';\n\nimport { preset } from '../../../index.js';\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 '@itemT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AAa,CAAC;QACzCK,KAAK,EAAE,KAAKJ,yBAAyB,EAAE;QACvCK,cAAc,EAAE,KAAKJ,iCAAiC;MACxD,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFP,IAAI,CAAC,2CAA2C,EAAE,MAAM;MACtD,MAAMY,kBAAkB,GAAG,eAAe,IAAAV,iCAAO,EAAC,CAAC,EAAE;MACrD,MAAMO,oBAAoB,GAAGZ,2BAA2B,CAAC;QACvDS,yBAAyB;QACzBC,iCAAiC;QACjCK;MACF,CAAC,CAAC;MAEFR,MAAM,CAACK,oBAAoB,CAAC,CAACJ,aAAa,CAAC;QACzCK,KAAK,EAAE;UACL,OAAO,EAAE,KAAKJ,yBAAyB,EAAE;UACzC,qBAAqB,EAAEM;QACzB,CAAC;QACDD,cAAc,EAAE,KAAKJ,iCAAiC;MACxD,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -2,13 +2,13 @@
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
4
  var _lodash = require("lodash");
5
- var _ = require("../../..");
5
+ var _index = require("../../../index.js");
6
6
  const {
7
7
  update: {
8
8
  buildRequestTransformation,
9
9
  buildResponseTransformation
10
10
  }
11
- } = _.preset;
11
+ } = _index.preset;
12
12
  describe('update-method transformations', () => {
13
13
  describe('buildRequestTransformation', () => {
14
14
  const requestMessageOptionsPath = (0, _motionRuntimeTestContext.aString)();
@@ -1 +1 @@
1
- {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","update","buildRequestTransformation","buildResponseTransformation","preset","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';\n\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;AAEA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAM;EACJG,MAAM,EAAE;IAAEC,0BAA0B;IAAEC;EAA4B;AACpE,CAAC,GAAGC,QAAM;AAEVC,QAAQ,CAAC,+BAA+B,EAAE,MAAM;EAC9CA,QAAQ,CAAC,4BAA4B,EAAE,MAAM;IAC3C,MAAMC,yBAAyB,GAAG,IAAAC,iCAAO,EAAC,CAAC;IAC3C,MAAMC,wBAAwB,GAAG,IAAAD,iCAAO,EAAC,CAAC;IAC1C,MAAME,mCAAmC,GAAG,IAAAF,iCAAO,EAAC,CAAC;IAErDG,IAAI,CAAC,sGAAsG,EAAE,MAAM;MACjH,MAAMC,iBAAiB,GAAGT,0BAA0B,CAAC;QACnDO,mCAAmC;QACnCD;MACF,CAAC,CAAC;MAEFI,MAAM,CAACD,iBAAiB,CAAC,CAACE,aAAa,CAAC;QACtC,CAACL,wBAAwB,GAAG;UAC1B,CAACC,mCAAmC,GAAG,MAAM;UAC7C,GAAG,EAAE;QACP;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEFC,IAAI,CAAC,kGAAkG,EAAE,MAAM;MAC7G,MAAMC,iBAAiB,GAAGT,0BAA0B,CAAC;QACnDO,mCAAmC;QACnCD,wBAAwB;QACxBF;MACF,CAAC,CAAC;MAEFM,MAAM,CAACD,iBAAiB,CAAC,CAACE,aAAa,CAAC;QACtC,CAACL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C,MAAM,EAAE,MAAM;QACtB;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFJ,QAAQ,CAAC,6BAA6B,EAAE,MAAM;IAC5CK,IAAI,CAAC,iDAAiD,EAAE,MAAM;MAC5D,MAAMU,yBAAyB,GAAG,IAAAb,iCAAO,EAAC,CAAC;MAE3C,MAAMc,oBAAoB,GAAGlB,2BAA2B,CAAC;QACvDiB;MACF,CAAC,CAAC;MAEFR,MAAM,CAACS,oBAAoB,CAAC,CAACR,aAAa,CACxC,KAAKO,yBAAyB,EAChC,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_index","update","buildRequestTransformation","buildResponseTransformation","preset","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';\n\nimport { preset } from '../../../index.js';\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;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAM;EACJG,MAAM,EAAE;IAAEC,0BAA0B;IAAEC;EAA4B;AACpE,CAAC,GAAGC,aAAM;AAEV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runtime-test-context");
4
4
  var _lodash = require("lodash");
5
- var _ = require("../..");
5
+ var _index = require("../../index.js");
6
6
  const {
7
7
  validateRequestTransformation
8
- } = _.validation;
8
+ } = _index.validation;
9
9
  describe('validateRequestTransformation', () => {
10
10
  describe('valid transformations', () => {
11
11
  const validResults = {
@@ -1 +1 @@
1
- {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","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 { aNumber, aString } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\n\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;AAEA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAM;EAAEG;AAA8B,CAAC,GAAGC,YAAU;AAEpDC,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;MAC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C;YAClBC,UAAU,EAAE,OAAO;YACnBC,YAAY,EAAE4B,mBAAmB;YACjC3B,WAAW,EAAEK;UACf,CAAC,CACH,CAAC;QACH,CAAC,CAAC;MACJ,CACF,CAAC;MAEDjB,QAAQ,CAAC,gBAAgB,EAAE,MAAM;QAC/BA,QAAQ,CAACe,IAAI,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CACjD,IAAI,EACHyB,YAAY,IAAK;UAChB,MAAMD,mBAAmB,GAAG,YAAYC,YAAY,EAAE;UACtD;UACA,MAAMvB,yBAAyB,GAAG,mBAAmBuB,YAAY,2BAA2BA,YAAY,UAAU;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","ignoreList":[]}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_index","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 { aNumber, aString } from '@wix/motion-runtime-test-context';\nimport { times } from 'lodash';\n\nimport { validation } from '../../index.js';\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: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AG,YAAYC,YAAY,EAAE;UACtD;UACA,MAAMvB,yBAAyB,GAAG,mBAAmBuB,YAAY,2BAA2BA,YAAY,UAAU;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","ignoreList":[]}
@@ -2,10 +2,10 @@
2
2
 
3
3
  var _motionRuntimeTestContext = require("@wix/motion-runtime-test-context");
4
4
  var _lodash = require("lodash");
5
- var _ = require("../..");
5
+ var _index = require("../../index.js");
6
6
  const {
7
7
  validateResponseTransformation
8
- } = _.validation;
8
+ } = _index.validation;
9
9
  describe('validateResponseTransformation', () => {
10
10
  describe('valid transformations', () => {
11
11
  const validResults = {
@@ -1 +1 @@
1
- {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_","validateResponseTransformation","validation","describe","validResults","isValid","validationErrors","test","validTransformation","expect","toStrictEqual","aaa","parentKey","aString","validationErrorWith","parentPath","invalidValue","description","arrayContaining","objectContaining","transformation","each","transformationKey","expectedValidationMessage","d","e","f","invalidCustomFunctionName","a","b","c","expectedParentPath","invalidCustomFunctionExpression","argumentExpression","path","set","transformationValue","specialField","invalidSourceValue","invalidSourceTransformation","times","invalidTransformation","transformationWithOmitValue","value","nonArray","nonStringArray","aNumber","arrayWithInvalidPaths","validValue","invalidPathTransformationWith","invalidPathValue","aRandomItemFrom","aBoolean","anObject","invalidPathTransformation"],"sources":["../../../../src/__tests__/validations/validateResponseTransformation.spec.ts"],"sourcesContent":["import {\n aBoolean,\n anObject,\n aNumber,\n aRandomItemFrom,\n aString,\n} from '@wix/motion-runtime-test-context';\nimport { set, times } from 'lodash';\n\nimport { validation } from '../..';\n\nconst { validateResponseTransformation } = validation;\n\ndescribe('validateResponseTransformation', () => {\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 = '$.a.b.c';\n\n expect(validateResponseTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n\n test('returns valid transformation response for a valid complex transformation', () => {\n const validTransformation = { aaa: '$.a.b.c' };\n\n expect(validateResponseTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n });\n\n describe('invalid transformations', () => {\n const parentKey = aString();\n\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 simple transformations', () => {\n test('returns a validation error when the transformation starts with an index argument', () => {\n const transformation = '$[0].a.b.c';\n\n expect(validateResponseTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformation,\n description: \"must be a string starting with '$.'\",\n }),\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 be a string starting with '$.'\"}\n ${'refers to the root identifier'} | ${'$'} | ${'cannot refer to $ in a transformation key'}\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]: '$.a.b.c' } } },\n '*': '$[1]',\n };\n\n expect(validateResponseTransformation(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('custom function expressions', () => {\n const invalidCustomFunctionName = '#1a';\n\n describe('invalid custom function-name is used', () => {\n test.each`\n description | transformation | expectedParentPath\n ${'top level'} | ${invalidCustomFunctionName} | ${null}\n ${'nested'} | ${{ a: { b: { c: invalidCustomFunctionName } } }} | ${'a.b.c'}\n `(\n 'returns a validation error for $description cases',\n ({ expectedParentPath, transformation }) => {\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: invalidCustomFunctionName,\n description: 'contains an invalid custom function expression',\n }),\n );\n },\n );\n });\n\n describe('a custom function argument is invalid in response transformation', () => {\n const invalidCustomFunctionExpression = '#someFunction($[0])';\n\n test.each`\n description | transformation | expectedParentPath\n ${'top level'} | ${invalidCustomFunctionExpression} | ${null}\n ${'nested'} | ${{ a: { b: { c: invalidCustomFunctionExpression } } }} | ${'a.b.c'}\n `(\n 'returns a validation error for $description cases',\n ({ expectedParentPath, transformation }) => {\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: '$[0]',\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n\n test('returns a validation error when an argument index is used', () => {\n const argumentExpression = '$[1].a.b.c.';\n const path = 'd.e.f';\n const transformation = set({}, path, argumentExpression);\n\n expect(validateResponseTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: path,\n invalidValue: argumentExpression,\n description: \"must be a string starting with '$.'\",\n }),\n );\n });\n });\n\n describe.each`\n description | transformationValue | expectedValidationMessage\n ${'does not start with $'} | ${'a.b.c'} | ${\"must be a string starting with '$.'\"}\n ${'refers to * in the path'} | ${'$.a.b.*'} | ${'cannot refer to the * operator'}\n `(\n 'returns a validation error when a transformation value segment $description',\n ({ transformationValue, expectedValidationMessage }) => {\n test('simple transformation', () => {\n expect(\n validateResponseTransformation(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 = { d: { e: { f: transformationValue } } };\n\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\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 expectedValidationMessage = `cannot refer to the ${specialField} field`;\n\n test('returns a validation error when a transformation value segment $description', () => {\n const transformation = {\n d: { e: { f: { [specialField]: '$.a.b.c' } } },\n '*': '$[1]',\n };\n\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\n invalidValue: specialField,\n description: expectedValidationMessage,\n }),\n );\n });\n\n describe('simple transformation', () => {\n test(`returns a validation error when a segment refers to the special field ${specialField}`, () => {\n const transformationValue = `$.a.b.${specialField}`;\n\n expect(\n validateResponseTransformation(transformationValue),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n });\n\n test('complex transformation', () => {\n const transformationValue = `$.a.b.${specialField}`;\n const transformation = { d: { e: { f: transformationValue } } };\n\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n },\n );\n });\n });\n\n describe('omit transformation', () => {\n describe('invalid @source', () => {\n const invalidSourceValue = '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 validateResponseTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: invalidSourceValue,\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n\n describe('invalid @omit', () => {\n const transformationWithOmitValue = (value) => ({\n '@source': '$.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 ({ description, invalidTransformation, expectedParentPath }) => {\n test(`returns a validation error for invalid ${description} transformation`, () => {\n expect(\n validateResponseTransformation(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 ({ description, invalidTransformation, expectedParentPath }) => {\n test(`returns a validation error for invalid ${description} transformation`, () => {\n expect(\n validateResponseTransformation(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 of 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 validateResponseTransformation(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('array-item transformation', () => {\n const validValue = '$.d.e.f';\n\n const invalidPathTransformationWith = (invalidPathValue) => ({\n '@path': invalidPathValue,\n '@itemTransformation': validValue,\n });\n\n describe.each`\n invalidValue | description\n ${'$[0].should.fail'} | ${'invalid path value'}\n ${aRandomItemFrom([aBoolean(), aNumber(), anObject()])} | ${'invalid path type'}\n `('$description', ({ invalidValue }) => {\n test.each`\n description | invalidTransformation | expectedParentPath\n ${'top-level'} | ${invalidPathTransformationWith(invalidValue)} | ${'@path'}\n ${'nested'} | ${{ [parentKey]: invalidPathTransformationWith(invalidValue) }} | ${`${parentKey}.@path`}\n `(\n 'returns a validation error when the @path value is invalid for $description transformation',\n ({ invalidTransformation, expectedParentPath }) => {\n expect(\n validateResponseTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue,\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n\n describe('invalid @itemTransformation', () => {\n const invalidValue = '$[0].should.fail';\n const invalidPathTransformation = {\n '@path': validValue,\n '@itemTransformation': invalidValue,\n };\n\n test.each`\n description | invalidTransformation | expectedParentPath\n ${'top-level'} | ${invalidPathTransformation} | ${'@itemTransformation'}\n ${'nested'} | ${{ [parentKey]: invalidPathTransformation }} | ${`${parentKey}.@itemTransformation`}\n `(\n 'returns a validation error when the @itemTransformation value is invalid for $description transformation',\n ({ invalidTransformation, expectedParentPath }) => {\n expect(\n validateResponseTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue,\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n });\n });\n});\n"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,CAAA,GAAAF,OAAA;AAEA,MAAM;EAAEG;AAA+B,CAAC,GAAGC,YAAU;AAErDC,QAAQ,CAAC,gCAAgC,EAAE,MAAM;EAC/CA,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,SAAS;MAErCC,MAAM,CAACR,8BAA8B,CAACO,mBAAmB,CAAC,CAAC,CAACE,aAAa,CACvEN,YACF,CAAC;IACH,CAAC,CAAC;IAEFG,IAAI,CAAC,0EAA0E,EAAE,MAAM;MACrF,MAAMC,mBAAmB,GAAG;QAAEG,GAAG,EAAE;MAAU,CAAC;MAE9CF,MAAM,CAACR,8BAA8B,CAACO,mBAAmB,CAAC,CAAC,CAACE,aAAa,CACvEN,YACF,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFD,QAAQ,CAAC,yBAAyB,EAAE,MAAM;IACxC,MAAMS,SAAS,GAAG,IAAAC,iCAAO,EAAC,CAAC;IAE3B,MAAMC,mBAAmB,GAAGA,CAAC;MAC3BC,UAAU;MACVC,YAAY;MACZC;IACF,CAAC,MAAM;MACLZ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CAACjC,YAAY,CAAC,uBAAuB,OAAO;AACtG,YAAY,QAAQ,SAAS;UAAE,CAACJ,SAAS,GAAGqC,6BAA6B,CAACjC,YAAY;QAAE,CAAC,MAAM,GAAGJ,SAAS,QAAQ;AACnH,SAAS,CACC,4FAA4F,EAC5F,CAAC;UAAE6B,qBAAqB;UAAEV;QAAmB,CAAC,KAAK;UACjDtB,MAAM,CACJR,8BAA8B,CAACwC,qBAAqB,CACtD,CAAC,CAAC/B,aAAa,CACbI,mBAAmB,CAAC;YAClBC,UAAU,EAAEgB,kBAAkB;YAC9Bf,YAAY;YACZC,WAAW,EAAE;UACf,CAAC,CACH,CAAC;QACH,CACF,CAAC;MACH,CAAC,CAAC;MAEFd,QAAQ,CAAC,6BAA6B,EAAE,MAAM;QAC5C,MAAMa,YAAY,GAAG,kBAAkB;QACvC,MAAMsC,yBAAyB,GAAG;UAChC,OAAO,EAAEN,UAAU;UACnB,qBAAqB,EAAEhC;QACzB,CAAC;QAEDT,IAAI,CAACc,IAAI;AACjB;AACA,YAAY,WAAW,MAAMiC,yBAAyB,uBAAuB,qBAAqB;AAClG,YAAY,QAAQ,SAAS;UAAE,CAAC1C,SAAS,GAAG0C;QAA0B,CAAC,MAAM,GAAG1C,SAAS,sBAAsB;AAC/G,SAAS,CACC,0GAA0G,EAC1G,CAAC;UAAE6B,qBAAqB;UAAEV;QAAmB,CAAC,KAAK;UACjDtB,MAAM,CACJR,8BAA8B,CAACwC,qBAAqB,CACtD,CAAC,CAAC/B,aAAa,CACbI,mBAAmB,CAAC;YAClBC,UAAU,EAAEgB,kBAAkB;YAC9Bf,YAAY;YACZC,WAAW,EAAE;UACf,CAAC,CACH,CAAC;QACH,CACF,CAAC;MACH,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_motionRuntimeTestContext","require","_lodash","_index","validateResponseTransformation","validation","describe","validResults","isValid","validationErrors","test","validTransformation","expect","toStrictEqual","aaa","parentKey","aString","validationErrorWith","parentPath","invalidValue","description","arrayContaining","objectContaining","transformation","each","transformationKey","expectedValidationMessage","d","e","f","invalidCustomFunctionName","a","b","c","expectedParentPath","invalidCustomFunctionExpression","argumentExpression","path","set","transformationValue","specialField","invalidSourceValue","invalidSourceTransformation","times","invalidTransformation","transformationWithOmitValue","value","nonArray","nonStringArray","aNumber","arrayWithInvalidPaths","validValue","invalidPathTransformationWith","invalidPathValue","aRandomItemFrom","aBoolean","anObject","invalidPathTransformation"],"sources":["../../../../src/__tests__/validations/validateResponseTransformation.spec.ts"],"sourcesContent":["import {\n aBoolean,\n anObject,\n aNumber,\n aRandomItemFrom,\n aString,\n} from '@wix/motion-runtime-test-context';\nimport { set, times } from 'lodash';\n\nimport { validation } from '../../index.js';\n\nconst { validateResponseTransformation } = validation;\n\ndescribe('validateResponseTransformation', () => {\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 = '$.a.b.c';\n\n expect(validateResponseTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n\n test('returns valid transformation response for a valid complex transformation', () => {\n const validTransformation = { aaa: '$.a.b.c' };\n\n expect(validateResponseTransformation(validTransformation)).toStrictEqual(\n validResults,\n );\n });\n });\n\n describe('invalid transformations', () => {\n const parentKey = aString();\n\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 simple transformations', () => {\n test('returns a validation error when the transformation starts with an index argument', () => {\n const transformation = '$[0].a.b.c';\n\n expect(validateResponseTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformation,\n description: \"must be a string starting with '$.'\",\n }),\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 be a string starting with '$.'\"}\n ${'refers to the root identifier'} | ${'$'} | ${'cannot refer to $ in a transformation key'}\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]: '$.a.b.c' } } },\n '*': '$[1]',\n };\n\n expect(validateResponseTransformation(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('custom function expressions', () => {\n const invalidCustomFunctionName = '#1a';\n\n describe('invalid custom function-name is used', () => {\n test.each`\n description | transformation | expectedParentPath\n ${'top level'} | ${invalidCustomFunctionName} | ${null}\n ${'nested'} | ${{ a: { b: { c: invalidCustomFunctionName } } }} | ${'a.b.c'}\n `(\n 'returns a validation error for $description cases',\n ({ expectedParentPath, transformation }) => {\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: invalidCustomFunctionName,\n description: 'contains an invalid custom function expression',\n }),\n );\n },\n );\n });\n\n describe('a custom function argument is invalid in response transformation', () => {\n const invalidCustomFunctionExpression = '#someFunction($[0])';\n\n test.each`\n description | transformation | expectedParentPath\n ${'top level'} | ${invalidCustomFunctionExpression} | ${null}\n ${'nested'} | ${{ a: { b: { c: invalidCustomFunctionExpression } } }} | ${'a.b.c'}\n `(\n 'returns a validation error for $description cases',\n ({ expectedParentPath, transformation }) => {\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: '$[0]',\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n\n test('returns a validation error when an argument index is used', () => {\n const argumentExpression = '$[1].a.b.c.';\n const path = 'd.e.f';\n const transformation = set({}, path, argumentExpression);\n\n expect(validateResponseTransformation(transformation)).toStrictEqual(\n validationErrorWith({\n parentPath: path,\n invalidValue: argumentExpression,\n description: \"must be a string starting with '$.'\",\n }),\n );\n });\n });\n\n describe.each`\n description | transformationValue | expectedValidationMessage\n ${'does not start with $'} | ${'a.b.c'} | ${\"must be a string starting with '$.'\"}\n ${'refers to * in the path'} | ${'$.a.b.*'} | ${'cannot refer to the * operator'}\n `(\n 'returns a validation error when a transformation value segment $description',\n ({ transformationValue, expectedValidationMessage }) => {\n test('simple transformation', () => {\n expect(\n validateResponseTransformation(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 = { d: { e: { f: transformationValue } } };\n\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\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 expectedValidationMessage = `cannot refer to the ${specialField} field`;\n\n test('returns a validation error when a transformation value segment $description', () => {\n const transformation = {\n d: { e: { f: { [specialField]: '$.a.b.c' } } },\n '*': '$[1]',\n };\n\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\n invalidValue: specialField,\n description: expectedValidationMessage,\n }),\n );\n });\n\n describe('simple transformation', () => {\n test(`returns a validation error when a segment refers to the special field ${specialField}`, () => {\n const transformationValue = `$.a.b.${specialField}`;\n\n expect(\n validateResponseTransformation(transformationValue),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: null,\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n });\n\n test('complex transformation', () => {\n const transformationValue = `$.a.b.${specialField}`;\n const transformation = { d: { e: { f: transformationValue } } };\n\n expect(\n validateResponseTransformation(transformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: 'd.e.f',\n invalidValue: transformationValue,\n description: expectedValidationMessage,\n }),\n );\n });\n },\n );\n });\n });\n\n describe('omit transformation', () => {\n describe('invalid @source', () => {\n const invalidSourceValue = '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 validateResponseTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue: invalidSourceValue,\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n\n describe('invalid @omit', () => {\n const transformationWithOmitValue = (value) => ({\n '@source': '$.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 ({ description, invalidTransformation, expectedParentPath }) => {\n test(`returns a validation error for invalid ${description} transformation`, () => {\n expect(\n validateResponseTransformation(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 ({ description, invalidTransformation, expectedParentPath }) => {\n test(`returns a validation error for invalid ${description} transformation`, () => {\n expect(\n validateResponseTransformation(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 of 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 validateResponseTransformation(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('array-item transformation', () => {\n const validValue = '$.d.e.f';\n\n const invalidPathTransformationWith = (invalidPathValue) => ({\n '@path': invalidPathValue,\n '@itemTransformation': validValue,\n });\n\n describe.each`\n invalidValue | description\n ${'$[0].should.fail'} | ${'invalid path value'}\n ${aRandomItemFrom([aBoolean(), aNumber(), anObject()])} | ${'invalid path type'}\n `('$description', ({ invalidValue }) => {\n test.each`\n description | invalidTransformation | expectedParentPath\n ${'top-level'} | ${invalidPathTransformationWith(invalidValue)} | ${'@path'}\n ${'nested'} | ${{ [parentKey]: invalidPathTransformationWith(invalidValue) }} | ${`${parentKey}.@path`}\n `(\n 'returns a validation error when the @path value is invalid for $description transformation',\n ({ invalidTransformation, expectedParentPath }) => {\n expect(\n validateResponseTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue,\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n\n describe('invalid @itemTransformation', () => {\n const invalidValue = '$[0].should.fail';\n const invalidPathTransformation = {\n '@path': validValue,\n '@itemTransformation': invalidValue,\n };\n\n test.each`\n description | invalidTransformation | expectedParentPath\n ${'top-level'} | ${invalidPathTransformation} | ${'@itemTransformation'}\n ${'nested'} | ${{ [parentKey]: invalidPathTransformation }} | ${`${parentKey}.@itemTransformation`}\n `(\n 'returns a validation error when the @itemTransformation value is invalid for $description transformation',\n ({ invalidTransformation, expectedParentPath }) => {\n expect(\n validateResponseTransformation(invalidTransformation),\n ).toStrictEqual(\n validationErrorWith({\n parentPath: expectedParentPath,\n invalidValue,\n description: \"must be a string starting with '$.'\",\n }),\n );\n },\n );\n });\n });\n });\n});\n"],"mappings":";;AAAA,IAAAA,yBAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAEA,MAAM;EAAEG;AAA+B,CAAC,GAAGC,iBAAU;AAErDC,QAAQ,CAAC,gCAAgC,EAAE,MAAM;EAC/CA,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,SAAS;MAErCC,MAAM,CAACR,8BAA8B,CAACO,mBAAmB,CAAC,CAAC,CAACE,aAAa,CACvEN,YACF,CAAC;IACH,CAAC,CAAC;IAEFG,IAAI,CAAC,0EAA0E,EAAE,MAAM;MACrF,MAAMC,mBAAmB,GAAG;QAAEG,GAAG,EAAE;MAAU,CAAC;MAE9CF,MAAM,CAACR,8BAA8B,CAACO,mBAAmB,CAAC,CAAC,CAACE,aAAa,CACvEN,YACF,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFD,QAAQ,CAAC,yBAAyB,EAAE,MAAM;IACxC,MAAMS,SAAS,GAAG,IAAAC,iCAAO,EAAC,CAAC;IAE3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/cjs/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.validation = exports.transformations = exports.preset = exports.namingHints = exports.corvidEntities = void 0;
5
- var _corvidEntity = require("./lib/corvid-entity");
6
- var _getArgumentCardinality = require("./lib/getArgumentCardinality");
5
+ var _index = require("./lib/corvid-entity/index.js");
6
+ var _getArgumentCardinality = require("./lib/getArgumentCardinality.js");
7
7
  exports.getArgumentCardinality = _getArgumentCardinality.getArgumentCardinality;
8
- var _helpers = require("./lib/helpers");
8
+ var _helpers = require("./lib/helpers.js");
9
9
  exports.extractIndexAndPath = _helpers.extractIndexAndPath;
10
10
  exports.getArgumentIndex = _helpers.getArgumentIndex;
11
11
  exports.isArrayIndexString = _helpers.isArrayIndexString;
@@ -18,21 +18,21 @@ exports.isSimpleTransformation = _helpers.isSimpleTransformation;
18
18
  exports.isSpreadOperator = _helpers.isSpreadOperator;
19
19
  exports.parseOmitTransformation = _helpers.parseOmitTransformation;
20
20
  exports.stripJsonPathRootPrefix = _helpers.stripJsonPathRootPrefix;
21
- var _common = require("./lib/transformations/common");
22
- var _customFunctions = require("./lib/transformations/custom-functions");
21
+ var _common = require("./lib/transformations/common.js");
22
+ var _customFunctions = require("./lib/transformations/custom-functions.js");
23
23
  exports.isFunctionCallExpression = _customFunctions.isFunctionCallExpression;
24
24
  exports.parseCustomFunctionCall = _customFunctions.parseCustomFunctionCall;
25
25
  exports.runCustomFunctionCallExpression = _customFunctions.runCustomFunctionCallExpression;
26
- var _create = require("./lib/transformations/preset/create");
27
- var _delete = require("./lib/transformations/preset/delete");
28
- var _get = require("./lib/transformations/preset/get");
29
- var _list = require("./lib/transformations/preset/list");
30
- var _query = require("./lib/transformations/preset/query");
31
- var _update = require("./lib/transformations/preset/update");
32
- var _reduceTransformation = require("./lib/transformations/reduceTransformation");
26
+ var _create = require("./lib/transformations/preset/create.js");
27
+ var _delete = require("./lib/transformations/preset/delete.js");
28
+ var _get = require("./lib/transformations/preset/get.js");
29
+ var _list = require("./lib/transformations/preset/list.js");
30
+ var _query = require("./lib/transformations/preset/query.js");
31
+ var _update = require("./lib/transformations/preset/update.js");
32
+ var _reduceTransformation = require("./lib/transformations/reduceTransformation.js");
33
33
  exports.reduceTransformation = _reduceTransformation.reduceTransformation;
34
- var _validateRequestTransformation = require("./lib/transformations/validations/validateRequestTransformation");
35
- var _validateResponseTransformation = require("./lib/transformations/validations/validateResponseTransformation");
34
+ var _validateRequestTransformation = require("./lib/transformations/validations/validateRequestTransformation.js");
35
+ var _validateResponseTransformation = require("./lib/transformations/validations/validateResponseTransformation.js");
36
36
  const {
37
37
  JS_SINGLE_ARG_UNCHANGED,
38
38
  RESPONSE_OBJECT_UNCHANGED,
@@ -73,7 +73,7 @@ const validation = exports.validation = {
73
73
  validateResponseTransformation: _validateResponseTransformation.validateResponseTransformation
74
74
  };
75
75
  const corvidEntities = exports.corvidEntities = {
76
- toCorvidName: _corvidEntity.toCorvidName,
77
- fromCorvidName: _corvidEntity.fromCorvidName
76
+ toCorvidName: _index.toCorvidName,
77
+ fromCorvidName: _index.fromCorvidName
78
78
  };
79
79
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_corvidEntity","require","_getArgumentCardinality","exports","getArgumentCardinality","_helpers","extractIndexAndPath","getArgumentIndex","isArrayIndexString","isIdentityResponseTransformation","isJsonPathExpression","isMapArrayItemsTransformation","isOmitTransformation","isRootObjectIdentifier","isSimpleTransformation","isSpreadOperator","parseOmitTransformation","stripJsonPathRootPrefix","_common","_customFunctions","isFunctionCallExpression","parseCustomFunctionCall","runCustomFunctionCallExpression","_create","_delete","_get","_list","_query","_update","_reduceTransformation","reduceTransformation","_validateRequestTransformation","_validateResponseTransformation","JS_SINGLE_ARG_UNCHANGED","RESPONSE_OBJECT_UNCHANGED","ARRAY_ITEMS_PATH_PROPERTY_NAME","ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME","OMIT_SOURCE_PROPERTY_NAME","FIELDS_TO_OMIT_PROPERTY_NAME","allTransformations","transformations","transformationBuilder","buildRequestTransformation","buildResponseTransformation","preset","create","buildCreateRequestTransformation","buildCreateResponseTransformation","update","buildUpdateRequestTransformation","buildUpdateResponseTransformation","delete","buildDeleteRequestTransformation","buildDeleteResponseTransformation","get","buildGetRequestTransformation","buildGetResponseTransformation","list","buildListRequestTransformation","buildListResponseTransformation","query","buildQueryRequestTransformation","buildQueryResponseTransformation","ITEMS_RESULT_PROPERTY_NAME","PAGING_METADATA_RESULT_PROPERTY_NAME","namingHints","OPTIONS","validation","validateRequestTransformation","validateResponseTransformation","corvidEntities","toCorvidName","fromCorvidName"],"sources":["../../src/index.ts"],"sourcesContent":["import { fromCorvidName, toCorvidName } from './lib/corvid-entity';\nimport { getArgumentCardinality } from './lib/getArgumentCardinality';\nimport {\n extractIndexAndPath,\n getArgumentIndex,\n isArrayIndexString,\n isIdentityResponseTransformation,\n isJsonPathExpression,\n isMapArrayItemsTransformation,\n isOmitTransformation,\n isRootObjectIdentifier,\n isSimpleTransformation,\n isSpreadOperator,\n parseOmitTransformation,\n stripJsonPathRootPrefix,\n} from './lib/helpers';\nimport { transformations as allTransformations } from './lib/transformations/common';\n\nconst {\n JS_SINGLE_ARG_UNCHANGED,\n RESPONSE_OBJECT_UNCHANGED,\n ARRAY_ITEMS_PATH_PROPERTY_NAME,\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME,\n OMIT_SOURCE_PROPERTY_NAME,\n FIELDS_TO_OMIT_PROPERTY_NAME,\n} = allTransformations;\n\nconst transformations = {\n JS_SINGLE_ARG_UNCHANGED,\n RESPONSE_OBJECT_UNCHANGED,\n ARRAY_ITEMS_PATH_PROPERTY_NAME,\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME,\n OMIT_SOURCE_PROPERTY_NAME,\n FIELDS_TO_OMIT_PROPERTY_NAME,\n};\n\nimport {\n isFunctionCallExpression,\n parseCustomFunctionCall,\n runCustomFunctionCallExpression,\n} from './lib/transformations/custom-functions';\nimport {\n buildRequestTransformation as buildCreateRequestTransformation,\n buildResponseTransformation as buildCreateResponseTransformation,\n} from './lib/transformations/preset/create';\nimport {\n buildRequestTransformation as buildDeleteRequestTransformation,\n buildResponseTransformation as buildDeleteResponseTransformation,\n} from './lib/transformations/preset/delete';\nimport {\n buildRequestTransformation as buildGetRequestTransformation,\n buildResponseTransformation as buildGetResponseTransformation,\n} from './lib/transformations/preset/get';\nimport {\n buildRequestTransformation as buildListRequestTransformation,\n buildResponseTransformation as buildListResponseTransformation,\n} from './lib/transformations/preset/list';\nimport {\n buildRequestTransformation as buildQueryRequestTransformation,\n buildResponseTransformation as buildQueryResponseTransformation,\n ITEMS_RESULT_PROPERTY_NAME,\n PAGING_METADATA_RESULT_PROPERTY_NAME,\n} from './lib/transformations/preset/query';\nimport {\n buildRequestTransformation as buildUpdateRequestTransformation,\n buildResponseTransformation as buildUpdateResponseTransformation,\n} from './lib/transformations/preset/update';\nimport { reduceTransformation } from './lib/transformations/reduceTransformation';\nimport { validateRequestTransformation } from './lib/transformations/validations/validateRequestTransformation';\nimport { validateResponseTransformation } from './lib/transformations/validations/validateResponseTransformation';\n\nconst transformationBuilder = (\n buildRequestTransformation,\n buildResponseTransformation,\n) => ({\n buildRequestTransformation,\n buildResponseTransformation,\n});\n\nconst preset = {\n create: transformationBuilder(\n buildCreateRequestTransformation,\n buildCreateResponseTransformation,\n ),\n update: transformationBuilder(\n buildUpdateRequestTransformation,\n buildUpdateResponseTransformation,\n ),\n delete: transformationBuilder(\n buildDeleteRequestTransformation,\n buildDeleteResponseTransformation,\n ),\n get: transformationBuilder(\n buildGetRequestTransformation,\n buildGetResponseTransformation,\n ),\n list: transformationBuilder(\n buildListRequestTransformation,\n buildListResponseTransformation,\n ),\n query: {\n ...transformationBuilder(\n buildQueryRequestTransformation,\n buildQueryResponseTransformation,\n ),\n ITEMS_RESULT_PROPERTY_NAME,\n PAGING_METADATA_RESULT_PROPERTY_NAME,\n },\n};\n\nconst namingHints = { OPTIONS: 'OPTIONS' };\n\nconst validation = {\n validateRequestTransformation,\n validateResponseTransformation,\n};\n\nconst corvidEntities = {\n toCorvidName,\n fromCorvidName,\n};\n\nexport {\n corvidEntities,\n extractIndexAndPath,\n getArgumentCardinality,\n getArgumentIndex,\n isArrayIndexString,\n isFunctionCallExpression,\n isIdentityResponseTransformation,\n isJsonPathExpression,\n isMapArrayItemsTransformation,\n isOmitTransformation,\n isRootObjectIdentifier,\n isSimpleTransformation,\n isSpreadOperator,\n namingHints,\n parseCustomFunctionCall,\n parseOmitTransformation,\n preset,\n reduceTransformation,\n runCustomFunctionCallExpression,\n stripJsonPathRootPrefix,\n transformations,\n validation,\n};\n"],"mappings":";;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAAsEE,OAAA,CAAAC,sBAAA,GAAAF,uBAAA,CAAAE,sBAAA;AACtE,IAAAC,QAAA,GAAAJ,OAAA;AAauBE,OAAA,CAAAG,mBAAA,GAAAD,QAAA,CAAAC,mBAAA;AAAAH,OAAA,CAAAI,gBAAA,GAAAF,QAAA,CAAAE,gBAAA;AAAAJ,OAAA,CAAAK,kBAAA,GAAAH,QAAA,CAAAG,kBAAA;AAAAL,OAAA,CAAAM,gCAAA,GAAAJ,QAAA,CAAAI,gCAAA;AAAAN,OAAA,CAAAO,oBAAA,GAAAL,QAAA,CAAAK,oBAAA;AAAAP,OAAA,CAAAQ,6BAAA,GAAAN,QAAA,CAAAM,6BAAA;AAAAR,OAAA,CAAAS,oBAAA,GAAAP,QAAA,CAAAO,oBAAA;AAAAT,OAAA,CAAAU,sBAAA,GAAAR,QAAA,CAAAQ,sBAAA;AAAAV,OAAA,CAAAW,sBAAA,GAAAT,QAAA,CAAAS,sBAAA;AAAAX,OAAA,CAAAY,gBAAA,GAAAV,QAAA,CAAAU,gBAAA;AAAAZ,OAAA,CAAAa,uBAAA,GAAAX,QAAA,CAAAW,uBAAA;AAAAb,OAAA,CAAAc,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C,MAAM,EAAEV,qBAAqB,CAC3BW,kCAAgC,EAChCC,mCACF,CAAC;EACDC,GAAG,EAAEb,qBAAqB,CACxBc,+BAA6B,EAC7BC,gCACF,CAAC;EACDC,IAAI,EAAEhB,qBAAqB,CACzBiB,gCAA8B,EAC9BC,iCACF,CAAC;EACDC,KAAK,EAAE;IACL,GAAGnB,qBAAqB,CACtBoB,iCAA+B,EAC/BC,kCACF,CAAC;IACDC,0BAA0B,EAA1BA,iCAA0B;IAC1BC,oCAAoC,EAApCA;EACF;AACF,CAAC;AAED,MAAMC,WAAW,GAAA9D,OAAA,CAAA8D,WAAA,GAAG;EAAEC,OAAO,EAAE;AAAU,CAAC;AAE1C,MAAMC,UAAU,GAAAhE,OAAA,CAAAgE,UAAA,GAAG;EACjBC,6BAA6B,EAA7BA,4DAA6B;EAC7BC,8BAA8B,EAA9BA;AACF,CAAC;AAED,MAAMC,cAAc,GAAAnE,OAAA,CAAAmE,cAAA,GAAG;EACrBC,YAAY,EAAZA,0BAAY;EACZC,cAAc,EAAdA;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_index","require","_getArgumentCardinality","exports","getArgumentCardinality","_helpers","extractIndexAndPath","getArgumentIndex","isArrayIndexString","isIdentityResponseTransformation","isJsonPathExpression","isMapArrayItemsTransformation","isOmitTransformation","isRootObjectIdentifier","isSimpleTransformation","isSpreadOperator","parseOmitTransformation","stripJsonPathRootPrefix","_common","_customFunctions","isFunctionCallExpression","parseCustomFunctionCall","runCustomFunctionCallExpression","_create","_delete","_get","_list","_query","_update","_reduceTransformation","reduceTransformation","_validateRequestTransformation","_validateResponseTransformation","JS_SINGLE_ARG_UNCHANGED","RESPONSE_OBJECT_UNCHANGED","ARRAY_ITEMS_PATH_PROPERTY_NAME","ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME","OMIT_SOURCE_PROPERTY_NAME","FIELDS_TO_OMIT_PROPERTY_NAME","allTransformations","transformations","transformationBuilder","buildRequestTransformation","buildResponseTransformation","preset","create","buildCreateRequestTransformation","buildCreateResponseTransformation","update","buildUpdateRequestTransformation","buildUpdateResponseTransformation","delete","buildDeleteRequestTransformation","buildDeleteResponseTransformation","get","buildGetRequestTransformation","buildGetResponseTransformation","list","buildListRequestTransformation","buildListResponseTransformation","query","buildQueryRequestTransformation","buildQueryResponseTransformation","ITEMS_RESULT_PROPERTY_NAME","PAGING_METADATA_RESULT_PROPERTY_NAME","namingHints","OPTIONS","validation","validateRequestTransformation","validateResponseTransformation","corvidEntities","toCorvidName","fromCorvidName"],"sources":["../../src/index.ts"],"sourcesContent":["import { fromCorvidName, toCorvidName } from './lib/corvid-entity/index.js';\nimport { getArgumentCardinality } from './lib/getArgumentCardinality.js';\nimport {\n extractIndexAndPath,\n getArgumentIndex,\n isArrayIndexString,\n isIdentityResponseTransformation,\n isJsonPathExpression,\n isMapArrayItemsTransformation,\n isOmitTransformation,\n isRootObjectIdentifier,\n isSimpleTransformation,\n isSpreadOperator,\n parseOmitTransformation,\n stripJsonPathRootPrefix,\n} from './lib/helpers.js';\nimport { transformations as allTransformations } from './lib/transformations/common.js';\n\nconst {\n JS_SINGLE_ARG_UNCHANGED,\n RESPONSE_OBJECT_UNCHANGED,\n ARRAY_ITEMS_PATH_PROPERTY_NAME,\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME,\n OMIT_SOURCE_PROPERTY_NAME,\n FIELDS_TO_OMIT_PROPERTY_NAME,\n} = allTransformations;\n\nconst transformations = {\n JS_SINGLE_ARG_UNCHANGED,\n RESPONSE_OBJECT_UNCHANGED,\n ARRAY_ITEMS_PATH_PROPERTY_NAME,\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME,\n OMIT_SOURCE_PROPERTY_NAME,\n FIELDS_TO_OMIT_PROPERTY_NAME,\n};\n\nimport {\n isFunctionCallExpression,\n parseCustomFunctionCall,\n runCustomFunctionCallExpression,\n} from './lib/transformations/custom-functions.js';\nimport {\n buildRequestTransformation as buildCreateRequestTransformation,\n buildResponseTransformation as buildCreateResponseTransformation,\n} from './lib/transformations/preset/create.js';\nimport {\n buildRequestTransformation as buildDeleteRequestTransformation,\n buildResponseTransformation as buildDeleteResponseTransformation,\n} from './lib/transformations/preset/delete.js';\nimport {\n buildRequestTransformation as buildGetRequestTransformation,\n buildResponseTransformation as buildGetResponseTransformation,\n} from './lib/transformations/preset/get.js';\nimport {\n buildRequestTransformation as buildListRequestTransformation,\n buildResponseTransformation as buildListResponseTransformation,\n} from './lib/transformations/preset/list.js';\nimport {\n buildRequestTransformation as buildQueryRequestTransformation,\n buildResponseTransformation as buildQueryResponseTransformation,\n ITEMS_RESULT_PROPERTY_NAME,\n PAGING_METADATA_RESULT_PROPERTY_NAME,\n} from './lib/transformations/preset/query.js';\nimport {\n buildRequestTransformation as buildUpdateRequestTransformation,\n buildResponseTransformation as buildUpdateResponseTransformation,\n} from './lib/transformations/preset/update.js';\nimport { reduceTransformation } from './lib/transformations/reduceTransformation.js';\nimport { validateRequestTransformation } from './lib/transformations/validations/validateRequestTransformation.js';\nimport { validateResponseTransformation } from './lib/transformations/validations/validateResponseTransformation.js';\n\nconst transformationBuilder = (\n buildRequestTransformation,\n buildResponseTransformation,\n) => ({\n buildRequestTransformation,\n buildResponseTransformation,\n});\n\nconst preset = {\n create: transformationBuilder(\n buildCreateRequestTransformation,\n buildCreateResponseTransformation,\n ),\n update: transformationBuilder(\n buildUpdateRequestTransformation,\n buildUpdateResponseTransformation,\n ),\n delete: transformationBuilder(\n buildDeleteRequestTransformation,\n buildDeleteResponseTransformation,\n ),\n get: transformationBuilder(\n buildGetRequestTransformation,\n buildGetResponseTransformation,\n ),\n list: transformationBuilder(\n buildListRequestTransformation,\n buildListResponseTransformation,\n ),\n query: {\n ...transformationBuilder(\n buildQueryRequestTransformation,\n buildQueryResponseTransformation,\n ),\n ITEMS_RESULT_PROPERTY_NAME,\n PAGING_METADATA_RESULT_PROPERTY_NAME,\n },\n};\n\nconst namingHints = { OPTIONS: 'OPTIONS' };\n\nconst validation = {\n validateRequestTransformation,\n validateResponseTransformation,\n};\n\nconst corvidEntities = {\n toCorvidName,\n fromCorvidName,\n};\n\nexport {\n corvidEntities,\n extractIndexAndPath,\n getArgumentCardinality,\n getArgumentIndex,\n isArrayIndexString,\n isFunctionCallExpression,\n isIdentityResponseTransformation,\n isJsonPathExpression,\n isMapArrayItemsTransformation,\n isOmitTransformation,\n isRootObjectIdentifier,\n isSimpleTransformation,\n isSpreadOperator,\n namingHints,\n parseCustomFunctionCall,\n parseOmitTransformation,\n preset,\n reduceTransformation,\n runCustomFunctionCallExpression,\n stripJsonPathRootPrefix,\n transformations,\n validation,\n};\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAAyEE,OAAA,CAAAC,sBAAA,GAAAF,uBAAA,CAAAE,sBAAA;AACzE,IAAAC,QAAA,GAAAJ,OAAA;AAa0BE,OAAA,CAAAG,mBAAA,GAAAD,QAAA,CAAAC,mBAAA;AAAAH,OAAA,CAAAI,gBAAA,GAAAF,QAAA,CAAAE,gBAAA;AAAAJ,OAAA,CAAAK,kBAAA,GAAAH,QAAA,CAAAG,kBAAA;AAAAL,OAAA,CAAAM,gCAAA,GAAAJ,QAAA,CAAAI,gCAAA;AAAAN,OAAA,CAAAO,oBAAA,GAAAL,QAAA,CAAAK,oBAAA;AAAAP,OAAA,CAAAQ,6BAAA,GAAAN,QAAA,CAAAM,6BAAA;AAAAR,OAAA,CAAAS,oBAAA,GAAAP,QAAA,CAAAO,oBAAA;AAAAT,OAAA,CAAAU,sBAAA,GAAAR,QAAA,CAAAQ,sBAAA;AAAAV,OAAA,CAAAW,sBAAA,GAAAT,QAAA,CAAAS,sBAAA;AAAAX,OAAA,CAAAY,gBAAA,GAAAV,QAAA,CAAAU,gBAAA;AAAAZ,OAAA,CAAAa,uBAAA,GAAAX,QAAA,CAAAW,uBAAA;AAAAb,OAAA,CAAAc,uBAAA,GAAAZ,QAAA,CAAAY,uBA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kCAAgC,EAChCC,mCACF,CAAC;EACDC,GAAG,EAAEb,qBAAqB,CACxBc,+BAA6B,EAC7BC,gCACF,CAAC;EACDC,IAAI,EAAEhB,qBAAqB,CACzBiB,gCAA8B,EAC9BC,iCACF,CAAC;EACDC,KAAK,EAAE;IACL,GAAGnB,qBAAqB,CACtBoB,iCAA+B,EAC/BC,kCACF,CAAC;IACDC,0BAA0B,EAA1BA,iCAA0B;IAC1BC,oCAAoC,EAApCA;EACF;AACF,CAAC;AAED,MAAMC,WAAW,GAAA9D,OAAA,CAAA8D,WAAA,GAAG;EAAEC,OAAO,EAAE;AAAU,CAAC;AAE1C,MAAMC,UAAU,GAAAhE,OAAA,CAAAgE,UAAA,GAAG;EACjBC,6BAA6B,EAA7BA,4DAA6B;EAC7BC,8BAA8B,EAA9BA;AACF,CAAC;AAED,MAAMC,cAAc,GAAAnE,OAAA,CAAAmE,cAAA,GAAG;EACrBC,YAAY,EAAZA,mBAAY;EACZC,cAAc,EAAdA;AACF,CAAC","ignoreList":[]}
@@ -4,8 +4,8 @@ exports.__esModule = true;
4
4
  exports.stripJsonPathRootPrefix = exports.parseOmitTransformation = exports.parseMapArrayItemsTransformation = exports.isSpreadOperator = exports.isSimpleTransformation = exports.isRootObjectIdentifier = exports.isOmitTransformation = exports.isMapArrayItemsTransformation = exports.isJsonPathExpression = exports.isInvalidJsonValue = exports.isInvalidJsonPath = exports.isIdentityResponseTransformation = exports.isConstantExpression = exports.isArrayIndexString = exports.hasValidArgumentIndex = exports.getArgumentIndex = exports.extractIndexAndPath = void 0;
5
5
  var _jsonpathPlus = require("jsonpath-plus");
6
6
  var _lodash = require("lodash");
7
- var _common = require("./transformations/common");
8
- var _constants = require("./transformations/constants");
7
+ var _common = require("./transformations/common.js");
8
+ var _constants = require("./transformations/constants.js");
9
9
  const {
10
10
  RESPONSE_OBJECT_UNCHANGED,
11
11
  ARRAY_ITEMS_PATH_PROPERTY_NAME,
@@ -1 +1 @@
1
- {"version":3,"names":["_jsonpathPlus","require","_lodash","_common","_constants","RESPONSE_OBJECT_UNCHANGED","ARRAY_ITEMS_PATH_PROPERTY_NAME","ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME","OMIT_SOURCE_PROPERTY_NAME","FIELDS_TO_OMIT_PROPERTY_NAME","SPREAD_OPERATOR","CONSTANT_VALUE_PROPERTY_NAME","transformations","isInvalidJsonPath","path","isError","attempt","JSONPath","json","exports","isInvalidJsonValue","value","JSON","parse","isSimpleTransformation","transformation","isArrayIndexString","str","test","isSpreadOperator","key","isIdentityResponseTransformation","transformationPath","getArgumentIndex","s","match","groups","Number","argIndex","hasValidArgumentIndex","isRootObjectIdentifier","JSON_PATH_ROOT","isJsonPathExpression","exp","startsWith","stripJsonPathRootPrefix","jsonPath","replace","extractIndexAndPath","simpleTransformation","maybeIndexExpression","rest","split","index","nestedPath","length","join","isMapArrayItemsTransformation","transformationValue","has","parseMapArrayItemsTransformation","sourceArrayExpression","itemTransformation","isOmitTransformation","parseOmitTransformation","sourceExpression","fieldsToOmit","isConstantExpression"],"sources":["../../../src/lib/helpers.ts"],"sourcesContent":["import { JSONPath } from 'jsonpath-plus';\nimport { attempt, has, isError } from 'lodash';\n\nimport { transformations } from './transformations/common';\nimport { JSON_PATH_ROOT } from './transformations/constants';\n\nconst {\n RESPONSE_OBJECT_UNCHANGED,\n ARRAY_ITEMS_PATH_PROPERTY_NAME,\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME,\n OMIT_SOURCE_PROPERTY_NAME,\n FIELDS_TO_OMIT_PROPERTY_NAME,\n SPREAD_OPERATOR,\n CONSTANT_VALUE_PROPERTY_NAME,\n} = transformations;\n\nconst isInvalidJsonPath = (path) =>\n isError(attempt(() => JSONPath({ path, json: {} })));\n\nconst isInvalidJsonValue = (value) => isError(attempt(() => JSON.parse(value)));\n\nconst isSimpleTransformation = (transformation) =>\n typeof transformation === 'string';\n\nconst isArrayIndexString = (str) => !!/\\d+/.test(str);\n\nconst isSpreadOperator = (key) => key === SPREAD_OPERATOR;\n\nconst isIdentityResponseTransformation = (transformationPath) =>\n transformationPath === RESPONSE_OBJECT_UNCHANGED;\n\nconst getArgumentIndex = (s) => {\n const match = s.match(/\\$\\[(?<argIndex>\\d+)\\]/);\n\n return match && match.groups && Number(match.groups.argIndex);\n};\n\nconst hasValidArgumentIndex = (path) => getArgumentIndex(path) !== null;\n\nconst isRootObjectIdentifier = (s) => s === JSON_PATH_ROOT;\n\nconst isJsonPathExpression = (exp) => exp && exp.startsWith(JSON_PATH_ROOT);\n\nconst stripJsonPathRootPrefix = (jsonPath) =>\n jsonPath.replace(`${JSON_PATH_ROOT}.`, '');\n\nconst extractIndexAndPath = (simpleTransformation) => {\n const [maybeIndexExpression, ...rest] = simpleTransformation.split('.');\n const index = getArgumentIndex(maybeIndexExpression);\n\n return {\n index,\n nestedPath: index !== null && rest.length > 0 ? rest.join('.') : null,\n };\n};\n\nconst isMapArrayItemsTransformation = (transformationValue) =>\n has(transformationValue, ARRAY_ITEMS_PATH_PROPERTY_NAME) &&\n has(transformationValue, ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME);\n\nconst parseMapArrayItemsTransformation = (transformationValue) => ({\n sourceArrayExpression: transformationValue[ARRAY_ITEMS_PATH_PROPERTY_NAME],\n itemTransformation:\n transformationValue[ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME],\n});\n\nconst isOmitTransformation = (transformationValue) =>\n has(transformationValue, OMIT_SOURCE_PROPERTY_NAME) &&\n has(transformationValue, FIELDS_TO_OMIT_PROPERTY_NAME);\n\nconst parseOmitTransformation = (transformationValue) => ({\n sourceExpression: transformationValue[OMIT_SOURCE_PROPERTY_NAME],\n fieldsToOmit: transformationValue[FIELDS_TO_OMIT_PROPERTY_NAME],\n});\n\nconst isConstantExpression = (value) =>\n has(value, CONSTANT_VALUE_PROPERTY_NAME);\n\nexport {\n extractIndexAndPath,\n getArgumentIndex,\n hasValidArgumentIndex,\n isArrayIndexString,\n isConstantExpression,\n isIdentityResponseTransformation,\n isInvalidJsonPath,\n isInvalidJsonValue,\n isJsonPathExpression,\n isMapArrayItemsTransformation,\n isOmitTransformation,\n isRootObjectIdentifier,\n isSimpleTransformation,\n isSpreadOperator,\n parseMapArrayItemsTransformation,\n parseOmitTransformation,\n stripJsonPathRootPrefix,\n};\n"],"mappings":";;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAEA,MAAM;EACJI,yBAAyB;EACzBC,8BAA8B;EAC9BC,uCAAuC;EACvCC,yBAAyB;EACzBC,4BAA4B;EAC5BC,eAAe;EACfC;AACF,CAAC,GAAGC,uBAAe;AAEnB,MAAMC,iBAAiB,GAAIC,IAAI,IAC7B,IAAAC,eAAO,EAAC,IAAAC,eAAO,EAAC,MAAM,IAAAC,sBAAQ,EAAC;EAAEH,IAAI;EAAEI,IAAI,EAAE,CAAC;AAAE,CAAC,CAAC,CAAC,CAAC;AAACC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA;AAEvD,MAAMO,kBAAkB,GAAIC,KAAK,IAAK,IAAAN,eAAO,EAAC,IAAAC,eAAO,EAAC,MAAMM,IAAI,CAACC,KAAK,CAACF,KAAK,CAAC,CAAC,CAAC;AAACF,OAAA,CAAAC,kBAAA,GAAAA,kBAAA;AAEhF,MAAMI,sBAAsB,GAAIC,cAAc,IAC5C,OAAOA,cAAc,KAAK,QAAQ;AAACN,OAAA,CAAAK,sBAAA,GAAAA,sBAAA;AAErC,MAAME,kBAAkB,GAAIC,GAAG,IAAK,CAAC,CAAC,KAAK,CAACC,IAAI,CAACD,GAAG,CAAC;AAACR,OAAA,CAAAO,kBAAA,GAAAA,kBAAA;AAEtD,MAAMG,gBAAgB,GAAIC,GAAG,IAAKA,GAAG,KAAKpB,eAAe;AAACS,OAAA,CAAAU,gBAAA,GAAAA,gBAAA;AAE1D,MAAME,gCAAgC,G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C;AACH,CAAC;AAACrC,OAAA,CAAA6B,mBAAA,GAAAA,mBAAA;AAEF,MAAMS,6BAA6B,GAAIC,mBAAmB,IACxD,IAAAC,WAAG,EAACD,mBAAmB,EAAEpD,8BAA8B,CAAC,IACxD,IAAAqD,WAAG,EAACD,mBAAmB,EAAEnD,uCAAuC,CAAC;AAACY,OAAA,CAAAsC,6BAAA,GAAAA,6BAAA;AAEpE,MAAMG,gCAAgC,GAAIF,mBAAmB,KAAM;EACjEG,qBAAqB,EAAEH,mBAAmB,CAACpD,8BAA8B,CAAC;EAC1EwD,kBAAkB,EAChBJ,mBAAmB,CAACnD,uCAAuC;AAC/D,CAAC,CAAC;AAACY,OAAA,CAAAyC,gCAAA,GAAAA,gCAAA;AAEH,MAAMG,oBAAoB,GAAIL,mBAAmB,IAC/C,IAAAC,WAAG,EAACD,mBAAmB,EAAElD,yBAAyB,CAAC,IACnD,IAAAmD,WAAG,EAACD,mBAAmB,EAAEjD,4BAA4B,CAAC;AAACU,OAAA,CAAA4C,oBAAA,GAAAA,oBAAA;AAEzD,MAAMC,uBAAuB,GAAIN,mBAAmB,KAAM;EACxDO,gBAAgB,EAAEP,mBAAmB,CAAClD,yBAAyB,CAAC;EAChE0D,YAAY,EAAER,mBAAmB,CAACjD,4BAA4B;AAChE,CAAC,CAAC;AAACU,OAAA,CAAA6C,uBAAA,GAAAA,uBAAA;AAEH,MAAMG,oBAAoB,GAAI9C,KAAK,IACjC,IAAAsC,WAAG,EAACtC,KAAK,EAAEV,4BAA4B,CAAC;AAACQ,OAAA,CAAAgD,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_jsonpathPlus","require","_lodash","_common","_constants","RESPONSE_OBJECT_UNCHANGED","ARRAY_ITEMS_PATH_PROPERTY_NAME","ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME","OMIT_SOURCE_PROPERTY_NAME","FIELDS_TO_OMIT_PROPERTY_NAME","SPREAD_OPERATOR","CONSTANT_VALUE_PROPERTY_NAME","transformations","isInvalidJsonPath","path","isError","attempt","JSONPath","json","exports","isInvalidJsonValue","value","JSON","parse","isSimpleTransformation","transformation","isArrayIndexString","str","test","isSpreadOperator","key","isIdentityResponseTransformation","transformationPath","getArgumentIndex","s","match","groups","Number","argIndex","hasValidArgumentIndex","isRootObjectIdentifier","JSON_PATH_ROOT","isJsonPathExpression","exp","startsWith","stripJsonPathRootPrefix","jsonPath","replace","extractIndexAndPath","simpleTransformation","maybeIndexExpression","rest","split","index","nestedPath","length","join","isMapArrayItemsTransformation","transformationValue","has","parseMapArrayItemsTransformation","sourceArrayExpression","itemTransformation","isOmitTransformation","parseOmitTransformation","sourceExpression","fieldsToOmit","isConstantExpression"],"sources":["../../../src/lib/helpers.ts"],"sourcesContent":["import { JSONPath } from 'jsonpath-plus';\nimport { attempt, has, isError } from 'lodash';\n\nimport { transformations } from './transformations/common.js';\nimport { JSON_PATH_ROOT } from './transformations/constants.js';\n\nconst {\n RESPONSE_OBJECT_UNCHANGED,\n ARRAY_ITEMS_PATH_PROPERTY_NAME,\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME,\n OMIT_SOURCE_PROPERTY_NAME,\n FIELDS_TO_OMIT_PROPERTY_NAME,\n SPREAD_OPERATOR,\n CONSTANT_VALUE_PROPERTY_NAME,\n} = transformations;\n\nconst isInvalidJsonPath = (path) =>\n isError(attempt(() => JSONPath({ path, json: {} })));\n\nconst isInvalidJsonValue = (value) => isError(attempt(() => JSON.parse(value)));\n\nconst isSimpleTransformation = (transformation) =>\n typeof transformation === 'string';\n\nconst isArrayIndexString = (str) => !!/\\d+/.test(str);\n\nconst isSpreadOperator = (key) => key === SPREAD_OPERATOR;\n\nconst isIdentityResponseTransformation = (transformationPath) =>\n transformationPath === RESPONSE_OBJECT_UNCHANGED;\n\nconst getArgumentIndex = (s) => {\n const match = s.match(/\\$\\[(?<argIndex>\\d+)\\]/);\n\n return match && match.groups && Number(match.groups.argIndex);\n};\n\nconst hasValidArgumentIndex = (path) => getArgumentIndex(path) !== null;\n\nconst isRootObjectIdentifier = (s) => s === JSON_PATH_ROOT;\n\nconst isJsonPathExpression = (exp) => exp && exp.startsWith(JSON_PATH_ROOT);\n\nconst stripJsonPathRootPrefix = (jsonPath) =>\n jsonPath.replace(`${JSON_PATH_ROOT}.`, '');\n\nconst extractIndexAndPath = (simpleTransformation) => {\n const [maybeIndexExpression, ...rest] = simpleTransformation.split('.');\n const index = getArgumentIndex(maybeIndexExpression);\n\n return {\n index,\n nestedPath: index !== null && rest.length > 0 ? rest.join('.') : null,\n };\n};\n\nconst isMapArrayItemsTransformation = (transformationValue) =>\n has(transformationValue, ARRAY_ITEMS_PATH_PROPERTY_NAME) &&\n has(transformationValue, ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME);\n\nconst parseMapArrayItemsTransformation = (transformationValue) => ({\n sourceArrayExpression: transformationValue[ARRAY_ITEMS_PATH_PROPERTY_NAME],\n itemTransformation:\n transformationValue[ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME],\n});\n\nconst isOmitTransformation = (transformationValue) =>\n has(transformationValue, OMIT_SOURCE_PROPERTY_NAME) &&\n has(transformationValue, FIELDS_TO_OMIT_PROPERTY_NAME);\n\nconst parseOmitTransformation = (transformationValue) => ({\n sourceExpression: transformationValue[OMIT_SOURCE_PROPERTY_NAME],\n fieldsToOmit: transformationValue[FIELDS_TO_OMIT_PROPERTY_NAME],\n});\n\nconst isConstantExpression = (value) =>\n has(value, CONSTANT_VALUE_PROPERTY_NAME);\n\nexport {\n extractIndexAndPath,\n getArgumentIndex,\n hasValidArgumentIndex,\n isArrayIndexString,\n isConstantExpression,\n isIdentityResponseTransformation,\n isInvalidJsonPath,\n isInvalidJsonValue,\n isJsonPathExpression,\n isMapArrayItemsTransformation,\n isOmitTransformation,\n isRootObjectIdentifier,\n isSimpleTransformation,\n isSpreadOperator,\n parseMapArrayItemsTransformation,\n parseOmitTransformation,\n stripJsonPathRootPrefix,\n};\n"],"mappings":";;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AAC;AAACY,OAAA,CAAAsC,6BAAA,GAAAA,6BAAA;AAEpE,MAAMG,gCAAgC,GAAIF,mBAAmB,KAAM;EACjEG,qBAAqB,EAAEH,mBAAmB,CAACpD,8BAA8B,CAAC;EAC1EwD,kBAAkB,EAChBJ,mBAAmB,CAACnD,uCAAuC;AAC/D,CAAC,CAAC;AAACY,OAAA,CAAAyC,gCAAA,GAAAA,gCAAA;AAEH,MAAMG,oBAAoB,GAAIL,mBAAmB,IAC/C,IAAAC,WAAG,EAACD,mBAAmB,EAAElD,yBAAyB,CAAC,IACnD,IAAAmD,WAAG,EAACD,mBAAmB,EAAEjD,4BAA4B,CAAC;AAACU,OAAA,CAAA4C,oBAAA,GAAAA,oBAAA;AAEzD,MAAMC,uBAAuB,GAAIN,mBAAmB,KAAM;EACxDO,gBAAgB,EAAEP,mBAAmB,CAAClD,yBAAyB,CAAC;EAChE0D,YAAY,EAAER,mBAAmB,CAACjD,4BAA4B;AAChE,CAAC,CAAC;AAACU,OAAA,CAAA6C,uBAAA,GAAAA,uBAAA;AAEH,MAAMG,oBAAoB,GAAI9C,KAAK,IACjC,IAAAsC,WAAG,EAACtC,KAAK,EAAEV,4BAA4B,CAAC;AAACQ,OAAA,CAAAgD,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.unwrap = exports.transformations = void 0;
5
- var _constants = require("./constants");
5
+ var _constants = require("./constants.js");
6
6
  const unwrap = ({
7
7
  responseMessageResultPath
8
8
  }) => `$.${responseMessageResultPath}`;
@@ -1 +1 @@
1
- {"version":3,"names":["_constants","require","unwrap","responseMessageResultPath","exports","transformations","JS_SINGLE_ARG_UNCHANGED","RESPONSE_OBJECT_UNCHANGED","JSON_PATH_ROOT","ARRAY_ITEMS_PATH_PROPERTY_NAME","ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME","OMIT_SOURCE_PROPERTY_NAME","FIELDS_TO_OMIT_PROPERTY_NAME","SPREAD_OPERATOR","CONSTANT_VALUE_PROPERTY_NAME"],"sources":["../../../../src/lib/transformations/common.ts"],"sourcesContent":["import { JSON_PATH_ROOT } from './constants';\n\nconst unwrap = ({ responseMessageResultPath }) =>\n `$.${responseMessageResultPath}`;\n\nconst transformations = {\n JS_SINGLE_ARG_UNCHANGED: '$[0]',\n RESPONSE_OBJECT_UNCHANGED: JSON_PATH_ROOT,\n ARRAY_ITEMS_PATH_PROPERTY_NAME: '@path',\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME: '@itemTransformation',\n OMIT_SOURCE_PROPERTY_NAME: '@source',\n FIELDS_TO_OMIT_PROPERTY_NAME: '@omit',\n SPREAD_OPERATOR: '*',\n CONSTANT_VALUE_PROPERTY_NAME: '@constant',\n};\n\nexport { transformations, unwrap };\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,MAAMC,MAAM,GAAGA,CAAC;EAAEC;AAA0B,CAAC,KAC3C,KAAKA,yBAAyB,EAAE;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAEnC,MAAMG,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG;EACtBC,uBAAuB,EAAE,MAAM;EAC/BC,yBAAyB,EAAEC,yBAAc;EACzCC,8BAA8B,EAAE,OAAO;EACvCC,uCAAuC,EAAE,qBAAqB;EAC9DC,yBAAyB,EAAE,SAAS;EACpCC,4BAA4B,EAAE,OAAO;EACrCC,eAAe,EAAE,GAAG;EACpBC,4BAA4B,EAAE;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_constants","require","unwrap","responseMessageResultPath","exports","transformations","JS_SINGLE_ARG_UNCHANGED","RESPONSE_OBJECT_UNCHANGED","JSON_PATH_ROOT","ARRAY_ITEMS_PATH_PROPERTY_NAME","ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME","OMIT_SOURCE_PROPERTY_NAME","FIELDS_TO_OMIT_PROPERTY_NAME","SPREAD_OPERATOR","CONSTANT_VALUE_PROPERTY_NAME"],"sources":["../../../../src/lib/transformations/common.ts"],"sourcesContent":["import { JSON_PATH_ROOT } from './constants.js';\n\nconst unwrap = ({ responseMessageResultPath }) =>\n `$.${responseMessageResultPath}`;\n\nconst transformations = {\n JS_SINGLE_ARG_UNCHANGED: '$[0]',\n RESPONSE_OBJECT_UNCHANGED: JSON_PATH_ROOT,\n ARRAY_ITEMS_PATH_PROPERTY_NAME: '@path',\n ARRAY_ITEM_TRANSFORMATION_PROPERTY_NAME: '@itemTransformation',\n OMIT_SOURCE_PROPERTY_NAME: '@source',\n FIELDS_TO_OMIT_PROPERTY_NAME: '@omit',\n SPREAD_OPERATOR: '*',\n CONSTANT_VALUE_PROPERTY_NAME: '@constant',\n};\n\nexport { transformations, unwrap };\n"],"mappings":";;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA,MAAMC,MAAM,GAAGA,CAAC;EAAEC;AAA0B,CAAC,KAC3C,KAAKA,yBAAyB,EAAE;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAEnC,MAAMG,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG;EACtBC,uBAAuB,EAAE,MAAM;EAC/BC,yBAAyB,EAAEC,yBAAc;EACzCC,8BAA8B,EAAE,OAAO;EACvCC,uCAAuC,EAAE,qBAAqB;EAC9DC,yBAAyB,EAAE,SAAS;EACpCC,4BAA4B,EAAE,OAAO;EACrCC,eAAe,EAAE,GAAG;EACpBC,4BAA4B,EAAE;AAChC,CAAC","ignoreList":[]}
@@ -3,7 +3,7 @@
3
3
  exports.__esModule = true;
4
4
  exports.buildRequestTransformation = void 0;
5
5
  var _lodash = require("lodash");
6
- var _common = require("../common");
6
+ var _common = require("../common.js");
7
7
  exports.buildResponseTransformation = _common.unwrap;
8
8
  const buildRequestTransformation = ({
9
9
  requestMessageEntityPath
@@ -1 +1 @@
1
- {"version":3,"names":["_lodash","require","_common","exports","buildResponseTransformation","unwrap","buildRequestTransformation","requestMessageEntityPath","set"],"sources":["../../../../../src/lib/transformations/preset/create.ts"],"sourcesContent":["import { set } from 'lodash';\n\nimport { unwrap as buildResponseTransformation } from '../common';\n\nconst buildRequestTransformation = ({ requestMessageEntityPath }) =>\n set({}, requestMessageEntityPath, '$[0]');\n\nexport { buildRequestTransformation, buildResponseTransformation };\n"],"mappings":";;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAkEE,OAAA,CAAAC,2BAAA,GAAAF,OAAA,CAAAG,MAAA;AAElE,MAAMC,0BAA0B,GAAGA,CAAC;EAAEC;AAAyB,CAAC,KAC9D,IAAAC,WAAG,EAAC,CAAC,CAAC,EAAED,wBAAwB,EAAE,MAAM,CAAC;AAACJ,OAAA,CAAAG,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_lodash","require","_common","exports","buildResponseTransformation","unwrap","buildRequestTransformation","requestMessageEntityPath","set"],"sources":["../../../../../src/lib/transformations/preset/create.ts"],"sourcesContent":["import { set } from 'lodash';\n\nimport { unwrap as buildResponseTransformation } from '../common.js';\n\nconst buildRequestTransformation = ({ requestMessageEntityPath }) =>\n set({}, requestMessageEntityPath, '$[0]');\n\nexport { buildRequestTransformation, buildResponseTransformation };\n"],"mappings":";;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAqEE,OAAA,CAAAC,2BAAA,GAAAF,OAAA,CAAAG,MAAA;AAErE,MAAMC,0BAA0B,GAAGA,CAAC;EAAEC;AAAyB,CAAC,KAC9D,IAAAC,WAAG,EAAC,CAAC,CAAC,EAAED,wBAAwB,EAAE,MAAM,CAAC;AAACJ,OAAA,CAAAG,0BAAA,GAAAA,0BAAA","ignoreList":[]}
@@ -4,7 +4,7 @@ exports.__esModule = true;
4
4
  exports.buildResponseTransformation = exports.buildRequestTransformation = void 0;
5
5
  var _motionEdmAutogenCommon = require("@wix/motion-edm-autogen-common");
6
6
  var _lodash = require("lodash");
7
- var _common = require("../common");
7
+ var _common = require("../common.js");
8
8
  const {
9
9
  RESPONSE_OBJECT_UNCHANGED
10
10
  } = _common.transformations;