-
-
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.
Backport request, request-utils, store cache-handler changes to 4.12 (#…
…9389) * Backport @ember-data/request changes from main * Backport cache-handler changes from main * Backport fetch handler changes from main * Backport @ember-data/request-utils * Don't build types for @ember-data/request-utils * Downgrade @ember-data/request-utils node engines * Fix @ember-data/request-utils build * Fix lint * Fix problems * Fix special-build-tests * Remove request-utils changelog
- Loading branch information
1 parent
9779c67
commit f557cee
Showing
33 changed files
with
5,493 additions
and
1,006 deletions.
There are no files selected for viewing
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
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
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
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (C) 2017-2023 Ember.js contributors | ||
Portions Copyright (C) 2011-2017 Tilde, Inc. and contributors. | ||
Portions Copyright (C) 2011 LivingSocial Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
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,76 @@ | ||
<p align="center"> | ||
<img | ||
class="project-logo" | ||
src="./ember-data-logo-dark.svg#gh-dark-mode-only" | ||
alt="EmberData RequestUtils" | ||
width="240px" | ||
title="EmberData RequestUtils" | ||
/> | ||
<img | ||
class="project-logo" | ||
src="./ember-data-logo-light.svg#gh-light-mode-only" | ||
alt="EmberData RequestUtils" | ||
width="240px" | ||
title="EmberData RequestUtils" | ||
/> | ||
</p> | ||
|
||
<p align="center">Utilities for Requests</p> | ||
|
||
This package provides Simple utility function to assist in url building, query params, and other common request operations. | ||
|
||
It's built for [*Ember***Data**](https://github.com/emberjs/data/) but useful more broadly if you're looking for lightweight functions to assist in working with urls and query params. | ||
|
||
## Installation | ||
|
||
Install using your javascript package manager of choice. For instance with [pnpm](https://pnpm.io/) | ||
|
||
```no-highlight | ||
pnpm add @ember-data/request-utils | ||
``` | ||
|
||
**Tagged Releases** | ||
|
||
- ![NPM Canary Version](https://img.shields.io/npm/v/%40ember-data/request-utils/canary?label=%40canary&color=FFBF00) | ||
- ![NPM Beta Version](https://img.shields.io/npm/v/%40ember-data/request-utils/beta?label=%40beta&color=ff00ff) | ||
- ![NPM Stable Version](https://img.shields.io/npm/v/%40ember-data/request-utils/latest?label=%40latest&color=90EE90) | ||
- ![NPM LTS Version](https://img.shields.io/npm/v/%40ember-data/request-utils/lts?label=%40lts&color=0096FF) | ||
- ![NPM LTS 4.12 Version](https://img.shields.io/npm/v/%40ember-data/request-utils/lts-4-12?label=%40lts-4-12&color=bbbbbb) | ||
|
||
|
||
## Utils | ||
|
||
- [buildBaseUrl]() | ||
- [sortQueryParams]() | ||
- [buildQueryParams]() | ||
- [filterEmpty]() | ||
|
||
### As a Library Primitive | ||
|
||
These primitives may be used directly or composed by request builders to provide a consistent interface for building requests. | ||
|
||
For instance: | ||
|
||
```ts | ||
import { buildBaseURL, buildQueryParams } from '@ember-data/request-utils'; | ||
|
||
const baseURL = buildBaseURL({ | ||
host: 'https://api.example.com', | ||
namespace: 'api/v1', | ||
resourcePath: 'emberDevelopers', | ||
op: 'query', | ||
identifier: { type: 'ember-developer' } | ||
}); | ||
const url = `${baseURL}?${buildQueryParams({ name: 'Chris', include:['pets'] })}`; | ||
// => 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris' | ||
``` | ||
|
||
This is useful, but not as useful as the REST request builder for query which is sugar over this (and more!): | ||
|
||
```ts | ||
import { query } from '@ember-data/rest/request'; | ||
|
||
const options = query('ember-developer', { name: 'Chris', include:['pets'] }); | ||
// => { url: 'https://api.example.com/api/v1/emberDevelopers?include=pets&name=Chris' } | ||
// Note: options will also include other request options like headers, method, etc. | ||
``` |
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,19 @@ | ||
module.exports = { | ||
name: require('./package.json').name, | ||
|
||
treeForVendor() { | ||
return; | ||
}, | ||
treeForPublic() { | ||
return; | ||
}, | ||
treeForStyles() { | ||
return; | ||
}, | ||
treeForAddonStyles() { | ||
return; | ||
}, | ||
treeForApp() { | ||
return; | ||
}, | ||
}; |
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,8 @@ | ||
{ | ||
"plugins": [ | ||
"@babel/plugin-transform-runtime", | ||
["@babel/plugin-transform-typescript", { "allowDeclareFields": true }], | ||
["@babel/plugin-proposal-decorators", { "legacy": true }], | ||
"@babel/plugin-transform-class-properties" | ||
] | ||
} |
Oops, something went wrong.