Skip to content

Commit efe2f6c

Browse files
authored
chore: Language versions update (#774)
## Summary Updated Minimum versions of the following **Typescript**: `4.7.4` **Node**: `14` **Browsers**: Chrome: `102.0` Edge: `84.0` Firefox: `91.0` Opera: `76.0` Safari: `13.0` ## Test plan All unit tests and Full stack compatibility suite tests pass. ## Ticket [OASIS-8467](https://optimizely.atlassian.net/browse/OASIS-8467)
1 parent e4b5dc9 commit efe2f6c

File tree

27 files changed

+18538
-7660
lines changed

27 files changed

+18538
-7660
lines changed

.github/workflows/javascript.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Set up Node
5454
uses: actions/setup-node@v3
5555
with:
56-
node-version: 12
56+
node-version: 14
5757
cache: 'npm'
5858
cache-dependency-path: packages/optimizely-sdk/package-lock.json
5959
- name: Cross-browser and umd unit tests
@@ -66,7 +66,7 @@ jobs:
6666
runs-on: ubuntu-latest
6767
strategy:
6868
matrix:
69-
node: [ '12', '14', '16', '18' ]
69+
node: ['14', '16', '18' ]
7070
steps:
7171
- uses: actions/checkout@v3
7272
- name: Set up Node ${{ matrix.node }}

packages/datafile-manager/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/datafile-manager/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"nock": "^10.0.6",
4242
"prettier": "^1.19.1",
4343
"ts-jest": "^27.0.1",
44-
"typescript": "3.8.x"
44+
"typescript": "^4.7.4"
4545
},
4646
"dependencies": {
4747
"@optimizely/js-sdk-logging": "^0.3.1",

packages/event-processor/__mocks__/@react-native-async-storage/async-storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default class AsyncStorage {
3636
return new Promise(resolve => {
3737
setTimeout(() => {
3838
items[key] && delete items[key]
39-
resolve()
39+
resolve(null)
4040
}, 1)
4141
})
4242
}

packages/event-processor/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
"jest": "^23.6.0",
4949
"jest-localstorage-mock": "^2.4.0",
5050
"ts-jest": "^23.10.5",
51-
"typescript": "^4.0.3"
51+
"typescript": "^4.7.4"
52+
5253
},
5354
"peerDependencies": {
5455
"@react-native-community/netinfo": "5.9.4",

packages/event-processor/src/pendingEventsStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class LocalStorageStore<K extends StoreEntry> implements PendingEventsSto
7575
// This is a temporary fix to support React Native which does not have localStorage.
7676
window.localStorage && localStorage.setItem(this.LS_KEY, JSON.stringify(map))
7777
this.clean()
78-
} catch (e) {
78+
} catch (e: any) {
7979
logger.error(e)
8080
}
8181
}
@@ -109,7 +109,7 @@ export class LocalStorageStore<K extends StoreEntry> implements PendingEventsSto
109109
if (data) {
110110
return (JSON.parse(data) as { [key: string]: K }) || {}
111111
}
112-
} catch (e) {
112+
} catch (e: any) {
113113
logger.error(e)
114114
}
115115
return {}

packages/event-processor/src/v1/v1EventProcessor.react_native.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ export class LogTierV1EventProcessor implements EventProcessor {
228228
this.unsubscribeNetInfo && this.unsubscribeNetInfo()
229229
await this.queue.stop()
230230
return this.requestTracker.onRequestsComplete()
231-
} catch (e) {
232-
logger.error('Error stopping EventProcessor: "%s"', e.message, e)
231+
} catch (e: any) {
232+
logger.error('Error stopping EventProcessor: "%s"', e?.message, e)
233233
}
234234
}
235235
}

packages/event-processor/src/v1/v1EventProcessor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ export class LogTierV1EventProcessor implements EventProcessor {
8888
try {
8989
this.queue.stop()
9090
return this.requestTracker.onRequestsComplete()
91-
} catch (e) {
91+
} catch (e: any) {
9292
logger.error('Error stopping EventProcessor: "%s"', e.message, e)
9393
}
9494
return Promise.resolve()

packages/logging/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/logging/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,6 @@
4343
"@types/jest": "^23.3.12",
4444
"jest": "^23.6.0",
4545
"ts-jest": "^23.10.5",
46-
"typescript": "3.8.x"
46+
"typescript": "^4.7.4"
4747
}
4848
}

packages/optimizely-sdk/.eslintrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ module.exports = {
3131
'no-prototype-builtins': 'off',
3232
'@typescript-eslint/explicit-module-boundary-types': 'off',
3333
'@typescript-eslint/no-empty-function': 'off',
34-
'no-shadow': 'error',
3534
},
3635
};

