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

Remove node-fetch dependency from SDK, introduce @realm/fetch and allow passing fetch through AppConfiguration #6401

Merged
merged 47 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0f40fed
Removed node-fetch and abort-controller from dependencies
kraenhansen Jan 18, 2024
891bbe1
Hoisted dependencies on typescript and @types/node
kraenhansen Jan 18, 2024
6de5563
Started implementing a truely isometric fetch package
kraenhansen Jan 18, 2024
1b653c3
Removed the path alias for types
kraenhansen Jan 19, 2024
63758fa
WIP
kraenhansen Jan 19, 2024
f104f44
Fixed Headers types
kraenhansen Jan 19, 2024
9d99127
Adding AbortSignal
kraenhansen Jan 19, 2024
f58bc74
Removing types project as reference in root tsconfig.json
kraenhansen Jan 19, 2024
76460cc
assserting AbortSignal types and patching timeout static
kraenhansen Jan 19, 2024
8e57b33
Adding AbortController
kraenhansen Jan 19, 2024
13f6364
Exporting Headers and returning Response
kraenhansen Jan 19, 2024
3b4243e
ReadableStream WIP
kraenhansen Jan 21, 2024
6711cc7
WIP
kraenhansen Jan 21, 2024
207640a
Deleted @realm/network-transport
kraenhansen Jan 21, 2024
75da88b
Adding textStreaming config to React Native fetch requests.
kraenhansen Jan 21, 2024
f6e2b13
Adding engines and type param to @realm/fetch
kraenhansen Jan 21, 2024
6b8a5f6
Removing network-transport from mono repo
kraenhansen Jan 21, 2024
624a833
Using @realm/fetch from "realm"
kraenhansen Jan 21, 2024
4dcba93
Using @realm/fetch from "app-importer"
kraenhansen Jan 21, 2024
eded4fa
Using @realm/fetch from "realm-web"
kraenhansen Jan 21, 2024
5a70b34
WIP
kraenhansen Jan 22, 2024
2015585
Ensure @realm/fetch is in the bundle of realm-web
kraenhansen Jan 22, 2024
e4535c6
Ensure @realm/fetch is in the bundle of realm
kraenhansen Jan 22, 2024
0c631da
Use a utility to wrap response.body in an async iterator
kraenhansen Jan 22, 2024
fd1fca4
Adding a version to @realm/fetch
kraenhansen Jan 22, 2024
0bdfa96
Adding engines to realm-web package.json
kraenhansen Jan 22, 2024
4350d2d
Fixing react-native fetch implementation
kraenhansen Jan 22, 2024
7f680fa
Adding comments to explain the weird emits
kraenhansen Jan 22, 2024
c4ac93f
Adding a "type-check" script to app-importer
kraenhansen Jan 22, 2024
4d15481
Adding a top-level "react-native" in @realm/fetch's package.json
kraenhansen Jan 22, 2024
759b87b
Prodiving a CJS + ESM node bundle
kraenhansen Jan 23, 2024
209cae1
Renamed fetch script to "build" (since it doesn't bundle)
kraenhansen Jan 23, 2024
78ec5c3
Bind fetch on node too (as this is loaded on Realm
kraenhansen Jan 23, 2024
2eb6242
Debugging url and init separately
kraenhansen Jan 23, 2024
6e9a314
Simplified types for ReactNative request init
kraenhansen Jan 23, 2024
685bb48
Implemented RN polyfill for AbortSignal.timeout
kraenhansen Jan 23, 2024
e689429
Fixed setting statusText instead of status
kraenhansen Jan 23, 2024
b26a475
Using AbortSignal.timeout only if timeout is positive
kraenhansen Jan 23, 2024
ede8128
Adding an AnyFetch type
kraenhansen Jan 23, 2024
6f432ab
Enable passing "fetch" through app configuration
kraenhansen Jan 23, 2024
4cc0c19
Passing baseUrl in the node-fetch test
kraenhansen Jan 23, 2024
0bff535
Providing a fallback for Symbol.asyncIterator if transpiled using Babel
kraenhansen Jan 23, 2024
7a46fc4
Apply suggestions from code review
kraenhansen Jan 24, 2024
6adbc52
Inlining configuration.storage
kraenhansen Jan 24, 2024
538ae38
Making cancel() return Promise<void>
kraenhansen Jan 24, 2024
eb5d38c
Adding ArrayBuffer | TypedArray to RequestBody
kraenhansen Jan 24, 2024
8af55d2
Bumping lib of realm-web to es2022
kraenhansen Jan 25, 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
1 change: 0 additions & 1 deletion .github/workflows/package-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ jobs:
matrix:
workspace:
- realm
- '@realm/network-transport'
- '@realm/babel-plugin'
- '@realm/react'
include:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-realm-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
# Only run when the PR makes changes to the packages
- "packages/realm-web/**"
- "packages/realm-web-integration-tests/**"
- "packages/realm-network-transport/**"
- "packages/realm-common/**"
- "packages/realm-app-importer/**"
# Changing types might also affect Realm Web
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/prepare-package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ on:
options:
- '@realm/babel-plugin'
- '@realm/common'
- '@realm/network-transport'
- '@realm/react'
- '@realm/tools'
- '@realm/web'
Expand All @@ -41,11 +40,6 @@ jobs:
"PACKAGE_NAME": "@realm/common",
"VERSION_PREFIX": "realm-common-"
},
"@realm/network-transport": {
"PACKAGE_PATH": "packages/realm-network-transport",
"PACKAGE_NAME": "@realm/network-transport",
"VERSION_PREFIX": "realm-network-transport-"
},
"@realm/react": {
"PACKAGE_PATH": "packages/realm-react",
"PACKAGE_NAME": "@realm/react",
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/publish-package-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ on:
options:
- '@realm/babel-plugin'
- '@realm/common'
- '@realm/network-transport'
- '@realm/react'
- '@realm/tools'
- '@realm/web'
Expand Down Expand Up @@ -50,13 +49,6 @@ jobs:
"RELEASE_TITLE": "Realm Common",
"SDK_NAME": "Common"
},
"@realm/network-transport": {
"PACKAGE_PATH": "packages/realm-network-transport",
"PACKAGE_NAME": "@realm/network-transport",
"VERSION_PREFIX": "realm-network-transport-",
"RELEASE_TITLE": "Realm Network Transport",
"SDK_NAME": "Network Transport"
},
"@realm/react": {
"PACKAGE_PATH": "packages/realm-react",
"PACKAGE_NAME": "@realm/react",
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* None

### Enhancements
* None
* Added an optional `fetch` parameter to the `AppConfiguration`. Use this to specify a custom implementation of the `fetch` function used by the app to perform network requests.

### Fixed
* <How to hit and notice issue? what was the impact?> ([#????](https://github.com/realm/realm-js/issues/????), since v?.?.?)
Expand Down
6 changes: 2 additions & 4 deletions integration-tests/environments/electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
]
},
"test:renderer": {
"command": "mocha-remote --reporter @realm/mocha-reporter --id renderer tsx runner.ts renderer",
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
]
}
},
Expand Down
6 changes: 2 additions & 4 deletions integration-tests/environments/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
]
},
"test:commonjs": {
"command": "mocha-remote --reporter @realm/mocha-reporter tsx index.cjs",
"dependencies": [
"../../../packages/realm:bundle",
"../../../packages/realm:build:node",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
]
}
},
Expand Down
18 changes: 6 additions & 12 deletions integration-tests/environments/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@
"dependencies": [
"../../../packages/realm:build:android",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
],
"env": {
"PLATFORM": "android",
Expand All @@ -118,8 +117,7 @@
"dependencies": [
"pod-install:simulator",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
],
"env": {
"PLATFORM": "ios",
Expand All @@ -131,8 +129,7 @@
"dependencies": [
"pod-install:catalyst",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
],
"env": {
"PLATFORM": "catalyst",
Expand All @@ -159,8 +156,7 @@
"dependencies": [
"../../../packages/realm:build:android",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
],
"env": {
"PLATFORM": "android",
Expand All @@ -173,8 +169,7 @@
"pod-install:simulator",
"../../../packages/realm:build:ios:debug:simulator",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
],
"env": {
"PLATFORM": "ios",
Expand All @@ -187,8 +182,7 @@
"pod-install:catalyst",
"../../../packages/realm:build:ios:debug:catalyst",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
"../../../packages/mocha-reporter:bundle"
],
"env": {
"PLATFORM": "catalyst",
Expand Down
196 changes: 96 additions & 100 deletions integration-tests/tests/package.json
Original file line number Diff line number Diff line change
@@ -1,101 +1,97 @@
{
"name": "@realm/integration-tests",
"version": "0.1.0",
"description": "A set of tests that can run in different environments",
"main": "src/index.ts",
"exports": {
".": "./src/index.ts",
"./node": "./src/node/index.ts"
},
"private": true,
"scripts": {
"build": "wireit",
"start": "wireit",
"test": "wireit",
"lint": "wireit",
"coverage": "wireit",
"ci:coverage": "wireit"
},
"wireit": {
"lint": {
"command": "eslint --ext .js,.ts . && tsc --noEmit",
"dependencies": [
"../../packages/realm-network-transport:bundle",
"../../packages/realm:bundle"
]
},
"build": {
"command": "tsc",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"start": {
"command": "mocha --watch",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"test": {
"command": "mocha --exit",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"coverage": {
"command": "nyc mocha --exit",
"dependencies": [
"../../packages/realm:bundle:coverage",
"build-dependencies"
]
},
"ci:coverage": {
"command": "nyc --reporter=lcov -- mocha --exit",
"dependencies": [
"../../packages/realm:bundle:coverage",
"build-dependencies"
]
},
"build-dependencies": {
"dependencies": [
"../../packages/realm:build:node",
"../../packages/mocha-reporter:bundle",
"../../packages/realm-network-transport:bundle"
]
}
},
"peerDependencies": {
"realm": "*"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@realm/app-importer": "*",
"@realm/mocha-reporter": "*",
"@thi.ng/bench": "^3.1.16",
"@types/chai": "^4.3.3",
"@types/chai-as-promised": "^7.1.5",
"@types/jsrsasign": "^10.5.4",
"@types/mocha": "^10.0.0",
"@types/node": "^18.15.10",
"concurrently": "^6.5.1",
"mocha": "^10.1.0",
"node-fetch": "^2.6.9",
"nyc": "^15.1.0",
"platform": "^1.3.6",
"realm": "*"
},
"dependencies": {
"@realm/network-transport": "^0.7.2",
"@thi.ng/bench": "^3.1.16",
"chai": "4.3.6",
"chai-as-promised": "^7.1.1",
"concurrently": "^6.0.2",
"jsrsasign": "^11.0.0"
},
"files": [
"/src"
]
}
"name": "@realm/integration-tests",
"version": "0.1.0",
"description": "A set of tests that can run in different environments",
"main": "src/index.ts",
"exports": {
".": "./src/index.ts",
"./node": "./src/node/index.ts"
},
"private": true,
"scripts": {
"build": "wireit",
"start": "wireit",
"test": "wireit",
"lint": "wireit",
"coverage": "wireit",
"ci:coverage": "wireit"
},
"wireit": {
"lint": {
"command": "eslint --ext .js,.ts . && tsc --noEmit",
"dependencies": [
"../../packages/realm:bundle"
]
},
"build": {
"command": "tsc",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"start": {
"command": "mocha --watch",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"test": {
"command": "mocha --exit",
"dependencies": [
"../../packages/realm:bundle",
"build-dependencies"
]
},
"coverage": {
"command": "nyc mocha --exit",
"dependencies": [
"../../packages/realm:bundle:coverage",
"build-dependencies"
]
},
"ci:coverage": {
"command": "nyc --reporter=lcov -- mocha --exit",
"dependencies": [
"../../packages/realm:bundle:coverage",
"build-dependencies"
]
},
"build-dependencies": {
"dependencies": [
"../../packages/realm:build:node",
"../../packages/mocha-reporter:bundle"
]
}
},
"peerDependencies": {
"realm": "*"
},
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.2",
"@realm/app-importer": "*",
"@realm/mocha-reporter": "*",
"@thi.ng/bench": "^3.1.16",
"@types/chai": "^4.3.3",
"@types/chai-as-promised": "^7.1.5",
"@types/jsrsasign": "^10.5.4",
"@types/mocha": "^10.0.0",
"concurrently": "^6.5.1",
"mocha": "^10.1.0",
"nyc": "^15.1.0",
"platform": "^1.3.6",
"realm": "*"
},
"dependencies": {
"@thi.ng/bench": "^3.1.16",
"chai": "4.3.6",
"chai-as-promised": "^7.1.1",
"concurrently": "^6.0.2",
"jsrsasign": "^11.0.0",
"node-fetch": "^3.3.2"
},
"files": [
"/src"
]
}
1 change: 1 addition & 0 deletions integration-tests/tests/src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ import "./path";
import "./sync-proxy";
import "./custom-inspect";
import "./ssl";
import "./node-fetch";
Loading
Loading