Skip to content

Commit

Permalink
chore(release): pull hotfix-release/3.74.0-SDK-2903 into main (#2015)
Browse files Browse the repository at this point in the history
* feat: lock plugins and integrations version by default (#1956)

* feat: lock plugins and integrations version by default

* chore: avoid publishing latest plugins and integrations to common prod location

* chore: regenerate listing html for other paths

* feat: get sdk url from script tag using the write key

* choer: bump size limit

* chore: update deploy script to copy dependencies first

* chore: include url in cdn path error messages

* fix: lock deps version through build

* chore: add env to deploy workflow

* fix: cdn paths edge case handling

* chore: fix lock deps envs

* chore: revert unnecessary changes

* feat: lock plugins and integrations versions for custom urls

* chore: fix a minor lint issue

* fix: load options normalization for boolean values

* test: add tests for coverage and fix issues

* chore: fix size limit

* refactor: rename variables and add in-line docs to improve readability

* chore: avoid cache invalidation for versioned directories by default

* refactor: fix a lint issue

* chore(@rudderstack/analytics-js-common): release version 3.15.0

* chore(@rudderstack/analytics-js-cookies): release version 0.4.19

* chore(@rudderstack/analytics-js-plugins): release version 3.6.22

* chore(@rudderstack/analytics-js): release version 3.12.0

* chore(rudder-sdk-js): release version 2.48.44

* chore(@rudderstack/analytics-js-integrations): release version 3.12.2

* chore(@rudderstack/analytics-js-service-worker): release version 3.2.19

* chore(@rudderstack/analytics-js-sanity-suite): release version 3.2.0

* chore(monorepo): sync versions and generate release logs

---------

Co-authored-by: Sai Kumar Battinoju <[email protected]>
Co-authored-by: GitHub actions <[email protected]>
  • Loading branch information
3 people authored Jan 27, 2025
1 parent 826439e commit 5f087eb
Show file tree
Hide file tree
Showing 61 changed files with 2,592 additions and 358 deletions.
164 changes: 75 additions & 89 deletions .github/workflows/deploy.yml

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions .github/workflows/rollback.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,44 @@ jobs:
BUGSNAG_API_KEY: ${{ secrets.RS_PROD_BUGSNAG_API_KEY }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }}

# As we rollback to a previous version, we need to invalidate the CDN cache for the previous version's directory
# The above deploy action will invalidate the cache for the core SDK artifacts, so this step is needed for dependencies (plugins and integrations)
invalidate-cdn-cache:
needs: deploy
name: Invalidate CDN cache
runs-on: [self-hosted, Linux, X64]

steps:
- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@master

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_PROD_ACCOUNT_ID }}:role/${{ secrets.AWS_PROD_S3_SYNC_ROLE }}
aws-region: us-east-1

- name: Checkout source code
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}

- name: Get new versions
run: |
current_version_v1=$(jq -r .version packages/analytics-v1.1/package.json)
current_version=$(jq -r .version packages/analytics-js/package.json)
echo "CURRENT_VERSION_V1_VALUE=$current_version_v1" >> $GITHUB_ENV
echo "CURRENT_VERSION_VALUE=$current_version" >> $GITHUB_ENV
- name: Invalidate CloudFront cache for all the SDK artifacts (versioned directory)
run: |
invalidation_id=$(AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/${{ env.CURRENT_VERSION_VALUE }}/*" --query "Invalidation.Id" --output text)
aws cloudfront wait invalidation-completed --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --id "$invalidation_id"
- name: Invalidate CloudFront cache for all the legacy SDK artifacts (versioned directory)
run: |
invalidation_id=$(AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --paths "/${{ env.CURRENT_VERSION_V1_VALUE }}/*" --query "Invalidation.Id" --output text)
aws cloudfront wait invalidation-completed --distribution-id ${{ secrets.AWS_PROD_CF_DISTRIBUTION_ID }} --id "$invalidation_id"
1 change: 1 addition & 0 deletions jest/jest.setup-dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ global.window.document.body.innerHTML = documentHTML;
global.window.innerWidth = 1680;
global.window.innerHeight = 1024;
global.window.__BUNDLE_ALL_PLUGINS__ = false;
global.window.__LOCK_DEPS_VERSION__ = false;
global.window.__IS_LEGACY_BUILD__ = false;
global.window.__IS_DYNAMIC_CUSTOM_BUNDLE__ = false;
global.PromiseRejectionEvent = function (reason) {
Expand Down
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-monorepo",
"version": "3.73.0",
"version": "3.74.0",
"private": true,
"description": "Monorepo for RudderStack Analytics JS SDK",
"workspaces": [
Expand Down
7 changes: 7 additions & 0 deletions packages/analytics-js-common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).

## [3.15.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2025-01-24)


### Features

* lock plugins and integrations version by default ([#1956](https://github.com/rudderlabs/rudder-sdk-js/issues/1956)) ([45e716e](https://github.com/rudderlabs/rudder-sdk-js/commit/45e716e6df3d6e665c25aa907531adb746961d50))

## [3.14.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected]...@rudderstack/[email protected]) (2025-01-03)


Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-js-common/CHANGELOG_LATEST.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## [3.14.15](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].14...@rudderstack/analytics-js-common@3.14.15) (2025-01-03)
## [3.15.0](https://github.com/rudderlabs/rudder-sdk-js/compare/@rudderstack/[email protected].15...@rudderstack/analytics-js-common@3.15.0) (2025-01-24)


### Bug Fixes
### Features

* update destination constants ([#1968](https://github.com/rudderlabs/rudder-sdk-js/issues/1968)) ([fbd3b3f](https://github.com/rudderlabs/rudder-sdk-js/commit/fbd3b3fd82441f50092326765c58bfdacd314876))
* lock plugins and integrations version by default ([#1956](https://github.com/rudderlabs/rudder-sdk-js/issues/1956)) ([45e716e](https://github.com/rudderlabs/rudder-sdk-js/commit/45e716e6df3d6e665c25aa907531adb746961d50))

178 changes: 178 additions & 0 deletions packages/analytics-js-common/__tests__/utilities/object.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
isObjectLiteralAndNotNull,
removeUndefinedValues,
removeUndefinedAndNullValues,
getNormalizedBooleanValue,
getNormalizedObjectValue,
} from '../../src/utilities/object';

const identifyTraitsPayloadMock = {
Expand Down Expand Up @@ -284,4 +286,180 @@ describe('Common Utils - Object', () => {
});
});
});

describe('getNormalizedObjectValue', () => {
describe('should return undefined if input value is not an object', () => {
it('should return undefined for non-object values', () => {
const outcome1 = getNormalizedObjectValue(undefined);
const outcome2 = getNormalizedObjectValue(null);
const outcome3 = getNormalizedObjectValue('string');
const outcome4 = getNormalizedObjectValue(123456);
const outcome5 = getNormalizedObjectValue([]);
expect(outcome1).toEqual(undefined);
expect(outcome2).toEqual(undefined);
expect(outcome3).toEqual(undefined);
expect(outcome4).toEqual(undefined);
expect(outcome5).toEqual(undefined);
});

it('should return undefined for empty object', () => {
const outcome = getNormalizedObjectValue({});
expect(outcome).toEqual(undefined);
});

it('should return normalized object for valid object', () => {
const nestedObj = {
someKey: 'someValue',
nested: {
key1: 'value1',
key2: undefined,
key3: null,
},
};

const outcome = getNormalizedObjectValue(nestedObj);

expect(outcome).toStrictEqual({
someKey: 'someValue',
nested: {
key1: 'value1',
},
});
});

it('should return normalized object for object with undefined and null values recursively', () => {
const nestedObj = {
key1: 'value',
key2: undefined,
key3: {
key4: 'value',
key5: undefined,
key6: {
key7: 'value',
key8: undefined,
},
key9: null,
},
key10: null,
key11: {
key12: null,
},
};

const outcome = getNormalizedObjectValue(nestedObj);

expect(outcome).toStrictEqual({
key1: 'value',
key3: {
key4: 'value',
key6: {
key7: 'value',
},
},
key11: {},
});
});
});
});

describe('getNormalizedBooleanValue', () => {
const tcData = [
{
input: [true, undefined],
output: true,
},
{
input: [false, undefined],
output: false,
},
{
input: [undefined, true],
output: true,
},
{
input: [undefined, false],
output: false,
},
{
input: [true, false],
output: true,
},
{
input: [false, true],
output: false,
},
{
input: [undefined, undefined],
output: false,
},
{
input: [{}, false],
output: false,
},
{
input: [{}, true],
output: false,
},
{
input: [{}, undefined],
output: false,
},
{
input: [[], false],
output: false,
},
{
input: [[], true],
output: false,
},
{
input: [[], undefined],
output: false,
},
{
input: ['string', false],
output: false,
},
{
input: ['string', true],
output: false,
},
{
input: ['string', undefined],
output: false,
},
{
input: [123456, false],
output: false,
},
{
input: [123456, true],
output: false,
},
{
input: [123456, undefined],
output: false,
},
{
input: [new Date(), false],
output: false,
},
{
input: [new Date(), true],
output: false,
},
{
input: [new Date(), undefined],
output: false,
},
];

it.each(tcData)(
'should return $output for input $input',
({ input, output }: { input: any; output: any }) => {
const outcome = getNormalizedBooleanValue(input[0], input[1]);
expect(outcome).toEqual(output);
},
);
});
});
2 changes: 1 addition & 1 deletion packages/analytics-js-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rudderstack/analytics-js-common",
"version": "3.14.15",
"version": "3.15.0",
"private": true,
"description": "RudderStack JavaScript SDK common code",
"module": "dist/npm/index.js",
Expand Down
6 changes: 3 additions & 3 deletions packages/analytics-js-common/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"github": {
"executor": "@jscutlery/semver:github",
"options": {
"tag": "@rudderstack/analytics-js-common@3.14.15",
"title": "@rudderstack/analytics-js-common@3.14.15",
"discussion-category": "@rudderstack/analytics-js-common@3.14.15",
"tag": "@rudderstack/analytics-js-common@3.15.0",
"title": "@rudderstack/analytics-js-common@3.15.0",
"discussion-category": "@rudderstack/analytics-js-common@3.15.0",
"notesFile": "./packages/analytics-js-common/CHANGELOG_LATEST.md"
}
}
Expand Down
Loading

0 comments on commit 5f087eb

Please sign in to comment.