From 8723379f4a9bbbfa9a70232581cc8a28476724b7 Mon Sep 17 00:00:00 2001 From: Greg Martin Date: Thu, 9 Apr 2026 14:53:19 -0400 Subject: [PATCH 1/2] fix(api-axios): filter undefined and null fields --- packages/api-axios/src/resources/dma-cloud.js | 1 + packages/api-axios/src/resources/dma.js | 1 + .../src/resources/tests/dma-cloud.test.js | 21 +++++++++++++++++-- .../api-axios/src/resources/tests/dma.test.js | 21 +++++++++++++++++-- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/packages/api-axios/src/resources/dma-cloud.js b/packages/api-axios/src/resources/dma-cloud.js index 3ce1ac14..b5fe2652 100644 --- a/packages/api-axios/src/resources/dma-cloud.js +++ b/packages/api-axios/src/resources/dma-cloud.js @@ -21,6 +21,7 @@ export default class AvLogMessagesApiV3 extends AvMicroserviceApi { flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); const fields = Object.keys(flattened) + .filter((key) => flattened[key] != null) .map((key) => { const name = key.replaceAll(/\[\d+]/g, '[]'); const value = flattened[key]; diff --git a/packages/api-axios/src/resources/dma.js b/packages/api-axios/src/resources/dma.js index 6dc77ad4..042560ef 100644 --- a/packages/api-axios/src/resources/dma.js +++ b/packages/api-axios/src/resources/dma.js @@ -20,6 +20,7 @@ export default class AvLogMessagesApiV2 extends AvMicroserviceApi { flattened.X_XSRF_TOKEN = document.cookie.replace(/(?:(?:^|.*;\s*)XSRF-TOKEN\s*=\s*([^;]*).*$)|^.*$/, '$1'); const fields = Object.keys(flattened) + .filter((key) => flattened[key] != null) .map((key) => { const name = key.replaceAll(/\[\d+]/g, '[]'); const value = flattened[key]; diff --git a/packages/api-axios/src/resources/tests/dma-cloud.test.js b/packages/api-axios/src/resources/tests/dma-cloud.test.js index d762b5fb..f80d6b6a 100644 --- a/packages/api-axios/src/resources/tests/dma-cloud.test.js +++ b/packages/api-axios/src/resources/tests/dma-cloud.test.js @@ -15,11 +15,28 @@ describe('AvLogMessagesApiV3', () => { test('send should generate fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2'}); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&X_XSRF_TOKEN='); }); test('send should generate optional overrides fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2', overrides: { akaName: 'override1', transactionId: 'override2' } }); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2&X_XSRF_TOKEN='); + }); + + test('send should not include undefined values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: undefined }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include null values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: null }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include overrides=undefined when overrides is not provided', () => { + const fields = api.send('info', { testField1: 'test1' }); + expect(fields).not.toContain('overrides'); }); }); diff --git a/packages/api-axios/src/resources/tests/dma.test.js b/packages/api-axios/src/resources/tests/dma.test.js index 2781e867..70c896e8 100644 --- a/packages/api-axios/src/resources/tests/dma.test.js +++ b/packages/api-axios/src/resources/tests/dma.test.js @@ -15,11 +15,28 @@ describe('AvLogMessagesApiV2', () => { test('send should generate fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2'}); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&X_XSRF_TOKEN='); }); test('send should generate optional overrides fields correctly', () => { const fields = api.send('info', { testField1: 'test1', testField2: 'test2', overrides: { akaName: 'override1', transactionId: 'override2' } }); - expect(fields).toContain('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2'); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&entries.testField2=test2&overrides.akaName=override1&overrides.transactionId=override2&X_XSRF_TOKEN='); + }); + + test('send should not include undefined values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: undefined }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include null values in fields', () => { + const fields = api.send('info', { testField1: 'test1', testField2: null }); + expect(fields).toStrictEqual('level=info&entries.testField1=test1&X_XSRF_TOKEN='); + expect(fields).not.toContain('testField2'); + }); + + test('send should not include overrides=undefined when overrides is not provided', () => { + const fields = api.send('info', { testField1: 'test1' }); + expect(fields).not.toContain('overrides'); }); }); From e28f14b550c30e6253d3283b423240cf9c4d463a Mon Sep 17 00:00:00 2001 From: Greg Martin Date: Wed, 27 May 2026 10:52:12 -0400 Subject: [PATCH 2/2] build(analytics-core): upgrade uuid --- packages/analytics-core/package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/analytics-core/package.json b/packages/analytics-core/package.json index 5ab0ce7f..52c61c1a 100644 --- a/packages/analytics-core/package.json +++ b/packages/analytics-core/package.json @@ -39,7 +39,7 @@ "publish": "yarn npm publish --tolerate-republish --access public" }, "dependencies": { - "uuid": "^10.0.0", + "uuid": "^11.1.1", "yup": "^0.32.11" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index da56c4b6..a54d8b9c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -269,7 +269,7 @@ __metadata: "@availity/api-axios": "workspace:*" tsup: "npm:^8.4.0" typescript: "npm:^5.5.4" - uuid: "npm:^10.0.0" + uuid: "npm:^11.1.1" yup: "npm:^0.32.11" languageName: unknown linkType: soft @@ -21579,12 +21579,12 @@ __metadata: languageName: node linkType: hard -"uuid@npm:^10.0.0": - version: 10.0.0 - resolution: "uuid@npm:10.0.0" +"uuid@npm:^11.1.1": + version: 11.1.1 + resolution: "uuid@npm:11.1.1" bin: - uuid: dist/bin/uuid - checksum: 10/35aa60614811a201ff90f8ca5e9ecb7076a75c3821e17f0f5ff72d44e36c2d35fcbc2ceee9c4ac7317f4cc41895da30e74f3885e30313bee48fda6338f250538 + uuid: dist/esm/bin/uuid + checksum: 10/16411d3dc12a08d6691616c09a75e66a7f900ba1beef6628a76fe0602f82fae2ee537b564d0b7bc95c24f58d059ca9b58c75a1e806118efb50e17822ff00ddd2 languageName: node linkType: hard