projen 0.61.13 → 0.61.16

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 (151) hide show
  1. package/.jsii +325 -33
  2. package/docs/api/API.md +166 -0
  3. package/docs/escape-hatches.md +3 -3
  4. package/lib/awscdk/auto-discover.js +5 -5
  5. package/lib/awscdk/awscdk-app-java.js +1 -1
  6. package/lib/awscdk/awscdk-app-py.js +1 -1
  7. package/lib/awscdk/awscdk-app-ts.js +1 -1
  8. package/lib/awscdk/awscdk-construct.js +2 -2
  9. package/lib/awscdk/awscdk-deps-java.js +1 -1
  10. package/lib/awscdk/awscdk-deps-js.js +1 -1
  11. package/lib/awscdk/awscdk-deps.js +1 -1
  12. package/lib/awscdk/cdk-config.js +1 -1
  13. package/lib/awscdk/cdk-tasks.js +1 -1
  14. package/lib/awscdk/integration-test.js +1 -1
  15. package/lib/awscdk/lambda-extension.js +1 -1
  16. package/lib/awscdk/lambda-function.js +2 -2
  17. package/lib/build/build-workflow.js +1 -1
  18. package/lib/cdk/auto-discover-base.js +2 -2
  19. package/lib/cdk/construct-lib.js +1 -1
  20. package/lib/cdk/integration-test-base.js +1 -1
  21. package/lib/cdk/jsii-docgen.js +1 -1
  22. package/lib/cdk/jsii-project.d.ts +1 -0
  23. package/lib/cdk/jsii-project.js +3 -2
  24. package/lib/cdk8s/auto-discover.js +2 -2
  25. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  26. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  27. package/lib/cdk8s/cdk8s-construct.js +1 -1
  28. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  29. package/lib/cdk8s/cdk8s-deps.js +1 -1
  30. package/lib/cdk8s/integration-test.js +1 -1
  31. package/lib/cdktf/cdktf-construct.js +1 -1
  32. package/lib/circleci/circleci.js +1 -1
  33. package/lib/component.js +1 -1
  34. package/lib/dependencies.js +1 -1
  35. package/lib/dev-env.js +1 -1
  36. package/lib/docker-compose.js +2 -2
  37. package/lib/file.js +1 -1
  38. package/lib/gitattributes.js +1 -1
  39. package/lib/github/auto-approve.js +1 -1
  40. package/lib/github/auto-merge.js +1 -1
  41. package/lib/github/dependabot.js +1 -1
  42. package/lib/github/github-credentials.js +1 -1
  43. package/lib/github/github-project.js +1 -1
  44. package/lib/github/github.js +1 -1
  45. package/lib/github/mergify.js +1 -1
  46. package/lib/github/pr-template.js +1 -1
  47. package/lib/github/pull-request-lint.js +1 -1
  48. package/lib/github/stale.js +1 -1
  49. package/lib/github/task-workflow.js +1 -1
  50. package/lib/github/workflows.js +1 -1
  51. package/lib/gitlab/configuration.js +1 -1
  52. package/lib/gitlab/gitlab-configuration.js +1 -1
  53. package/lib/gitlab/nested-configuration.js +1 -1
  54. package/lib/gitpod.js +1 -1
  55. package/lib/ignore-file.js +1 -1
  56. package/lib/index.d.ts +1 -0
  57. package/lib/index.js +2 -1
  58. package/lib/ini.js +1 -1
  59. package/lib/java/java-project.js +1 -1
  60. package/lib/java/junit.js +1 -1
  61. package/lib/java/maven-compile.js +1 -1
  62. package/lib/java/maven-packaging.js +1 -1
  63. package/lib/java/maven-sample.js +1 -1
  64. package/lib/java/pom.js +1 -1
  65. package/lib/java/projenrc.js +1 -1
  66. package/lib/javascript/bundler.js +1 -1
  67. package/lib/javascript/eslint.js +1 -1
  68. package/lib/javascript/jest.js +1 -1
  69. package/lib/javascript/node-package.js +1 -1
  70. package/lib/javascript/node-project.js +1 -1
  71. package/lib/javascript/npm-config.js +1 -1
  72. package/lib/javascript/prettier.js +1 -1
  73. package/lib/javascript/projenrc.js +1 -1
  74. package/lib/javascript/typescript-config.js +1 -1
  75. package/lib/javascript/upgrade-dependencies.js +2 -2
  76. package/lib/json-patch.d.ts +75 -0
  77. package/lib/json-patch.js +105 -0
  78. package/lib/json.js +1 -1
  79. package/lib/license.js +1 -1
  80. package/lib/logger.js +1 -1
  81. package/lib/makefile.js +1 -1
  82. package/lib/object-file.d.ts +36 -0
  83. package/lib/object-file.js +39 -3
  84. package/lib/project-build.js +1 -1
  85. package/lib/project.js +1 -1
  86. package/lib/projects.js +1 -1
  87. package/lib/projenrc-json.js +1 -1
  88. package/lib/python/pip.js +1 -1
  89. package/lib/python/poetry.js +2 -2
  90. package/lib/python/projenrc.js +1 -1
  91. package/lib/python/pytest-sample.js +1 -1
  92. package/lib/python/pytest.js +1 -1
  93. package/lib/python/python-project.js +1 -1
  94. package/lib/python/python-sample.js +1 -1
  95. package/lib/python/requirements-file.js +1 -1
  96. package/lib/python/setuppy.js +1 -1
  97. package/lib/python/setuptools.js +1 -1
  98. package/lib/python/venv.js +1 -1
  99. package/lib/readme.js +1 -1
  100. package/lib/release/publisher.js +1 -1
  101. package/lib/release/release-trigger.js +1 -1
  102. package/lib/release/release.js +1 -1
  103. package/lib/renovatebot.js +1 -1
  104. package/lib/run-task.js +1833 -0
  105. package/lib/sample-file.js +2 -2
  106. package/lib/semver.js +1 -1
  107. package/lib/source-code.js +1 -1
  108. package/lib/task-runtime.js +1 -1
  109. package/lib/task.js +1 -1
  110. package/lib/tasks.js +1 -1
  111. package/lib/testing.js +1 -1
  112. package/lib/textfile.js +1 -1
  113. package/lib/toml.js +1 -1
  114. package/lib/typescript/projenrc.js +1 -1
  115. package/lib/typescript/typescript-typedoc.js +1 -1
  116. package/lib/typescript/typescript.js +3 -3
  117. package/lib/version.js +1 -1
  118. package/lib/vscode/devcontainer.js +1 -1
  119. package/lib/vscode/launch-config.js +1 -1
  120. package/lib/vscode/vscode.js +1 -1
  121. package/lib/web/next.js +3 -3
  122. package/lib/web/postcss.js +1 -1
  123. package/lib/web/react.js +4 -4
  124. package/lib/web/tailwind.js +1 -1
  125. package/lib/xmlfile.js +1 -1
  126. package/lib/yaml.js +1 -1
  127. package/node_modules/fast-json-patch/LICENSE.txt +22 -0
  128. package/node_modules/fast-json-patch/README.md +428 -0
  129. package/node_modules/fast-json-patch/commonjs/core.d.ts +111 -0
  130. package/node_modules/fast-json-patch/commonjs/core.js +441 -0
  131. package/node_modules/fast-json-patch/commonjs/duplex.d.ts +23 -0
  132. package/node_modules/fast-json-patch/commonjs/duplex.js +181 -0
  133. package/node_modules/fast-json-patch/commonjs/helpers.d.ts +41 -0
  134. package/node_modules/fast-json-patch/commonjs/helpers.js +181 -0
  135. package/node_modules/fast-json-patch/dist/fast-json-patch.js +928 -0
  136. package/node_modules/fast-json-patch/dist/fast-json-patch.min.js +14 -0
  137. package/node_modules/fast-json-patch/index.d.ts +34 -0
  138. package/node_modules/fast-json-patch/index.js +11 -0
  139. package/node_modules/fast-json-patch/index.mjs +29 -0
  140. package/node_modules/fast-json-patch/index.ts +31 -0
  141. package/node_modules/fast-json-patch/jasmine-run.mjs +23 -0
  142. package/node_modules/fast-json-patch/module/core.d.ts +111 -0
  143. package/node_modules/fast-json-patch/module/core.mjs +433 -0
  144. package/node_modules/fast-json-patch/module/duplex.d.ts +23 -0
  145. package/node_modules/fast-json-patch/module/duplex.mjs +176 -0
  146. package/node_modules/fast-json-patch/module/helpers.d.ts +41 -0
  147. package/node_modules/fast-json-patch/module/helpers.mjs +171 -0
  148. package/node_modules/fast-json-patch/package.json +65 -0
  149. package/node_modules/fast-json-patch/tsc-to-mjs.sh +10 -0
  150. package/node_modules/fast-json-patch/webpack.config.js +63 -0
  151. package/package.json +3 -1