packages/optimizely-sdk/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10-
### Changed
10+
### Breaking Changes
1111
- Updated `murmurhash` dependency to version `2.0.1`.
1212
- Updated `uuid` dependency to version `8.3.2`.
1313
- Dropped support for the following browser versions.
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1717
- Firefox versions earlier than `91.0`.
1818
- Opera versions earlier than `76.0`.
1919
- Safari versions earlier than `13.0`.
20+
- Dropped support for Node JS versions earlier than `14`.
2021

2122
## [4.9.2] - June 27, 2022
2223

packages/optimizely-sdk/lib/core/audience_evaluator/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export class AudienceEvaluator {
109109
}
110110
try {
111111
return evaluator.evaluate(condition, user);
112-
} catch (err) {
112+
} catch (err: any) {
113113
logger.log(
114114
LOG_LEVEL.ERROR,
115115
ERROR_MESSAGES.CONDITION_EVALUATOR_ERROR, MODULE_NAME, condition.type, err.message

packages/optimizely-sdk/lib/core/bucketer/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export const _generateBucketValue = function(bucketingKey: string): number {
234234
const hashValue = murmurhash.v3(bucketingKey, HASH_SEED);
235235
const ratio = hashValue / MAX_HASH_VALUE;
236236
return Math.floor(ratio * MAX_TRAFFIC_VALUE);
237-
} catch (ex) {
237+
} catch (ex: any) {
238238
throw new Error(sprintf(ERROR_MESSAGES.INVALID_BUCKETING_ID, MODULE_NAME, bucketingKey, ex.message));
239239
}
240240
};

packages/optimizely-sdk/lib/core/decision_service/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ export class DecisionService {
484484

485485
try {
486486
return this.userProfileService.lookup(userId);
487-
} catch (ex) {
487+
} catch (ex: any) {
488488
this.logger.log(
489489
LOG_LEVEL.ERROR,
490490
ERROR_MESSAGES.USER_PROFILE_LOOKUP_ERROR,
@@ -532,7 +532,7 @@ export class DecisionService {
532532
experiment.key,
533533
userId,
534534
);
535-
} catch (ex) {
535+
} catch (ex: any) {
536536
this.logger.log(LOG_LEVEL.ERROR, ERROR_MESSAGES.USER_PROFILE_SAVE_ERROR, MODULE_NAME, userId, ex.message);
537537
}
538538
}
@@ -972,7 +972,7 @@ export class DecisionService {
972972
reasons: decideReasons,
973973
};
974974
}
975-
} catch (ex) {
975+
} catch (ex: any) {
976976
// catching experiment not in datafile
977977
this.logger.log(LOG_LEVEL.ERROR, ex.message);
978978
decideReasons.push(ex.message);
@@ -1065,7 +1065,7 @@ export class DecisionService {
10651065
);
10661066
return false;
10671067
}
1068-
} catch (ex) {
1068+
} catch (ex: any) {
10691069
// catching experiment not in datafile
10701070
this.logger.log(LOG_LEVEL.ERROR, ex.message);
10711071
return false;
@@ -1075,7 +1075,7 @@ export class DecisionService {
10751075
try {
10761076
this.removeForcedVariation(userId, experimentId, experimentKey);
10771077
return true;
1078-
} catch (ex) {
1078+
} catch (ex: any) {
10791079
this.logger.log(LOG_LEVEL.ERROR, ex.message);
10801080
return false;
10811081
}
@@ -1097,7 +1097,7 @@ export class DecisionService {
10971097
try {
10981098
this.setInForcedVariationMap(userId, experimentId, variationId);
10991099
return true;
1100-
} catch (ex) {
1100+
} catch (ex: any) {
11011101
this.logger.log(LOG_LEVEL.ERROR, ex.message);
11021102
return false;
11031103
}

packages/optimizely-sdk/lib/core/notification_center/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class NotificationCenter {
116116
const returnId = this.listenerId;
117117
this.listenerId += 1;
118118
return returnId;
119-
} catch (e) {
119+
} catch (e: any) {
120120
this.logger.log(LOG_LEVEL.ERROR, e.message);
121121
this.errorHandler.handleError(e);
122122
return -1;
@@ -159,7 +159,7 @@ export class NotificationCenter {
159159
this.notificationListeners[typeToRemove].splice(indexToRemove, 1);
160160
return true;
161161
}
162-
} catch (e) {
162+
} catch (e: any) {
163163
this.logger.log(LOG_LEVEL.ERROR, e.message);
164164
this.errorHandler.handleError(e);
165165
}
@@ -177,7 +177,7 @@ export class NotificationCenter {
177177
this.notificationListeners[notificationTypeEnum] = [];
178178
}
179179
);
180-
} catch (e) {
180+
} catch (e: any) {
181181
this.logger.log(LOG_LEVEL.ERROR, e.message);
182182
this.errorHandler.handleError(e);
183183
}
@@ -190,7 +190,7 @@ export class NotificationCenter {
190190
clearNotificationListeners(notificationType: NOTIFICATION_TYPES): void {
191191
try {
192192
this.notificationListeners[notificationType] = [];
193-
} catch (e) {
193+
} catch (e: any) {
194194
this.logger.log(LOG_LEVEL.ERROR, e.message);
195195
this.errorHandler.handleError(e);
196196
}
@@ -212,7 +212,7 @@ export class NotificationCenter {
212212
const callback = listenerEntry.callback;
213213
try {
214214
callback(notificationData);
215-
} catch (ex) {
215+
} catch (ex: any) {
216216
this.logger.log(
217217
LOG_LEVEL.ERROR,
218218
LOG_MESSAGES.NOTIFICATION_LISTENER_EXCEPTION,
@@ -223,7 +223,7 @@ export class NotificationCenter {
223223
}
224224
}
225225
);
226-
} catch (e) {
226+
} catch (e: any) {
227227
this.logger.log(LOG_LEVEL.ERROR, e.message);
228228
this.errorHandler.handleError(e);
229229
}

packages/optimizely-sdk/lib/core/project_config/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ export const getTypeCastValue = function (
759759
case FEATURE_VARIABLE_TYPES.JSON:
760760
try {
761761
castValue = JSON.parse(variableValue);
762-
} catch (e) {
762+
} catch (e: any) {
763763
logger.log(
764764
LOG_LEVEL.ERROR,
765765
ERROR_MESSAGES.UNABLE_TO_CAST_VALUE,
@@ -843,15 +843,15 @@ export const tryCreatingProjectConfig = function (
843843
let newDatafileObj;
844844
try {
845845
newDatafileObj = configValidator.validateDatafile(config.datafile);
846-
} catch (error) {
846+
} catch (error: any) {
847847
return { configObj: null, error };
848848
}
849849

850850
if (config.jsonSchemaValidator) {
851851
try {
852852
config.jsonSchemaValidator.validate(newDatafileObj);
853853
config.logger.log(LOG_LEVEL.INFO, LOG_MESSAGES.VALID_DATAFILE, MODULE_NAME);
854-
} catch (error) {
854+
} catch (error : any) {
855855
return { configObj: null, error };
856856
}
857857
} else {

packages/optimizely-sdk/lib/core/project_config/project_config_manager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class ProjectConfigManager {
105105
reason: getErrorMessage(handleNewDatafileException, 'Invalid datafile'),
106106
});
107107
}
108-
} catch (ex) {
108+
} catch (ex: any) {
109109
logger.error(ex);
110110
this.readyPromise = Promise.resolve({
111111
success: false,

packages/optimizely-sdk/lib/index.browser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const createInstance = function(config: Config): Client | null {
7070
try {
7171
configValidator.validate(config);
7272
isValidInstance = true;
73-
} catch (ex) {
73+
} catch (ex: any) {
7474
logger.error(ex);
7575
}
7676

@@ -141,12 +141,12 @@ const createInstance = function(config: Config): Client | null {
141141
false
142142
);
143143
}
144-
} catch (e) {
144+
} catch (e: any) {
145145
logger.error(enums.LOG_MESSAGES.UNABLE_TO_ATTACH_UNLOAD, MODULE_NAME, e.message);
146146
}
147147

148148
return optimizely;
149-
} catch (e) {
149+
} catch (e: any) {
150150
logger.error(e);
151151
return null;
152152
}

packages/optimizely-sdk/lib/index.lite.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ setLogLevel(LogLevel.ERROR);
6363
try {
6464
configValidator.validate(config);
6565
isValidInstance = true;
66-
} catch (ex) {
66+
} catch (ex: any) {
6767
logger.error(ex);
6868
}
6969

@@ -85,7 +85,7 @@ setLogLevel(LogLevel.ERROR);
8585

8686
const optimizely = new Optimizely(optimizelyOptions);
8787
return optimizely;
88-
} catch (e) {
88+
} catch (e: any) {
8989
logger.error(e);
9090
return null;
9191
}

packages/optimizely-sdk/lib/index.node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
6868
try {
6969
configValidator.validate(config);
7070
isValidInstance = true;
71-
} catch (ex) {
71+
} catch (ex: any) {
7272
if (hasLogger) {
7373
logger.error(ex);
7474
} else {
@@ -117,7 +117,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
117117
};
118118

119119
return new Optimizely(optimizelyOptions);
120-
} catch (e) {
120+
} catch (e: any) {
121121
logger.error(e);
122122
return null;
123123
}

packages/optimizely-sdk/lib/index.react_native.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
6767
try {
6868
configValidator.validate(config);
6969
isValidInstance = true;
70-
} catch (ex) {
70+
} catch (ex: any) {
7171
logger.error(ex);
7272
}
7373

@@ -117,7 +117,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
117117
}
118118

119119
return new Optimizely(optimizelyOptions);
120-
} catch (e) {
120+
} catch (e: any) {
121121
logger.error(e);
122122
return null;
123123
}

0 commit comments

Comments
 (0)