acebase-server 1.16.2 → 1.18.0

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 (252) hide show
  1. package/README.md +180 -10
  2. package/bin/acebase-server.js +8 -0
  3. package/build-vars.js +2 -1
  4. package/dist/cjs/auth.js +88 -88
  5. package/dist/cjs/cluster.js +6 -56
  6. package/dist/cjs/index.d.ts +1 -1
  7. package/dist/cjs/index.js +24 -24
  8. package/dist/cjs/logger.js +73 -73
  9. package/dist/cjs/middleware/404.js +14 -14
  10. package/dist/cjs/middleware/admin-only.js +28 -28
  11. package/dist/cjs/middleware/cache.js +14 -14
  12. package/dist/cjs/middleware/connection.js +49 -49
  13. package/dist/cjs/middleware/context.js +20 -20
  14. package/dist/cjs/middleware/cors.js +50 -50
  15. package/dist/cjs/middleware/swagger.js +17 -17
  16. package/dist/cjs/middleware/user.js +57 -57
  17. package/dist/cjs/oauth-providers/dropbox.js +109 -109
  18. package/dist/cjs/oauth-providers/facebook.js +85 -85
  19. package/dist/cjs/oauth-providers/google.js +119 -119
  20. package/dist/cjs/oauth-providers/index.js +26 -26
  21. package/dist/cjs/oauth-providers/instagram.js +80 -80
  22. package/dist/cjs/oauth-providers/oauth-provider.js +20 -20
  23. package/dist/cjs/oauth-providers/spotify.js +113 -113
  24. package/dist/cjs/routes/auth-change-password.js +87 -87
  25. package/dist/cjs/routes/auth-delete.js +52 -52
  26. package/dist/cjs/routes/auth-forgot-password.js +77 -77
  27. package/dist/cjs/routes/auth-reset-password.js +97 -97
  28. package/dist/cjs/routes/auth-signin.js +46 -46
  29. package/dist/cjs/routes/auth-signout.js +61 -61
  30. package/dist/cjs/routes/auth-signup.js +142 -142
  31. package/dist/cjs/routes/auth-state.js +25 -25
  32. package/dist/cjs/routes/auth-update.js +131 -131
  33. package/dist/cjs/routes/auth-verify-email.js +71 -71
  34. package/dist/cjs/routes/auth.js +57 -54
  35. package/dist/cjs/routes/data-exists.js +33 -33
  36. package/dist/cjs/routes/data-export.js +48 -48
  37. package/dist/cjs/routes/data-get.js +70 -66
  38. package/dist/cjs/routes/data-import.js +54 -54
  39. package/dist/cjs/routes/data-index-create.js +42 -42
  40. package/dist/cjs/routes/data-index-delete.js +33 -33
  41. package/dist/cjs/routes/data-index-list.js +31 -31
  42. package/dist/cjs/routes/data-query.js +80 -70
  43. package/dist/cjs/routes/data-reflect.js +97 -86
  44. package/dist/cjs/routes/data-schema-get.js +36 -36
  45. package/dist/cjs/routes/data-schema-set.js +30 -30
  46. package/dist/cjs/routes/data-schema-test.js +43 -43
  47. package/dist/cjs/routes/data-schemas-list.js +32 -32
  48. package/dist/cjs/routes/data-set.js +85 -75
  49. package/dist/cjs/routes/data-sync-changes.js +81 -67
  50. package/dist/cjs/routes/data-sync-mutations.js +81 -67
  51. package/dist/cjs/routes/data-transaction.js +159 -139
  52. package/dist/cjs/routes/data-update.js +86 -75
  53. package/dist/cjs/routes/data.js +62 -62
  54. package/dist/cjs/routes/docs.js +258 -251
  55. package/dist/cjs/routes/meta-info.js +63 -63
  56. package/dist/cjs/routes/meta-logs.js +49 -49
  57. package/dist/cjs/routes/meta-ping.js +11 -11
  58. package/dist/cjs/routes/meta-stats.js +27 -27
  59. package/dist/cjs/routes/meta.js +19 -19
  60. package/dist/cjs/routes/oauth2-init.js +54 -54
  61. package/dist/cjs/routes/oauth2-refresh.js +42 -42
  62. package/dist/cjs/routes/oauth2-signin.js +265 -265
  63. package/dist/cjs/routes/webmanager.js +26 -26
  64. package/dist/cjs/rules.js +380 -167
  65. package/dist/cjs/sandbox.js +28 -0
  66. package/dist/cjs/schema/user.js +24 -24
  67. package/dist/cjs/server.js +410 -407
  68. package/dist/cjs/settings/email.js +2 -2
  69. package/dist/cjs/settings/index.js +175 -172
  70. package/dist/cjs/shared/clients.js +26 -26
  71. package/dist/cjs/shared/email.js +2 -2
  72. package/dist/cjs/shared/env.js +2 -2
  73. package/dist/cjs/shared/error.js +33 -33
  74. package/dist/cjs/shared/http.js +28 -28
  75. package/dist/cjs/shared/password.js +45 -45
  76. package/dist/cjs/shared/rootpath.js +16 -16
  77. package/dist/cjs/shared/signin.js +143 -143
  78. package/dist/cjs/shared/simple-fetch.js +76 -76
  79. package/dist/cjs/shared/tokens.js +79 -79
  80. package/dist/cjs/shared/validate.js +61 -61
  81. package/dist/cjs/start.js +119 -53
  82. package/dist/cjs/test.js +10 -10
  83. package/dist/cjs/websocket/index.js +331 -319
  84. package/dist/cjs/websocket/manager.js +15 -15
  85. package/dist/cjs/websocket/socket.io.js +76 -76
  86. package/dist/esm/auth.js +75 -75
  87. package/dist/esm/cluster.js +6 -54
  88. package/dist/esm/index.d.ts +1 -1
  89. package/dist/esm/index.js +4 -4
  90. package/dist/esm/logger.js +51 -51
  91. package/dist/esm/middleware/404.js +10 -10
  92. package/dist/esm/middleware/admin-only.js +24 -24
  93. package/dist/esm/middleware/cache.js +10 -10
  94. package/dist/esm/middleware/connection.js +45 -45
  95. package/dist/esm/middleware/context.js +16 -16
  96. package/dist/esm/middleware/cors.js +44 -44
  97. package/dist/esm/middleware/swagger.js +13 -13
  98. package/dist/esm/middleware/user.js +44 -44
  99. package/dist/esm/oauth-providers/dropbox.js +90 -90
  100. package/dist/esm/oauth-providers/facebook.js +66 -66
  101. package/dist/esm/oauth-providers/google.js +96 -96
  102. package/dist/esm/oauth-providers/index.js +18 -18
  103. package/dist/esm/oauth-providers/instagram.js +61 -61
  104. package/dist/esm/oauth-providers/oauth-provider.js +16 -16
  105. package/dist/esm/oauth-providers/spotify.js +92 -92
  106. package/dist/esm/routes/auth-change-password.js +72 -72
  107. package/dist/esm/routes/auth-delete.js +37 -37
  108. package/dist/esm/routes/auth-forgot-password.js +62 -62
  109. package/dist/esm/routes/auth-reset-password.js +81 -81
  110. package/dist/esm/routes/auth-signin.js +33 -33
  111. package/dist/esm/routes/auth-signout.js +47 -47
  112. package/dist/esm/routes/auth-signup.js +127 -127
  113. package/dist/esm/routes/auth-state.js +12 -12
  114. package/dist/esm/routes/auth-update.js +116 -116
  115. package/dist/esm/routes/auth-verify-email.js +57 -57
  116. package/dist/esm/routes/auth.js +53 -50
  117. package/dist/esm/routes/data-exists.js +20 -20
  118. package/dist/esm/routes/data-export.js +35 -35
  119. package/dist/esm/routes/data-get.js +56 -52
  120. package/dist/esm/routes/data-import.js +41 -41
  121. package/dist/esm/routes/data-index-create.js +28 -28
  122. package/dist/esm/routes/data-index-delete.js +20 -20
  123. package/dist/esm/routes/data-index-list.js +18 -18
  124. package/dist/esm/routes/data-query.js +66 -56
  125. package/dist/esm/routes/data-reflect.js +83 -72
  126. package/dist/esm/routes/data-schema-get.js +23 -23
  127. package/dist/esm/routes/data-schema-set.js +17 -17
  128. package/dist/esm/routes/data-schema-test.js +29 -29
  129. package/dist/esm/routes/data-schemas-list.js +19 -19
  130. package/dist/esm/routes/data-set.js +70 -60
  131. package/dist/esm/routes/data-sync-changes.js +67 -53
  132. package/dist/esm/routes/data-sync-mutations.js +67 -53
  133. package/dist/esm/routes/data-transaction.js +142 -123
  134. package/dist/esm/routes/data-update.js +71 -60
  135. package/dist/esm/routes/data.js +58 -58
  136. package/dist/esm/routes/docs.js +252 -245
  137. package/dist/esm/routes/meta-info.js +59 -59
  138. package/dist/esm/routes/meta-logs.js +35 -35
  139. package/dist/esm/routes/meta-ping.js +7 -7
  140. package/dist/esm/routes/meta-stats.js +14 -14
  141. package/dist/esm/routes/meta.js +15 -15
  142. package/dist/esm/routes/oauth2-init.js +41 -41
  143. package/dist/esm/routes/oauth2-refresh.js +29 -29
  144. package/dist/esm/routes/oauth2-signin.js +251 -251
  145. package/dist/esm/routes/webmanager.js +22 -22
  146. package/dist/esm/rules.js +374 -163
  147. package/dist/esm/sandbox.js +12 -0
  148. package/dist/esm/schema/user.js +19 -19
  149. package/dist/esm/server.js +395 -387
  150. package/dist/esm/settings/email.js +1 -1
  151. package/dist/esm/settings/index.js +168 -165
  152. package/dist/esm/shared/clients.js +22 -22
  153. package/dist/esm/shared/email.js +1 -1
  154. package/dist/esm/shared/env.js +1 -1
  155. package/dist/esm/shared/error.js +25 -25
  156. package/dist/esm/shared/http.js +22 -22
  157. package/dist/esm/shared/password.js +38 -38
  158. package/dist/esm/shared/rootpath.js +13 -13
  159. package/dist/esm/shared/signin.js +128 -128
  160. package/dist/esm/shared/simple-fetch.js +59 -59
  161. package/dist/esm/shared/tokens.js +72 -72
  162. package/dist/esm/shared/validate.js +41 -41
  163. package/dist/esm/start.js +116 -50
  164. package/dist/esm/test.js +8 -8
  165. package/dist/esm/websocket/index.js +313 -302
  166. package/dist/esm/websocket/manager.js +11 -11
  167. package/dist/esm/websocket/socket.io.js +71 -71
  168. package/dist/types/auth.d.ts +3 -3
  169. package/dist/types/cluster.d.ts +6 -1
  170. package/dist/types/index.d.ts +4 -4
  171. package/dist/types/logger.d.ts +35 -35
  172. package/dist/types/middleware/404.d.ts +7 -7
  173. package/dist/types/middleware/admin-only.d.ts +19 -19
  174. package/dist/types/middleware/cache.d.ts +3 -3
  175. package/dist/types/middleware/connection.d.ts +7 -7
  176. package/dist/types/middleware/context.d.ts +3 -3
  177. package/dist/types/middleware/cors.d.ts +25 -25
  178. package/dist/types/middleware/swagger.d.ts +3 -3
  179. package/dist/types/middleware/user.d.ts +2 -2
  180. package/dist/types/oauth-providers/dropbox.d.ts +52 -52
  181. package/dist/types/oauth-providers/facebook.d.ts +41 -41
  182. package/dist/types/oauth-providers/google.d.ts +43 -43
  183. package/dist/types/oauth-providers/index.d.ts +10 -10
  184. package/dist/types/oauth-providers/instagram.d.ts +50 -50
  185. package/dist/types/oauth-providers/oauth-provider.d.ts +74 -74
  186. package/dist/types/oauth-providers/spotify.d.ts +53 -53
  187. package/dist/types/routes/auth-change-password.d.ts +20 -20
  188. package/dist/types/routes/auth-delete.d.ts +16 -16
  189. package/dist/types/routes/auth-forgot-password.d.ts +16 -16
  190. package/dist/types/routes/auth-reset-password.d.ts +23 -23
  191. package/dist/types/routes/auth-signin.d.ts +24 -24
  192. package/dist/types/routes/auth-signout.d.ts +14 -14
  193. package/dist/types/routes/auth-signup.d.ts +32 -32
  194. package/dist/types/routes/auth-state.d.ts +13 -13
  195. package/dist/types/routes/auth-update.d.ts +33 -33
  196. package/dist/types/routes/auth-verify-email.d.ts +21 -21
  197. package/dist/types/routes/auth.d.ts +6 -6
  198. package/dist/types/routes/data-exists.d.ts +9 -9
  199. package/dist/types/routes/data-export.d.ts +10 -10
  200. package/dist/types/routes/data-get.d.ts +14 -14
  201. package/dist/types/routes/data-import.d.ts +13 -13
  202. package/dist/types/routes/data-index-create.d.ts +51 -51
  203. package/dist/types/routes/data-index-delete.d.ts +17 -17
  204. package/dist/types/routes/data-index-list.d.ts +21 -21
  205. package/dist/types/routes/data-query.d.ts +49 -49
  206. package/dist/types/routes/data-reflect.d.ts +29 -29
  207. package/dist/types/routes/data-schema-get.d.ts +11 -11
  208. package/dist/types/routes/data-schema-set.d.ts +20 -19
  209. package/dist/types/routes/data-schema-test.d.ts +19 -19
  210. package/dist/types/routes/data-schemas-list.d.ts +11 -11
  211. package/dist/types/routes/data-set.d.ts +27 -27
  212. package/dist/types/routes/data-sync-changes.d.ts +25 -28
  213. package/dist/types/routes/data-sync-mutations.d.ts +25 -28
  214. package/dist/types/routes/data-transaction.d.ts +34 -34
  215. package/dist/types/routes/data-update.d.ts +27 -27
  216. package/dist/types/routes/data.d.ts +3 -3
  217. package/dist/types/routes/docs.d.ts +3 -3
  218. package/dist/types/routes/meta-info.d.ts +11 -11
  219. package/dist/types/routes/meta-logs.d.ts +20 -20
  220. package/dist/types/routes/meta-ping.d.ts +7 -7
  221. package/dist/types/routes/meta-stats.d.ts +13 -13
  222. package/dist/types/routes/meta.d.ts +3 -3
  223. package/dist/types/routes/oauth2-init.d.ts +13 -13
  224. package/dist/types/routes/oauth2-refresh.d.ts +17 -17
  225. package/dist/types/routes/oauth2-signin.d.ts +15 -15
  226. package/dist/types/routes/webmanager.d.ts +3 -3
  227. package/dist/types/rules.d.ts +73 -34
  228. package/dist/types/sandbox.d.ts +3 -0
  229. package/dist/types/schema/user.d.ts +85 -85
  230. package/dist/types/server.d.ts +117 -111
  231. package/dist/types/settings/email.d.ts +14 -14
  232. package/dist/types/settings/index.d.ts +195 -187
  233. package/dist/types/shared/clients.d.ts +46 -46
  234. package/dist/types/shared/email.d.ts +34 -34
  235. package/dist/types/shared/env.d.ts +47 -44
  236. package/dist/types/shared/error.d.ts +15 -15
  237. package/dist/types/shared/http.d.ts +22 -21
  238. package/dist/types/shared/password.d.ts +19 -19
  239. package/dist/types/shared/rootpath.d.ts +2 -2
  240. package/dist/types/shared/signin.d.ts +31 -31
  241. package/dist/types/shared/simple-fetch.d.ts +21 -21
  242. package/dist/types/shared/tokens.d.ts +24 -24
  243. package/dist/types/shared/validate.d.ts +22 -22
  244. package/dist/types/start.d.ts +1 -1
  245. package/dist/types/test.d.ts +1 -1
  246. package/dist/types/websocket/index.d.ts +6 -6
  247. package/dist/types/websocket/manager.d.ts +99 -99
  248. package/dist/types/websocket/socket.io.d.ts +10 -10
  249. package/package.json +7 -4
  250. package/src/routes/data-schema-set.yaml +4 -0
  251. package/src/routes/data-set.yaml +5 -5
  252. package/src/routes/data-update.yaml +4 -4
