@strav/jina 0.1.0 → 0.1.1
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.
- package/README.md +7 -7
- package/package.json +1 -1
- package/src/actions.ts +1 -1
- package/src/errors.ts +1 -1
- package/src/handlers/confirm_password.ts +2 -2
- package/src/handlers/forgot_password.ts +3 -3
- package/src/handlers/login.ts +3 -3
- package/src/handlers/logout.ts +3 -3
- package/src/handlers/register.ts +3 -3
- package/src/handlers/reset_password.ts +2 -2
- package/src/handlers/two_factor.ts +2 -2
- package/src/handlers/update_password.ts +2 -2
- package/src/handlers/update_profile.ts +2 -2
- package/src/handlers/verify_email.ts +4 -4
- package/src/helpers.ts +1 -1
- package/src/jina_manager.ts +3 -3
- package/src/jina_provider.ts +3 -3
- package/src/middleware/confirmed.ts +1 -1
- package/src/middleware/two_factor_challenge.ts +1 -1
- package/src/middleware/verified.ts +1 -1
- package/src/tokens.ts +1 -1
- package/src/types.ts +1 -1
- package/stubs/actions/jina.ts +2 -2
- package/stubs/config/jina.ts +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @strav/jina
|
|
2
2
|
|
|
3
|
-
Headless authentication flows for the [Strav](https://www.npmjs.com/package/@
|
|
3
|
+
Headless authentication flows for the [Strav](https://www.npmjs.com/package/@strav/core) framework. Registration, login, logout, password reset, email verification, two-factor authentication (TOTP), password confirmation, and profile updates — all as JSON API endpoints.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
bun add @
|
|
8
|
+
bun add @strav/jina
|
|
9
9
|
bun strav install jina
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
Requires `@
|
|
12
|
+
Requires `@strav/core` as a peer dependency.
|
|
13
13
|
|
|
14
14
|
## Setup
|
|
15
15
|
|
|
16
16
|
```ts
|
|
17
|
-
import { defineActions } from '@
|
|
17
|
+
import { defineActions } from '@strav/jina'
|
|
18
18
|
import User from './models/user'
|
|
19
19
|
|
|
20
20
|
const actions = defineActions<User>({
|
|
@@ -28,7 +28,7 @@ const actions = defineActions<User>({
|
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
```ts
|
|
31
|
-
import { JinaProvider } from '@
|
|
31
|
+
import { JinaProvider } from '@strav/jina'
|
|
32
32
|
|
|
33
33
|
app.use(new JinaProvider(actions))
|
|
34
34
|
```
|
|
@@ -57,7 +57,7 @@ Routes are registered automatically:
|
|
|
57
57
|
## Middleware
|
|
58
58
|
|
|
59
59
|
```ts
|
|
60
|
-
import { verified, confirmed, twoFactorChallenge } from '@
|
|
60
|
+
import { verified, confirmed, twoFactorChallenge } from '@strav/jina'
|
|
61
61
|
|
|
62
62
|
router.group({ middleware: [auth(), verified()] }, r => {
|
|
63
63
|
r.delete('/account', compose([confirmed()], deleteAccountHandler))
|
package/package.json
CHANGED
package/src/actions.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { JinaActions } from './types.ts'
|
|
|
5
5
|
* Zero runtime cost — just provides autocompletion and type checking.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* import { defineActions } from '@
|
|
8
|
+
* import { defineActions } from '@strav/jina'
|
|
9
9
|
* import { User } from '../models/user'
|
|
10
10
|
*
|
|
11
11
|
* export default defineActions<User>({
|
package/src/errors.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { encrypt, Emitter } from '@
|
|
2
|
-
import type { Context, Session } from '@
|
|
1
|
+
import { encrypt, Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Context, Session } from '@strav/http'
|
|
3
3
|
import JinaManager from '../jina_manager.ts'
|
|
4
4
|
import { JinaEvents } from '../types.ts'
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { mail } from '@
|
|
2
|
-
import { extractUserId } from '@
|
|
3
|
-
import type { Context } from '@
|
|
1
|
+
import { mail } from '@strav/signal'
|
|
2
|
+
import { extractUserId } from '@strav/database'
|
|
3
|
+
import type { Context } from '@strav/http'
|
|
4
4
|
import JinaManager from '../jina_manager.ts'
|
|
5
5
|
import { createSignedToken } from '../tokens.ts'
|
|
6
6
|
|
package/src/handlers/login.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { encrypt, Emitter } from '@
|
|
2
|
-
import { AccessToken } from '@
|
|
3
|
-
import type { Context, Session } from '@
|
|
1
|
+
import { encrypt, Emitter } from '@strav/kernel'
|
|
2
|
+
import { AccessToken } from '@strav/http'
|
|
3
|
+
import type { Context, Session } from '@strav/http'
|
|
4
4
|
import JinaManager from '../jina_manager.ts'
|
|
5
5
|
import { JinaEvents } from '../types.ts'
|
|
6
6
|
|
package/src/handlers/logout.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import { Session } from '@
|
|
3
|
-
import type { Context } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import { Session } from '@strav/http'
|
|
3
|
+
import type { Context } from '@strav/http'
|
|
4
4
|
import JinaManager from '../jina_manager.ts'
|
|
5
5
|
import { JinaEvents } from '../types.ts'
|
|
6
6
|
|
package/src/handlers/register.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import { AccessToken } from '@
|
|
3
|
-
import type { Context, Session } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import { AccessToken } from '@strav/http'
|
|
3
|
+
import type { Context, Session } from '@strav/http'
|
|
4
4
|
import JinaManager from '../jina_manager.ts'
|
|
5
5
|
import { ValidationError } from '../errors.ts'
|
|
6
6
|
import { JinaEvents } from '../types.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Context } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Context } from '@strav/http'
|
|
3
3
|
import JinaManager from '../jina_manager.ts'
|
|
4
4
|
import { verifySignedToken } from '../tokens.ts'
|
|
5
5
|
import { JinaEvents } from '../types.ts'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Context, Session } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Context, Session } from '@strav/http'
|
|
3
3
|
import JinaManager from '../jina_manager.ts'
|
|
4
4
|
import { JinaEvents } from '../types.ts'
|
|
5
5
|
import {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { encrypt, Emitter } from '@
|
|
2
|
-
import type { Context } from '@
|
|
1
|
+
import { encrypt, Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Context } from '@strav/http'
|
|
3
3
|
import JinaManager from '../jina_manager.ts'
|
|
4
4
|
import { JinaEvents } from '../types.ts'
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import type { Context } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import type { Context } from '@strav/http'
|
|
3
3
|
import JinaManager from '../jina_manager.ts'
|
|
4
4
|
import { JinaEvents } from '../types.ts'
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Emitter } from '@
|
|
2
|
-
import { mail } from '@
|
|
3
|
-
import { extractUserId } from '@
|
|
4
|
-
import type { Context } from '@
|
|
1
|
+
import { Emitter } from '@strav/kernel'
|
|
2
|
+
import { mail } from '@strav/signal'
|
|
3
|
+
import { extractUserId } from '@strav/database'
|
|
4
|
+
import type { Context } from '@strav/http'
|
|
5
5
|
import JinaManager from '../jina_manager.ts'
|
|
6
6
|
import { createSignedToken, verifySignedToken } from '../tokens.ts'
|
|
7
7
|
import { JinaEvents } from '../types.ts'
|
package/src/helpers.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { generateSecret, totpUri, verifyTotp, base32Decode, generateRecoveryCode
|
|
|
6
6
|
* Jina helper — convenience API for auth flow utilities.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
* import { jina } from '@
|
|
9
|
+
* import { jina } from '@strav/jina'
|
|
10
10
|
*
|
|
11
11
|
* const token = jina.signedToken({ sub: user.id, typ: 'custom' }, 60)
|
|
12
12
|
* const payload = jina.verifyToken(token)
|
package/src/jina_manager.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { inject, Configuration, ConfigurationError } from '@
|
|
2
|
-
import { Router, compose, rateLimit, auth, guest, session } from '@
|
|
3
|
-
import type { Handler, Middleware } from '@
|
|
1
|
+
import { inject, Configuration, ConfigurationError } from '@strav/kernel'
|
|
2
|
+
import { Router, compose, rateLimit, auth, guest, session } from '@strav/http'
|
|
3
|
+
import type { Handler, Middleware } from '@strav/http'
|
|
4
4
|
import { MissingActionError } from './errors.ts'
|
|
5
5
|
import type { JinaActions, JinaConfig, Feature } from './types.ts'
|
|
6
6
|
import { registerHandler } from './handlers/register.ts'
|
package/src/jina_provider.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ServiceProvider } from '@
|
|
2
|
-
import type { Application } from '@
|
|
3
|
-
import { Router } from '@
|
|
1
|
+
import { ServiceProvider } from '@strav/kernel'
|
|
2
|
+
import type { Application } from '@strav/kernel'
|
|
3
|
+
import { Router } from '@strav/http'
|
|
4
4
|
import JinaManager from './jina_manager.ts'
|
|
5
5
|
import type { JinaActions } from './types.ts'
|
|
6
6
|
|
package/src/tokens.ts
CHANGED
package/src/types.ts
CHANGED
package/stubs/actions/jina.ts
CHANGED
package/stubs/config/jina.ts
CHANGED