Skip to content
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

fix: Implement RN SDK EventSource jitter backoff. #359

Merged
merged 36 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
2c7ac96
feat: Implement common support for auto environment attributes.
yusinto Jan 25, 2024
53d4358
feat: Implement common client side support for auto environment attri…
yusinto Jan 25, 2024
dc3f3af
chore: Fixed server sdk tests due to mock api changes for auto env.
yusinto Jan 25, 2024
e552def
feat: React-native support for auto-env attributes.
yusinto Jan 25, 2024
2028f4c
chore: Fix broken common tests due to mocks api changes.
yusinto Jan 25, 2024
e8989f1
Merge branch 'yus/client-sdk-auto-env' into yus/rn-sdk-auto-env
yusinto Jan 25, 2024
23a11dc
Merge branch 'main' into yus/client-sdk-auto-env
yusinto Jan 25, 2024
1156f25
Merge branch 'yus/client-sdk-auto-env' into yus/rn-sdk-auto-env
yusinto Jan 25, 2024
adc1de1
fix: Remove sdk data as fallback for auto env. Strip falsy values and…
yusinto Jan 26, 2024
04bb98f
fix: Respect customer provided ld_application and ld_device contexts.
yusinto Jan 26, 2024
75bb880
fix: Add mandatory autoEnvAttributes argument to LDClient constructor.
yusinto Jan 26, 2024
5243f3f
chore: Move AutoEnvAttributes enum to common.
yusinto Jan 26, 2024
22b97bd
fix: Make all device.os properties optional.
yusinto Jan 26, 2024
d365184
fix: Added mandatory AutoEnvAttributes constructor arg.
yusinto Jan 26, 2024
b47a5e2
chore: Log warning if auto env attributes are not added because they …
yusinto Jan 26, 2024
d1f0310
Merge branch 'yus/client-sdk-auto-env' into yus/rn-sdk-auto-env
yusinto Jan 26, 2024
ebc670a
chore: Remove unused import in platform mock.
yusinto Jan 26, 2024
b5ce097
chore: Fix duplicated test name.
yusinto Jan 26, 2024
ccb8419
fix: Implemented separate namespaces for anon and contexts. Fixed bug…
yusinto Jan 27, 2024
125f82b
Merge branch 'yus/client-sdk-auto-env' into yus/rn-sdk-auto-env
yusinto Jan 27, 2024
4e7f1c1
fix: Hardcode @types/node version to avoid crypto typings but in v20.…
yusinto Jan 28, 2024
caa1f14
chore: Add comment to explain harcoding of @types.node.
yusinto Jan 28, 2024
6ef3a87
Merge branch 'yus/client-sdk-auto-env' into yus/rn-sdk-auto-env
yusinto Jan 28, 2024
4375509
Merge branch 'yus/client-sdk-auto-env' into yus/rn-sdk-auto-env
yusinto Jan 28, 2024
ef15c18
Merge branch 'yus/rn-sdk-auto-env' of github.com:launchdarkly/js-core…
yusinto Jan 28, 2024
189d379
fix: Import AutoEnvAttributes from the rn sdk instead of client common.
yusinto Jan 28, 2024
31643eb
fix: Add tsconfig jsx react setting.
yusinto Jan 28, 2024
1788a21
chore: Remove hardcoded @types/node version.
yusinto Jan 29, 2024
f851823
Merge branch 'yus/client-sdk-auto-env' into yus/rn-sdk-auto-env
yusinto Jan 29, 2024
d9dc2e5
chore: Deleted redundant react-native-sse files and folder.
yusinto Jan 30, 2024
f6ca89c
fix: Added rn sdk streaming jitter backoff.
yusinto Jan 30, 2024
50c884c
chore: Added backoff jitter tests.
yusinto Jan 31, 2024
aaa7f94
chore: Use Math.min instead of logical operators for backoff.
yusinto Jan 31, 2024
05f52b6
chore: Fixed minor type import.
yusinto Jan 31, 2024
eb2a682
Merge branch 'main' into yus/sc-225912/implement-rn-eventsource-jitte…
yusinto Feb 1, 2024
b50c904
chore: Remove trailing commas.
yusinto Feb 1, 2024
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
25 changes: 22 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
module.exports = {
env: {
node: true,
'jest/globals': true,
},
extends: ['airbnb-base', 'airbnb-typescript/base', 'prettier'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.eslint.json',
},
plugins: ['@typescript-eslint', 'prettier'],
ignorePatterns: ['**/dist/**', '**/vercel/examples/**'],
plugins: ['@typescript-eslint', 'prettier', 'jest'],
ignorePatterns: [
'**/dist/**',
'**/vercel/examples/**',
'**/react-native/example/**',
'**/fromExternal/**',
],
rules: {
'@typescript-eslint/lines-between-class-members': 'off',
'@typescript-eslint/no-unused-vars': [
Expand All @@ -20,7 +26,12 @@ module.exports = {
'import/no-extraneous-dependencies': [
'error',
{
devDependencies: ['**/jest*.ts', '**/*.test.ts', '**/rollup.config.ts'],
devDependencies: [
'**/jest*.ts',
'**/*.test.ts',
'**/rollup.config.ts',
'**/*{.,_}{test,spec}.{ts,tsx}',
],
},
],
'import/default': 'error',
Expand All @@ -30,5 +41,13 @@ module.exports = {
'import/no-cycle': 'error',
'import/no-useless-path-segments': 'error',
'import/no-duplicates': 'error',
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
// 'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
},
globals: {
BigInt: 'readonly',
},
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"eslint": "^8.45.0",
"eslint": "^8.56.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-prettier": "^5.0.0",
"prettier": "^3.0.0",
"typedoc": "0.25.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ and re-run pod install for [auto-linking to work](https://github.com/react-nativ
// App.tsx
import { LDProvider, ReactNativeLDClient } from '@launchdarkly/react-native-client-sdk';

const featureClient = new ReactNativeLDClient('mobile-key');
const featureClient = new ReactNativeLDClient('mobile-key', AutoEnvAttributes.Enabled);
const userContext = { kind: 'user', key: 'test-user-1' };

const App = () => (
Expand Down Expand Up @@ -100,7 +100,7 @@ yarn && yarn ios-go

## Verifying SDK build provenance with the SLSA framework

LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).
LaunchDarkly uses the [SLSA framework](https://slsa.dev/spec/v1.0/about) (Supply-chain Levels for Software Artifacts) to help developers make their supply chain more secure by ensuring the authenticity and build integrity of our published SDK packages. To learn more, see the [provenance guide](PROVENANCE.md).

## About LaunchDarkly

Expand Down
3 changes: 3 additions & 0 deletions packages/sdk/react-native/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
8 changes: 6 additions & 2 deletions packages/sdk/react-native/example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { MOBILE_KEY } from '@env';

import { LDProvider, ReactNativeLDClient } from '@launchdarkly/react-native-client-sdk';
import {
AutoEnvAttributes,
LDProvider,
ReactNativeLDClient,
} from '@launchdarkly/react-native-client-sdk';

import Welcome from './src/welcome';

const featureClient = new ReactNativeLDClient(MOBILE_KEY);
const featureClient = new ReactNativeLDClient(MOBILE_KEY, AutoEnvAttributes.Enabled);

const App = () => {
return (
Expand Down
5 changes: 3 additions & 2 deletions packages/sdk/react-native/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.7.1",
"react": "18.2.0",
"react-native": "0.72.6"
"react-native": "0.72.6",
"react-native-dotenv": "^3.4.9"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand All @@ -37,7 +38,7 @@
"@types/react": "~18.2.14",
"@types/react-native-dotenv": "^0.2.1",
"detox": "^20.14.7",
"react-native-dotenv": "^3.4.9",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
}
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/react-native/example/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "expo/tsconfig.base",
"compilerOptions": {
"jsx": "react",
"strict": true,
"typeRoots": ["./types"]
},
Expand Down
Loading
Loading