@@ -1,44 +1,44 @@
1
- import { IOAuth2ProviderSettings, IOpenIDToken, IOpenIDConfiguration, IOAuth2AuthCodeParams, IOAuth2RefreshTokenParams, OAuth2ProviderInitInfo, OAuth2Provider } from './oauth-provider';
2
- /**
3
- * Details of your app to access the Google API. See https://developers.google.com/identity/protocols/oauth2/scopes
4
- */
5
- export interface IGoogleAuthSettings extends IOAuth2ProviderSettings {
6
- /** 'openid', 'email', 'profile' and additional scopes you want to access. */
7
- scopes?: string[];
8
- }
9
- interface IGoogleAuthToken {
10
- access_token: string;
11
- expires_in: number;
12
- expires: Date;
13
- id_token: IOpenIDToken;
14
- refresh_token: string;
15
- scope: string;
16
- token_type: string;
17
- }
18
- export declare class GoogleAuthProvider extends OAuth2Provider {
19
- _config: IOpenIDConfiguration;
20
- constructor(settings: IGoogleAuthSettings);
21
- getOpenIDConfig(): Promise<IOpenIDConfiguration>;
22
- /**
23
- * Starts auth flow by getting the url the user should be redirected to
24
- * @param info.redirectUrl Url spotify will redirect to after authorizing, should be the url
25
- * @param info.state Optional state that will be passed to redirectUri by spotify
26
- */
27
- init(info: OAuth2ProviderInitInfo): Promise<string>;
28
- getAccessToken(params: IOAuth2AuthCodeParams | IOAuth2RefreshTokenParams): Promise<IGoogleAuthToken>;
29
- revokeAccess(access_token: string): Promise<void>;
30
- getUserInfo(access_token: string): Promise<{
31
- id: string;
32
- name: string;
33
- display_name: string;
34
- picture: {
35
- url: string;
36
- }[];
37
- email: string;
38
- email_verified: boolean;
39
- other: {};
40
- }>;
41
- }
42
- export declare const AuthProvider: typeof GoogleAuthProvider;
43
- export {};
1
+ import { IOAuth2ProviderSettings, IOpenIDToken, IOpenIDConfiguration, IOAuth2AuthCodeParams, IOAuth2RefreshTokenParams, OAuth2ProviderInitInfo, OAuth2Provider } from './oauth-provider';
2
+ /**
3
+ * Details of your app to access the Google API. See https://developers.google.com/identity/protocols/oauth2/scopes
4
+ */
5
+ export interface IGoogleAuthSettings extends IOAuth2ProviderSettings {
6
+ /** 'openid', 'email', 'profile' and additional scopes you want to access. */
7
+ scopes?: string[];
8
+ }
9
+ interface IGoogleAuthToken {
10
+ access_token: string;
11
+ expires_in: number;
12
+ expires: Date;
13
+ id_token: IOpenIDToken;
14
+ refresh_token: string;
15
+ scope: string;
16
+ token_type: string;
17
+ }
18
+ export declare class GoogleAuthProvider extends OAuth2Provider {
19
+ _config: IOpenIDConfiguration;
20
+ constructor(settings: IGoogleAuthSettings);
21
+ getOpenIDConfig(): Promise<IOpenIDConfiguration>;
22
+ /**
23
+ * Starts auth flow by getting the url the user should be redirected to
24
+ * @param info.redirectUrl Url spotify will redirect to after authorizing, should be the url
25
+ * @param info.state Optional state that will be passed to redirectUri by spotify
26
+ */
27
+ init(info: OAuth2ProviderInitInfo): Promise<string>;
28
+ getAccessToken(params: IOAuth2AuthCodeParams | IOAuth2RefreshTokenParams): Promise<IGoogleAuthToken>;
29
+ revokeAccess(access_token: string): Promise<void>;
30
+ getUserInfo(access_token: string): Promise<{
31
+ id: string;
32
+ name: string;
33
+ display_name: string;
34
+ picture: {
35
+ url: string;
36
+ }[];
37
+ email: string;
38
+ email_verified: boolean;
39
+ other: {};
40
+ }>;
41
+ }
42
+ export declare const AuthProvider: typeof GoogleAuthProvider;
43
+ export {};
44
44
  //# sourceMappingURL=google.d.ts.map
@@ -1,11 +1,11 @@
1
- import { OAuth2Provider } from './oauth-provider';
2
- export { DropboxAuthProvider, IDropboxAuthSettings } from './dropbox';
3
- export { FacebookAuthProvider, IFacebookAuthSettings } from './facebook';
4
- export { GoogleAuthProvider, IGoogleAuthSettings } from './google';
5
- export { InstagramAuthProvider, IInstagramAuthSettings } from './instagram';
6
- export { SpotifyAuthProvider, ISpotifyAuthSettings } from './spotify';
7
- declare const oAuth2Providers: {
8
- [key: string]: typeof OAuth2Provider;
9
- };
10
- export default oAuth2Providers;
1
+ import { OAuth2Provider } from './oauth-provider';
2
+ export { DropboxAuthProvider, IDropboxAuthSettings } from './dropbox';
3
+ export { FacebookAuthProvider, IFacebookAuthSettings } from './facebook';
4
+ export { GoogleAuthProvider, IGoogleAuthSettings } from './google';
5
+ export { InstagramAuthProvider, IInstagramAuthSettings } from './instagram';
6
+ export { SpotifyAuthProvider, ISpotifyAuthSettings } from './spotify';
7
+ declare const oAuth2Providers: {
8
+ [key: string]: typeof OAuth2Provider;
9
+ };
10
+ export default oAuth2Providers;
11
11
  //# sourceMappingURL=index.d.ts.map
