@jbrowse/plugin-authentication 2.5.0 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/dist/DropboxOAuthModel/configSchema.d.ts +3 -14
  2. package/dist/DropboxOAuthModel/configSchema.js +0 -9
  3. package/dist/DropboxOAuthModel/index.js +0 -1
  4. package/dist/DropboxOAuthModel/model.d.ts +35 -33
  5. package/dist/DropboxOAuthModel/model.js +26 -36
  6. package/dist/DropboxOAuthModel/util.d.ts +1 -0
  7. package/dist/DropboxOAuthModel/util.js +27 -0
  8. package/dist/ExternalTokenModel/ExternalTokenEntryForm.d.ts +2 -1
  9. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js +10 -12
  10. package/dist/ExternalTokenModel/configSchema.js +0 -1
  11. package/dist/ExternalTokenModel/index.js +0 -1
  12. package/dist/ExternalTokenModel/model.js +0 -1
  13. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +15 -0
  14. package/dist/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +19 -0
  15. package/dist/GoogleDriveOAuthModel/configSchema.d.ts +0 -5
  16. package/dist/GoogleDriveOAuthModel/configSchema.js +0 -1
  17. package/dist/GoogleDriveOAuthModel/index.js +0 -1
  18. package/dist/GoogleDriveOAuthModel/model.d.ts +36 -121
  19. package/dist/GoogleDriveOAuthModel/model.js +38 -52
  20. package/dist/GoogleDriveOAuthModel/util.d.ts +1 -0
  21. package/dist/GoogleDriveOAuthModel/util.js +16 -0
  22. package/dist/HTTPBasicModel/HTTPBasicLoginForm.d.ts +2 -1
  23. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js +17 -22
  24. package/dist/HTTPBasicModel/configSchema.js +0 -1
  25. package/dist/HTTPBasicModel/index.js +0 -1
  26. package/dist/HTTPBasicModel/model.d.ts +36 -4
  27. package/dist/HTTPBasicModel/model.js +24 -10
  28. package/dist/OAuthModel/configSchema.d.ts +0 -8
  29. package/dist/OAuthModel/configSchema.js +1 -10
  30. package/dist/OAuthModel/index.js +0 -1
  31. package/dist/OAuthModel/model.d.ts +103 -18
  32. package/dist/OAuthModel/model.js +165 -114
  33. package/dist/OAuthModel/util.d.ts +7 -0
  34. package/dist/OAuthModel/util.js +59 -0
  35. package/dist/index.d.ts +7 -433
  36. package/dist/index.js +0 -1
  37. package/dist/util.d.ts +6 -0
  38. package/dist/util.js +22 -0
  39. package/esm/DropboxOAuthModel/configSchema.d.ts +3 -14
  40. package/esm/DropboxOAuthModel/configSchema.js +0 -9
  41. package/esm/DropboxOAuthModel/index.js +0 -1
  42. package/esm/DropboxOAuthModel/model.d.ts +35 -33
  43. package/esm/DropboxOAuthModel/model.js +26 -36
  44. package/esm/DropboxOAuthModel/util.d.ts +1 -0
  45. package/esm/DropboxOAuthModel/util.js +23 -0
  46. package/esm/ExternalTokenModel/ExternalTokenEntryForm.d.ts +2 -1
  47. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js +10 -12
  48. package/esm/ExternalTokenModel/configSchema.js +0 -1
  49. package/esm/ExternalTokenModel/index.js +0 -1
  50. package/esm/ExternalTokenModel/model.js +0 -1
  51. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.d.ts +15 -0
  52. package/esm/GoogleDriveOAuthModel/GoogleDriveFilehandle.js +15 -0
  53. package/esm/GoogleDriveOAuthModel/configSchema.d.ts +0 -5
  54. package/esm/GoogleDriveOAuthModel/configSchema.js +0 -1
  55. package/esm/GoogleDriveOAuthModel/index.js +0 -1
  56. package/esm/GoogleDriveOAuthModel/model.d.ts +36 -121
  57. package/esm/GoogleDriveOAuthModel/model.js +37 -50
  58. package/esm/GoogleDriveOAuthModel/util.d.ts +1 -0
  59. package/esm/GoogleDriveOAuthModel/util.js +12 -0
  60. package/esm/HTTPBasicModel/HTTPBasicLoginForm.d.ts +2 -1
  61. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js +18 -23
  62. package/esm/HTTPBasicModel/configSchema.js +0 -1
  63. package/esm/HTTPBasicModel/index.js +0 -1
  64. package/esm/HTTPBasicModel/model.d.ts +36 -4
  65. package/esm/HTTPBasicModel/model.js +24 -10
  66. package/esm/OAuthModel/configSchema.d.ts +0 -8
  67. package/esm/OAuthModel/configSchema.js +1 -10
  68. package/esm/OAuthModel/index.js +0 -1
  69. package/esm/OAuthModel/model.d.ts +103 -18
  70. package/esm/OAuthModel/model.js +164 -87
  71. package/esm/OAuthModel/util.d.ts +7 -0
  72. package/esm/OAuthModel/util.js +29 -0
  73. package/esm/index.d.ts +7 -433
  74. package/esm/index.js +0 -1
  75. package/esm/util.d.ts +6 -0
  76. package/esm/util.js +17 -0
  77. package/package.json +4 -6
  78. package/dist/DropboxOAuthModel/configSchema.js.map +0 -1
  79. package/dist/DropboxOAuthModel/index.js.map +0 -1
  80. package/dist/DropboxOAuthModel/model.js.map +0 -1
  81. package/dist/ExternalTokenModel/ExternalTokenEntryForm.js.map +0 -1
  82. package/dist/ExternalTokenModel/configSchema.js.map +0 -1
  83. package/dist/ExternalTokenModel/index.js.map +0 -1
  84. package/dist/ExternalTokenModel/model.js.map +0 -1
  85. package/dist/GoogleDriveOAuthModel/configSchema.js.map +0 -1
  86. package/dist/GoogleDriveOAuthModel/index.js.map +0 -1
  87. package/dist/GoogleDriveOAuthModel/model.js.map +0 -1
  88. package/dist/HTTPBasicModel/HTTPBasicLoginForm.js.map +0 -1
  89. package/dist/HTTPBasicModel/configSchema.js.map +0 -1
  90. package/dist/HTTPBasicModel/index.js.map +0 -1
  91. package/dist/HTTPBasicModel/model.js.map +0 -1
  92. package/dist/OAuthModel/configSchema.js.map +0 -1
  93. package/dist/OAuthModel/index.js.map +0 -1
  94. package/dist/OAuthModel/model.js.map +0 -1
  95. package/dist/index.js.map +0 -1
  96. package/esm/DropboxOAuthModel/configSchema.js.map +0 -1
  97. package/esm/DropboxOAuthModel/index.js.map +0 -1
  98. package/esm/DropboxOAuthModel/model.js.map +0 -1
  99. package/esm/ExternalTokenModel/ExternalTokenEntryForm.js.map +0 -1
  100. package/esm/ExternalTokenModel/configSchema.js.map +0 -1
  101. package/esm/ExternalTokenModel/index.js.map +0 -1
  102. package/esm/ExternalTokenModel/model.js.map +0 -1
  103. package/esm/GoogleDriveOAuthModel/configSchema.js.map +0 -1
  104. package/esm/GoogleDriveOAuthModel/index.js.map +0 -1
  105. package/esm/GoogleDriveOAuthModel/model.js.map +0 -1
  106. package/esm/HTTPBasicModel/HTTPBasicLoginForm.js.map +0 -1
  107. package/esm/HTTPBasicModel/configSchema.js.map +0 -1
  108. package/esm/HTTPBasicModel/index.js.map +0 -1
  109. package/esm/HTTPBasicModel/model.js.map +0 -1
  110. package/esm/OAuthModel/configSchema.js.map +0 -1
  111. package/esm/OAuthModel/index.js.map +0 -1
  112. package/esm/OAuthModel/model.js.map +0 -1
  113. package/esm/index.js.map +0 -1
  114. package/src/DropboxOAuthModel/configSchema.ts +0 -77
  115. package/src/DropboxOAuthModel/index.ts +0 -2
  116. package/src/DropboxOAuthModel/model.tsx +0 -141
  117. package/src/ExternalTokenModel/ExternalTokenEntryForm.tsx +0 -57
  118. package/src/ExternalTokenModel/configSchema.ts +0 -36
  119. package/src/ExternalTokenModel/index.ts +0 -2
  120. package/src/ExternalTokenModel/model.tsx +0 -70
  121. package/src/GoogleDriveOAuthModel/configSchema.ts +0 -61
  122. package/src/GoogleDriveOAuthModel/index.ts +0 -2
  123. package/src/GoogleDriveOAuthModel/model.tsx +0 -174
  124. package/src/HTTPBasicModel/HTTPBasicLoginForm.tsx +0 -71
  125. package/src/HTTPBasicModel/configSchema.ts +0 -43
  126. package/src/HTTPBasicModel/index.ts +0 -2
  127. package/src/HTTPBasicModel/model.tsx +0 -70
  128. package/src/OAuthModel/configSchema.ts +0 -98
  129. package/src/OAuthModel/index.ts +0 -2
  130. package/src/OAuthModel/model.tsx +0 -348
  131. package/src/__snapshots__/index.test.js.snap +0 -8
  132. package/src/index.test.js +0 -96
  133. package/src/index.ts +0 -108
@@ -1,61 +0,0 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
- import { Instance } from 'mobx-state-tree'
3
- import OAuthConfigSchema from '../OAuthModel/configSchema'
4
-
5
- /**
6
- * #config GoogleDriveOAuthInternetAccount
7
- */
8
- function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
9
-
10
- const GoogleDriveOAuthConfigSchema = ConfigurationSchema(
11
- 'GoogleDriveOAuthInternetAccount',
12
- {
13
- /**
14
- * #slot
15
- */
16
- authEndpoint: {
17
- description: 'the authorization code endpoint of the internet account',
18
- type: 'string',
19
- defaultValue: 'https://accounts.google.com/o/oauth2/v2/auth',
20
- },
21
- /**
22
- * #slot
23
- */
24
- scopes: {
25
- description: 'optional scopes for the authorization call',
26
- type: 'string',
27
- defaultValue: 'https://www.googleapis.com/auth/drive.readonly',
28
- },
29
- /**
30
- * #slot
31
- */
32
- domains: {
33
- description:
34
- 'array of valid domains the url can contain to use this account',
35
- type: 'stringArray',
36
- defaultValue: ['drive.google.com"'],
37
- },
38
- /**
39
- * #slot
40
- */
41
- responseType: {
42
- description: 'the type of response from the authorization endpoint',
43
- type: 'string',
44
- defaultValue: 'token',
45
- },
46
- },
47
- {
48
- /**
49
- * #baseConfiguration
50
- */
51
- baseConfiguration: OAuthConfigSchema,
52
- explicitlyTyped: true,
53
- },
54
- )
55
-
56
- export type GoogleDriveOAuthInternetAccountConfigModel =
57
- typeof GoogleDriveOAuthConfigSchema
58
-
59
- export type GoogleDriveOAuthInternetAccountConfig =
60
- Instance<GoogleDriveOAuthInternetAccountConfigModel>
61
- export default GoogleDriveOAuthConfigSchema
@@ -1,2 +0,0 @@
1
- export { default as configSchema } from './configSchema'
2
- export { default as modelFactory } from './model'
@@ -1,174 +0,0 @@
1
- import React from 'react'
2
- import { ConfigurationReference } from '@jbrowse/core/configuration'
3
- import { Instance, types } from 'mobx-state-tree'
4
- import { RemoteFileWithRangeCache } from '@jbrowse/core/util/io'
5
- import { UriLocation } from '@jbrowse/core/util/types'
6
- import { SvgIconProps, SvgIcon } from '@mui/material'
7
- import {
8
- FilehandleOptions,
9
- Stats,
10
- PolyfilledResponse,
11
- } from 'generic-filehandle'
12
-
13
- // locals
14
- import { GoogleDriveOAuthInternetAccountConfigModel } from './configSchema'
15
- import baseModel from '../OAuthModel/model'
16
- import { configSchema as OAuthConfigSchema } from '../OAuthModel'
17
-
18
- export interface RequestInitWithMetadata extends RequestInit {
19
- metadataOnly?: boolean
20
- }
21
-
22
- interface GoogleDriveFilehandleOptions extends FilehandleOptions {
23
- fetch(
24
- input: RequestInfo,
25
- opts?: RequestInitWithMetadata,
26
- ): Promise<PolyfilledResponse>
27
- }
28
-
29
- interface GoogleDriveError {
30
- error: {
31
- errors: {
32
- domain: string
33
- reason: string
34
- message: string
35
- locationType?: string
36
- location?: string
37
- }[]
38
- code: number
39
- message: string
40
- }
41
- }
42
-
43
- export class GoogleDriveFile extends RemoteFileWithRangeCache {
44
- private statsPromise: Promise<{ size: number }>
45
- constructor(source: string, opts: GoogleDriveFilehandleOptions) {
46
- super(source, opts)
47
- this.statsPromise = this.fetch(source, {
48
- metadataOnly: true,
49
- }).then((response: Response) => response.json())
50
- }
51
-
52
- async fetch(
53
- input: RequestInfo,
54
- opts?: RequestInitWithMetadata,
55
- ): Promise<PolyfilledResponse> {
56
- return super.fetch(input, opts)
57
- }
58
-
59
- async stat(): Promise<Stats> {
60
- return this.statsPromise
61
- }
62
- }
63
-
64
- function GoogleDriveIcon(props: SvgIconProps) {
65
- return (
66
- <SvgIcon {...props}>
67
- <path d="M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z" />
68
- </SvgIcon>
69
- )
70
- }
71
-
72
- async function getDescriptiveErrorMessage(response: Response) {
73
- let errorMessage
74
- try {
75
- errorMessage = await response.text()
76
- } catch (error) {
77
- errorMessage = ''
78
- }
79
- if (errorMessage) {
80
- let errorMessageParsed: GoogleDriveError | undefined
81
- try {
82
- errorMessageParsed = JSON.parse(errorMessage)
83
- } catch (error) {
84
- errorMessageParsed = undefined
85
- }
86
- if (errorMessageParsed) {
87
- errorMessage = errorMessageParsed.error.message
88
- }
89
- }
90
- return `Network response failure — ${response.status} (${
91
- response.statusText
92
- })${errorMessage ? ` (${errorMessage})` : ''}`
93
- }
94
-
95
- const stateModelFactory = (
96
- configSchema: GoogleDriveOAuthInternetAccountConfigModel,
97
- ) => {
98
- return baseModel(OAuthConfigSchema)
99
- .named('GoogleDriveOAuthInternetAccount')
100
- .props({
101
- type: types.literal('GoogleDriveOAuthInternetAccount'),
102
- configuration: ConfigurationReference(configSchema),
103
- })
104
- .views(() => ({
105
- get toggleContents() {
106
- return <GoogleDriveIcon />
107
- },
108
- get selectorLabel() {
109
- return 'Enter Google Drive share link'
110
- },
111
- }))
112
- .actions(self => ({
113
- getFetcher(
114
- location?: UriLocation,
115
- ): (input: RequestInfo, init?: RequestInit) => Promise<Response> {
116
- return async (
117
- input: RequestInfo,
118
- init?: RequestInitWithMetadata,
119
- ): Promise<Response> => {
120
- const urlId = String(input).match(/[-\w]{25,}/)
121
- const driveUrl = new URL(
122
- `https://www.googleapis.com/drive/v3/files/${urlId}`,
123
- )
124
- const searchParams = new URLSearchParams()
125
- if (init?.metadataOnly) {
126
- searchParams.append('fields', 'size')
127
- } else {
128
- searchParams.append('alt', 'media')
129
- }
130
- driveUrl.search = searchParams.toString()
131
- const authToken = await self.getToken(location)
132
- const newInit = self.addAuthHeaderToInit(
133
- { ...init, method: 'GET', credentials: 'same-origin' },
134
- authToken,
135
- )
136
- const response = await fetch(driveUrl.toString(), newInit)
137
- if (!response.ok) {
138
- const message = await getDescriptiveErrorMessage(response)
139
- throw new Error(message)
140
- }
141
- return response
142
- }
143
- },
144
- openLocation(location: UriLocation) {
145
- return new GoogleDriveFile(location.uri, {
146
- fetch: this.getFetcher(location),
147
- })
148
- },
149
- async validateToken(
150
- token: string,
151
- location: UriLocation,
152
- ): Promise<string> {
153
- const urlId = location.uri.match(/[-\w]{25,}/)
154
- const response = await fetch(
155
- `https://www.googleapis.com/drive/v3/files/${urlId}`,
156
- {
157
- headers: {
158
- Authorization: `Bearer ${token}`,
159
- 'Content-Type': 'application/x-www-form-urlencoded',
160
- },
161
- },
162
- )
163
- if (!response.ok) {
164
- const message = await getDescriptiveErrorMessage(response)
165
- throw new Error(`Token could not be validated. ${message}`)
166
- }
167
- return token
168
- },
169
- }))
170
- }
171
-
172
- export default stateModelFactory
173
- export type GoogleDriveOAuthStateModel = ReturnType<typeof stateModelFactory>
174
- export type GoogleDriveOAuthModel = Instance<GoogleDriveOAuthStateModel>
@@ -1,71 +0,0 @@
1
- import React, { useState } from 'react'
2
- import {
3
- Button,
4
- Dialog,
5
- DialogContent,
6
- DialogTitle,
7
- DialogActions,
8
- TextField,
9
- } from '@mui/material'
10
-
11
- export const HTTPBasicLoginForm = ({
12
- internetAccountId,
13
- handleClose,
14
- }: {
15
- internetAccountId: string
16
- handleClose: (arg?: string) => void
17
- }) => {
18
- const [username, setUsername] = useState('')
19
- const [password, setPassword] = useState('')
20
-
21
- function onSubmit(event: React.FormEvent<HTMLFormElement>) {
22
- if (username && password) {
23
- handleClose(btoa(`${username}:${password}`))
24
- } else {
25
- handleClose()
26
- }
27
- event.preventDefault()
28
- }
29
-
30
- return (
31
- <>
32
- <Dialog open maxWidth="xl" data-testid="login-httpbasic">
33
- <DialogTitle>Log In for {internetAccountId}</DialogTitle>
34
- <form onSubmit={onSubmit}>
35
- <DialogContent style={{ display: 'flex', flexDirection: 'column' }}>
36
- <TextField
37
- required
38
- label="Username"
39
- variant="outlined"
40
- inputProps={{ 'data-testid': 'login-httpbasic-username' }}
41
- onChange={event => setUsername(event.target.value)}
42
- margin="dense"
43
- />
44
- <TextField
45
- required
46
- label="Password"
47
- type="password"
48
- autoComplete="current-password"
49
- variant="outlined"
50
- inputProps={{ 'data-testid': 'login-httpbasic-password' }}
51
- onChange={event => setPassword(event.target.value)}
52
- margin="dense"
53
- />
54
- </DialogContent>
55
- <DialogActions>
56
- <Button variant="contained" color="primary" type="submit">
57
- Submit
58
- </Button>
59
- <Button
60
- variant="contained"
61
- type="submit"
62
- onClick={() => handleClose()}
63
- >
64
- Cancel
65
- </Button>
66
- </DialogActions>
67
- </form>
68
- </Dialog>
69
- </>
70
- )
71
- }
@@ -1,43 +0,0 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
- import { Instance } from 'mobx-state-tree'
3
- import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models'
4
-
5
- /**
6
- * #config HTTPBasicInternetAccount
7
- */
8
- function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
9
-
10
- const HTTPBasicConfigSchema = ConfigurationSchema(
11
- 'HTTPBasicInternetAccount',
12
- {
13
- /**
14
- * #slot
15
- */
16
- tokenType: {
17
- description: 'a custom name for a token to include in the header',
18
- type: 'string',
19
- defaultValue: 'Basic',
20
- },
21
- /**
22
- * #slot
23
- */
24
- validateWithHEAD: {
25
- description: 'validate the token with a HEAD request before using it',
26
- type: 'boolean',
27
- defaultValue: true,
28
- },
29
- },
30
- {
31
- /**
32
- * #baseConfiguration
33
- */
34
- baseConfiguration: BaseInternetAccountConfig,
35
- explicitlyTyped: true,
36
- },
37
- )
38
-
39
- export type HTTPBasicInternetAccountConfigModel = typeof HTTPBasicConfigSchema
40
-
41
- export type HTTPBasicInternetAccountConfig =
42
- Instance<HTTPBasicInternetAccountConfigModel>
43
- export default HTTPBasicConfigSchema
@@ -1,2 +0,0 @@
1
- export { default as configSchema } from './configSchema'
2
- export { default as modelFactory } from './model'
@@ -1,70 +0,0 @@
1
- import { ConfigurationReference, getConf } from '@jbrowse/core/configuration'
2
- import { InternetAccount } from '@jbrowse/core/pluggableElementTypes/models'
3
- import { UriLocation } from '@jbrowse/core/util/types'
4
- import { HTTPBasicInternetAccountConfigModel } from './configSchema'
5
- import { Instance, types, getRoot } from 'mobx-state-tree'
6
-
7
- import { HTTPBasicLoginForm } from './HTTPBasicLoginForm'
8
-
9
- const stateModelFactory = (
10
- configSchema: HTTPBasicInternetAccountConfigModel,
11
- ) => {
12
- return InternetAccount.named('HTTPBasicInternetAccount')
13
- .props({
14
- type: types.literal('HTTPBasicInternetAccount'),
15
- configuration: ConfigurationReference(configSchema),
16
- })
17
- .views(self => ({
18
- get validateWithHEAD(): boolean {
19
- return getConf(self, 'validateWithHEAD')
20
- },
21
- }))
22
- .actions(self => ({
23
- getTokenFromUser(
24
- resolve: (token: string) => void,
25
- reject: (error: Error) => void,
26
- ) {
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
- const { session } = getRoot<any>(self)
29
- session.queueDialog((doneCallback: () => void) => [
30
- HTTPBasicLoginForm,
31
- {
32
- internetAccountId: self.internetAccountId,
33
- handleClose: (token: string) => {
34
- if (token) {
35
- resolve(token)
36
- } else {
37
- reject(new Error('user cancelled entry'))
38
- }
39
- doneCallback()
40
- },
41
- },
42
- ])
43
- },
44
- async validateToken(token: string, location: UriLocation) {
45
- if (!self.validateWithHEAD) {
46
- return token
47
- }
48
- const newInit = self.addAuthHeaderToInit({ method: 'HEAD' }, token)
49
- const response = await fetch(location.uri, newInit)
50
- if (!response.ok) {
51
- let errorMessage
52
- try {
53
- errorMessage = await response.text()
54
- } catch (error) {
55
- errorMessage = ''
56
- }
57
- throw new Error(
58
- `Error validating token — ${response.status} (${
59
- response.statusText
60
- })${errorMessage ? ` (${errorMessage})` : ''}`,
61
- )
62
- }
63
- return token
64
- },
65
- }))
66
- }
67
-
68
- export default stateModelFactory
69
- export type HTTPBasicStateModel = ReturnType<typeof stateModelFactory>
70
- export type HTTPBasicModel = Instance<HTTPBasicStateModel>
@@ -1,98 +0,0 @@
1
- import { ConfigurationSchema } from '@jbrowse/core/configuration'
2
- import { Instance } from 'mobx-state-tree'
3
- import { BaseInternetAccountConfig } from '@jbrowse/core/pluggableElementTypes/models'
4
-
5
- /**
6
- * #config OAuthInternetAccount
7
- */
8
- function x() {} // eslint-disable-line @typescript-eslint/no-unused-vars
9
-
10
- const OAuthConfigSchema = ConfigurationSchema(
11
- 'OAuthInternetAccount',
12
- {
13
- /**
14
- * #slot
15
- */
16
- tokenType: {
17
- description: 'a custom name for a token to include in the header',
18
- type: 'string',
19
- defaultValue: 'Bearer',
20
- },
21
- /**
22
- * #slot
23
- */
24
- authEndpoint: {
25
- description: 'the authorization code endpoint of the internet account',
26
- type: 'string',
27
- defaultValue: '',
28
- },
29
- /**
30
- * #slot
31
- */
32
- tokenEndpoint: {
33
- description: 'the token endpoint of the internet account',
34
- type: 'string',
35
- defaultValue: '',
36
- },
37
- /**
38
- * #slot
39
- */
40
- needsPKCE: {
41
- description: 'boolean to indicate if the endpoint needs a PKCE code',
42
- type: 'boolean',
43
- defaultValue: false,
44
- },
45
- /**
46
- * #slot
47
- */
48
- clientId: {
49
- description: 'id for the OAuth application',
50
- type: 'string',
51
- defaultValue: '',
52
- },
53
- /**
54
- * #slot
55
- */
56
- scopes: {
57
- description: 'optional scopes for the authorization call',
58
- type: 'string',
59
- defaultValue: '',
60
- },
61
- /**
62
- * #slot
63
- */
64
- state: {
65
- description: 'optional state for the authorization call',
66
- type: 'string',
67
- defaultValue: '',
68
- },
69
- /**
70
- * #slot
71
- */
72
- responseType: {
73
- description: 'the type of response from the authorization endpoint',
74
- type: 'string',
75
- defaultValue: 'code',
76
- },
77
- /**
78
- * #slot
79
- */
80
- hasRefreshToken: {
81
- description: 'true if the endpoint can supply a refresh token',
82
- type: 'boolean',
83
- defaultValue: false,
84
- },
85
- },
86
- {
87
- /**
88
- * #baseConfiguration
89
- */
90
- baseConfiguration: BaseInternetAccountConfig,
91
- explicitlyTyped: true,
92
- },
93
- )
94
-
95
- export type OAuthInternetAccountConfigModel = typeof OAuthConfigSchema
96
- export type OAuthInternetAccountConfig =
97
- Instance<OAuthInternetAccountConfigModel>
98
- export default OAuthConfigSchema
@@ -1,2 +0,0 @@
1
- export { default as configSchema } from './configSchema'
2
- export { default as modelFactory } from './model'