Skip to content

chore: Language versions update #774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 12
node-version: 14
cache: 'npm'
cache-dependency-path: packages/optimizely-sdk/package-lock.json
- name: Cross-browser and umd unit tests
Expand All @@ -66,7 +66,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: [ '12', '14', '16', '18' ]
node: ['14', '16', '18' ]
steps:
- uses: actions/checkout@v3
- name: Set up Node ${{ matrix.node }}
Expand Down
6 changes: 3 additions & 3 deletions packages/datafile-manager/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 packages/datafile-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"nock": "^10.0.6",
"prettier": "^1.19.1",
"ts-jest": "^27.0.1",
"typescript": "3.8.x"
"typescript": "^4.7.4"
},
"dependencies": {
"@optimizely/js-sdk-logging": "^0.3.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default class AsyncStorage {
return new Promise(resolve => {
setTimeout(() => {
items[key] && delete items[key]
resolve()
resolve(null)
}, 1)
})
}
Expand Down
3 changes: 2 additions & 1 deletion packages/event-processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"jest": "^23.6.0",
"jest-localstorage-mock": "^2.4.0",
"ts-jest": "^23.10.5",
"typescript": "^4.0.3"
"typescript": "^4.7.4"

},
"peerDependencies": {
"@react-native-community/netinfo": "5.9.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/event-processor/src/pendingEventsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export class LocalStorageStore<K extends StoreEntry> implements PendingEventsSto
// This is a temporary fix to support React Native which does not have localStorage.
window.localStorage && localStorage.setItem(this.LS_KEY, JSON.stringify(map))
this.clean()
} catch (e) {
} catch (e: any) {
logger.error(e)
}
}
Expand Down Expand Up @@ -109,7 +109,7 @@ export class LocalStorageStore<K extends StoreEntry> implements PendingEventsSto
if (data) {
return (JSON.parse(data) as { [key: string]: K }) || {}
}
} catch (e) {
} catch (e: any) {
logger.error(e)
}
return {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,8 @@ export class LogTierV1EventProcessor implements EventProcessor {
this.unsubscribeNetInfo && this.unsubscribeNetInfo()
await this.queue.stop()
return this.requestTracker.onRequestsComplete()
} catch (e) {
logger.error('Error stopping EventProcessor: "%s"', e.message, e)
} catch (e: any) {
logger.error('Error stopping EventProcessor: "%s"', e?.message, e)
}
}
}
2 changes: 1 addition & 1 deletion packages/event-processor/src/v1/v1EventProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class LogTierV1EventProcessor implements EventProcessor {
try {
this.queue.stop()
return this.requestTracker.onRequestsComplete()
} catch (e) {
} catch (e: any) {
logger.error('Error stopping EventProcessor: "%s"', e.message, e)
}
return Promise.resolve()
Expand Down
6 changes: 3 additions & 3 deletions packages/logging/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 packages/logging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@
"@types/jest": "^23.3.12",
"jest": "^23.6.0",
"ts-jest": "^23.10.5",
"typescript": "3.8.x"
"typescript": "^4.7.4"
}
}
1 change: 0 additions & 1 deletion packages/optimizely-sdk/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@ module.exports = {
'no-prototype-builtins': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-empty-function': 'off',
'no-shadow': 'error',
},
};
3 changes: 2 additions & 1 deletion packages/optimizely-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

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

## [4.9.2] - June 27, 2022

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class AudienceEvaluator {
}
try {
return evaluator.evaluate(condition, user);
} catch (err) {
} catch (err: any) {
logger.log(
LOG_LEVEL.ERROR,
ERROR_MESSAGES.CONDITION_EVALUATOR_ERROR, MODULE_NAME, condition.type, err.message
Expand Down
2 changes: 1 addition & 1 deletion packages/optimizely-sdk/lib/core/bucketer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export const _generateBucketValue = function(bucketingKey: string): number {
const hashValue = murmurhash.v3(bucketingKey, HASH_SEED);
const ratio = hashValue / MAX_HASH_VALUE;
return Math.floor(ratio * MAX_TRAFFIC_VALUE);
} catch (ex) {
} catch (ex: any) {
throw new Error(sprintf(ERROR_MESSAGES.INVALID_BUCKETING_ID, MODULE_NAME, bucketingKey, ex.message));
}
};
Expand Down
12 changes: 6 additions & 6 deletions packages/optimizely-sdk/lib/core/decision_service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ export class DecisionService {

try {
return this.userProfileService.lookup(userId);
} catch (ex) {
} catch (ex: any) {
this.logger.log(
LOG_LEVEL.ERROR,
ERROR_MESSAGES.USER_PROFILE_LOOKUP_ERROR,
Expand Down Expand Up @@ -532,7 +532,7 @@ export class DecisionService {
experiment.key,
userId,
);
} catch (ex) {
} catch (ex: any) {
this.logger.log(LOG_LEVEL.ERROR, ERROR_MESSAGES.USER_PROFILE_SAVE_ERROR, MODULE_NAME, userId, ex.message);
}
}
Expand Down Expand Up @@ -972,7 +972,7 @@ export class DecisionService {
reasons: decideReasons,
};
}
} catch (ex) {
} catch (ex: any) {
// catching experiment not in datafile
this.logger.log(LOG_LEVEL.ERROR, ex.message);
decideReasons.push(ex.message);
Expand Down Expand Up @@ -1065,7 +1065,7 @@ export class DecisionService {
);
return false;
}
} catch (ex) {
} catch (ex: any) {
// catching experiment not in datafile
this.logger.log(LOG_LEVEL.ERROR, ex.message);
return false;
Expand All @@ -1075,7 +1075,7 @@ export class DecisionService {
try {
this.removeForcedVariation(userId, experimentId, experimentKey);
return true;
} catch (ex) {
} catch (ex: any) {
this.logger.log(LOG_LEVEL.ERROR, ex.message);
return false;
}
Expand All @@ -1097,7 +1097,7 @@ export class DecisionService {
try {
this.setInForcedVariationMap(userId, experimentId, variationId);
return true;
} catch (ex) {
} catch (ex: any) {
this.logger.log(LOG_LEVEL.ERROR, ex.message);
return false;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/optimizely-sdk/lib/core/notification_center/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class NotificationCenter {
const returnId = this.listenerId;
this.listenerId += 1;
return returnId;
} catch (e) {
} catch (e: any) {
this.logger.log(LOG_LEVEL.ERROR, e.message);
this.errorHandler.handleError(e);
return -1;
Expand Down Expand Up @@ -159,7 +159,7 @@ export class NotificationCenter {
this.notificationListeners[typeToRemove].splice(indexToRemove, 1);
return true;
}
} catch (e) {
} catch (e: any) {
this.logger.log(LOG_LEVEL.ERROR, e.message);
this.errorHandler.handleError(e);
}
Expand All @@ -177,7 +177,7 @@ export class NotificationCenter {
this.notificationListeners[notificationTypeEnum] = [];
}
);
} catch (e) {
} catch (e: any) {
this.logger.log(LOG_LEVEL.ERROR, e.message);
this.errorHandler.handleError(e);
}
Expand All @@ -190,7 +190,7 @@ export class NotificationCenter {
clearNotificationListeners(notificationType: NOTIFICATION_TYPES): void {
try {
this.notificationListeners[notificationType] = [];
} catch (e) {
} catch (e: any) {
this.logger.log(LOG_LEVEL.ERROR, e.message);
this.errorHandler.handleError(e);
}
Expand All @@ -212,7 +212,7 @@ export class NotificationCenter {
const callback = listenerEntry.callback;
try {
callback(notificationData);
} catch (ex) {
} catch (ex: any) {
this.logger.log(
LOG_LEVEL.ERROR,
LOG_MESSAGES.NOTIFICATION_LISTENER_EXCEPTION,
Expand All @@ -223,7 +223,7 @@ export class NotificationCenter {
}
}
);
} catch (e) {
} catch (e: any) {
this.logger.log(LOG_LEVEL.ERROR, e.message);
this.errorHandler.handleError(e);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/optimizely-sdk/lib/core/project_config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ export const getTypeCastValue = function (
case FEATURE_VARIABLE_TYPES.JSON:
try {
castValue = JSON.parse(variableValue);
} catch (e) {
} catch (e: any) {
logger.log(
LOG_LEVEL.ERROR,
ERROR_MESSAGES.UNABLE_TO_CAST_VALUE,
Expand Down Expand Up @@ -843,15 +843,15 @@ export const tryCreatingProjectConfig = function (
let newDatafileObj;
try {
newDatafileObj = configValidator.validateDatafile(config.datafile);
} catch (error) {
} catch (error: any) {
return { configObj: null, error };
}

if (config.jsonSchemaValidator) {
try {
config.jsonSchemaValidator.validate(newDatafileObj);
config.logger.log(LOG_LEVEL.INFO, LOG_MESSAGES.VALID_DATAFILE, MODULE_NAME);
} catch (error) {
} catch (error : any) {
return { configObj: null, error };
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class ProjectConfigManager {
reason: getErrorMessage(handleNewDatafileException, 'Invalid datafile'),
});
}
} catch (ex) {
} catch (ex: any) {
logger.error(ex);
this.readyPromise = Promise.resolve({
success: false,
Expand Down
6 changes: 3 additions & 3 deletions packages/optimizely-sdk/lib/index.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const createInstance = function(config: Config): Client | null {
try {
configValidator.validate(config);
isValidInstance = true;
} catch (ex) {
} catch (ex: any) {
logger.error(ex);
}

Expand Down Expand Up @@ -141,12 +141,12 @@ const createInstance = function(config: Config): Client | null {
false
);
}
} catch (e) {
} catch (e: any) {
logger.error(enums.LOG_MESSAGES.UNABLE_TO_ATTACH_UNLOAD, MODULE_NAME, e.message);
}

return optimizely;
} catch (e) {
} catch (e: any) {
logger.error(e);
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/optimizely-sdk/lib/index.lite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ setLogLevel(LogLevel.ERROR);
try {
configValidator.validate(config);
isValidInstance = true;
} catch (ex) {
} catch (ex: any) {
logger.error(ex);
}

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

const optimizely = new Optimizely(optimizelyOptions);
return optimizely;
} catch (e) {
} catch (e: any) {
logger.error(e);
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/optimizely-sdk/lib/index.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
try {
configValidator.validate(config);
isValidInstance = true;
} catch (ex) {
} catch (ex: any) {
if (hasLogger) {
logger.error(ex);
} else {
Expand Down Expand Up @@ -117,7 +117,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
};

return new Optimizely(optimizelyOptions);
} catch (e) {
} catch (e: any) {
logger.error(e);
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/optimizely-sdk/lib/index.react_native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
try {
configValidator.validate(config);
isValidInstance = true;
} catch (ex) {
} catch (ex: any) {
logger.error(ex);
}

Expand Down Expand Up @@ -117,7 +117,7 @@ const DEFAULT_EVENT_MAX_QUEUE_SIZE = 10000;
}

return new Optimizely(optimizelyOptions);
} catch (e) {
} catch (e: any) {
logger.error(e);
return null;
}
Expand Down
Loading