@@ -1,51 +1,51 @@
1
- import { IOAuth2ProviderSettings, IOAuth2AuthCodeParams, OAuth2Provider, OAuth2ProviderInitInfo } from './oauth-provider';
2
- /**
3
- * Details of your app to access the Legacy Instagram API.
4
- */
5
- export interface IInstagramAuthSettings extends IOAuth2ProviderSettings {
6
- /** Only 'basic' is available since October 2017. See https://www.instagram.com/developer/authorization/ */
7
- scopes?: string[];
8
- }
9
- interface IInstagramAuthToken {
10
- access_token: string;
11
- user: IInstagramUser;
12
- }
13
- interface IInstagramUser {
14
- id: string;
15
- username: string;
16
- full_name: string;
17
- profile_picture: string;
18
- bio: string;
19
- website: string;
20
- is_business: boolean;
21
- counts: {
22
- media: number;
23
- follows: number;
24
- followed_by: number;
25
- };
26
- }
27
- export declare class InstagramAuthProvider extends OAuth2Provider {
28
- constructor(settings: IInstagramAuthSettings);
29
- /**
30
- * Starts auth flow by getting the url the user should be redirected to
31
- * @param info.redirectUrl Url spotify will redirect to after authorizing, should be the url
32
- * @param info.state Optional state that will be passed to redirectUri by spotify
33
- */
34
- init(info: OAuth2ProviderInitInfo): Promise<string>;
35
- _userInfo: IInstagramUser;
36
- getAccessToken(params: IOAuth2AuthCodeParams): Promise<IInstagramAuthToken>;
37
- getUserInfo(access_token: string): Promise<{
38
- id: string;
39
- name: string;
40
- display_name: string;
41
- picture: {
42
- url: string;
43
- }[];
44
- email: any;
45
- email_verified: boolean;
46
- other: {};
47
- }>;
48
- }
49
- export declare const AuthProvider: typeof InstagramAuthProvider;
50
- export {};
1
+ import { IOAuth2ProviderSettings, IOAuth2AuthCodeParams, OAuth2Provider, OAuth2ProviderInitInfo } from './oauth-provider';
2
+ /**
3
+ * Details of your app to access the Legacy Instagram API.
4
+ */
5
+ export interface IInstagramAuthSettings extends IOAuth2ProviderSettings {
6
+ /** Only 'basic' is available since October 2017. See https://www.instagram.com/developer/authorization/ */
7
+ scopes?: string[];
8
+ }
9
+ interface IInstagramAuthToken {
10
+ access_token: string;
11
+ user: IInstagramUser;
12
+ }
13
+ interface IInstagramUser {
14
+ id: string;
15
+ username: string;
16
+ full_name: string;
17
+ profile_picture: string;
18
+ bio: string;
19
+ website: string;
20
+ is_business: boolean;
21
+ counts: {
22
+ media: number;
23
+ follows: number;
24
+ followed_by: number;
25
+ };
26
+ }
27
+ export declare class InstagramAuthProvider extends OAuth2Provider {
28
+ constructor(settings: IInstagramAuthSettings);
29
+ /**
30
+ * Starts auth flow by getting the url the user should be redirected to
31
+ * @param info.redirectUrl Url spotify will redirect to after authorizing, should be the url
32
+ * @param info.state Optional state that will be passed to redirectUri by spotify
33
+ */
34
+ init(info: OAuth2ProviderInitInfo): Promise<string>;
35
+ _userInfo: IInstagramUser;
36
+ getAccessToken(params: IOAuth2AuthCodeParams): Promise<IInstagramAuthToken>;
37
+ getUserInfo(access_token: string): Promise<{
38
+ id: string;
39
+ name: string;
40
+ display_name: string;
41
+ picture: {
42
+ url: string;
43
+ }[];
44
+ email: any;
45
+ email_verified: boolean;
46
+ other: {};
47
+ }>;
48
+ }
49
+ export declare const AuthProvider: typeof InstagramAuthProvider;
50
+ export {};
51
51
  //# sourceMappingURL=instagram.d.ts.map
