-
Notifications
You must be signed in to change notification settings - Fork 2k
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
wpcom-proxy-request: Return Promise if no callback specified #39683
Changes from all commits
2788b24
ac3d9f7
93e07ed
61bdfd1
eeb30f0
4011d32
11bb655
4a745e4
e633952
989506c
46a4350
e94f9df
feeff98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export interface WpcomClientCredentials { | ||
client_id: string; | ||
client_secret: string; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,18 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import wpcomRequest, { requestAllBlogsAccess } from 'wpcom-proxy-request'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { wpcomRequest, WpcomClientCredentials } from '../utils'; | ||
import { CreateSiteAction } from './types'; | ||
import { WpcomClientCredentials } from '../shared-types'; | ||
|
||
export default function createControls( clientCreds: WpcomClientCredentials ) { | ||
requestAllBlogsAccess().catch( () => { | ||
throw new Error( 'Could not get all blog access.' ); | ||
} ); | ||
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's worth noting that this is async, so we'll synchronously return the controls below, but may asynchronously error. That seems alright to keep the happy path simple and failing fast. |
||
return { | ||
CREATE_SITE: async ( action: CreateSiteAction ) => { | ||
const { authToken, ...providedParams } = action.params; | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,154 +1,136 @@ | ||
6.0.0 / TBD | ||
================== | ||
# 6.0.0 / TBD | ||
|
||
* Move the published `build/` folder to `dist/` to align with other Calypso packages | ||
* Upgrade dependency 'debug' to 4.1.1 | ||
- Breaking: Return Promise (rather than `XMLHttpRequest` instance) if no callback argument is provided. | ||
- In practice, most people have probably been using the callback rather than the returned `XMLHttpRequest` instance, so this shouldn't be a breaking change for most. | ||
- Add `requestAllBlogsAccess()`. | ||
- Add a few type definitions. | ||
- Move the published `build/` folder to `dist/` to align with other Calypso packages | ||
- Upgrade dependency 'debug' to 4.1.1 | ||
|
||
5.0.2 / 2018-10-30 | ||
================== | ||
# 5.0.2 / 2018-10-30 | ||
|
||
* Fix the Chrome site isolation workaround to not break file uploads on Safari 10 | ||
- Fix the Chrome site isolation workaround to not break file uploads on Safari 10 | ||
|
||
5.0.1 / 2018-10-29 | ||
================== | ||
# 5.0.1 / 2018-10-29 | ||
|
||
* Work around a Chrome site isolation bug when uploading files | ||
- Work around a Chrome site isolation bug when uploading files | ||
|
||
3.0.0 / 2016-07-27 | ||
================== | ||
# 3.0.0 / 2016-07-27 | ||
|
||
* examples: add wp-api example | ||
* client-test-app: add index.html | ||
* Add test stuff - Add tests - Add rules to compile the browser application | ||
* core: improve WP-API integration - detect response error in envelope mode - remove _headers from body and add a thrid response parameter in the callback - add status to headers parameter | ||
* examples: eslint | ||
* examples: update bundle path and global var | ||
* create bundle file only for testing purpose | ||
* pkg: make build in prepublish hook | ||
* pkg: publish only useful files in npm package | ||
* rewrite using ES6 | ||
* Add eslint rules | ||
* change compiling process - Use n8-make to make pre-compilation - Make bundle file using Webpack`` | ||
* index: opt-in to `supports_error_obj` better Errors | ||
* Use `wp-error` module for common Error handling logic | ||
* index: add missing `uninstall()` function | ||
* Fix TypeError on string body 'error' from rest-proxy | ||
* Add pinghub example | ||
* Add support for persistent connections | ||
- examples: add wp-api example | ||
- client-test-app: add index.html | ||
- Add test stuff - Add tests - Add rules to compile the browser application | ||
- core: improve WP-API integration - detect response error in envelope mode - remove \_headers from body and add a thrid response parameter in the callback - add status to headers parameter | ||
- examples: eslint | ||
- examples: update bundle path and global var | ||
- create bundle file only for testing purpose | ||
- pkg: make build in prepublish hook | ||
- pkg: publish only useful files in npm package | ||
- rewrite using ES6 | ||
- Add eslint rules | ||
- change compiling process - Use n8-make to make pre-compilation - Make bundle file using Webpack`` | ||
- index: opt-in to `supports_error_obj` better Errors | ||
- Use `wp-error` module for common Error handling logic | ||
- index: add missing `uninstall()` function | ||
- Fix TypeError on string body 'error' from rest-proxy | ||
- Add pinghub example | ||
- Add support for persistent connections | ||
|
||
2.0.0 / 2016-03-11 | ||
================== | ||
# 2.0.0 / 2016-03-11 | ||
|
||
* index: opt-in to `supports_error_obj` better Errors | ||
- index: opt-in to `supports_error_obj` better Errors | ||
|
||
1.2.0 / 2016-03-09 | ||
================== | ||
# 1.2.0 / 2016-03-09 | ||
|
||
* dist: recompile | ||
* Use `wp-error` module for common Error handling logic | ||
* add missing LICENSE stuff | ||
* index: add missing `uninstall()` function | ||
- dist: recompile | ||
- Use `wp-error` module for common Error handling logic | ||
- add missing LICENSE stuff | ||
- index: add missing `uninstall()` function | ||
|
||
1.1.1 / 2016-03-08 | ||
================== | ||
# 1.1.1 / 2016-03-08 | ||
|
||
* fix TypeError on string body 'error' from rest-proxy | ||
- fix TypeError on string body 'error' from rest-proxy | ||
|
||
1.1.0 / 2016-02-24 | ||
================== | ||
# 1.1.0 / 2016-02-24 | ||
|
||
* support persistent connections e.g. websockets | ||
* add example for connecting to Pinghub via websocket | ||
- support persistent connections e.g. websockets | ||
- add example for connecting to Pinghub via websocket | ||
|
||
1.0.5 / 2015-11-22 | ||
================== | ||
# 1.0.5 / 2015-11-22 | ||
|
||
* package: update "debug" to v2.2.0 | ||
- package: update "debug" to v2.2.0 | ||
|
||
1.0.4 / 2015-02-27 | ||
================== | ||
# 1.0.4 / 2015-02-27 | ||
|
||
* dist: recompile | ||
* wrapping try/catch on an IIFE. | ||
* optimization for short-circuit evaluation. | ||
* detecting support for the structured clone algorithm. | ||
* forcing JSON string for postMessage/onmessage to circumvent IE9 limitations. | ||
- dist: recompile | ||
- wrapping try/catch on an IIFE. | ||
- optimization for short-circuit evaluation. | ||
- detecting support for the structured clone algorithm. | ||
- forcing JSON string for postMessage/onmessage to circumvent IE9 limitations. | ||
|
||
1.0.3 / 2015-02-09 | ||
================== | ||
# 1.0.3 / 2015-02-09 | ||
|
||
* index: don't throw in the case that there's no `buffered` Array | ||
* examples: better me.html example output | ||
- index: don't throw in the case that there's no `buffered` Array | ||
- examples: better me.html example output | ||
|
||
1.0.2 / 2014-10-21 | ||
================== | ||
# 1.0.2 / 2014-10-21 | ||
|
||
* Republish since npm messed up v1.0.1 | ||
- Republish since npm messed up v1.0.1 | ||
|
||
1.0.1 / 2014-10-21 | ||
================== | ||
# 1.0.1 / 2014-10-21 | ||
|
||
* index: bail if no matching XHR instance was found | ||
* index: use `event` module to listen for XHR events | ||
- index: bail if no matching XHR instance was found | ||
- index: use `event` module to listen for XHR events | ||
|
||
1.0.0 / 2014-10-20 | ||
================== | ||
# 1.0.0 / 2014-10-20 | ||
|
||
* index: refactor to not use Promise anymore | ||
* examples: tweak "me.html" example since it no longer returns a Promise | ||
* examples: add "progress" listeners to upload example | ||
* examples: multiply percent complete by 100 | ||
* examples: make "upload.html" example use user's primary blog | ||
* package: update "debug" to v2.1.0 | ||
* package: update "browserify" to v6.1.0 | ||
* package: remove unused "promise" dependency | ||
- index: refactor to not use Promise anymore | ||
- examples: tweak "me.html" example since it no longer returns a Promise | ||
- examples: add "progress" listeners to upload example | ||
- examples: multiply percent complete by 100 | ||
- examples: make "upload.html" example use user's primary blog | ||
- package: update "debug" to v2.1.0 | ||
- package: update "browserify" to v6.1.0 | ||
- package: remove unused "promise" dependency | ||
|
||
0.2.5 / 2014-06-26 | ||
================== | ||
# 0.2.5 / 2014-06-26 | ||
|
||
* dist: recompile | ||
* index: honor ports on the host page (#3, @rralian) | ||
- dist: recompile | ||
- index: honor ports on the host page (#3, @rralian) | ||
|
||
0.2.4 / 2014-06-24 | ||
================== | ||
# 0.2.4 / 2014-06-24 | ||
|
||
* dist: recompile | ||
* package: update all dependencies | ||
- dist: recompile | ||
- package: update all dependencies | ||
|
||
0.2.3 / 2014-06-24 | ||
================== | ||
# 0.2.3 / 2014-06-24 | ||
|
||
* dist: recompile | ||
* index: don't bother doing a debug() call for the metaAPI calls | ||
* index: use %o debug formatter when it makes sense | ||
* index: implement File -> ArrayBuffer manual conversion for Firefox | ||
- dist: recompile | ||
- index: don't bother doing a debug() call for the metaAPI calls | ||
- index: use %o debug formatter when it makes sense | ||
- index: implement File -> ArrayBuffer manual conversion for Firefox | ||
|
||
0.2.2 / 2014-06-10 | ||
================== | ||
# 0.2.2 / 2014-06-10 | ||
|
||
* dist: recompile | ||
* examples: add `freshly-pressed.html` example | ||
* package: be loose with the `debug` version | ||
- dist: recompile | ||
- examples: add `freshly-pressed.html` example | ||
- package: be loose with the `debug` version | ||
|
||
0.2.1 / 2014-06-05 | ||
================== | ||
# 0.2.1 / 2014-06-05 | ||
|
||
* package: update "debug" to v1.0.0 | ||
- package: update "debug" to v1.0.0 | ||
|
||
0.2.0 / 2014-05-27 | ||
================== | ||
# 0.2.0 / 2014-05-27 | ||
|
||
* index: update <iframe> "src" URL | ||
* examples: fix <script> tag src location | ||
- index: update <iframe> "src" URL | ||
- examples: fix <script> tag src location | ||
|
||
0.1.1 / 2014-05-12 | ||
================== | ||
# 0.1.1 / 2014-05-12 | ||
|
||
* examples: add `upload.html` example | ||
* index: rename `res` variable to `body` | ||
* index: bind to iframe "load" event before setting `.src` | ||
- examples: add `upload.html` example | ||
- index: rename `res` variable to `body` | ||
- index: bind to iframe "load" event before setting `.src` | ||
|
||
0.1.0 / 2014-04-22 | ||
================== | ||
# 0.1.0 / 2014-04-22 | ||
|
||
* initial release | ||
- initial release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks!