@shipfox/api-auth 7.1.0 → 9.0.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +78 -0
- package/README.md +10 -8
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +30 -23
- package/src/core/auth.test.ts +1 -0
- package/src/index.test.ts +1 -0
- package/src/index.ts +1 -1
- package/src/presentation/e2eRoutes/index.test.ts +1 -0
- package/src/presentation/routes/index.test.ts +1 -0
- package/test/globalSetup.ts +3 -10
- package/test/routes.ts +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-auth",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.0.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -11,10 +11,6 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"main": "dist/index.js",
|
|
13
13
|
"types": "dist/index.d.ts",
|
|
14
|
-
"imports": {
|
|
15
|
-
"#test/*": "./test/*",
|
|
16
|
-
"#*": "./dist/*"
|
|
17
|
-
},
|
|
18
14
|
"exports": {
|
|
19
15
|
".": {
|
|
20
16
|
"types": "./dist/index.d.ts",
|
|
@@ -30,24 +26,35 @@
|
|
|
30
26
|
"@node-rs/argon2": "^2.0.2",
|
|
31
27
|
"drizzle-orm": "^0.45.2",
|
|
32
28
|
"zod": "^4.4.3",
|
|
33
|
-
"@shipfox/api-auth-context": "
|
|
34
|
-
"@shipfox/api-auth-dto": "
|
|
35
|
-
"@shipfox/api-email-challenges": "
|
|
36
|
-
"@shipfox/api-workspaces-dto": "
|
|
37
|
-
"@shipfox/inter-module": "0.2.
|
|
38
|
-
"@shipfox/config": "1.2.
|
|
39
|
-
"@shipfox/node-drizzle": "0.3.
|
|
40
|
-
"@shipfox/node-auth-root-key": "0.2.
|
|
41
|
-
"@shipfox/node-fastify": "0.3.
|
|
42
|
-
"@shipfox/node-jwt": "0.3.
|
|
43
|
-
"@shipfox/node-email": "0.3.
|
|
44
|
-
"@shipfox/node-mailer": "0.2.
|
|
45
|
-
"@shipfox/node-module": "0.
|
|
46
|
-
"@shipfox/node-opentelemetry": "0.6.
|
|
47
|
-
"@shipfox/node-outbox": "0.2.
|
|
48
|
-
"@shipfox/node-postgres": "0.4.
|
|
49
|
-
"@shipfox/node-rate-limit": "0.3.
|
|
50
|
-
"@shipfox/node-tokens": "0.3.
|
|
29
|
+
"@shipfox/api-auth-context": "9.0.2",
|
|
30
|
+
"@shipfox/api-auth-dto": "9.0.2",
|
|
31
|
+
"@shipfox/api-email-challenges": "1.1.1",
|
|
32
|
+
"@shipfox/api-workspaces-dto": "9.0.2",
|
|
33
|
+
"@shipfox/inter-module": "0.2.2",
|
|
34
|
+
"@shipfox/config": "1.2.4",
|
|
35
|
+
"@shipfox/node-drizzle": "0.3.4",
|
|
36
|
+
"@shipfox/node-auth-root-key": "0.2.3",
|
|
37
|
+
"@shipfox/node-fastify": "0.3.2",
|
|
38
|
+
"@shipfox/node-jwt": "0.3.2",
|
|
39
|
+
"@shipfox/node-email": "0.3.3",
|
|
40
|
+
"@shipfox/node-mailer": "0.2.3",
|
|
41
|
+
"@shipfox/node-module": "1.0.1",
|
|
42
|
+
"@shipfox/node-opentelemetry": "0.6.2",
|
|
43
|
+
"@shipfox/node-outbox": "0.2.6",
|
|
44
|
+
"@shipfox/node-postgres": "0.4.4",
|
|
45
|
+
"@shipfox/node-rate-limit": "0.3.2",
|
|
46
|
+
"@shipfox/node-tokens": "0.3.2"
|
|
47
|
+
},
|
|
48
|
+
"imports": {
|
|
49
|
+
"#*": "./dist/*"
|
|
50
|
+
},
|
|
51
|
+
"shipfox": {
|
|
52
|
+
"architecture": {
|
|
53
|
+
"schema": 1,
|
|
54
|
+
"realm": "source-available",
|
|
55
|
+
"kind": "implementation",
|
|
56
|
+
"context": "auth"
|
|
57
|
+
}
|
|
51
58
|
},
|
|
52
59
|
"scripts": {
|
|
53
60
|
"build": "shipfox-swc",
|
package/src/core/auth.test.ts
CHANGED
|
@@ -73,6 +73,7 @@ const listMembershipsByUserMock = vi.fn(() =>
|
|
|
73
73
|
);
|
|
74
74
|
const workspaces = {
|
|
75
75
|
listMembershipsForTokenClaims: listMembershipsByUserMock,
|
|
76
|
+
getWorkspaceCreator: vi.fn(),
|
|
76
77
|
preflightInvitationAcceptance: vi.fn(),
|
|
77
78
|
acceptInvitation: vi.fn(),
|
|
78
79
|
requireActiveMembership: vi.fn(),
|
package/src/index.test.ts
CHANGED
|
@@ -26,6 +26,7 @@ describe('authModule', () => {
|
|
|
26
26
|
const authModule = createAuthModule({
|
|
27
27
|
workspaces: {
|
|
28
28
|
listMembershipsForTokenClaims: vi.fn(),
|
|
29
|
+
getWorkspaceCreator: vi.fn(),
|
|
29
30
|
preflightInvitationAcceptance: vi.fn(),
|
|
30
31
|
acceptInvitation: vi.fn(),
|
|
31
32
|
requireActiveMembership: vi.fn(),
|
package/src/index.ts
CHANGED
|
@@ -69,7 +69,7 @@ export function createAuthModule({
|
|
|
69
69
|
}): ShipfoxModule {
|
|
70
70
|
return {
|
|
71
71
|
name: 'auth',
|
|
72
|
-
database: {db, migrationsPath},
|
|
72
|
+
database: {db, migrationsPath, databaseNamespace: 'auth'},
|
|
73
73
|
auth: [createJwtAuthMethod(), createLeaseTokenAuthMethod(), createRunnerSessionAuthMethod()],
|
|
74
74
|
loginMethods: passwordLoginMethods(config.AUTH_PASSWORD_ENABLED),
|
|
75
75
|
routes: [buildAuthRoutes(config.AUTH_PASSWORD_ENABLED, workspaces)],
|
|
@@ -10,6 +10,7 @@ describe('auth E2E routes', () => {
|
|
|
10
10
|
routes: [
|
|
11
11
|
createAuthE2eRoutes({
|
|
12
12
|
listMembershipsForTokenClaims: vi.fn(() => Promise.resolve({memberships: []})),
|
|
13
|
+
getWorkspaceCreator: vi.fn(),
|
|
13
14
|
preflightInvitationAcceptance: vi.fn(),
|
|
14
15
|
acceptInvitation: vi.fn(),
|
|
15
16
|
requireActiveMembership: vi.fn(),
|
|
@@ -4,6 +4,7 @@ import {buildAuthRoutes} from './index.js';
|
|
|
4
4
|
|
|
5
5
|
const workspaces = {
|
|
6
6
|
listMembershipsForTokenClaims: vi.fn(() => Promise.resolve({memberships: []})),
|
|
7
|
+
getWorkspaceCreator: vi.fn(),
|
|
7
8
|
preflightInvitationAcceptance: vi.fn(),
|
|
8
9
|
acceptInvitation: vi.fn(),
|
|
9
10
|
requireActiveMembership: vi.fn(),
|
package/test/globalSetup.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './env.js';
|
|
2
|
-
import {
|
|
2
|
+
import {initializeEmailChallengesForTests} from '@shipfox/api-email-challenges/test';
|
|
3
3
|
import {runMigrations} from '@shipfox/node-drizzle';
|
|
4
4
|
import {closePostgresClient, createPostgresClient} from '@shipfox/node-postgres';
|
|
5
5
|
import {sql} from 'drizzle-orm';
|
|
@@ -10,16 +10,9 @@ export async function setup() {
|
|
|
10
10
|
createPostgresClient();
|
|
11
11
|
|
|
12
12
|
await runMigrations(db(), migrationsPath, '__drizzle_migrations_auth');
|
|
13
|
-
|
|
14
|
-
const emailChallengesMigrations =
|
|
15
|
-
emailChallengesDatabase && !Array.isArray(emailChallengesDatabase)
|
|
16
|
-
? emailChallengesDatabase.migrationsPath
|
|
17
|
-
: undefined;
|
|
18
|
-
if (!emailChallengesMigrations)
|
|
19
|
-
throw new Error('Email challenges module has no database migrations');
|
|
20
|
-
await runMigrations(db(), emailChallengesMigrations, '__drizzle_migrations_email_challenges');
|
|
13
|
+
await initializeEmailChallengesForTests();
|
|
21
14
|
await db().execute(
|
|
22
|
-
sql`TRUNCATE
|
|
15
|
+
sql`TRUNCATE auth_outbox, auth_password_resets, auth_rate_limits, auth_refresh_tokens, auth_users CASCADE`,
|
|
23
16
|
);
|
|
24
17
|
|
|
25
18
|
closeDb();
|
package/test/routes.ts
CHANGED
|
@@ -36,6 +36,7 @@ const testConfig = vi.hoisted(
|
|
|
36
36
|
const workspaceTestDoubles = vi.hoisted(() => {
|
|
37
37
|
return {
|
|
38
38
|
acceptInvitation: vi.fn(),
|
|
39
|
+
getWorkspaceCreator: vi.fn(),
|
|
39
40
|
preflightInvitationAcceptance: vi.fn(),
|
|
40
41
|
listMembershipsForTokenClaims: vi.fn(() => Promise.resolve({memberships: []})),
|
|
41
42
|
requireActiveMembership: vi.fn(),
|