Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
2035a96a
Commit
2035a96a
authored
Apr 16, 2021
by
Robert Knight
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add types to references to `AuthService`
This found an error in some of the existing types in the `api` service.
parent
78c7f624
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
12 deletions
+8
-12
HypothesisApp.js
src/sidebar/components/HypothesisApp.js
+1
-1
api.js
src/sidebar/services/api.js
+4
-11
groups.js
src/sidebar/services/groups.js
+1
-0
session.js
src/sidebar/services/session.js
+2
-0
No files found.
src/sidebar/components/HypothesisApp.js
View file @
2035a96a
...
...
@@ -53,7 +53,7 @@ function authStateFromProfile(profile) {
/**
* @typedef HypothesisAppProps
* @prop {
Object
} auth
* @prop {
import('../services/auth').AuthService
} auth
* @prop {Bridge} bridge
* @prop {ServiceUrlGetter} serviceUrl
* @prop {MergedConfig} settings
...
...
src/sidebar/services/api.js
View file @
2035a96a
...
...
@@ -66,7 +66,7 @@ function stripInternalProperties(obj) {
* Configuration for an API method.
*
* @typedef {Object} APIMethodOptions
* @prop {() => Promise<string>} getAccessToken -
* @prop {() => Promise<string
|null
>} getAccessToken -
* Function which acquires a valid access token for making an API request.
* @prop {() => string|null} getClientId -
* Function that returns a per-session client ID to include with the request
...
...
@@ -75,9 +75,6 @@ function stripInternalProperties(obj) {
* @prop {() => any} onRequestFinished - Callback invoked when the API request finishes.
*/
// istanbul ignore next
const
noop
=
()
=>
null
;
function
get
(
object
,
path
)
{
let
cursor
=
object
;
path
.
split
(
'.'
).
forEach
(
segment
=>
{
...
...
@@ -92,18 +89,13 @@ function get(object, path) {
* @param links - Object or promise for an object mapping named API routes to
* URL templates and methods
* @param route - The dotted path of the named API route (eg. `annotation.create`)
* @param
[APIMethodOptions]
- Configuration for the API method
* @param
{APIMethodOptions} options
- Configuration for the API method
* @return {APICallFunction}
*/
function
createAPICall
(
links
,
route
,
{
getAccessToken
=
noop
,
getClientId
=
noop
,
onRequestStarted
=
noop
,
onRequestFinished
=
noop
,
}
=
{}
{
getAccessToken
,
getClientId
,
onRequestStarted
,
onRequestFinished
}
)
{
return
function
(
params
,
data
,
options
=
{})
{
onRequestStarted
();
...
...
@@ -204,6 +196,7 @@ function createAPICall(
* not use authentication.
*
* @param {import('./api-routes').APIRoutesService} apiRoutes
* @param {import('./auth').AuthService} auth
*/
// @inject
export
default
function
api
(
apiRoutes
,
auth
,
store
)
{
...
...
src/sidebar/services/groups.js
View file @
2035a96a
...
...
@@ -22,6 +22,7 @@ const DEFAULT_ORGANIZATION = {
/**
* @param {import('./toast-messenger').ToastMessengerService} toastMessenger
* @param {import('./auth').AuthService} auth
*/
// @inject
export
default
function
groups
(
...
...
src/sidebar/services/session.js
View file @
2035a96a
...
...
@@ -12,6 +12,8 @@ const CACHE_TTL = 5 * 60 * 1000; // 5 minutes
*
* Access to the current profile is exposed via the `state` property.
*
* @param {import('../store').SidebarStore} store
* @param {import('./auth').AuthService} auth
* @param {import('./toast-messenger').ToastMessengerService} toastMessenger
* @inject
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment