From 2e66cc81741226dbf03a5d011ad15dfe3eaab603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20=C3=85str=C3=B6m?= Date: Wed, 17 Jan 2024 15:23:33 +0100 Subject: [PATCH] fix: guard against empty patch array (#994) * fix: guard against empty patch array * chore: remove change * fix: guard against empty patch array * chore: try update node * chore: try update node * chore: downgrade we --- .circleci/config.yml | 11 +++++------ package-lock.json | 14 +++++++------- package.json | 2 +- src/interceptors/delta-response-interceptor.js | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7d89a7c2..20c89203 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,8 +4,8 @@ defaults: &defaults working_directory: ~/enigma.js # Available images https://hub.docker.com/r/circleci/node/tags/ docker: - - image: circleci/node:17.2.0 - + - image: cimg/node:21.5.0 + jobs: install: <<: *defaults @@ -25,7 +25,7 @@ jobs: command: npm run -s lint - persist_to_workspace: root: ~/enigma.js - paths: + paths: - . check-api-specs: <<: *defaults @@ -91,7 +91,7 @@ jobs: name: Run API Compliance command: > VER=v$(cat version.txt) - + docker run --volumes-from specs -e SPEC_PATHS="0f0b4c98-db9c-46c7-8958-2a98bd15a946@/specs/api-spec.json" -e COMMIT_SHA="$CIRCLE_SHA1" @@ -106,7 +106,7 @@ workflows: jobs: - install - check-api-specs: - requires: + requires: - install - build: requires: @@ -115,4 +115,3 @@ workflows: context: api-compliance requires: - check-api-specs - diff --git a/package-lock.json b/package-lock.json index 3140a945..0d6f3027 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,7 @@ "rollup-plugin-node-resolve": "5.2.0", "rollup-plugin-terser": "7.0.2", "scriptappy-from-jsdoc": "0.7.0", - "ws": "8.16.0" + "ws": "8.13.0" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -23282,9 +23282,9 @@ } }, "node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "dev": true, "engines": { "node": ">=10.0.0" @@ -41675,9 +41675,9 @@ } }, "ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", "dev": true, "requires": {} }, diff --git a/package.json b/package.json index d9d9ae17..80c186b0 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,6 @@ "rollup-plugin-node-resolve": "5.2.0", "rollup-plugin-terser": "7.0.2", "scriptappy-from-jsdoc": "0.7.0", - "ws": "8.16.0" + "ws": "8.13.0" } } diff --git a/src/interceptors/delta-response-interceptor.js b/src/interceptors/delta-response-interceptor.js index 9e8b9951..4a0f71da 100644 --- a/src/interceptors/delta-response-interceptor.js +++ b/src/interceptors/delta-response-interceptor.js @@ -50,7 +50,7 @@ const patchValue = (session, handle, cacheId, patches) => { const cache = getHandleCache(session, handle); let entry = cache.get(cacheId); if (typeof entry === 'undefined') { - entry = Array.isArray(patches[0].value) ? [] : {}; + entry = patches[0] && Array.isArray(patches[0].value) ? [] : {}; } if (patches.length) { if (patches[0].path === '/' && typeof patches[0].value !== 'object') {