-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
169 additions
and
96 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
{ | ||
"name": "@ember-data/request", | ||
"description": "Network Primitive for coordinating and configuring `fetch` usage", | ||
"description": "⚡️ A simple, small and fast framework-agnostic library to make `fetch` happen", | ||
"version": "4.9.0-alpha.14", | ||
"private": false, | ||
"license": "MIT", | ||
"author": "Chris Thoburn <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+ssh://[email protected]:emberjs/data.git", | ||
"directory": "addons/tracking" | ||
"directory": "packages/request" | ||
}, | ||
"homepage": "https://github.com/emberjs/data", | ||
"bugs": "https://github.com/emberjs/data/issues", | ||
|
@@ -20,18 +20,16 @@ | |
"extends": "../../package.json" | ||
}, | ||
"dependencies": { | ||
"broccoli-funnel": "^3.0.8", | ||
"ember-cli-babel": "^7.26.11" | ||
}, | ||
"exports": { | ||
".": "./dist/index.js", | ||
"./*": "./dist/*", | ||
".": "./addon/index.js", | ||
"./*": "./addon/*", | ||
"./addon-main.js": "./addon-main.js" | ||
}, | ||
"files": [ | ||
"lib", | ||
"addon-main.js", | ||
"dist" | ||
"addon" | ||
], | ||
"scripts": { | ||
"build": "rollup --config", | ||
|
@@ -47,6 +45,7 @@ | |
"devDependencies": { | ||
"@embroider/addon-dev": "^2.0.0", | ||
"@embroider/macros": "^1.9.0", | ||
"@ember-data/private-build-infra": "workspace:4.9.0-alpha.14", | ||
"rollup": "^3.2.3", | ||
"@babel/core": "^7.19.6", | ||
"@babel/plugin-proposal-class-properties": "^7.18.6", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @module @ember-data/request | ||
*/ | ||
export interface StructuredDocument<T> { | ||
data?: T; | ||
} | ||
|
||
/** | ||
* @class Future | ||
*/ | ||
export interface Future<T> extends Promise<StructuredDocument<T>> { | ||
/** | ||
* Cancel this request by firing the AbortController's signal. | ||
* | ||
* @method abort | ||
* @public | ||
* @returns {void} | ||
*/ | ||
abort(): void; | ||
|
||
/** | ||
* Get the response stream, if any, once made available. | ||
* | ||
* @method getStream | ||
* @public | ||
* @returns {Promise<ReadableStream | null>} | ||
*/ | ||
getStream(): Promise<ReadableStream | null>; | ||
} | ||
|
||
export function createFuture<T>(promise: Promise<T>): Future<T> {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @module @ember-data/request/fetch | ||
*/ | ||
import type { RequestContext } from './index'; | ||
|
||
/** | ||
* A basic handler which onverts a request into a | ||
* `fetch` call presuming the response to be `json`. | ||
* | ||
* ```ts | ||
* import Fetch from '@ember-data/request/fetch'; | ||
* | ||
* manager.use([Fetch]); | ||
* ``` | ||
* | ||
* @class Fetch | ||
* @public | ||
*/ | ||
export default { | ||
async request(context: RequestContext) { | ||
const response = await fetch(context.request.url, context.request); | ||
context.setResponse(response); | ||
|
||
return response.json(); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters