@effection/fetch
Advanced tools
Comparing version 2.0.0-preview.2-f9e72f1 to 2.0.0-side-effects.1628154356605
146
CHANGELOG.md
# @effection/fetch | ||
## \[2.0.0-beta.8] | ||
- The `dist` directory didn't contain the `esm` and `cjs` directory. We copy the `package.json` for reference into the dist, and this broke the `files` resolution. Switch to using `dist-cjs` and `dist-esm` which allows us to avoid copying `package.json`. | ||
- [63fbcfb](https://github.com/thefrontside/effection/commit/63fbcfb8151bb7434f1cb8c58bfed25012ad2727) fix: @effection/core to ship dist/esm and dist/cjs on 2021-08-03 | ||
- [7788e24](https://github.com/thefrontside/effection/commit/7788e2408bcff8180b24ce497043283c97b6dbaa) fix: @effection/core to ship dist-esm and dist-cjs on 2021-08-03 | ||
- [6923a0f](https://github.com/thefrontside/effection/commit/6923a0fa1a84cd0788f8c9c1600ccf7539b08bbf) update change file with everything patched on 2021-08-03 | ||
## \[2.0.0-beta.7] | ||
- Add esm builds | ||
- Bumped due to a bump in @effection/core. | ||
- [6660a46](https://github.com/thefrontside/effection/commit/6660a466a50c9b9c36829c2d52448ebbc0e7e6fb) Add esm build ([#462](https://github.com/thefrontside/effection/pull/462)) on 2021-08-03 | ||
## \[2.0.0-beta.6] | ||
- remove accidentally compiled .js files from distributed sources | ||
- Bumped due to a bump in @effection/mocha. | ||
- [f0f0023](https://github.com/thefrontside/effection/commit/f0f002354743ae6d6f69bfe6df28ddc11d0f8be0) add changefile on 2021-07-26 | ||
## \[2.0.0-beta.5] | ||
- Upgrade typescript to 4.3.5 and replace tsdx with tsc | ||
- [121bd40](https://github.com/thefrontside/effection/commit/121bd40e17609a82bce649c5fed34ee0754681b7) Add change file for typescript bump on 2021-07-23 | ||
## 2.0.0-beta.4 | ||
### Patch Changes | ||
- Updated dependencies \[e297c86] | ||
- @effection/core@2.0.0-beta.4 | ||
## 2.0.0-beta.3 | ||
### Patch Changes | ||
- Updated dependencies \[5d95e6d] | ||
- Updated dependencies \[9700b45] | ||
- @effection/core@2.0.0-beta.3 | ||
## 2.0.0-beta.2 | ||
### Patch Changes | ||
- Updated dependencies \[19414f0] | ||
- Updated dependencies \[26a86cb] | ||
- Updated dependencies \[9c76cc5] | ||
- Updated dependencies \[f7e3344] | ||
- Updated dependencies \[ac7c1ce] | ||
- @effection/core@2.0.0-beta.2 | ||
## 2.0.0-beta.1 | ||
### Patch Changes | ||
- 0c6e263: release 2.0.0-beta | ||
- Updated dependencies \[0c6e263] | ||
- @effection/core@2.0.0-beta.1 | ||
## 2.0.0-preview.11 | ||
### Patch Changes | ||
- Updated dependencies \[9998088] | ||
- Updated dependencies \[2bce454] | ||
- Updated dependencies \[1981b35] | ||
- Updated dependencies \[88dc59a] | ||
- @effection/core@2.0.0-preview.12 | ||
## 2.0.0-preview.10 | ||
### Patch Changes | ||
- Updated dependencies \[88eca21] | ||
- Updated dependencies \[ae8d090] | ||
- Updated dependencies \[8bb4514] | ||
- Updated dependencies \[44c354d] | ||
- @effection/core@2.0.0-preview.11 | ||
## 2.0.0-preview.9 | ||
### Patch Changes | ||
- Updated dependencies \[625b521] | ||
- Updated dependencies \[a06c679] | ||
- Updated dependencies \[4d04159] | ||
- Updated dependencies \[625b521] | ||
- @effection/core@2.0.0-preview.10 | ||
## 2.0.0-preview.8 | ||
### Patch Changes | ||
- Updated dependencies \[110a2cd] | ||
- Updated dependencies \[e2545b2] | ||
- Updated dependencies \[2b92370] | ||
- Updated dependencies \[00562fd] | ||
- Updated dependencies \[110a2cd] | ||
- Updated dependencies \[110a2cd] | ||
- Updated dependencies \[02446ad] | ||
- Updated dependencies \[da86a9c] | ||
- @effection/core@2.0.0-preview.9 | ||
## 2.0.0-preview.7 | ||
### Patch Changes | ||
- a13987f: make operation resolution an interface. Make operation iterators | ||
an operation. | ||
- Updated dependencies \[a13987f] | ||
- @effection/core@2.0.0-preview.8 | ||
## 2.0.0-preview.6 | ||
### Patch Changes | ||
- Updated dependencies \[2bad074] | ||
- @effection/core@2.0.0-preview.7 | ||
## 2.0.0-preview.5 | ||
### Patch Changes | ||
- 1222756: Use strict dependency requirements for internal dependencies while in prerelease mode | ||
- Updated dependencies \[1222756] | ||
- @effection/core@2.0.0-preview.6 | ||
## 2.0.0-preview.4 | ||
### Patch Changes | ||
- cb25211: reset these pre-release versions to 2.0.0 series | ||
## 2.0.0-preview.2 | ||
@@ -8,3 +140,3 @@ | ||
- 93ec0d6: Include CHANGELOGS and src with all packages | ||
- Updated dependencies [93ec0d6] | ||
- Updated dependencies \[93ec0d6] | ||
- @effection/core@2.0.0-preview.2 | ||
@@ -17,3 +149,3 @@ | ||
- 80143d5: Fix packaging | ||
- Updated dependencies [80143d5] | ||
- Updated dependencies \[80143d5] | ||
- @effection/core@2.0.0-preview.1 | ||
@@ -29,3 +161,3 @@ | ||
- Updated dependencies [undefined] | ||
- Updated dependencies \[undefined] | ||
- effection@2.0.0-preview.0 | ||
@@ -41,3 +173,3 @@ | ||
- Updated dependencies [b988025] | ||
- Updated dependencies \[b988025] | ||
- effection@1.0.0 | ||
@@ -49,3 +181,3 @@ | ||
- Updated dependencies [f851981] | ||
- Updated dependencies \[f851981] | ||
- effection@0.8.0 | ||
@@ -65,3 +197,3 @@ | ||
- db11b3f: convert `effection` dependency into normal, non-peer dependency | ||
- Updated dependencies [0e8951f] | ||
- Updated dependencies \[0e8951f] | ||
- effection@0.7.0 | ||
@@ -77,3 +209,3 @@ | ||
- Updated dependencies [68c4dab] | ||
- Updated dependencies \[68c4dab] | ||
- effection@0.6.4 |
{ | ||
"name": "@effection/fetch", | ||
"version": "2.0.0-preview.2-f9e72f1", | ||
"version": "2.0.0-side-effects.1628154356605", | ||
"description": "Fetch operation for Effection", | ||
"main": "dist/index.js", | ||
"typings": "dist/index.d.ts", | ||
"repository": "https://github.com/thefrontside/effection.git", | ||
"main": "dist-cjs/index.js", | ||
"module": "dist-esm/index.js", | ||
"types": "dist-esm/index.d.ts", | ||
"sideEffects": false, | ||
"homepage": "https://github.com/thefrontside/effection", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/thefrontside/effection.git", | ||
"directory": "packages/fetch" | ||
}, | ||
"typeDocEntry": "src/index.ts", | ||
"author": "Frontside Engineering <engineering@frontside.com>", | ||
@@ -13,3 +21,3 @@ "license": "MIT", | ||
"CHANGELOG.md", | ||
"dist/**/*", | ||
"dist-*/**/*", | ||
"src/**/*" | ||
@@ -19,3 +27,3 @@ ], | ||
"lint": "eslint '{src,tests}/**/*.ts'", | ||
"prepack": "tsdx build --tsconfig tsconfig.dist.json", | ||
"prepack": "tsc --build tsconfig.esm.json && tsc --build tsconfig.cjs.json", | ||
"test": "mocha -r ts-node/register test/**/*.test.ts", | ||
@@ -25,17 +33,19 @@ "mocha": "mocha -r ts-node/register" | ||
"devDependencies": { | ||
"@effection/mocha": "2.0.0-preview.2", | ||
"@frontside/tsconfig": "^0.0.1", | ||
"@types/node": "^13.13.4", | ||
"@effection/mocha": "2.0.0-side-effects.1628154356605", | ||
"@frontside/tsconfig": "^1.2.0", | ||
"@types/node": "^16.3.2", | ||
"expect": "26.0.1", | ||
"mocha": "8.3.1", | ||
"ts-node": "8.10.2", | ||
"tsdx": "0.13.2", | ||
"typescript": "^3.9.5" | ||
"ts-node": "^8.10.2", | ||
"typescript": "^4.3.5" | ||
}, | ||
"dependencies": { | ||
"@effection/core": "^2.0.0-preview.2", | ||
"@effection/core": "2.0.0-side-effects.1628154356605", | ||
"abort-controller": "^3.0.0", | ||
"cross-fetch": "^3.0.4", | ||
"node-fetch": "^2.6.1" | ||
}, | ||
"volta": { | ||
"extends": "../../package.json" | ||
} | ||
} |
@@ -1,15 +0,54 @@ | ||
import { Task, Operation } from '@effection/core'; | ||
import { spawn, Operation, Resource } from '@effection/core'; | ||
import { fetch as nativeFetch } from 'cross-fetch'; | ||
import { AbortController } from 'abort-controller'; | ||
export function fetch(scope: Task, info: RequestInfo, init: RequestInit = {}): Operation<Response> { | ||
return function*() { | ||
export interface Fetch extends Resource<Response> { | ||
arrayBuffer(): Operation<ArrayBuffer>; | ||
blob(): Operation<Blob>; | ||
formData(): Operation<FormData>; | ||
json(): Operation<unknown>; | ||
text(): Operation<string>; | ||
} | ||
export function fetch(info: RequestInfo, requestInit: RequestInit = {}): Fetch { | ||
function* init() { | ||
let controller = new AbortController(); | ||
scope.ensure(() => controller.abort()); | ||
yield spawn(function*() { | ||
try { | ||
yield; | ||
} finally { | ||
controller.abort(); | ||
} | ||
}); | ||
init.signal = controller.signal; | ||
requestInit.signal = controller.signal; | ||
return yield nativeFetch(info, init); | ||
let response: Response = yield nativeFetch(info, requestInit); | ||
return response; | ||
} | ||
}; | ||
return { | ||
init, | ||
*arrayBuffer() { | ||
let response = yield { init }; | ||
return yield response.arrayBuffer(); | ||
}, | ||
*blob() { | ||
let response = yield { init }; | ||
return yield response.blob(); | ||
}, | ||
*formData() { | ||
let response = yield { init }; | ||
return yield response.formData(); | ||
}, | ||
*json() { | ||
let response = yield { init }; | ||
return yield response.json(); | ||
}, | ||
*text() { | ||
let response = yield { init }; | ||
return yield response.text(); | ||
}, | ||
}; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
16492
7
21
169
1
0
2
+ Added@effection/core@2.0.0-side-effects.1628154356605(transitive)
- Removed@chainsafe/abort-controller@3.0.1(transitive)
- Removed@effection/core@2.2.3(transitive)