@kuckit/cli-auth-module 1.0.1 → 1.0.3
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/dist/server/module.d.ts +1 -2
- package/package.json +11 -25
- package/src/server/module.ts +0 -70
package/dist/server/module.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _kuckit_sdk0 from "@kuckit/sdk";
|
|
2
1
|
import "drizzle-orm/pg-core";
|
|
3
2
|
import "drizzle-orm";
|
|
4
3
|
import { NextFunction, Request, Response } from "express";
|
|
@@ -32,7 +31,7 @@ declare const requireScope: (scope: string) => (req: Request, res: Response, nex
|
|
|
32
31
|
//#endregion
|
|
33
32
|
//#region src/server/module.d.ts
|
|
34
33
|
type CliAuthModuleConfig = Record<string, never>;
|
|
35
|
-
declare const kuckitModule:
|
|
34
|
+
declare const kuckitModule: any;
|
|
36
35
|
//#endregion
|
|
37
36
|
export { type CliAuthContext, CliAuthModuleConfig, kuckitModule, makeCliAuthMiddleware, requireScope };
|
|
38
37
|
//# sourceMappingURL=module.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,35 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kuckit/cli-auth-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Device flow authentication module for Kuckit CLI tools",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "
|
|
6
|
+
"main": "dist/server/module.js",
|
|
7
|
+
"types": "dist/server/module.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
-
"types": "./
|
|
14
|
-
"default": "./
|
|
13
|
+
"types": "./dist/server/module.d.ts",
|
|
14
|
+
"default": "./dist/server/module.js"
|
|
15
15
|
},
|
|
16
16
|
"./client": {
|
|
17
|
-
"types": "./
|
|
18
|
-
"default": "./
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"publishConfig": {
|
|
22
|
-
"main": "dist/server/module.js",
|
|
23
|
-
"types": "dist/server/module.d.ts",
|
|
24
|
-
"exports": {
|
|
25
|
-
".": {
|
|
26
|
-
"types": "./dist/server/module.d.ts",
|
|
27
|
-
"default": "./dist/server/module.js"
|
|
28
|
-
},
|
|
29
|
-
"./client": {
|
|
30
|
-
"types": "./dist/client/index.d.ts",
|
|
31
|
-
"default": "./dist/client/index.js"
|
|
32
|
-
}
|
|
17
|
+
"types": "./dist/client/index.d.ts",
|
|
18
|
+
"default": "./dist/client/index.js"
|
|
33
19
|
}
|
|
34
20
|
},
|
|
35
21
|
"kuckit": {
|
|
@@ -42,15 +28,15 @@
|
|
|
42
28
|
"prepublishOnly": "npm run build && node ../../scripts/resolve-workspace-protocols.cjs && node ../../scripts/check-no-workspace-protocol.cjs"
|
|
43
29
|
},
|
|
44
30
|
"peerDependencies": {
|
|
45
|
-
"@kuckit/sdk": "^1.0.
|
|
46
|
-
"@kuckit/sdk-react": "^1.0.
|
|
31
|
+
"@kuckit/sdk": "^1.0.3",
|
|
32
|
+
"@kuckit/sdk-react": "^1.0.3",
|
|
47
33
|
"react": "^18 || ^19",
|
|
48
34
|
"typescript": "^5",
|
|
49
35
|
"express": "^4 || ^5"
|
|
50
36
|
},
|
|
51
37
|
"dependencies": {
|
|
52
|
-
"@kuckit/api": "^1.0.
|
|
53
|
-
"@kuckit/domain": "^1.0.
|
|
38
|
+
"@kuckit/api": "^1.0.3",
|
|
39
|
+
"@kuckit/domain": "^1.0.3",
|
|
54
40
|
"drizzle-orm": "^0.44.2",
|
|
55
41
|
"zod": "^4.1.11"
|
|
56
42
|
},
|
package/src/server/module.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { defineKuckitModule, asFunction, type KuckitModuleContext } from '@kuckit/sdk'
|
|
2
|
-
import { cliAuthTokenTable, cliAuthDeviceCodeTable } from './schema'
|
|
3
|
-
import { makeCliAuthRepository } from './repository'
|
|
4
|
-
import {
|
|
5
|
-
makeInitiateDeviceLogin,
|
|
6
|
-
makePollDeviceLogin,
|
|
7
|
-
makeApproveDeviceLogin,
|
|
8
|
-
makeValidateCliToken,
|
|
9
|
-
} from './use-cases'
|
|
10
|
-
import { cliDeviceRouter } from './router'
|
|
11
|
-
|
|
12
|
-
export { makeCliAuthMiddleware, requireScope, type CliAuthContext } from './middleware'
|
|
13
|
-
|
|
14
|
-
export type CliAuthModuleConfig = Record<string, never>
|
|
15
|
-
|
|
16
|
-
export const kuckitModule = defineKuckitModule<CliAuthModuleConfig>({
|
|
17
|
-
id: 'kuckit.cli-auth',
|
|
18
|
-
displayName: 'CLI Authentication',
|
|
19
|
-
description: 'Device flow authentication for CLI tools',
|
|
20
|
-
version: '0.1.0',
|
|
21
|
-
|
|
22
|
-
async register(ctx: KuckitModuleContext<CliAuthModuleConfig>) {
|
|
23
|
-
const { container } = ctx
|
|
24
|
-
|
|
25
|
-
// Register database schemas
|
|
26
|
-
ctx.registerSchema('cli_auth_token', cliAuthTokenTable)
|
|
27
|
-
ctx.registerSchema('cli_auth_device_code', cliAuthDeviceCodeTable)
|
|
28
|
-
|
|
29
|
-
// Register repository
|
|
30
|
-
container.register({
|
|
31
|
-
cliAuthRepository: asFunction(({ db }) => makeCliAuthRepository(db)).scoped(),
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
// Register use cases
|
|
35
|
-
container.register({
|
|
36
|
-
initiateDeviceLogin: asFunction(({ cliAuthRepository, logger }) =>
|
|
37
|
-
makeInitiateDeviceLogin({ cliAuthRepository, logger })
|
|
38
|
-
).scoped(),
|
|
39
|
-
pollDeviceLogin: asFunction(({ cliAuthRepository, userRepository, logger }) =>
|
|
40
|
-
makePollDeviceLogin({ cliAuthRepository, userRepository, logger })
|
|
41
|
-
).scoped(),
|
|
42
|
-
approveDeviceLogin: asFunction(({ cliAuthRepository, logger }) =>
|
|
43
|
-
makeApproveDeviceLogin({ cliAuthRepository, logger })
|
|
44
|
-
).scoped(),
|
|
45
|
-
validateCliToken: asFunction(({ cliAuthRepository }) =>
|
|
46
|
-
makeValidateCliToken({ cliAuthRepository })
|
|
47
|
-
).scoped(),
|
|
48
|
-
})
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
registerApi(ctx) {
|
|
52
|
-
ctx.addApiRegistration({
|
|
53
|
-
type: 'rpc-router',
|
|
54
|
-
name: 'cliDevice',
|
|
55
|
-
router: cliDeviceRouter,
|
|
56
|
-
})
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
async onBootstrap(ctx: KuckitModuleContext<CliAuthModuleConfig>) {
|
|
60
|
-
const { container } = ctx
|
|
61
|
-
const logger = container.resolve('logger')
|
|
62
|
-
logger.info('CLI Auth module initialized')
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
async onShutdown(ctx: KuckitModuleContext<CliAuthModuleConfig>) {
|
|
66
|
-
const { container } = ctx
|
|
67
|
-
const logger = container.resolve('logger')
|
|
68
|
-
logger.info('CLI Auth module shutting down')
|
|
69
|
-
},
|
|
70
|
-
})
|