@@ -0,0 +1,14 @@
1
+ /*! fast-json-patch, version: 3.1.1 */
2
+ var jsonpatch=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=2)}([function(e,t){
3
+ /*!
4
+ * https://github.com/Starcounter-Jack/JSON-Patch
5
+ * (c) 2017-2022 Joachim Wester
6
+ * MIT licensed
7
+ */
8
+ var r,n=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=Object.prototype.hasOwnProperty;function a(e,t){return o.call(e,t)}function i(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var o in e)a(e,o)&&n.push(o);return n}function p(e){return-1===e.indexOf("/")&&-1===e.indexOf("~")?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}function u(e,t){var r;for(var n in e)if(a(e,n)){if(e[n]===t)return p(n)+"/";if("object"==typeof e[n]&&""!=(r=u(e[n],t)))return p(n)+"/"+r}return""}function s(e,t){var r=[e];for(var n in t){var o="object"==typeof t[n]?JSON.stringify(t[n],null,2):t[n];void 0!==o&&r.push(n+": "+o)}return r.join("\n")}t.hasOwnProperty=a,t._objectKeys=i,t._deepClone=function(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}},t.isInteger=function(e){for(var t,r=0,n=e.length;r<n;){if(!((t=e.charCodeAt(r))>=48&&t<=57))return!1;r++}return!0},t.escapePathComponent=p,t.unescapePathComponent=function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")},t._getPathRecursive=u,t.getPath=function(e,t){if(e===t)return"/";var r=u(e,t);if(""===r)throw new Error("Object not found in root");return"/"+r},t.hasUndefined=function e(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var r=0,n=t.length;r<n;r++)if(e(t[r]))return!0}else if("object"==typeof t)for(var o=i(t),a=o.length,p=0;p<a;p++)if(e(t[o[p]]))return!0;return!1};var c=function(e){function t(t,r,n,o,a){var i=this.constructor,p=e.call(this,s(t,{name:r,index:n,operation:o,tree:a}))||this;return p.name=r,p.index=n,p.operation=o,p.tree=a,Object.setPrototypeOf(p,i.prototype),p.message=s(t,{name:r,index:n,operation:o,tree:a}),p}return n(t,e),t}(Error);t.PatchError=c},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});var n=r(0);t.JsonPatchError=n.PatchError,t.deepClone=n._deepClone;var o={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var o=i(r,this.path);o&&(o=n._deepClone(o));var a=p(r,{op:"remove",path:this.from}).removed;return p(r,{op:"add",path:this.path,value:a}),{newDocument:r,removed:o}},copy:function(e,t,r){var o=i(r,this.from);return p(r,{op:"add",path:this.path,value:n._deepClone(o)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:f(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},a={add:function(e,t,r){return n.isInteger(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){return{newDocument:r,removed:e.splice(t,1)[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:o.move,copy:o.copy,test:o.test,_get:o._get};function i(e,t){if(""==t)return e;var r={op:"_get",path:t};return p(e,r),r.value}function p(e,r,p,u,c,h){if(void 0===p&&(p=!1),void 0===u&&(u=!0),void 0===c&&(c=!0),void 0===h&&(h=0),p&&("function"==typeof p?p(r,0,e,r.path):s(r,0)),""===r.path){var l={newDocument:e};if("add"===r.op)return l.newDocument=r.value,l;if("replace"===r.op)return l.newDocument=r.value,l.removed=e,l;if("move"===r.op||"copy"===r.op)return l.newDocument=i(e,r.from),"move"===r.op&&(l.removed=e),l;if("test"===r.op){if(l.test=f(e,r.value),!1===l.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",h,r,e);return l.newDocument=e,l}if("remove"===r.op)return l.removed=e,l.newDocument=null,l;if("_get"===r.op)return r.value=e,l;if(p)throw new t.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",h,r,e);return l}u||(e=n._deepClone(e));var d=(r.path||"").split("/"),v=e,y=1,w=d.length,_=void 0,O=void 0,m=void 0;for(m="function"==typeof p?p:s;;){if((O=d[y])&&-1!=O.indexOf("~")&&(O=n.unescapePathComponent(O)),c&&("__proto__"==O||"prototype"==O&&y>0&&"constructor"==d[y-1]))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(p&&void 0===_&&(void 0===v[O]?_=d.slice(0,y).join("/"):y==w-1&&(_=r.path),void 0!==_&&m(r,0,e,_)),y++,Array.isArray(v)){if("-"===O)O=v.length;else{if(p&&!n.isInteger(O))throw new t.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",h,r,e);n.isInteger(O)&&(O=~~O)}if(y>=w){if(p&&"add"===r.op&&O>v.length)throw new t.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",h,r,e);if(!1===(l=a[r.op].call(r,v,O,e)).test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",h,r,e);return l}}else if(y>=w){if(!1===(l=o[r.op].call(r,v,O,e)).test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",h,r,e);return l}if(v=v[O],p&&y<w&&(!v||"object"!=typeof v))throw new t.JsonPatchError("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",h,r,e)}}function u(e,r,o,a,i){if(void 0===a&&(a=!0),void 0===i&&(i=!0),o&&!Array.isArray(r))throw new t.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");a||(e=n._deepClone(e));for(var u=new Array(r.length),s=0,c=r.length;s<c;s++)u[s]=p(e,r[s],o,!0,i,s),e=u[s].newDocument;return u.newDocument=e,u}function s(e,r,a,i){if("object"!=typeof e||null===e||Array.isArray(e))throw new t.JsonPatchError("Operation is not an object","OPERATION_NOT_AN_OBJECT",r,e,a);if(!o[e.op])throw new t.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",r,e,a);if("string"!=typeof e.path)throw new t.JsonPatchError("Operation `path` property is not a string","OPERATION_PATH_INVALID",r,e,a);if(0!==e.path.indexOf("/")&&e.path.length>0)throw new t.JsonPatchError('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",r,e,a);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new t.JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",r,e,a);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new t.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",r,e,a);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&n.hasUndefined(e.value))throw new t.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",r,e,a);if(a)if("add"==e.op){var p=e.path.split("/").length,u=i.split("/").length;if(p!==u+1&&p!==u)throw new t.JsonPatchError("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",r,e,a)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==i)throw new t.JsonPatchError("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",r,e,a)}else if("move"===e.op||"copy"===e.op){var s=c([{op:"_get",path:e.from,value:void 0}],a);if(s&&"OPERATION_PATH_UNRESOLVABLE"===s.name)throw new t.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",r,e,a)}}function c(e,r,o){try{if(!Array.isArray(e))throw new t.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(r)u(n._deepClone(r),n._deepClone(e),o||!0);else{o=o||s;for(var a=0;a<e.length;a++)o(e[a],a,r,void 0)}}catch(e){if(e instanceof t.JsonPatchError)return e;throw e}}function f(e,t){if(e===t)return!0;if(e&&t&&"object"==typeof e&&"object"==typeof t){var r,n,o,a=Array.isArray(e),i=Array.isArray(t);if(a&&i){if((n=e.length)!=t.length)return!1;for(r=n;0!=r--;)if(!f(e[r],t[r]))return!1;return!0}if(a!=i)return!1;var p=Object.keys(e);if((n=p.length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!t.hasOwnProperty(p[r]))return!1;for(r=n;0!=r--;)if(!f(e[o=p[r]],t[o]))return!1;return!0}return e!=e&&t!=t}t.getValueByPointer=i,t.applyOperation=p,t.applyPatch=u,t.applyReducer=function(e,r,n){var o=p(e,r);if(!1===o.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",n,r,e);return o.newDocument},t.validator=s,t.validate=c,t._areEquals=f},function(e,t,r){var n=r(1);Object.assign(t,n);var o=r(3);Object.assign(t,o);var a=r(0);t.JsonPatchError=a.PatchError,t.deepClone=a._deepClone,t.escapePathComponent=a.escapePathComponent,t.unescapePathComponent=a.unescapePathComponent},function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0});
9
+ /*!
10
+ * https://github.com/Starcounter-Jack/JSON-Patch
11
+ * (c) 2017-2021 Joachim Wester
12
+ * MIT license
13
+ */
14
+ var n=r(0),o=r(1),a=new WeakMap,i=function(e){this.observers=new Map,this.obj=e},p=function(e,t){this.callback=e,this.observer=t};function u(e,t){void 0===t&&(t=!1);var r=a.get(e.object);s(r.value,e.object,e.patches,"",t),e.patches.length&&o.applyPatch(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}function s(e,t,r,o,a){if(t!==e){"function"==typeof t.toJSON&&(t=t.toJSON());for(var i=n._objectKeys(t),p=n._objectKeys(e),u=!1,c=p.length-1;c>=0;c--){var f=e[l=p[c]];if(!n.hasOwnProperty(t,l)||void 0===t[l]&&void 0!==f&&!1===Array.isArray(t))Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(f)}),r.push({op:"remove",path:o+"/"+n.escapePathComponent(l)}),u=!0):(a&&r.push({op:"test",path:o,value:e}),r.push({op:"replace",path:o,value:t}),!0);else{var h=t[l];"object"==typeof f&&null!=f&&"object"==typeof h&&null!=h&&Array.isArray(f)===Array.isArray(h)?s(f,h,r,o+"/"+n.escapePathComponent(l),a):f!==h&&(!0,a&&r.push({op:"test",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(f)}),r.push({op:"replace",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(h)}))}}if(u||i.length!=p.length)for(c=0;c<i.length;c++){var l=i[c];n.hasOwnProperty(e,l)||void 0===t[l]||r.push({op:"add",path:o+"/"+n.escapePathComponent(l),value:n._deepClone(t[l])})}}}t.unobserve=function(e,t){t.unobserve()},t.observe=function(e,t){var r,o=function(e){return a.get(e)}(e);if(o){var s=function(e,t){return e.observers.get(t)}(o,t);r=s&&s.observer}else o=new i(e),a.set(e,o);if(r)return r;if(r={},o.value=n._deepClone(e),t){r.callback=t,r.next=null;var c=function(){u(r)},f=function(){clearTimeout(r.next),r.next=setTimeout(c)};"undefined"!=typeof window&&(window.addEventListener("mouseup",f),window.addEventListener("keyup",f),window.addEventListener("mousedown",f),window.addEventListener("keydown",f),window.addEventListener("change",f))}return r.patches=[],r.object=e,r.unobserve=function(){u(r),clearTimeout(r.next),function(e,t){e.observers.delete(t.callback)}(o,r),"undefined"!=typeof window&&(window.removeEventListener("mouseup",f),window.removeEventListener("keyup",f),window.removeEventListener("mousedown",f),window.removeEventListener("keydown",f),window.removeEventListener("change",f))},o.observers.set(t,new p(t,r)),r},t.generate=u,t.compare=function(e,t,r){void 0===r&&(r=!1);var n=[];return s(e,t,n,"",r),n}}]);
@@ -0,0 +1,34 @@
1
+ export * from './module/core';
2
+ export * from './module/duplex';
3
+ export {
4
+ PatchError as JsonPatchError,
5
+ _deepClone as deepClone,
6
+ escapePathComponent,
7
+ unescapePathComponent
8
+ } from './module/helpers';
9
+
10
+
11
+ /**
12
+ * Default export for backwards compat
13
+ */
14
+ import * as core from './module/core';
15
+ import * as duplex from './module/duplex';
16
+ import { PatchError as JsonPatchError, _deepClone as deepClone, escapePathComponent, unescapePathComponent } from './module/helpers';
17
+ declare const _default: {
18
+ JsonPatchError: typeof JsonPatchError;
19
+ deepClone: typeof deepClone;
20
+ escapePathComponent: typeof escapePathComponent;
21
+ unescapePathComponent: typeof unescapePathComponent;
22
+ unobserve<T>(root: T, observer: duplex.Observer<T>): void;
23
+ observe<T>(obj: Object | T[], callback?: (patches: core.Operation[]) => void): duplex.Observer<T>;
24
+ generate<T>(observer: duplex.Observer<Object>, invertible?: boolean): core.Operation[];
25
+ compare(tree1: Object | any[], tree2: Object | any[], invertible?: boolean): core.Operation[];
26
+ getValueByPointer(document: any, pointer: string): any;
27
+ applyOperation<T>(document: T, operation: core.Operation, validateOperation?: boolean | core.Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean, index?: number): core.OperationResult<T>;
28
+ applyPatch<T>(document: T, patch: core.Operation[], validateOperation?: boolean | core.Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean): core.PatchResult<T>;
29
+ applyReducer<T>(document: T, operation: core.Operation, index: number): T;
30
+ validator(operation: core.Operation, index: number, document?: any, existingPathFragment?: string): void;
31
+ validate<T>(sequence: core.Operation[], document?: T, externalValidator?: core.Validator<T>): JsonPatchError;
32
+ _areEquals(a: any, b: any): boolean;
33
+ };
34
+ export default _default;
@@ -0,0 +1,11 @@
1
+ var core = require("./commonjs/core.js");
2
+ Object.assign(exports, core);
3
+
4
+ var duplex = require("./commonjs/duplex.js");
5
+ Object.assign(exports, duplex);
6
+
7
+ var helpers = require("./commonjs/helpers.js");
8
+ exports.JsonPatchError = helpers.PatchError;
9
+ exports.deepClone = helpers._deepClone;
10
+ exports.escapePathComponent = helpers.escapePathComponent;
11
+ exports.unescapePathComponent = helpers.unescapePathComponent;
@@ -0,0 +1,29 @@
1
+ export * from './module/core.mjs';
2
+ export * from './module/duplex.mjs';
3
+ export {
4
+ PatchError as JsonPatchError,
5
+ _deepClone as deepClone,
6
+ escapePathComponent,
7
+ unescapePathComponent
8
+ } from './module/helpers.mjs';
9
+
10
+
11
+ /**
12
+ * Default export for backwards compat
13
+ */
14
+
15
+ import * as core from './module/core.mjs';
16
+ import * as duplex from './module/duplex.mjs';
17
+ import {
18
+ PatchError as JsonPatchError,
19
+ _deepClone as deepClone,
20
+ escapePathComponent,
21
+ unescapePathComponent
22
+ } from './module/helpers.mjs';
23
+
24
+ export default Object.assign({}, core, duplex, {
25
+ JsonPatchError,
26
+ deepClone,
27
+ escapePathComponent,
28
+ unescapePathComponent
29
+ });
@@ -0,0 +1,31 @@
1
+ export * from './src/core';
2
+ export * from './src/duplex';
3
+ export {
4
+ PatchError as JsonPatchError,
5
+ _deepClone as deepClone,
6
+ escapePathComponent,
7
+ unescapePathComponent
8
+ } from './src/helpers';
9
+
10
+
11
+ /**
12
+ * Default export for backwards compat
13
+ */
14
+
15
+ import * as core from './src/core';
16
+ import * as duplex from './src/duplex';
17
+ import {
18
+ PatchError as JsonPatchError,
19
+ _deepClone as deepClone,
20
+ escapePathComponent,
21
+ unescapePathComponent
22
+ } from './src/helpers';
23
+
24
+ export default {
25
+ ...core,
26
+ ...duplex,
27
+ JsonPatchError,
28
+ deepClone,
29
+ escapePathComponent,
30
+ unescapePathComponent
31
+ }
@@ -0,0 +1,23 @@
1
+ import glob from 'glob';
2
+ import Jasmine from 'jasmine';
3
+
4
+ const jasmine = new Jasmine();
5
+ jasmine.loadConfigFile('test/jasmine.json');
6
+
7
+ const pattern = process.argv[2] || 'test/spec/*.js';
8
+
9
+ // Load your specs
10
+ glob(pattern, function (er, files) {
11
+ Promise.all(
12
+ files
13
+ // Use relative paths
14
+ .map(f => f.replace(/^([^\/])/, './$1'))
15
+ .map(f => import(f)
16
+ .catch(e => {
17
+ console.error('** Error loading ' + f + ': ');
18
+ console.error(e);
19
+ process.exit(1);
20
+ }))
21
+ )
22
+ .then(() => jasmine.execute());
23
+ });
@@ -0,0 +1,111 @@
1
+ import { PatchError, _deepClone } from './helpers.js';
2
+ export declare const JsonPatchError: typeof PatchError;
3
+ export declare const deepClone: typeof _deepClone;
4
+ export declare type Operation = AddOperation<any> | RemoveOperation | ReplaceOperation<any> | MoveOperation | CopyOperation | TestOperation<any> | GetOperation<any>;
5
+ export interface Validator<T> {
6
+ (operation: Operation, index: number, document: T, existingPathFragment: string): void;
7
+ }
8
+ export interface OperationResult<T> {
9
+ removed?: any;
10
+ test?: boolean;
11
+ newDocument: T;
12
+ }
13
+ export interface BaseOperation {
14
+ path: string;
15
+ }
16
+ export interface AddOperation<T> extends BaseOperation {
17
+ op: 'add';
18
+ value: T;
19
+ }
20
+ export interface RemoveOperation extends BaseOperation {
21
+ op: 'remove';
22
+ }
23
+ export interface ReplaceOperation<T> extends BaseOperation {
24
+ op: 'replace';
25
+ value: T;
26
+ }
27
+ export interface MoveOperation extends BaseOperation {
28
+ op: 'move';
29
+ from: string;
30
+ }
31
+ export interface CopyOperation extends BaseOperation {
32
+ op: 'copy';
33
+ from: string;
34
+ }
35
+ export interface TestOperation<T> extends BaseOperation {
36
+ op: 'test';
37
+ value: T;
38
+ }
39
+ export interface GetOperation<T> extends BaseOperation {
40
+ op: '_get';
41
+ value: T;
42
+ }
43
+ export interface PatchResult<T> extends Array<OperationResult<T>> {
44
+ newDocument: T;
45
+ }
46
+ /**
47
+ * Retrieves a value from a JSON document by a JSON pointer.
48
+ * Returns the value.
49
+ *
50
+ * @param document The document to get the value from
51
+ * @param pointer an escaped JSON pointer
52
+ * @return The retrieved value
53
+ */
54
+ export declare function getValueByPointer(document: any, pointer: string): any;
55
+ /**
56
+ * Apply a single JSON Patch Operation on a JSON document.
57
+ * Returns the {newDocument, result} of the operation.
58
+ * It modifies the `document` and `operation` objects - it gets the values by reference.
59
+ * If you would like to avoid touching your values, clone them:
60
+ * `jsonpatch.applyOperation(document, jsonpatch._deepClone(operation))`.
61
+ *
62
+ * @param document The document to patch
63
+ * @param operation The operation to apply
64
+ * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
65
+ * @param mutateDocument Whether to mutate the original document or clone it before applying
66
+ * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
67
+ * @return `{newDocument, result}` after the operation
68
+ */
69
+ export declare function applyOperation<T>(document: T, operation: Operation, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean, index?: number): OperationResult<T>;
70
+ /**
71
+ * Apply a full JSON Patch array on a JSON document.
72
+ * Returns the {newDocument, result} of the patch.
73
+ * It modifies the `document` object and `patch` - it gets the values by reference.
74
+ * If you would like to avoid touching your values, clone them:
75
+ * `jsonpatch.applyPatch(document, jsonpatch._deepClone(patch))`.
76
+ *
77
+ * @param document The document to patch
78
+ * @param patch The patch to apply
79
+ * @param validateOperation `false` is without validation, `true` to use default jsonpatch's validation, or you can pass a `validateOperation` callback to be used for validation.
80
+ * @param mutateDocument Whether to mutate the original document or clone it before applying
81
+ * @param banPrototypeModifications Whether to ban modifications to `__proto__`, defaults to `true`.
82
+ * @return An array of `{newDocument, result}` after the patch
83
+ */
84
+ export declare function applyPatch<T>(document: T, patch: ReadonlyArray<Operation>, validateOperation?: boolean | Validator<T>, mutateDocument?: boolean, banPrototypeModifications?: boolean): PatchResult<T>;
85
+ /**
86
+ * Apply a single JSON Patch Operation on a JSON document.
87
+ * Returns the updated document.
88
+ * Suitable as a reducer.
89
+ *
90
+ * @param document The document to patch
91
+ * @param operation The operation to apply
92
+ * @return The updated document
93
+ */
94
+ export declare function applyReducer<T>(document: T, operation: Operation, index: number): T;
95
+ /**
96
+ * Validates a single operation. Called from `jsonpatch.validate`. Throws `JsonPatchError` in case of an error.
97
+ * @param {object} operation - operation object (patch)
98
+ * @param {number} index - index of operation in the sequence
99
+ * @param {object} [document] - object where the operation is supposed to be applied
100
+ * @param {string} [existingPathFragment] - comes along with `document`
101
+ */
102
+ export declare function validator(operation: Operation, index: number, document?: any, existingPathFragment?: string): void;
103
+ /**
104
+ * Validates a sequence of operations. If `document` parameter is provided, the sequence is additionally validated against the object document.
105
+ * If error is encountered, returns a JsonPatchError object
106
+ * @param sequence
107
+ * @param document
108
+ * @returns {JsonPatchError|undefined}
109
+ */
110
+ export declare function validate<T>(sequence: ReadonlyArray<Operation>, document?: T, externalValidator?: Validator<T>): PatchError;
111
+ export declare function _areEquals(a: any, b: any): boolean;