@@ -1,75 +1,75 @@
1
- export interface IOAuth2ProviderSettings {
2
- client_id: string;
3
- client_secret: string;
4
- scopes?: string[];
5
- }
6
- export interface IOAuth2RefreshTokenParams {
7
- type: 'refresh';
8
- refresh_token: string;
9
- }
10
- export interface IOAuth2AuthCodeParams {
11
- type: 'auth';
12
- auth_code: string;
13
- redirect_url: string;
14
- }
15
- export interface IOAuth2TokenResult {
16
- access_token: string;
17
- id_token?: IOpenIDToken;
18
- expires_in?: number;
19
- refresh_token?: string;
20
- }
21
- export declare type OAuth2ProviderInitInfo = {
22
- redirect_url: string;
23
- state?: string;
24
- options?: any;
25
- };
26
- export declare type OAuth2ProviderUserInfo = {
27
- id: string;
28
- name: string;
29
- display_name: string;
30
- picture?: Array<{
31
- width?: number;
32
- height?: number;
33
- url: string;
34
- }>;
35
- email: string;
36
- email_verified: boolean;
37
- other?: {
38
- [key: string]: string | number | boolean;
39
- };
40
- };
41
- export declare class OAuth2Provider {
42
- protected settings: IOAuth2ProviderSettings;
43
- constructor(settings: IOAuth2ProviderSettings);
44
- init(info: OAuth2ProviderInitInfo): Promise<string>;
45
- getAccessToken(param: IOAuth2AuthCodeParams | IOAuth2RefreshTokenParams): Promise<IOAuth2TokenResult>;
46
- getUserInfo(access_token: string): Promise<OAuth2ProviderUserInfo>;
47
- }
48
- export interface IOpenIDToken {
49
- email: string;
50
- email_verified: boolean;
51
- family_name?: string;
52
- given_name?: string;
53
- locale: string;
54
- name: string;
55
- picture?: string;
56
- profile?: string;
57
- }
58
- export interface IOpenIDConfiguration {
59
- issuer: string;
60
- authorization_endpoint: string;
61
- device_authorization_endpoint: string;
62
- token_endpoint: string;
63
- userinfo_endpoint: string;
64
- revocation_endpoint: string;
65
- jwks_uri: string;
66
- response_types_supported: string[];
67
- subject_types_supported: string[];
68
- id_token_signing_alg_values_supported: string[];
69
- scopes_supported: string[];
70
- token_endpoint_auth_methods_supported: string[];
71
- claims_supported: string[];
72
- code_challenge_methods_supported: string[];
73
- grant_types_supported: string[];
74
- }
1
+ export interface IOAuth2ProviderSettings {
2
+ client_id: string;
3
+ client_secret: string;
4
+ scopes?: string[];
5
+ }
6
+ export interface IOAuth2RefreshTokenParams {
7
+ type: 'refresh';
8
+ refresh_token: string;
9
+ }
10
+ export interface IOAuth2AuthCodeParams {
11
+ type: 'auth';
12
+ auth_code: string;
13
+ redirect_url: string;
14
+ }
15
+ export interface IOAuth2TokenResult {
16
+ access_token: string;
17
+ id_token?: IOpenIDToken;
18
+ expires_in?: number;
19
+ refresh_token?: string;
20
+ }
21
+ export type OAuth2ProviderInitInfo = {
22
+ redirect_url: string;
23
+ state?: string;
24
+ options?: any;
25
+ };
26
+ export type OAuth2ProviderUserInfo = {
27
+ id: string;
28
+ name: string;
29
+ display_name: string;
30
+ picture?: Array<{
31
+ width?: number;
32
+ height?: number;
33
+ url: string;
34
+ }>;
35
+ email: string;
36
+ email_verified: boolean;
37
+ other?: {
38
+ [key: string]: string | number | boolean;
39
+ };
40
+ };
41
+ export declare class OAuth2Provider {
42
+ protected settings: IOAuth2ProviderSettings;
43
+ constructor(settings: IOAuth2ProviderSettings);
44
+ init(info: OAuth2ProviderInitInfo): Promise<string>;
45
+ getAccessToken(param: IOAuth2AuthCodeParams | IOAuth2RefreshTokenParams): Promise<IOAuth2TokenResult>;
46
+ getUserInfo(access_token: string): Promise<OAuth2ProviderUserInfo>;
47
+ }
48
+ export interface IOpenIDToken {
49
+ email: string;
50
+ email_verified: boolean;
51
+ family_name?: string;
52
+ given_name?: string;
53
+ locale: string;
54
+ name: string;
55
+ picture?: string;
56
+ profile?: string;
57
+ }
58
+ export interface IOpenIDConfiguration {
59
+ issuer: string;
60
+ authorization_endpoint: string;
61
+ device_authorization_endpoint: string;
62
+ token_endpoint: string;
63
+ userinfo_endpoint: string;
64
+ revocation_endpoint: string;
65
+ jwks_uri: string;
66
+ response_types_supported: string[];
67
+ subject_types_supported: string[];
68
+ id_token_signing_alg_values_supported: string[];
69
+ scopes_supported: string[];
70
+ token_endpoint_auth_methods_supported: string[];
71
+ claims_supported: string[];
72
+ code_challenge_methods_supported: string[];
73
+ grant_types_supported: string[];
74
+ }
75
75
  //# sourceMappingURL=oauth-provider.d.ts.map
