From c93cfeafe9d55cd76ecec762615fbdaefa9b5b65 Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju Date: Mon, 18 Nov 2024 17:08:26 +0530 Subject: [PATCH 01/15] chore: update code owners and slack group for integrations --- .github/workflows/deploy-npm.yml | 12 ++++++------ .github/workflows/deploy-sanity-suite.yml | 4 ++-- .github/workflows/deploy.yml | 4 ++-- .github/workflows/publish-new-release.yml | 4 ++-- CODEOWNERS | 18 +++++++++--------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/deploy-npm.yml b/.github/workflows/deploy-npm.yml index 63dfa3e0f..71ae08088 100644 --- a/.github/workflows/deploy-npm.yml +++ b/.github/workflows/deploy-npm.yml @@ -155,7 +155,7 @@ jobs: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} payload: | { - "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}\nCC: ", + "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}\nCC: ", "blocks": [ { "type": "header", @@ -171,7 +171,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*<${{ env.NPM_PACKAGE_URL }}|v${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}\nCC: " + "text": "*<${{ env.NPM_PACKAGE_URL }}|v${{ env.CURRENT_VERSION_VALUE }}>*\n${{ env.DATE }}\nCC: " }, "accessory": { "type": "image", @@ -205,7 +205,7 @@ jobs: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} payload: | { - "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_SW_VALUE }}>*\n${{ env.DATE }}\nCC: ", + "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_SW_VALUE }}>*\n${{ env.DATE }}\nCC: ", "blocks": [ { "type": "header", @@ -221,7 +221,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*<${{ env.NPM_PACKAGE_URL }}|v${{ env.CURRENT_VERSION_SW_VALUE }}>*\n${{ env.DATE }}\nCC: " + "text": "*<${{ env.NPM_PACKAGE_URL }}|v${{ env.CURRENT_VERSION_SW_VALUE }}>*\n${{ env.DATE }}\nCC: " }, "accessory": { "type": "image", @@ -255,7 +255,7 @@ jobs: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} payload: | { - "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_COOKIE_UTILS_VALUE }}>*\n${{ env.DATE }}\nCC: ", + "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.NPM_PACKAGE_URL }}|${{ env.CURRENT_VERSION_COOKIE_UTILS_VALUE }}>*\n${{ env.DATE }}\nCC: ", "blocks": [ { "type": "header", @@ -271,7 +271,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*<${{ env.NPM_PACKAGE_URL }}|v${{ env.CURRENT_VERSION_COOKIE_UTILS_VALUE }}>*\n${{ env.DATE }}\nCC: " + "text": "*<${{ env.NPM_PACKAGE_URL }}|v${{ env.CURRENT_VERSION_COOKIE_UTILS_VALUE }}>*\n${{ env.DATE }}\nCC: " }, "accessory": { "type": "image", diff --git a/.github/workflows/deploy-sanity-suite.yml b/.github/workflows/deploy-sanity-suite.yml index 1896ba1b5..0c73ebfab 100644 --- a/.github/workflows/deploy-sanity-suite.yml +++ b/.github/workflows/deploy-sanity-suite.yml @@ -154,7 +154,7 @@ jobs: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} payload: | { - "text": "*New Deployment: ${{ env.PROJECT_NAME }} - <${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: ", + "text": "*New Deployment: ${{ env.PROJECT_NAME }} - <${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: ", "blocks": [ { "type": "header", @@ -170,7 +170,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*<${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: " + "text": "*<${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: " }, "accessory": { "type": "image", diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8dc190672..bfdc3b1b4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -233,7 +233,7 @@ jobs: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} payload: | { - "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: ", + "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: ", "blocks": [ { "type": "header", @@ -249,7 +249,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*<${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: " + "text": "*<${{ env.CDN_URL }}|${{ env.LINK_TEXT }}>*\n${{ env.DATE }}\nCC: " }, "accessory": { "type": "image", diff --git a/.github/workflows/publish-new-release.yml b/.github/workflows/publish-new-release.yml index c03c086fb..836fe8d05 100644 --- a/.github/workflows/publish-new-release.yml +++ b/.github/workflows/publish-new-release.yml @@ -117,7 +117,7 @@ jobs: channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} payload: | { - "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.TAG_COMPARE_URL }}${{ env.last_monorepo_version }}...v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}\nCC: ", + "text": "*New Release: ${{ env.PROJECT_NAME }} - <${{ env.TAG_COMPARE_URL }}${{ env.last_monorepo_version }}...v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}\nCC: ", "blocks": [ { "type": "header", @@ -133,7 +133,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*<${{ env.TAG_COMPARE_URL }}${{ env.last_monorepo_version }}...v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}\nCC: " + "text": "*<${{ env.TAG_COMPARE_URL }}${{ env.last_monorepo_version }}...v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}\nCC: " }, "accessory": { "type": "image", diff --git a/CODEOWNERS b/CODEOWNERS index ba26277d2..ec64eff79 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,12 +1,12 @@ * @rudderlabs/js-sdk -/packages/analytics-js-integrations/src/ @rudderlabs/js-sdk-dm-intg-eng -/packages/analytics-js-integrations/__fixtures__/ @rudderlabs/js-sdk-dm-intg-eng -/packages/analytics-js-integrations/__tests__/ @rudderlabs/js-sdk-dm-intg-eng -/packages/analytics-js-integrations/__mocks__/ @rudderlabs/js-sdk-dm-intg-eng -/packages/analytics-js-integrations/README.md @rudderlabs/js-sdk-dm-intg-eng -/packages/analytics-js-integrations/.size-limit.js @rudderlabs/js-sdk-dm-intg-eng +/packages/analytics-js-integrations/src/ @rudderlabs/integrations +/packages/analytics-js-integrations/__fixtures__/ @rudderlabs/integrations +/packages/analytics-js-integrations/__tests__/ @rudderlabs/integrations +/packages/analytics-js-integrations/__mocks__/ @rudderlabs/integrations +/packages/analytics-js-integrations/README.md @rudderlabs/integrations +/packages/analytics-js-integrations/.size-limit.js @rudderlabs/integrations -/packages/analytics-js-common/src/constants/integrations/ @rudderlabs/js-sdk-dm-intg-eng -/assets/integrations/AdobeAnalytics/ @rudderlabs/js-sdk-dm-intg-eng -/examples/integrations/ @rudderlabs/js-sdk-dm-intg-eng +/packages/analytics-js-common/src/constants/integrations/ @rudderlabs/integrations +/assets/integrations/AdobeAnalytics/ @rudderlabs/integrations +/examples/integrations/ @rudderlabs/integrations From 77f1201a621740a52787c8641a1b3ce6ef8f448a Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju Date: Mon, 18 Nov 2024 17:08:53 +0530 Subject: [PATCH 02/15] chore: convert todo lint rule to warning --- .eslintrc.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.eslintrc.json b/.eslintrc.json index 6ef4c561b..f92368f4e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -138,7 +138,8 @@ } ] } - ] + ], + "sonarjs/todo-tag": "warn" } }, { From 1902aa576d83dbda9bd40ca44e6addf58227e0db Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju Date: Mon, 18 Nov 2024 17:25:52 +0530 Subject: [PATCH 03/15] refactor: use RSA as context --- .../analytics-js-common/src/constants/loggerContexts.ts | 4 ++-- packages/analytics-js/src/app/RudderAnalytics.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/analytics-js-common/src/constants/loggerContexts.ts b/packages/analytics-js-common/src/constants/loggerContexts.ts index 2aa4f7f85..65583c977 100644 --- a/packages/analytics-js-common/src/constants/loggerContexts.ts +++ b/packages/analytics-js-common/src/constants/loggerContexts.ts @@ -11,7 +11,7 @@ const LOAD_CONFIGURATION = 'LoadConfiguration'; const EVENT_REPOSITORY = 'EventRepository'; const EXTERNAL_SRC_LOADER = 'ExternalSrcLoader'; const HTTP_CLIENT = 'HttpClient'; -const RS_APP = 'RudderStackApplication'; +const RSA = 'RudderStackAnalytics'; const ANALYTICS_CORE = 'AnalyticsCore'; export { @@ -28,6 +28,6 @@ export { EVENT_REPOSITORY, EXTERNAL_SRC_LOADER, HTTP_CLIENT, - RS_APP, + RSA, ANALYTICS_CORE, }; diff --git a/packages/analytics-js/src/app/RudderAnalytics.ts b/packages/analytics-js/src/app/RudderAnalytics.ts index dabf2b191..110598b3a 100644 --- a/packages/analytics-js/src/app/RudderAnalytics.ts +++ b/packages/analytics-js/src/app/RudderAnalytics.ts @@ -17,7 +17,7 @@ import { } from '@rudderstack/analytics-js-common/types/LoadOptions'; import type { ApiCallback, ApiOptions } from '@rudderstack/analytics-js-common/types/EventApi'; import type { ApiObject } from '@rudderstack/analytics-js-common/types/ApiObject'; -import { RS_APP } from '@rudderstack/analytics-js-common/constants/loggerContexts'; +import { RSA } from '@rudderstack/analytics-js-common/constants/loggerContexts'; import { isString } from '@rudderstack/analytics-js-common/utilities/checks'; import type { IdentifyTraits } from '@rudderstack/analytics-js-common/types/traits'; import { generateUUID } from '@rudderstack/analytics-js-common/utilities/uuId'; @@ -132,7 +132,7 @@ class RudderAnalytics implements IRudderAnalytics { */ load(writeKey: string, dataPlaneUrl: string, loadOptions?: Partial) { if (!isString(writeKey)) { - this.logger.error(WRITE_KEY_NOT_A_STRING_ERROR(RS_APP, writeKey)); + this.logger.error(WRITE_KEY_NOT_A_STRING_ERROR(RSA, writeKey)); return; } @@ -264,7 +264,7 @@ class RudderAnalytics implements IRudderAnalytics { }); } else { // throw warning if beacon is disabled - this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RS_APP)); + this.logger.warn(PAGE_UNLOAD_ON_BEACON_DISABLED_WARNING(RSA)); } } } @@ -440,7 +440,7 @@ class RudderAnalytics implements IRudderAnalytics { callback?: ApiCallback, ) { if (arguments.length === 0) { - this.logger.error(EMPTY_GROUP_CALL_ERROR(RS_APP)); + this.logger.error(EMPTY_GROUP_CALL_ERROR(RSA)); return; } From d821ee399b3bcbf85e2c70c851f73be2b3be88e2 Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju Date: Mon, 18 Nov 2024 17:34:04 +0530 Subject: [PATCH 04/15] refactor: fix types --- packages/analytics-js-common/src/types/ApiObject.ts | 2 +- packages/analytics-js-common/src/types/IRudderAnalytics.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/analytics-js-common/src/types/ApiObject.ts b/packages/analytics-js-common/src/types/ApiObject.ts index 1265ec70d..a72a68bac 100644 --- a/packages/analytics-js-common/src/types/ApiObject.ts +++ b/packages/analytics-js-common/src/types/ApiObject.ts @@ -10,6 +10,6 @@ export type ApiObject = { | ApiObject | null | Date - | (string | number | boolean | null | Date | ApiObject)[] + | (string | number | boolean | null | Date | ApiObject | undefined)[] | undefined; }; diff --git a/packages/analytics-js-common/src/types/IRudderAnalytics.ts b/packages/analytics-js-common/src/types/IRudderAnalytics.ts index c9dcdbdfb..3663b78c5 100644 --- a/packages/analytics-js-common/src/types/IRudderAnalytics.ts +++ b/packages/analytics-js-common/src/types/IRudderAnalytics.ts @@ -85,7 +85,7 @@ export interface IRudderAnalytics { /** * Get the instance of Analytics that is set as default */ - getAnalyticsInstance(writeKey?: string): T; + getAnalyticsInstance(writeKey?: string): T | undefined; /** * Trigger load event in buffer queue if exists @@ -188,7 +188,7 @@ export interface IRudderAnalytics { /** * To fetch the current sessionId */ - getSessionId(): Nullable; + getSessionId(): Nullable | undefined; /** * To provide consent From 7bd0cc98d5de1e9c20aaee4400263da12f2943d1 Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju Date: Mon, 18 Nov 2024 17:53:14 +0530 Subject: [PATCH 05/15] feat: add more utilities --- .../__tests__/utilities/errors.test.ts | 18 ++ .../__tests__/utilities/json.test.ts | 251 +++++++++++++++++- .../src/constants/logMessages.ts | 8 +- .../src/utilities/checks.ts | 8 + .../src/utilities/errors.ts | 11 +- .../analytics-js-common/src/utilities/json.ts | 107 +++++++- .../src/utilities/object.ts | 5 +- 7 files changed, 400 insertions(+), 8 deletions(-) create mode 100644 packages/analytics-js-common/__tests__/utilities/errors.test.ts diff --git a/packages/analytics-js-common/__tests__/utilities/errors.test.ts b/packages/analytics-js-common/__tests__/utilities/errors.test.ts new file mode 100644 index 000000000..d1dab5619 --- /dev/null +++ b/packages/analytics-js-common/__tests__/utilities/errors.test.ts @@ -0,0 +1,18 @@ +import { dispatchErrorEvent } from '../../src/utilities/errors'; + +describe('Errors - utilities', () => { + describe('dispatchErrorEvent', () => { + it('should dispatch an error event', () => { + const dispatchEvent = jest.fn(); + const originalDispatchEvent = globalThis.dispatchEvent; + + globalThis.dispatchEvent = dispatchEvent; + const error = new Error('Test error'); + dispatchErrorEvent(error); + expect(dispatchEvent).toHaveBeenCalledWith(new ErrorEvent('error', { error })); + + // Cleanup + globalThis.dispatchEvent = originalDispatchEvent; + }); + }); +}); diff --git a/packages/analytics-js-common/__tests__/utilities/json.test.ts b/packages/analytics-js-common/__tests__/utilities/json.test.ts index 451527403..425dfa4c8 100644 --- a/packages/analytics-js-common/__tests__/utilities/json.test.ts +++ b/packages/analytics-js-common/__tests__/utilities/json.test.ts @@ -1,5 +1,9 @@ import { clone } from 'ramda'; -import { stringifyWithoutCircular } from '../../src/utilities/json'; +import { + getSanitizedValue, + stringifyData, + stringifyWithoutCircular, +} from '../../src/utilities/json'; const identifyTraitsPayloadMock: Record = { firstName: 'Dummy Name', @@ -47,6 +51,7 @@ const identifyTraitsPayloadMock: Record = { }; const circularReferenceNotice = '[Circular Reference]'; +const bigIntNotice = '[BigInt]'; describe('Common Utils - JSON', () => { describe('stringifyWithoutCircular', () => { @@ -152,4 +157,248 @@ describe('Common Utils - JSON', () => { ); }); }); + + describe('stringifyData', () => { + it('should stringify json excluding null values', () => { + // Define an object with null values in multiple levels along with other data types + const obj = { + key1: 'value1', + key2: null, + key3: { + key4: null, + key5: 'value5', + key10: undefined, + key6: { + key7: null, + key8: 'value8', + key9: undefined, + key11: [1, 2, null, 3], + }, + }, + }; + + expect(stringifyData(obj)).toBe( + '{"key1":"value1","key3":{"key5":"value5","key6":{"key8":"value8","key11":[1,2,null,3]}}}', + ); + }); + + it('should stringify json without excluding null values', () => { + // Define an object with null values in multiple levels along with other data types + const obj = { + key1: 'value1', + key2: null, + key3: { + key4: null, + key5: 'value5', + key6: { + key7: null, + key8: 'value8', + }, + }, + }; + + expect(stringifyData(obj, false)).toBe( + '{"key1":"value1","key2":null,"key3":{"key4":null,"key5":"value5","key6":{"key7":null,"key8":"value8"}}}', + ); + }); + + it('should stringify json after excluding certain keys', () => { + // Define an object with null values in multiple levels along with other data types + const obj = { + key1: 'value1', + key2: null, + key3: { + key4: null, + key5: 'value5', + key6: { + key7: null, + key8: 'value8', + }, + }, + }; + + const keysToExclude = ['key1', 'key7']; + + expect(stringifyData(obj, true, keysToExclude)).toBe( + '{"key3":{"key5":"value5","key6":{"key8":"value8"}}}', + ); + + expect(stringifyData(obj, false, keysToExclude)).toBe( + '{"key2":null,"key3":{"key4":null,"key5":"value5","key6":{"key8":"value8"}}}', + ); + }); + }); + + describe('getSanitizedValue', () => { + const mockLogger = { + warn: jest.fn(), + }; + + it('should sanitize json without excluding null and undefined values', () => { + const obj = { + a: 1, + b: null, + c: 'value', + d: undefined, + i: () => {}, + e: { + f: 2, + g: null, + h: 'value', + i: undefined, + j: { + k: 3, + l: null, + m: 'value', + n: [1, 2, 3], + o: [1, 2, 3, new Date()], + s: () => {}, + }, + }, + }; + + expect(getSanitizedValue(obj)).toEqual(obj); + }); + + it('should sanitize json after replacing BigInt and circular references', () => { + const obj = { + a: BigInt(1), + b: undefined, + c: 'value', + d: { + e: BigInt(2), + f: undefined, + g: 'value', + h: { + i: BigInt(3), + j: undefined, + k: 'value', + }, + }, + }; + + obj.myself = obj; + obj.d.myself2 = obj.d; + obj.d.h.myself3 = obj.d; + + expect(getSanitizedValue(obj, mockLogger)).toEqual({ + a: bigIntNotice, + c: 'value', + b: undefined, + myself: circularReferenceNotice, + d: { + e: bigIntNotice, + g: 'value', + f: undefined, + myself2: circularReferenceNotice, + h: { + i: bigIntNotice, + k: 'value', + j: undefined, + myself3: circularReferenceNotice, + }, + }, + }); + + expect(mockLogger.warn).toHaveBeenCalledTimes(6); + + expect(mockLogger.warn).toHaveBeenNthCalledWith( + 1, + 'JSON:: A bad data (like circular reference, BigInt) has been detected in the object and the property "a" has been dropped from the output.', + ); + + expect(mockLogger.warn).toHaveBeenNthCalledWith( + 2, + 'JSON:: A bad data (like circular reference, BigInt) has been detected in the object and the property "e" has been dropped from the output.', + ); + + expect(mockLogger.warn).toHaveBeenNthCalledWith( + 3, + 'JSON:: A bad data (like circular reference, BigInt) has been detected in the object and the property "i" has been dropped from the output.', + ); + + expect(mockLogger.warn).toHaveBeenNthCalledWith( + 4, + 'JSON:: A bad data (like circular reference, BigInt) has been detected in the object and the property "myself3" has been dropped from the output.', + ); + + expect(mockLogger.warn).toHaveBeenNthCalledWith( + 5, + 'JSON:: A bad data (like circular reference, BigInt) has been detected in the object and the property "myself2" has been dropped from the output.', + ); + + expect(mockLogger.warn).toHaveBeenNthCalledWith( + 6, + 'JSON:: A bad data (like circular reference, BigInt) has been detected in the object and the property "myself" has been dropped from the output.', + ); + }); + + it('should sanitize json even if it contains reused objects', () => { + const obj = { + a: BigInt(1), + b: undefined, + c: 'value', + d: { + e: BigInt(2), + f: undefined, + g: 'value', + h: { + i: BigInt(3), + j: undefined, + k: 'value', + }, + }, + }; + + const reusableArray = [1, 2, 3]; + const reusableObject = { dummy: 'val' }; + obj.reused = reusableArray; + obj.reusedAgain = [1, 2, reusableArray]; + obj.reusedObj = reusableObject; + obj.reusedObjAgain = { reused: reusableObject }; + + obj.d.reused = reusableArray; + obj.d.h.reused = reusableObject; + obj.d.h.reusedAgain = [1, 2, reusableArray]; + + expect(getSanitizedValue(obj)).toEqual({ + a: bigIntNotice, + c: 'value', + b: undefined, + reused: [1, 2, 3], + reusedAgain: [1, 2, [1, 2, 3]], + reusedObj: { dummy: 'val' }, + reusedObjAgain: { reused: { dummy: 'val' } }, + d: { + e: bigIntNotice, + g: 'value', + f: undefined, + reused: [1, 2, 3], + h: { + i: bigIntNotice, + k: 'value', + j: undefined, + reused: { dummy: 'val' }, + reusedAgain: [1, 2, [1, 2, 3]], + }, + }, + }); + }); + + it('should sanitize all data types', () => { + const array = [1, 2, 3]; + const number = 1; + const string = ''; + const object = {}; + const date = new Date(2023, 1, 20, 0, 0, 0); + + expect(getSanitizedValue(array)).toEqual(array); + expect(getSanitizedValue(number)).toEqual(number); + expect(getSanitizedValue(string)).toEqual(string); + expect(getSanitizedValue(object)).toEqual(object); + expect(getSanitizedValue(date)).toEqual(date); + expect(getSanitizedValue(null)).toEqual(null); + expect(getSanitizedValue(undefined)).toEqual(undefined); + }); + }); }); diff --git a/packages/analytics-js-common/src/constants/logMessages.ts b/packages/analytics-js-common/src/constants/logMessages.ts index 91eb20f04..83ef4fa82 100644 --- a/packages/analytics-js-common/src/constants/logMessages.ts +++ b/packages/analytics-js-common/src/constants/logMessages.ts @@ -14,11 +14,15 @@ const CIRCULAR_REFERENCE_WARNING = (context: string, key: string): string => const JSON_STRINGIFY_WARNING = `Failed to convert the value to a JSON string.`; +const BAD_DATA_WARNING = (context: string, key: string): string => + `${context}${LOG_CONTEXT_SEPARATOR}A bad data (like circular reference, BigInt) has been detected in the object and the property "${key}" has been dropped from the output.`; + export { LOG_CONTEXT_SEPARATOR, SCRIPT_ALREADY_EXISTS_ERROR, SCRIPT_LOAD_ERROR, SCRIPT_LOAD_TIMEOUT_ERROR, CIRCULAR_REFERENCE_WARNING, - JSON_STRINGIFY_WARNING -} + JSON_STRINGIFY_WARNING, + BAD_DATA_WARNING, +}; diff --git a/packages/analytics-js-common/src/utilities/checks.ts b/packages/analytics-js-common/src/utilities/checks.ts index afb4def56..fc973a34c 100644 --- a/packages/analytics-js-common/src/utilities/checks.ts +++ b/packages/analytics-js-common/src/utilities/checks.ts @@ -35,6 +35,13 @@ const isUndefined = (value: any): value is undefined => typeof value === 'undefi */ const isNullOrUndefined = (value: any): boolean => isNull(value) || isUndefined(value); +/** + * Checks if the input is a BigInt + * @param value input value + * @returns True if the input is a BigInt + */ +const isBigInt = (value: any): value is bigint => typeof value === 'bigint'; + /** * A function to check given value is defined * @param value input value @@ -74,4 +81,5 @@ export { isDefined, isDefinedAndNotNull, isDefinedNotNullAndNotEmptyString, + isBigInt, }; diff --git a/packages/analytics-js-common/src/utilities/errors.ts b/packages/analytics-js-common/src/utilities/errors.ts index 5e806a6dc..e9fac17a8 100644 --- a/packages/analytics-js-common/src/utilities/errors.ts +++ b/packages/analytics-js-common/src/utilities/errors.ts @@ -1,6 +1,8 @@ import { isTypeOfError } from './checks'; import { stringifyWithoutCircular } from './json'; +const MANUAL_ERROR_IDENTIFIER = '[MANUAL ERROR]'; + /** * Get mutated error with issue prepended to error message * @param err Original error @@ -17,4 +19,11 @@ const getMutatedError = (err: any, issue: string): Error => { return finalError; }; -export { getMutatedError }; +const dispatchErrorEvent = (error: any) => { + if (isTypeOfError(error)) { + error.stack = `${error.stack ?? ''}\n${MANUAL_ERROR_IDENTIFIER}`; + } + (globalThis as typeof window).dispatchEvent(new ErrorEvent('error', { error })); +}; + +export { getMutatedError, dispatchErrorEvent, MANUAL_ERROR_IDENTIFIER }; diff --git a/packages/analytics-js-common/src/utilities/json.ts b/packages/analytics-js-common/src/utilities/json.ts index 128d9edc5..f8d593403 100644 --- a/packages/analytics-js-common/src/utilities/json.ts +++ b/packages/analytics-js-common/src/utilities/json.ts @@ -1,7 +1,12 @@ import type { ILogger } from '../types/Logger'; import type { Nullable } from '../types/Nullable'; -import { isNull, isNullOrUndefined } from './checks'; -import { CIRCULAR_REFERENCE_WARNING, JSON_STRINGIFY_WARNING } from '../constants/logMessages'; +import { isBigInt, isNull, isNullOrUndefined } from './checks'; +import { + BAD_DATA_WARNING, + CIRCULAR_REFERENCE_WARNING, + JSON_STRINGIFY_WARNING, +} from '../constants/logMessages'; +import { isObjectLiteralAndNotNull } from './object'; const JSON_STRINGIFY = 'JSONStringify'; @@ -66,4 +71,100 @@ const stringifyWithoutCircular = | any[] | number | str } }; -export { stringifyWithoutCircular }; +const JSON_UTIL = 'JSON'; + +/** + * Utility method for JSON stringify object excluding null values & circular references + * + * @param {*} value input value + * @param {boolean} excludeNull optional flag to exclude null values + * @param {string[]} excludeKeys optional array of keys to exclude + * @returns string + */ +const stringifyData = | any[] | number | string>( + value?: Nullable, + excludeNull: boolean = true, + excludeKeys: string[] = [], +): string => + JSON.stringify(value, (key: string, value: any): any => { + if ((excludeNull && isNull(value)) || excludeKeys.includes(key)) { + return undefined; + } + return value; + }); + +const getReplacer = (logger?: ILogger): ((key: string, value: any) => any) => { + const ancestors: any[] = []; // Array to track ancestor objects + + // Using a regular function to use `this` for the parent context + return function replacer(key, value): any { + if (isBigInt(value)) { + logger?.warn(BAD_DATA_WARNING(JSON_UTIL, key)); + return '[BigInt]'; // Replace BigInt values + } + + // `this` is the object that value is contained in, i.e., its direct parent. + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore-next-line + while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) { + ancestors.pop(); // Remove ancestors that are no longer part of the chain + } + + // Check for circular references (if the value is already in the ancestors) + if (ancestors.includes(value)) { + logger?.warn(BAD_DATA_WARNING(JSON_UTIL, key)); + return '[Circular Reference]'; + } + + // Add current value to ancestors + ancestors.push(value); + + return value; + }; +}; + +const traverseWithThis = (obj: any, replacer: (key: string, value: any) => any): any => { + // Create a new result object or array + const result = Array.isArray(obj) ? [] : {}; + + // Traverse object properties or array elements + // eslint-disable-next-line no-restricted-syntax + for (const key in obj) { + if (Object.hasOwnProperty.call(obj, key)) { + const value = obj[key]; + + // Recursively apply the replacer and traversal + const sanitizedValue = replacer.call(obj, key, value); + + // If the value is an object or array, continue traversal + if (isObjectLiteralAndNotNull(sanitizedValue) || Array.isArray(sanitizedValue)) { + (result as any)[key] = traverseWithThis(sanitizedValue, replacer); + } else { + (result as any)[key] = sanitizedValue; + } + } + } + + return result; +}; + +/** + * Recursively traverses an object similar to JSON.stringify, + * sanitizing BigInts and circular references + * @param value Input object + * @param logger Logger instance + * @returns Sanitized value + */ +const getSanitizedValue = (value: T, logger?: ILogger): T => { + const replacer = getReplacer(logger); + + // This is needed for registering the first ancestor + const newValue = replacer.call(value, '', value); + + if (isObjectLiteralAndNotNull(value) || Array.isArray(value)) { + return traverseWithThis(value, replacer); + } + return newValue; +}; + +export { stringifyWithoutCircular, getSanitizedValue, stringifyData }; diff --git a/packages/analytics-js-common/src/utilities/object.ts b/packages/analytics-js-common/src/utilities/object.ts index 276aac118..366e605a0 100644 --- a/packages/analytics-js-common/src/utilities/object.ts +++ b/packages/analytics-js-common/src/utilities/object.ts @@ -9,13 +9,15 @@ const getValueByPath = (obj: Record, keyPath: string): any => { const hasValueByPath = (obj: Record, path: string): boolean => Boolean(getValueByPath(obj, path)); +const isObject = (value: any): value is object => typeof value === 'object'; + /** * Checks if the input is an object literal or built-in object type and not null * @param value Input value * @returns true if the input is an object and not null */ const isObjectAndNotNull = (value: any): value is object => - !isNull(value) && typeof value === 'object' && !Array.isArray(value); + !isNull(value) && isObject(value) && !Array.isArray(value); /** * Checks if the input is an object literal and not null @@ -116,4 +118,5 @@ export { removeUndefinedValues, removeUndefinedAndNullValues, getObjectValues, + isObject, }; From cf2f7c056e06f36f97e1c8b40af02533e609515a Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:35 +0000 Subject: [PATCH 06/15] chore(@rudderstack/analytics-js-common): release version 3.13.0 --- packages/analytics-js-common/CHANGELOG.md | 7 +++++++ packages/analytics-js-common/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js-common/CHANGELOG.md b/packages/analytics-js-common/CHANGELOG.md index 98e005f0a..6099859dd 100644 --- a/packages/analytics-js-common/CHANGELOG.md +++ b/packages/analytics-js-common/CHANGELOG.md @@ -2,6 +2,13 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.13.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-common@3.12.1...@rudderstack/analytics-js-common@3.13.0) (2024-11-18) + + +### Features + +* add more utilities ([7bd0cc9](https://github.com/rudderlabs/rudder-sdk-js/commit/7bd0cc98d5de1e9c20aaee4400263da12f2943d1)) + ## [3.12.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-common@3.12.0...@rudderstack/analytics-js-common@3.12.1) (2024-11-12) diff --git a/packages/analytics-js-common/package.json b/packages/analytics-js-common/package.json index a0dd3a130..9818557b0 100644 --- a/packages/analytics-js-common/package.json +++ b/packages/analytics-js-common/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-common", - "version": "3.12.1", + "version": "3.13.0", "private": true, "description": "RudderStack JavaScript SDK common code", "module": "dist/npm/index.js", From 69afb5f8703b11f34b37d1b82860523f78018589 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:36 +0000 Subject: [PATCH 07/15] chore(@rudderstack/analytics-js-plugins): release version 3.6.2 --- packages/analytics-js-plugins/CHANGELOG.md | 7 +++++++ packages/analytics-js-plugins/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js-plugins/CHANGELOG.md b/packages/analytics-js-plugins/CHANGELOG.md index cf14c1e9e..e9b0fa77f 100644 --- a/packages/analytics-js-plugins/CHANGELOG.md +++ b/packages/analytics-js-plugins/CHANGELOG.md @@ -2,6 +2,13 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.6.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.6.1...@rudderstack/analytics-js-plugins@3.6.2) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js-common` updated to version `3.13.0` +* `@rudderstack/analytics-js` updated to version `3.10.1` +* `@rudderstack/analytics-js-cookies` updated to version `0.4.1` ## [3.6.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.6.0...@rudderstack/analytics-js-plugins@3.6.1) (2024-11-12) ### Dependency Updates diff --git a/packages/analytics-js-plugins/package.json b/packages/analytics-js-plugins/package.json index 941d933c9..817d70e15 100644 --- a/packages/analytics-js-plugins/package.json +++ b/packages/analytics-js-plugins/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-plugins", - "version": "3.6.1", + "version": "3.6.2", "private": true, "description": "RudderStack JavaScript SDK plugins", "main": "dist/npm/modern/cjs/index.cjs", From cb1c4818430f2213fbef3853627d841fc359427f Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:37 +0000 Subject: [PATCH 08/15] chore(@rudderstack/analytics-js-cookies): release version 0.4.2 --- packages/analytics-js-cookies/CHANGELOG.md | 5 +++++ packages/analytics-js-cookies/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js-cookies/CHANGELOG.md b/packages/analytics-js-cookies/CHANGELOG.md index bbc6d0a05..1f594bf33 100644 --- a/packages/analytics-js-cookies/CHANGELOG.md +++ b/packages/analytics-js-cookies/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [0.4.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-cookies@0.4.1...@rudderstack/analytics-js-cookies@0.4.2) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js-common` updated to version `3.13.0` ## [0.4.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-cookies@0.4.0...@rudderstack/analytics-js-cookies@0.4.1) (2024-11-12) ### Dependency Updates diff --git a/packages/analytics-js-cookies/package.json b/packages/analytics-js-cookies/package.json index 11be833f9..7852d9e27 100644 --- a/packages/analytics-js-cookies/package.json +++ b/packages/analytics-js-cookies/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-cookies", - "version": "0.4.1", + "version": "0.4.2", "description": "RudderStack JavaScript SDK Cookies Utilities", "main": "dist/npm/modern/cjs/index.cjs", "module": "dist/npm/modern/esm/index.mjs", From 580c32e50a5c4552e212506a3d8237b797f54542 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:38 +0000 Subject: [PATCH 09/15] chore(@rudderstack/analytics-js): release version 3.10.2 --- packages/analytics-js/CHANGELOG.md | 7 +++++++ packages/analytics-js/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js/CHANGELOG.md b/packages/analytics-js/CHANGELOG.md index 0b7d1436c..4dca8ae5f 100644 --- a/packages/analytics-js/CHANGELOG.md +++ b/packages/analytics-js/CHANGELOG.md @@ -2,6 +2,13 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.10.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.10.1...@rudderstack/analytics-js@3.10.2) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js-cookies` updated to version `0.4.2` +* `@rudderstack/analytics-js-common` updated to version `3.13.0` +* `@rudderstack/analytics-js-plugins` updated to version `3.6.2` ## [3.10.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.10.0...@rudderstack/analytics-js@3.10.1) (2024-11-12) ### Dependency Updates diff --git a/packages/analytics-js/package.json b/packages/analytics-js/package.json index 74de6a0b0..ddef1b415 100644 --- a/packages/analytics-js/package.json +++ b/packages/analytics-js/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js", - "version": "3.10.1", + "version": "3.10.2", "description": "RudderStack JavaScript SDK", "main": "dist/npm/modern/cjs/index.cjs", "module": "dist/npm/modern/esm/index.mjs", From 8239f5dfdf91d8e39acbcf082afa4c1e44d8f0da Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:39 +0000 Subject: [PATCH 10/15] chore(rudder-sdk-js): release version 2.48.27 --- packages/analytics-v1.1/CHANGELOG.md | 5 +++++ packages/analytics-v1.1/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/analytics-v1.1/CHANGELOG.md b/packages/analytics-v1.1/CHANGELOG.md index e994c19e5..0164e14d3 100644 --- a/packages/analytics-v1.1/CHANGELOG.md +++ b/packages/analytics-v1.1/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [2.48.27](https://github.com/rudderlabs/rudder-sdk-js/compare/rudder-sdk-js@2.48.26...rudder-sdk-js@2.48.27) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js-common` updated to version `3.13.0` ## [2.48.26](https://github.com/rudderlabs/rudder-sdk-js/compare/rudder-sdk-js@2.48.25...rudder-sdk-js@2.48.26) (2024-11-12) ### Dependency Updates diff --git a/packages/analytics-v1.1/package.json b/packages/analytics-v1.1/package.json index a269a2b97..cfd46b717 100644 --- a/packages/analytics-v1.1/package.json +++ b/packages/analytics-v1.1/package.json @@ -1,6 +1,6 @@ { "name": "rudder-sdk-js", - "version": "2.48.26", + "version": "2.48.27", "description": "RudderStack JavaScript SDK", "main": "dist/npm/index.js", "module": "dist/npm/index.es.js", From b272933d9884e351f079e9daa3c074bfe477fe37 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:40 +0000 Subject: [PATCH 11/15] chore(@rudderstack/analytics-js-loading-scripts): release version 3.0.42 --- packages/loading-scripts/CHANGELOG.md | 5 +++++ packages/loading-scripts/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/loading-scripts/CHANGELOG.md b/packages/loading-scripts/CHANGELOG.md index ce9945d80..097403e18 100644 --- a/packages/loading-scripts/CHANGELOG.md +++ b/packages/loading-scripts/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.0.42](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.41...@rudderstack/analytics-js-loading-scripts@3.0.42) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.10.2` ## [3.0.41](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.40...@rudderstack/analytics-js-loading-scripts@3.0.41) (2024-11-12) ### Dependency Updates diff --git a/packages/loading-scripts/package.json b/packages/loading-scripts/package.json index 2e1210a4b..96aff3f41 100644 --- a/packages/loading-scripts/package.json +++ b/packages/loading-scripts/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-loading-scripts", - "version": "3.0.41", + "version": "3.0.42", "private": true, "description": "Loading script for RudderStack JavaScript SDK", "main": "./src/index.js", From f97ef3d0479087ec0aacba996d73a437fba4a190 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:41 +0000 Subject: [PATCH 12/15] chore(@rudderstack/analytics-js-integrations): release version 3.10.4 --- packages/analytics-js-integrations/CHANGELOG.md | 5 +++++ packages/analytics-js-integrations/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js-integrations/CHANGELOG.md b/packages/analytics-js-integrations/CHANGELOG.md index 8ad43f0e1..ae91ccc1b 100644 --- a/packages/analytics-js-integrations/CHANGELOG.md +++ b/packages/analytics-js-integrations/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.10.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-integrations@3.10.3...@rudderstack/analytics-js-integrations@3.10.4) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js-common` updated to version `3.13.0` ## [3.10.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-integrations@3.10.2...@rudderstack/analytics-js-integrations@3.10.3) (2024-11-12) ### Dependency Updates diff --git a/packages/analytics-js-integrations/package.json b/packages/analytics-js-integrations/package.json index a47716cbd..343dddf47 100644 --- a/packages/analytics-js-integrations/package.json +++ b/packages/analytics-js-integrations/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-integrations", - "version": "3.10.3", + "version": "3.10.4", "private": true, "description": "RudderStack JavaScript SDK device mode integrations", "main": "dist/npm/modern/cjs/index.js", From 2d822e8cb9b77fc23b7d4d91cab8233777f842bc Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:42 +0000 Subject: [PATCH 13/15] chore(@rudderstack/analytics-js-service-worker): release version 3.2.2 --- packages/analytics-js-service-worker/CHANGELOG.md | 5 +++++ packages/analytics-js-service-worker/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/analytics-js-service-worker/CHANGELOG.md b/packages/analytics-js-service-worker/CHANGELOG.md index b0a32a48a..adc2cf308 100644 --- a/packages/analytics-js-service-worker/CHANGELOG.md +++ b/packages/analytics-js-service-worker/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.2.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-service-worker@3.2.1...@rudderstack/analytics-js-service-worker@3.2.2) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js-common` updated to version `3.13.0` ## [3.2.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-service-worker@3.2.0...@rudderstack/analytics-js-service-worker@3.2.1) (2024-11-12) ### Dependency Updates diff --git a/packages/analytics-js-service-worker/package.json b/packages/analytics-js-service-worker/package.json index e5e70cbdd..798751355 100644 --- a/packages/analytics-js-service-worker/package.json +++ b/packages/analytics-js-service-worker/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-service-worker", - "version": "3.2.1", + "version": "3.2.2", "description": "RudderStack JavaScript Service Worker SDK", "main": "dist/npm/modern/cjs/index.cjs", "module": "dist/npm/modern/esm/index.mjs", From b81c5d226f0d19bea4689dad013051bf04186253 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:43 +0000 Subject: [PATCH 14/15] chore(@rudderstack/analytics-js-sanity-suite): release version 3.1.33 --- packages/sanity-suite/CHANGELOG.md | 5 +++++ packages/sanity-suite/package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/sanity-suite/CHANGELOG.md b/packages/sanity-suite/CHANGELOG.md index 36d3d3438..c3cfe7c4a 100644 --- a/packages/sanity-suite/CHANGELOG.md +++ b/packages/sanity-suite/CHANGELOG.md @@ -2,6 +2,11 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [3.1.33](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-sanity-suite@3.1.32...@rudderstack/analytics-js-sanity-suite@3.1.33) (2024-11-18) + +### Dependency Updates + +* `@rudderstack/analytics-js` updated to version `3.10.2` ## [3.1.32](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-sanity-suite@3.1.31...@rudderstack/analytics-js-sanity-suite@3.1.32) (2024-11-12) ### Dependency Updates diff --git a/packages/sanity-suite/package.json b/packages/sanity-suite/package.json index 64305216d..baee28322 100644 --- a/packages/sanity-suite/package.json +++ b/packages/sanity-suite/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-sanity-suite", - "version": "3.1.32", + "version": "3.1.33", "private": true, "description": "Sanity suite for testing JS SDK package", "main": "./dist/v3/cdn/testBook.js", From 32b2ce8d25f796a46e33bb1ed548c02ef475f57a Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Mon, 18 Nov 2024 12:31:54 +0000 Subject: [PATCH 15/15] chore(monorepo): sync versions and generate release logs --- package-lock.json | 22 +++++++++---------- package.json | 2 +- .../analytics-js-common/CHANGELOG_LATEST.md | 6 ++--- packages/analytics-js-common/project.json | 6 ++--- .../analytics-js-cookies/CHANGELOG_LATEST.md | 9 ++------ packages/analytics-js-cookies/project.json | 6 ++--- .../CHANGELOG_LATEST.md | 4 ++-- .../analytics-js-integrations/project.json | 6 ++--- .../analytics-js-plugins/CHANGELOG_LATEST.md | 14 ++++-------- packages/analytics-js-plugins/project.json | 6 ++--- .../CHANGELOG_LATEST.md | 4 ++-- .../analytics-js-service-worker/project.json | 6 ++--- packages/analytics-js/CHANGELOG_LATEST.md | 14 ++++-------- packages/analytics-js/project.json | 6 ++--- packages/analytics-v1.1/CHANGELOG_LATEST.md | 4 ++-- packages/analytics-v1.1/project.json | 6 ++--- packages/loading-scripts/CHANGELOG_LATEST.md | 4 ++-- packages/loading-scripts/project.json | 6 ++--- sonar-project.properties | 2 +- 19 files changed, 58 insertions(+), 75 deletions(-) diff --git a/package-lock.json b/package-lock.json index 495930caa..edd52f3db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.50.0", + "version": "3.51.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.50.0", + "version": "3.51.0", "hasInstallScript": true, "license": "Elastic-2.0", "workspaces": [ @@ -25284,7 +25284,7 @@ }, "packages/analytics-js": { "name": "@rudderstack/analytics-js", - "version": "3.10.1", + "version": "3.10.2", "license": "Elastic-2.0", "dependencies": { "@preact/signals-core": "1.8.0", @@ -25298,7 +25298,7 @@ }, "packages/analytics-js-common": { "name": "@rudderstack/analytics-js-common", - "version": "3.12.1", + "version": "3.13.0", "license": "Elastic-2.0", "dependencies": { "@lukeed/uuid": "2.0.1", @@ -25315,7 +25315,7 @@ }, "packages/analytics-js-cookies": { "name": "@rudderstack/analytics-js-cookies", - "version": "0.4.1", + "version": "0.4.2", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js-common": "*" @@ -25324,7 +25324,7 @@ }, "packages/analytics-js-integrations": { "name": "@rudderstack/analytics-js-integrations", - "version": "3.10.3", + "version": "3.10.4", "license": "Elastic-2.0", "dependencies": { "@lukeed/uuid": "2.0.1", @@ -25344,7 +25344,7 @@ }, "packages/analytics-js-plugins": { "name": "@rudderstack/analytics-js-plugins", - "version": "3.6.1", + "version": "3.6.2", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js-common": "*", @@ -25358,7 +25358,7 @@ }, "packages/analytics-js-service-worker": { "name": "@rudderstack/analytics-js-service-worker", - "version": "3.2.1", + "version": "3.2.2", "license": "Elastic-2.0", "dependencies": { "@lukeed/uuid": "2.0.1", @@ -25379,7 +25379,7 @@ }, "packages/analytics-v1.1": { "name": "rudder-sdk-js", - "version": "2.48.26", + "version": "2.48.27", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js-common": "*" @@ -25388,7 +25388,7 @@ }, "packages/loading-scripts": { "name": "@rudderstack/analytics-js-loading-scripts", - "version": "3.0.41", + "version": "3.0.42", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js": "*" @@ -25397,7 +25397,7 @@ }, "packages/sanity-suite": { "name": "@rudderstack/analytics-js-sanity-suite", - "version": "3.1.32", + "version": "3.1.33", "license": "Elastic-2.0", "dependencies": { "@rudderstack/analytics-js": "*", diff --git a/package.json b/package.json index 931fbe91e..0e0c4466d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/analytics-js-monorepo", - "version": "3.50.0", + "version": "3.51.0", "private": true, "description": "Monorepo for RudderStack Analytics JS SDK", "workspaces": [ diff --git a/packages/analytics-js-common/CHANGELOG_LATEST.md b/packages/analytics-js-common/CHANGELOG_LATEST.md index 599acb8c8..06ff69a74 100644 --- a/packages/analytics-js-common/CHANGELOG_LATEST.md +++ b/packages/analytics-js-common/CHANGELOG_LATEST.md @@ -1,7 +1,7 @@ -## [3.12.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-common@3.12.0...@rudderstack/analytics-js-common@3.12.1) (2024-11-12) +## [3.13.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-common@3.12.1...@rudderstack/analytics-js-common@3.13.0) (2024-11-18) -### Bug Fixes +### Features -* revert sanitization changes ([#1916](https://github.com/rudderlabs/rudder-sdk-js/issues/1916)) ([890fb7b](https://github.com/rudderlabs/rudder-sdk-js/commit/890fb7b615535992290f5008b93d77b540c03955)), closes [#1907](https://github.com/rudderlabs/rudder-sdk-js/issues/1907) [#1902](https://github.com/rudderlabs/rudder-sdk-js/issues/1902) +* add more utilities ([7bd0cc9](https://github.com/rudderlabs/rudder-sdk-js/commit/7bd0cc98d5de1e9c20aaee4400263da12f2943d1)) diff --git a/packages/analytics-js-common/project.json b/packages/analytics-js-common/project.json index 84a1ebd3d..d3ade0832 100644 --- a/packages/analytics-js-common/project.json +++ b/packages/analytics-js-common/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-common@3.12.1", - "title": "@rudderstack/analytics-js-common@3.12.1", - "discussion-category": "@rudderstack/analytics-js-common@3.12.1", + "tag": "@rudderstack/analytics-js-common@3.13.0", + "title": "@rudderstack/analytics-js-common@3.13.0", + "discussion-category": "@rudderstack/analytics-js-common@3.13.0", "notesFile": "./packages/analytics-js-common/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js-cookies/CHANGELOG_LATEST.md b/packages/analytics-js-cookies/CHANGELOG_LATEST.md index 8821efa6e..075f2adf0 100644 --- a/packages/analytics-js-cookies/CHANGELOG_LATEST.md +++ b/packages/analytics-js-cookies/CHANGELOG_LATEST.md @@ -1,10 +1,5 @@ -## [0.4.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-cookies@0.4.0...@rudderstack/analytics-js-cookies@0.4.1) (2024-11-12) +## [0.4.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-cookies@0.4.1...@rudderstack/analytics-js-cookies@0.4.2) (2024-11-18) ### Dependency Updates -* `@rudderstack/analytics-js-common` updated to version `3.12.1` - -### Bug Fixes - -* revert sanitization changes ([#1916](https://github.com/rudderlabs/rudder-sdk-js/issues/1916)) ([890fb7b](https://github.com/rudderlabs/rudder-sdk-js/commit/890fb7b615535992290f5008b93d77b540c03955)), closes [#1907](https://github.com/rudderlabs/rudder-sdk-js/issues/1907) [#1902](https://github.com/rudderlabs/rudder-sdk-js/issues/1902) - +* `@rudderstack/analytics-js-common` updated to version `3.13.0` diff --git a/packages/analytics-js-cookies/project.json b/packages/analytics-js-cookies/project.json index 81cd6925e..d56f884d5 100644 --- a/packages/analytics-js-cookies/project.json +++ b/packages/analytics-js-cookies/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-cookies@0.4.1", - "title": "@rudderstack/analytics-js-cookies@0.4.1", - "discussion-category": "@rudderstack/analytics-js-cookies@0.4.1", + "tag": "@rudderstack/analytics-js-cookies@0.4.2", + "title": "@rudderstack/analytics-js-cookies@0.4.2", + "discussion-category": "@rudderstack/analytics-js-cookies@0.4.2", "notesFile": "./packages/analytics-js-cookies/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js-integrations/CHANGELOG_LATEST.md b/packages/analytics-js-integrations/CHANGELOG_LATEST.md index c0215e3a3..fe5dbb12f 100644 --- a/packages/analytics-js-integrations/CHANGELOG_LATEST.md +++ b/packages/analytics-js-integrations/CHANGELOG_LATEST.md @@ -1,5 +1,5 @@ -## [3.10.3](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-integrations@3.10.2...@rudderstack/analytics-js-integrations@3.10.3) (2024-11-12) +## [3.10.4](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-integrations@3.10.3...@rudderstack/analytics-js-integrations@3.10.4) (2024-11-18) ### Dependency Updates -* `@rudderstack/analytics-js-common` updated to version `3.12.1` +* `@rudderstack/analytics-js-common` updated to version `3.13.0` diff --git a/packages/analytics-js-integrations/project.json b/packages/analytics-js-integrations/project.json index 69d77e7dd..39634a7f0 100644 --- a/packages/analytics-js-integrations/project.json +++ b/packages/analytics-js-integrations/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-integrations@3.10.3", - "title": "@rudderstack/analytics-js-integrations@3.10.3", - "discussion-category": "@rudderstack/analytics-js-integrations@3.10.3", + "tag": "@rudderstack/analytics-js-integrations@3.10.4", + "title": "@rudderstack/analytics-js-integrations@3.10.4", + "discussion-category": "@rudderstack/analytics-js-integrations@3.10.4", "notesFile": "./packages/analytics-js-integrations/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js-plugins/CHANGELOG_LATEST.md b/packages/analytics-js-plugins/CHANGELOG_LATEST.md index 2347b6c63..81944482a 100644 --- a/packages/analytics-js-plugins/CHANGELOG_LATEST.md +++ b/packages/analytics-js-plugins/CHANGELOG_LATEST.md @@ -1,13 +1,7 @@ -## [3.6.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.6.0...@rudderstack/analytics-js-plugins@3.6.1) (2024-11-12) +## [3.6.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-plugins@3.6.1...@rudderstack/analytics-js-plugins@3.6.2) (2024-11-18) ### Dependency Updates -* `@rudderstack/analytics-js-common` updated to version `3.12.1` -* `@rudderstack/analytics-js` updated to version `3.10.0` -* `@rudderstack/analytics-js-cookies` updated to version `0.4.0` - -### Bug Fixes - -* batch entry retry ([#1918](https://github.com/rudderlabs/rudder-sdk-js/issues/1918)) ([ff346b8](https://github.com/rudderlabs/rudder-sdk-js/commit/ff346b867335750d7b428cab9c650a4d9dbfde57)) -* revert sanitization changes ([#1916](https://github.com/rudderlabs/rudder-sdk-js/issues/1916)) ([890fb7b](https://github.com/rudderlabs/rudder-sdk-js/commit/890fb7b615535992290f5008b93d77b540c03955)), closes [#1907](https://github.com/rudderlabs/rudder-sdk-js/issues/1907) [#1902](https://github.com/rudderlabs/rudder-sdk-js/issues/1902) - +* `@rudderstack/analytics-js-common` updated to version `3.13.0` +* `@rudderstack/analytics-js` updated to version `3.10.1` +* `@rudderstack/analytics-js-cookies` updated to version `0.4.1` diff --git a/packages/analytics-js-plugins/project.json b/packages/analytics-js-plugins/project.json index 51bcca01b..4f31c1de6 100644 --- a/packages/analytics-js-plugins/project.json +++ b/packages/analytics-js-plugins/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-plugins@3.6.1", - "title": "@rudderstack/analytics-js-plugins@3.6.1", - "discussion-category": "@rudderstack/analytics-js-plugins@3.6.1", + "tag": "@rudderstack/analytics-js-plugins@3.6.2", + "title": "@rudderstack/analytics-js-plugins@3.6.2", + "discussion-category": "@rudderstack/analytics-js-plugins@3.6.2", "notesFile": "./packages/analytics-js-plugins/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js-service-worker/CHANGELOG_LATEST.md b/packages/analytics-js-service-worker/CHANGELOG_LATEST.md index 1591cab7b..1178aded4 100644 --- a/packages/analytics-js-service-worker/CHANGELOG_LATEST.md +++ b/packages/analytics-js-service-worker/CHANGELOG_LATEST.md @@ -1,5 +1,5 @@ -## [3.2.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-service-worker@3.2.0...@rudderstack/analytics-js-service-worker@3.2.1) (2024-11-12) +## [3.2.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-service-worker@3.2.1...@rudderstack/analytics-js-service-worker@3.2.2) (2024-11-18) ### Dependency Updates -* `@rudderstack/analytics-js-common` updated to version `3.12.1` +* `@rudderstack/analytics-js-common` updated to version `3.13.0` diff --git a/packages/analytics-js-service-worker/project.json b/packages/analytics-js-service-worker/project.json index 919635281..b1375f0ef 100644 --- a/packages/analytics-js-service-worker/project.json +++ b/packages/analytics-js-service-worker/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-service-worker@3.2.1", - "title": "rudderstack/analytics-js-service-worker@3.2.1", - "discussion-category": "rudderstack/analytics-js-service-worker@3.2.1", + "tag": "@rudderstack/analytics-js-service-worker@3.2.2", + "title": "rudderstack/analytics-js-service-worker@3.2.2", + "discussion-category": "rudderstack/analytics-js-service-worker@3.2.2", "notesFile": "./packages/analytics-js-service-worker/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-js/CHANGELOG_LATEST.md b/packages/analytics-js/CHANGELOG_LATEST.md index dfbd9e70a..765335051 100644 --- a/packages/analytics-js/CHANGELOG_LATEST.md +++ b/packages/analytics-js/CHANGELOG_LATEST.md @@ -1,13 +1,7 @@ -## [3.10.1](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.10.0...@rudderstack/analytics-js@3.10.1) (2024-11-12) +## [3.10.2](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js@3.10.1...@rudderstack/analytics-js@3.10.2) (2024-11-18) ### Dependency Updates -* `@rudderstack/analytics-js-cookies` updated to version `0.4.1` -* `@rudderstack/analytics-js-common` updated to version `3.12.1` -* `@rudderstack/analytics-js-plugins` updated to version `3.6.1` - -### Bug Fixes - -* batch entry retry ([#1918](https://github.com/rudderlabs/rudder-sdk-js/issues/1918)) ([ff346b8](https://github.com/rudderlabs/rudder-sdk-js/commit/ff346b867335750d7b428cab9c650a4d9dbfde57)) -* revert sanitization changes ([#1916](https://github.com/rudderlabs/rudder-sdk-js/issues/1916)) ([890fb7b](https://github.com/rudderlabs/rudder-sdk-js/commit/890fb7b615535992290f5008b93d77b540c03955)), closes [#1907](https://github.com/rudderlabs/rudder-sdk-js/issues/1907) [#1902](https://github.com/rudderlabs/rudder-sdk-js/issues/1902) - +* `@rudderstack/analytics-js-cookies` updated to version `0.4.2` +* `@rudderstack/analytics-js-common` updated to version `3.13.0` +* `@rudderstack/analytics-js-plugins` updated to version `3.6.2` diff --git a/packages/analytics-js/project.json b/packages/analytics-js/project.json index 057a7a73c..a374ce690 100644 --- a/packages/analytics-js/project.json +++ b/packages/analytics-js/project.json @@ -59,9 +59,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js@3.10.1", - "title": "@rudderstack/analytics-js@3.10.1", - "discussion-category": "@rudderstack/analytics-js@3.10.1", + "tag": "@rudderstack/analytics-js@3.10.2", + "title": "@rudderstack/analytics-js@3.10.2", + "discussion-category": "@rudderstack/analytics-js@3.10.2", "notesFile": "./packages/analytics-js/CHANGELOG_LATEST.md" } } diff --git a/packages/analytics-v1.1/CHANGELOG_LATEST.md b/packages/analytics-v1.1/CHANGELOG_LATEST.md index 26e1bc4b3..d2d2732e0 100644 --- a/packages/analytics-v1.1/CHANGELOG_LATEST.md +++ b/packages/analytics-v1.1/CHANGELOG_LATEST.md @@ -1,5 +1,5 @@ -## [2.48.26](https://github.com/rudderlabs/rudder-sdk-js/compare/rudder-sdk-js@2.48.25...rudder-sdk-js@2.48.26) (2024-11-12) +## [2.48.27](https://github.com/rudderlabs/rudder-sdk-js/compare/rudder-sdk-js@2.48.26...rudder-sdk-js@2.48.27) (2024-11-18) ### Dependency Updates -* `@rudderstack/analytics-js-common` updated to version `3.12.1` +* `@rudderstack/analytics-js-common` updated to version `3.13.0` diff --git a/packages/analytics-v1.1/project.json b/packages/analytics-v1.1/project.json index afdd1bc96..3199e0ee0 100644 --- a/packages/analytics-v1.1/project.json +++ b/packages/analytics-v1.1/project.json @@ -59,9 +59,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "rudder-sdk-js@2.48.26", - "title": "rudder-sdk-js@2.48.26", - "discussion-category": "rudder-sdk-js@2.48.26", + "tag": "rudder-sdk-js@2.48.27", + "title": "rudder-sdk-js@2.48.27", + "discussion-category": "rudder-sdk-js@2.48.27", "notesFile": "./packages/analytics-v1.1/CHANGELOG_LATEST.md" } } diff --git a/packages/loading-scripts/CHANGELOG_LATEST.md b/packages/loading-scripts/CHANGELOG_LATEST.md index ddafa7707..8cc0fd520 100644 --- a/packages/loading-scripts/CHANGELOG_LATEST.md +++ b/packages/loading-scripts/CHANGELOG_LATEST.md @@ -1,5 +1,5 @@ -## [3.0.41](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.40...@rudderstack/analytics-js-loading-scripts@3.0.41) (2024-11-12) +## [3.0.42](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/analytics-js-loading-scripts@3.0.41...@rudderstack/analytics-js-loading-scripts@3.0.42) (2024-11-18) ### Dependency Updates -* `@rudderstack/analytics-js` updated to version `3.10.1` +* `@rudderstack/analytics-js` updated to version `3.10.2` diff --git a/packages/loading-scripts/project.json b/packages/loading-scripts/project.json index a81e8580f..eb34ebd77 100644 --- a/packages/loading-scripts/project.json +++ b/packages/loading-scripts/project.json @@ -51,9 +51,9 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "tag": "@rudderstack/analytics-js-loading-scripts@3.0.41", - "title": "@rudderstack/analytics-js-loading-scripts@3.0.41", - "discussion-category": "@rudderstack/analytics-js-loading-scripts@3.0.41", + "tag": "@rudderstack/analytics-js-loading-scripts@3.0.42", + "title": "@rudderstack/analytics-js-loading-scripts@3.0.42", + "discussion-category": "@rudderstack/analytics-js-loading-scripts@3.0.42", "notesFile": "./packages/loading-scripts/CHANGELOG_LATEST.md" } } diff --git a/sonar-project.properties b/sonar-project.properties index 6f8f97075..b6072b34a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -6,7 +6,7 @@ sonar.qualitygate.wait=false sonar.projectKey=rudderlabs_rudder-sdk-js sonar.organization=rudderlabs sonar.projectName=rudder-sdk-js -sonar.projectVersion=3.50.0 +sonar.projectVersion=3.51.0 # Meta-data for the project sonar.links.scm=https://github.com/rudderlabs/rudder-sdk-js