@@ -1,54 +1,54 @@
1
- import { IOAuth2ProviderSettings, IOAuth2AuthCodeParams, IOAuth2RefreshTokenParams, OAuth2Provider, OAuth2ProviderInitInfo } from './oauth-provider';
2
- /**
3
- * Details of your app to access the Spotify API
4
- */
5
- export interface ISpotifyAuthSettings extends IOAuth2ProviderSettings {
6
- /** 'user-read-email', 'user-read-private' and additional scopes you want to access. See https://developer.spotify.com/documentation/general/guides/scopes/ */
7
- scopes?: string[];
8
- }
9
- interface ISpotifyAuthToken {
10
- access_token: string;
11
- expires_in: number;
12
- expires: Date;
13
- refresh_token: string;
14
- scope: string;
15
- token_type: string;
16
- }
17
- interface ISpotifyClientAuthToken {
18
- access_token: string;
19
- token_type: string;
20
- expires_in: number;
21
- }
22
- interface ISpotifyImage {
23
- width: number;
24
- height: number;
25
- url: string;
26
- }
27
- export declare class SpotifyAuthProvider extends OAuth2Provider {
28
- constructor(settings: ISpotifyAuthSettings);
29
- /**
30
- * Starts auth flow by getting the url the user should be redirected to
31
- * @param info.redirectUrl Url spotify will redirect to after authorizing
32
- * @param info.state Optional state that will be passed to redirectUri by spotify
33
- */
34
- init(info: OAuth2ProviderInitInfo): Promise<string>;
35
- getAccessToken(params: IOAuth2AuthCodeParams | IOAuth2RefreshTokenParams): Promise<ISpotifyAuthToken>;
36
- getClientAccessToken(): Promise<ISpotifyClientAuthToken>;
37
- getUserInfo(access_token: string): Promise<{
38
- id: string;
39
- name: string;
40
- display_name: string;
41
- picture: ISpotifyImage[];
42
- email: string;
43
- email_verified: boolean;
44
- other: {
45
- premium: boolean;
46
- followers: number;
47
- country: string;
48
- uri: string;
49
- };
50
- }>;
51
- }
52
- export declare const AuthProvider: typeof SpotifyAuthProvider;
53
- export {};
1
+ import { IOAuth2ProviderSettings, IOAuth2AuthCodeParams, IOAuth2RefreshTokenParams, OAuth2Provider, OAuth2ProviderInitInfo } from './oauth-provider';
2
+ /**
3
+ * Details of your app to access the Spotify API
4
+ */
5
+ export interface ISpotifyAuthSettings extends IOAuth2ProviderSettings {
6
+ /** 'user-read-email', 'user-read-private' and additional scopes you want to access. See https://developer.spotify.com/documentation/general/guides/scopes/ */
7
+ scopes?: string[];
8
+ }
9
+ interface ISpotifyAuthToken {
10
+ access_token: string;
11
+ expires_in: number;
12
+ expires: Date;
13
+ refresh_token: string;
14
+ scope: string;
15
+ token_type: string;
16
+ }
17
+ interface ISpotifyClientAuthToken {
18
+ access_token: string;
19
+ token_type: string;
20
+ expires_in: number;
21
+ }
22
+ interface ISpotifyImage {
23
+ width: number;
24
+ height: number;
25
+ url: string;
26
+ }
27
+ export declare class SpotifyAuthProvider extends OAuth2Provider {
28
+ constructor(settings: ISpotifyAuthSettings);
29
+ /**
30
+ * Starts auth flow by getting the url the user should be redirected to
31
+ * @param info.redirectUrl Url spotify will redirect to after authorizing
32
+ * @param info.state Optional state that will be passed to redirectUri by spotify
33
+ */
34
+ init(info: OAuth2ProviderInitInfo): Promise<string>;
35
+ getAccessToken(params: IOAuth2AuthCodeParams | IOAuth2RefreshTokenParams): Promise<ISpotifyAuthToken>;
36
+ getClientAccessToken(): Promise<ISpotifyClientAuthToken>;
37
+ getUserInfo(access_token: string): Promise<{
38
+ id: string;
39
+ name: string;
40
+ display_name: string;
41
+ picture: ISpotifyImage[];
42
+ email: string;
43
+ email_verified: boolean;
44
+ other: {
45
+ premium: boolean;
46
+ followers: number;
47
+ country: string;
48
+ uri: string;
49
+ };
50
+ }>;
51
+ }
52
+ export declare const AuthProvider: typeof SpotifyAuthProvider;
53
+ export {};
54
54
  //# sourceMappingURL=spotify.d.ts.map
@@ -1,21 +1,21 @@
1
- import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
- export declare class ChangePasswordError extends Error {
3
- code: 'unknown_uid' | 'wrong_password' | 'wrong_access_token';
4
- constructor(code: 'unknown_uid' | 'wrong_password' | 'wrong_access_token', message: string);
5
- }
6
- export declare type RequestQuery = never;
7
- export declare type RequestBody = {
8
- uid: string;
9
- password: string;
10
- new_password: string;
11
- };
12
- export declare type ResponseBody = {
13
- access_token: string;
14
- } | {
15
- code: string;
16
- message: string;
17
- } | string;
18
- export declare type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
19
- export declare const addRoute: (env: RouteInitEnvironment) => void;
20
- export default addRoute;
1
+ import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
+ export declare class ChangePasswordError extends Error {
3
+ code: 'unknown_uid' | 'wrong_password' | 'wrong_access_token';
4
+ constructor(code: 'unknown_uid' | 'wrong_password' | 'wrong_access_token', message: string);
5
+ }
6
+ export type RequestQuery = never;
7
+ export type RequestBody = {
8
+ uid: string;
9
+ password: string;
10
+ new_password: string;
11
+ };
12
+ export type ResponseBody = {
13
+ access_token: string;
14
+ } | {
15
+ code: string;
16
+ message: string;
17
+ } | string;
18
+ export type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
19
+ export declare const addRoute: (env: RouteInitEnvironment) => void;
20
+ export default addRoute;
21
21
  //# sourceMappingURL=auth-change-password.d.ts.map
@@ -1,17 +1,17 @@
1
- import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
- export declare class DeleteError extends Error {
3
- code: 'unauthenticated_delete' | 'unauthorized_delete';
4
- constructor(code: 'unauthenticated_delete' | 'unauthorized_delete', message: string);
5
- }
6
- export declare type RequestQuery = never;
7
- export declare type RequestBody = {
8
- uid: string;
9
- };
10
- export declare type ResponseBody = 'Farewell' | {
11
- code: DeleteError['code'];
12
- message: string;
13
- };
14
- export declare type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
15
- export declare const addRoute: (env: RouteInitEnvironment) => void;
16
- export default addRoute;
1
+ import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
+ export declare class DeleteError extends Error {
3
+ code: 'unauthenticated_delete' | 'unauthorized_delete';
4
+ constructor(code: 'unauthenticated_delete' | 'unauthorized_delete', message: string);
5
+ }
6
+ export type RequestQuery = never;
7
+ export type RequestBody = {
8
+ uid: string;
9
+ };
10
+ export type ResponseBody = 'Farewell' | {
11
+ code: DeleteError['code'];
12
+ message: string;
13
+ };
14
+ export type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
15
+ export declare const addRoute: (env: RouteInitEnvironment) => void;
16
+ export default addRoute;
17
17
  //# sourceMappingURL=auth-delete.d.ts.map
@@ -1,17 +1,17 @@
1
- import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
- export declare class ForgotPasswordError extends Error {
3
- code: 'server_email_config' | 'invalid_details' | 'invalid_email';
4
- constructor(code: 'server_email_config' | 'invalid_details' | 'invalid_email', message: string);
5
- }
6
- export declare type RequestQuery = never;
7
- export declare type RequestBody = {
8
- email: string;
9
- };
10
- export declare type ResponseBody = 'OK' | {
11
- code: string;
12
- message: string;
13
- };
14
- export declare type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
15
- export declare const addRoute: (env: RouteInitEnvironment) => void;
16
- export default addRoute;
1
+ import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
+ export declare class ForgotPasswordError extends Error {
3
+ code: 'server_email_config' | 'invalid_details' | 'invalid_email';
4
+ constructor(code: 'server_email_config' | 'invalid_details' | 'invalid_email', message: string);
5
+ }
6
+ export type RequestQuery = never;
7
+ export type RequestBody = {
8
+ email: string;
9
+ };
10
+ export type ResponseBody = 'OK' | {
11
+ code: string;
12
+ message: string;
13
+ };
14
+ export type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
15
+ export declare const addRoute: (env: RouteInitEnvironment) => void;
16
+ export default addRoute;
17
17
  //# sourceMappingURL=auth-forgot-password.d.ts.map
@@ -1,24 +1,24 @@
1
- import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
- import { DbUserAccountDetails } from '../schema/user';
3
- export declare class ResetPasswordError extends Error {
4
- code: 'invalid_code' | 'unknown_user' | 'password_requirement_mismatch';
5
- constructor(code: 'invalid_code' | 'unknown_user' | 'password_requirement_mismatch', message: string);
6
- }
7
- export declare type RequestQuery = never;
8
- export declare type RequestBody = {
9
- code: string;
10
- password: string;
11
- };
12
- export declare type ResponseBody = 'OK' | {
13
- code: string;
14
- message: string;
15
- };
16
- export declare type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
17
- /**
18
- * Adds the reset_password route and returns the reset function that can be used to manually reset a password
19
- * @param env environment
20
- * @returns returns the reset function
21
- */
22
- export declare const addRoute: (env: RouteInitEnvironment) => (clientIp: string, code: string, newPassword: string) => Promise<DbUserAccountDetails>;
23
- export default addRoute;
1
+ import { RouteInitEnvironment, RouteRequest } from '../shared/env';
2
+ import { DbUserAccountDetails } from '../schema/user';
3
+ export declare class ResetPasswordError extends Error {
4
+ code: 'invalid_code' | 'unknown_user' | 'password_requirement_mismatch';
5
+ constructor(code: 'invalid_code' | 'unknown_user' | 'password_requirement_mismatch', message: string);
6
+ }
7
+ export type RequestQuery = never;
8
+ export type RequestBody = {
9
+ code: string;
10
+ password: string;
11
+ };
12
+ export type ResponseBody = 'OK' | {
13
+ code: string;
14
+ message: string;
15
+ };
16
+ export type Request = RouteRequest<RequestQuery, RequestBody, ResponseBody>;
17
+ /**
18
+ * Adds the reset_password route and returns the reset function that can be used to manually reset a password
19
+ * @param env environment
20
+ * @returns returns the reset function
21
+ */
22
+ export declare const addRoute: (env: RouteInitEnvironment) => (clientIp: string, code: string, newPassword: string) => Promise<DbUserAccountDetails>;
23
+ export default addRoute;
24
24
  //# sourceMappingURL=auth-reset-password.d.ts.map