@frontmcp/sdk 0.1.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.
- package/README.md +11 -0
- package/package.json +29 -0
- package/src/constants.d.ts +30 -0
- package/src/constants.js +36 -0
- package/src/constants.js.map +1 -0
- package/src/decorators/adapter.decorator.d.ts +7 -0
- package/src/decorators/adapter.decorator.js +20 -0
- package/src/decorators/adapter.decorator.js.map +1 -0
- package/src/decorators/app.decorator.d.ts +7 -0
- package/src/decorators/app.decorator.js +44 -0
- package/src/decorators/app.decorator.js.map +1 -0
- package/src/decorators/auth-provider.decorator.d.ts +7 -0
- package/src/decorators/auth-provider.decorator.js +20 -0
- package/src/decorators/auth-provider.decorator.js.map +1 -0
- package/src/decorators/flow-hooks.decorator.d.ts +12 -0
- package/src/decorators/flow-hooks.decorator.js +63 -0
- package/src/decorators/flow-hooks.decorator.js.map +1 -0
- package/src/decorators/flow.decorator.d.ts +6 -0
- package/src/decorators/flow.decorator.js +19 -0
- package/src/decorators/flow.decorator.js.map +1 -0
- package/src/decorators/front-mcp.decorator.d.ts +6 -0
- package/src/decorators/front-mcp.decorator.js +40 -0
- package/src/decorators/front-mcp.decorator.js.map +1 -0
- package/src/decorators/index.d.ts +12 -0
- package/src/decorators/index.js +16 -0
- package/src/decorators/index.js.map +1 -0
- package/src/decorators/logger.decorator.d.ts +7 -0
- package/src/decorators/logger.decorator.js +20 -0
- package/src/decorators/logger.decorator.js.map +1 -0
- package/src/decorators/plugin.decorator.d.ts +7 -0
- package/src/decorators/plugin.decorator.js +38 -0
- package/src/decorators/plugin.decorator.js.map +1 -0
- package/src/decorators/prompt.decorator.d.ts +13 -0
- package/src/decorators/prompt.decorator.js +38 -0
- package/src/decorators/prompt.decorator.js.map +1 -0
- package/src/decorators/provider.decorator.d.ts +7 -0
- package/src/decorators/provider.decorator.js +20 -0
- package/src/decorators/provider.decorator.js.map +1 -0
- package/src/decorators/resource.decorator.d.ts +17 -0
- package/src/decorators/resource.decorator.js +52 -0
- package/src/decorators/resource.decorator.js.map +1 -0
- package/src/decorators/tool.decorator.d.ts +14 -0
- package/src/decorators/tool.decorator.js +38 -0
- package/src/decorators/tool.decorator.js.map +1 -0
- package/src/decorators-old/async-with.decorator.d.ts +9 -0
- package/src/decorators-old/async-with.decorator.js +23 -0
- package/src/decorators-old/async-with.decorator.js.map +1 -0
- package/src/decorators-old/auth-hook.decorator.d.ts +14 -0
- package/src/decorators-old/auth-hook.decorator.js +27 -0
- package/src/decorators-old/auth-hook.decorator.js.map +1 -0
- package/src/decorators-old/session-hook.decorator.d.ts +14 -0
- package/src/decorators-old/session-hook.decorator.js +27 -0
- package/src/decorators-old/session-hook.decorator.js.map +1 -0
- package/src/decorators-old/tool-hook.decorator.d.ts +14 -0
- package/src/decorators-old/tool-hook.decorator.js +27 -0
- package/src/decorators-old/tool-hook.decorator.js.map +1 -0
- package/src/dynamic/dynamic.adapter.d.ts +42 -0
- package/src/dynamic/dynamic.adapter.js +28 -0
- package/src/dynamic/dynamic.adapter.js.map +1 -0
- package/src/dynamic/dynamic.plugin.d.ts +52 -0
- package/src/dynamic/dynamic.plugin.js +33 -0
- package/src/dynamic/dynamic.plugin.js.map +1 -0
- package/src/dynamic/dynamic.utils.d.ts +3 -0
- package/src/dynamic/dynamic.utils.js +27 -0
- package/src/dynamic/dynamic.utils.js.map +1 -0
- package/src/dynamic/index.d.ts +2 -0
- package/src/dynamic/index.js +6 -0
- package/src/dynamic/index.js.map +1 -0
- package/src/entries/adapter.entry.d.ts +6 -0
- package/src/entries/adapter.entry.js +8 -0
- package/src/entries/adapter.entry.js.map +1 -0
- package/src/entries/app.entry.d.ts +13 -0
- package/src/entries/app.entry.js +9 -0
- package/src/entries/app.entry.js.map +1 -0
- package/src/entries/auth-provider.entry.d.ts +6 -0
- package/src/entries/auth-provider.entry.js +8 -0
- package/src/entries/auth-provider.entry.js.map +1 -0
- package/src/entries/base.entry.d.ts +20 -0
- package/src/entries/base.entry.js +17 -0
- package/src/entries/base.entry.js.map +1 -0
- package/src/entries/flow.entry.d.ts +15 -0
- package/src/entries/flow.entry.js +21 -0
- package/src/entries/flow.entry.js.map +1 -0
- package/src/entries/index.d.ts +12 -0
- package/src/entries/index.js +16 -0
- package/src/entries/index.js.map +1 -0
- package/src/entries/logger.entry.d.ts +6 -0
- package/src/entries/logger.entry.js +8 -0
- package/src/entries/logger.entry.js.map +1 -0
- package/src/entries/plugin.entry.d.ts +6 -0
- package/src/entries/plugin.entry.js +8 -0
- package/src/entries/plugin.entry.js.map +1 -0
- package/src/entries/prompt.entry.d.ts +6 -0
- package/src/entries/prompt.entry.js +8 -0
- package/src/entries/prompt.entry.js.map +1 -0
- package/src/entries/provider.entry.d.ts +7 -0
- package/src/entries/provider.entry.js +8 -0
- package/src/entries/provider.entry.js.map +1 -0
- package/src/entries/resource.entry.d.ts +7 -0
- package/src/entries/resource.entry.js +11 -0
- package/src/entries/resource.entry.js.map +1 -0
- package/src/entries/scope.entry.d.ts +17 -0
- package/src/entries/scope.entry.js +8 -0
- package/src/entries/scope.entry.js.map +1 -0
- package/src/entries/tool.entry.d.ts +15 -0
- package/src/entries/tool.entry.js +11 -0
- package/src/entries/tool.entry.js.map +1 -0
- package/src/index.d.ts +18 -0
- package/src/index.js +22 -0
- package/src/index.js.map +1 -0
- package/src/interfaces/adapter.interface.d.ts +20 -0
- package/src/interfaces/adapter.interface.js +3 -0
- package/src/interfaces/adapter.interface.js.map +1 -0
- package/src/interfaces/app.interface.d.ts +6 -0
- package/src/interfaces/app.interface.js +3 -0
- package/src/interfaces/app.interface.js.map +1 -0
- package/src/interfaces/auth-hook.interface.d.ts +126 -0
- package/src/interfaces/auth-hook.interface.js +135 -0
- package/src/interfaces/auth-hook.interface.js.map +1 -0
- package/src/interfaces/auth-provider.interface.d.ts +22 -0
- package/src/interfaces/auth-provider.interface.js +18 -0
- package/src/interfaces/auth-provider.interface.js.map +1 -0
- package/src/interfaces/base.interface.d.ts +77 -0
- package/src/interfaces/base.interface.js +3 -0
- package/src/interfaces/base.interface.js.map +1 -0
- package/src/interfaces/flow.interface.d.ts +38 -0
- package/src/interfaces/flow.interface.js +69 -0
- package/src/interfaces/flow.interface.js.map +1 -0
- package/src/interfaces/front-mcp.interface.d.ts +5 -0
- package/src/interfaces/front-mcp.interface.js +3 -0
- package/src/interfaces/front-mcp.interface.js.map +1 -0
- package/src/interfaces/index.d.ts +15 -0
- package/src/interfaces/index.js +19 -0
- package/src/interfaces/index.js.map +1 -0
- package/src/interfaces/internal/flow.utils.d.ts +24 -0
- package/src/interfaces/internal/flow.utils.js +83 -0
- package/src/interfaces/internal/flow.utils.js.map +1 -0
- package/src/interfaces/internal/index.d.ts +2 -0
- package/src/interfaces/internal/index.js +7 -0
- package/src/interfaces/internal/index.js.map +1 -0
- package/src/interfaces/internal/primary-auth-provider.interface.d.ts +24 -0
- package/src/interfaces/internal/primary-auth-provider.interface.js +33 -0
- package/src/interfaces/internal/primary-auth-provider.interface.js.map +1 -0
- package/src/interfaces/internal/registry.interface.d.ts +71 -0
- package/src/interfaces/internal/registry.interface.js +3 -0
- package/src/interfaces/internal/registry.interface.js.map +1 -0
- package/src/interfaces/logger.interface.d.ts +42 -0
- package/src/interfaces/logger.interface.js +10 -0
- package/src/interfaces/logger.interface.js.map +1 -0
- package/src/interfaces/plugin.interface.d.ts +8 -0
- package/src/interfaces/plugin.interface.js +3 -0
- package/src/interfaces/plugin.interface.js.map +1 -0
- package/src/interfaces/prompt.interface.d.ts +5 -0
- package/src/interfaces/prompt.interface.js +3 -0
- package/src/interfaces/prompt.interface.js.map +1 -0
- package/src/interfaces/provider.interface.d.ts +20 -0
- package/src/interfaces/provider.interface.js +18 -0
- package/src/interfaces/provider.interface.js.map +1 -0
- package/src/interfaces/resource.interface.d.ts +21 -0
- package/src/interfaces/resource.interface.js +3 -0
- package/src/interfaces/resource.interface.js.map +1 -0
- package/src/interfaces/scope.interface.d.ts +5 -0
- package/src/interfaces/scope.interface.js +3 -0
- package/src/interfaces/scope.interface.js.map +1 -0
- package/src/interfaces/server.interface.d.ts +46 -0
- package/src/interfaces/server.interface.js +18 -0
- package/src/interfaces/server.interface.js.map +1 -0
- package/src/interfaces/session-hook.interface.d.ts +131 -0
- package/src/interfaces/session-hook.interface.js +140 -0
- package/src/interfaces/session-hook.interface.js.map +1 -0
- package/src/interfaces/tool-hook.interface.d.ts +80 -0
- package/src/interfaces/tool-hook.interface.js +92 -0
- package/src/interfaces/tool-hook.interface.js.map +1 -0
- package/src/interfaces/tool.interface.d.ts +45 -0
- package/src/interfaces/tool.interface.js +89 -0
- package/src/interfaces/tool.interface.js.map +1 -0
- package/src/metadata/adapter.metadata.d.ts +22 -0
- package/src/metadata/adapter.metadata.js +10 -0
- package/src/metadata/adapter.metadata.js.map +1 -0
- package/src/metadata/app.metadata.d.ts +872 -0
- package/src/metadata/app.metadata.js +30 -0
- package/src/metadata/app.metadata.js.map +1 -0
- package/src/metadata/auth-provider.metadata.d.ts +33 -0
- package/src/metadata/auth-provider.metadata.js +19 -0
- package/src/metadata/auth-provider.metadata.js.map +1 -0
- package/src/metadata/flow-hooks.metadata.d.ts +20 -0
- package/src/metadata/flow-hooks.metadata.js +3 -0
- package/src/metadata/flow-hooks.metadata.js.map +1 -0
- package/src/metadata/flow.metadata.d.ts +75 -0
- package/src/metadata/flow.metadata.js +15 -0
- package/src/metadata/flow.metadata.js.map +1 -0
- package/src/metadata/front-mcp.metadata.d.ts +1144 -0
- package/src/metadata/front-mcp.metadata.js +25 -0
- package/src/metadata/front-mcp.metadata.js.map +1 -0
- package/src/metadata/index.d.ts +12 -0
- package/src/metadata/index.js +16 -0
- package/src/metadata/index.js.map +1 -0
- package/src/metadata/logger.metadata.d.ts +39 -0
- package/src/metadata/logger.metadata.js +10 -0
- package/src/metadata/logger.metadata.js.map +1 -0
- package/src/metadata/plugin.metadata.d.ts +93 -0
- package/src/metadata/plugin.metadata.js +18 -0
- package/src/metadata/plugin.metadata.js.map +1 -0
- package/src/metadata/prompt.metadata.d.ts +226 -0
- package/src/metadata/prompt.metadata.js +27 -0
- package/src/metadata/prompt.metadata.js.map +1 -0
- package/src/metadata/provider.metadata.d.ts +34 -0
- package/src/metadata/provider.metadata.js +20 -0
- package/src/metadata/provider.metadata.js.map +1 -0
- package/src/metadata/resource.metadata.d.ts +199 -0
- package/src/metadata/resource.metadata.js +22 -0
- package/src/metadata/resource.metadata.js.map +1 -0
- package/src/metadata/tool.metadata.d.ts +278 -0
- package/src/metadata/tool.metadata.js +28 -0
- package/src/metadata/tool.metadata.js.map +1 -0
- package/src/providers/session.provider.d.ts +13 -0
- package/src/providers/session.provider.js +27 -0
- package/src/providers/session.provider.js.map +1 -0
- package/src/records/adapter.record.d.ts +26 -0
- package/src/records/adapter.record.js +11 -0
- package/src/records/adapter.record.js.map +1 -0
- package/src/records/app.record.d.ts +19 -0
- package/src/records/app.record.js +9 -0
- package/src/records/app.record.js.map +1 -0
- package/src/records/auth-provider.record.d.ts +37 -0
- package/src/records/auth-provider.record.js +12 -0
- package/src/records/auth-provider.record.js.map +1 -0
- package/src/records/flow.record.d.ts +11 -0
- package/src/records/flow.record.js +8 -0
- package/src/records/flow.record.js.map +1 -0
- package/src/records/index.d.ts +11 -0
- package/src/records/index.js +15 -0
- package/src/records/index.js.map +1 -0
- package/src/records/logger.record.d.ts +11 -0
- package/src/records/logger.record.js +8 -0
- package/src/records/logger.record.js.map +1 -0
- package/src/records/plugin.record.d.ts +21 -0
- package/src/records/plugin.record.js +11 -0
- package/src/records/plugin.record.js.map +1 -0
- package/src/records/prompt.record.d.ts +18 -0
- package/src/records/prompt.record.js +9 -0
- package/src/records/prompt.record.js.map +1 -0
- package/src/records/provider.record.d.ts +36 -0
- package/src/records/provider.record.js +14 -0
- package/src/records/provider.record.js.map +1 -0
- package/src/records/resource.record.d.ts +18 -0
- package/src/records/resource.record.js +14 -0
- package/src/records/resource.record.js.map +1 -0
- package/src/records/scope.record.d.ts +18 -0
- package/src/records/scope.record.js +9 -0
- package/src/records/scope.record.js.map +1 -0
- package/src/records/tool.record.d.ts +17 -0
- package/src/records/tool.record.js +9 -0
- package/src/records/tool.record.js.map +1 -0
- package/src/schemas/annotated-class.schema.d.ts +11 -0
- package/src/schemas/annotated-class.schema.js +40 -0
- package/src/schemas/annotated-class.schema.js.map +1 -0
- package/src/schemas/http-input.schema.d.ts +33 -0
- package/src/schemas/http-input.schema.js +13 -0
- package/src/schemas/http-input.schema.js.map +1 -0
- package/src/schemas/http-output.schema.d.ts +2011 -0
- package/src/schemas/http-output.schema.js +283 -0
- package/src/schemas/http-output.schema.js.map +1 -0
- package/src/schemas/index.d.ts +3 -0
- package/src/schemas/index.js +7 -0
- package/src/schemas/index.js.map +1 -0
- package/src/tokens/adapter.tokens.d.ts +3 -0
- package/src/tokens/adapter.tokens.js +11 -0
- package/src/tokens/adapter.tokens.js.map +1 -0
- package/src/tokens/app.tokens.d.ts +4 -0
- package/src/tokens/app.tokens.js +30 -0
- package/src/tokens/app.tokens.js.map +1 -0
- package/src/tokens/auth-provider.tokens.d.ts +3 -0
- package/src/tokens/auth-provider.tokens.js +12 -0
- package/src/tokens/auth-provider.tokens.js.map +1 -0
- package/src/tokens/base.tokens.d.ts +5 -0
- package/src/tokens/base.tokens.js +9 -0
- package/src/tokens/base.tokens.js.map +1 -0
- package/src/tokens/flow-hook.tokens.d.ts +4 -0
- package/src/tokens/flow-hook.tokens.js +9 -0
- package/src/tokens/flow-hook.tokens.js.map +1 -0
- package/src/tokens/flow.tokens.d.ts +11 -0
- package/src/tokens/flow.tokens.js +16 -0
- package/src/tokens/flow.tokens.js.map +1 -0
- package/src/tokens/front-mcp.tokens.d.ts +3 -0
- package/src/tokens/front-mcp.tokens.js +19 -0
- package/src/tokens/front-mcp.tokens.js.map +1 -0
- package/src/tokens/index.d.ts +13 -0
- package/src/tokens/index.js +17 -0
- package/src/tokens/index.js.map +1 -0
- package/src/tokens/logger.tokens.d.ts +3 -0
- package/src/tokens/logger.tokens.js +11 -0
- package/src/tokens/logger.tokens.js.map +1 -0
- package/src/tokens/plugin.tokens.d.ts +13 -0
- package/src/tokens/plugin.tokens.js +18 -0
- package/src/tokens/plugin.tokens.js.map +1 -0
- package/src/tokens/prompt.tokens.d.ts +9 -0
- package/src/tokens/prompt.tokens.js +14 -0
- package/src/tokens/prompt.tokens.js.map +1 -0
- package/src/tokens/provider.tokens.d.ts +3 -0
- package/src/tokens/provider.tokens.js +12 -0
- package/src/tokens/provider.tokens.js.map +1 -0
- package/src/tokens/resource.tokens.d.ts +20 -0
- package/src/tokens/resource.tokens.js +25 -0
- package/src/tokens/resource.tokens.js.map +1 -0
- package/src/tokens/server.tokens.d.ts +6 -0
- package/src/tokens/server.tokens.js +11 -0
- package/src/tokens/server.tokens.js.map +1 -0
- package/src/tokens/tool.tokens.d.ts +13 -0
- package/src/tokens/tool.tokens.js +18 -0
- package/src/tokens/tool.tokens.js.map +1 -0
- package/src/types/auth/index.d.ts +2 -0
- package/src/types/auth/index.js +6 -0
- package/src/types/auth/index.js.map +1 -0
- package/src/types/auth/jwt.types.d.ts +112 -0
- package/src/types/auth/jwt.types.js +36 -0
- package/src/types/auth/jwt.types.js.map +1 -0
- package/src/types/auth/session.types.d.ts +263 -0
- package/src/types/auth/session.types.js +40 -0
- package/src/types/auth/session.types.js.map +1 -0
- package/src/types/common.types.d.ts +11 -0
- package/src/types/common.types.js +3 -0
- package/src/types/common.types.js.map +1 -0
- package/src/types/index.d.ts +3 -0
- package/src/types/index.js +7 -0
- package/src/types/index.js.map +1 -0
- package/src/types/options/auth.options.d.ts +513 -0
- package/src/types/options/auth.options.js +53 -0
- package/src/types/options/auth.options.js.map +1 -0
- package/src/types/options/http.options.d.ts +22 -0
- package/src/types/options/http.options.js +10 -0
- package/src/types/options/http.options.js.map +1 -0
- package/src/types/options/index.d.ts +5 -0
- package/src/types/options/index.js +9 -0
- package/src/types/options/index.js.map +1 -0
- package/src/types/options/logging.options.d.ts +39 -0
- package/src/types/options/logging.options.js +37 -0
- package/src/types/options/logging.options.js.map +1 -0
- package/src/types/options/server-info.options.d.ts +48 -0
- package/src/types/options/server-info.options.js +13 -0
- package/src/types/options/server-info.options.js.map +1 -0
- package/src/types/options/session.options.d.ts +67 -0
- package/src/types/options/session.options.js +9 -0
- package/src/types/options/session.options.js.map +1 -0
- package/src/utils/decide-request-intent.utils.d.ts +79 -0
- package/src/utils/decide-request-intent.utils.js +326 -0
- package/src/utils/decide-request-intent.utils.js.map +1 -0
- package/src/utils/index.d.ts +2 -0
- package/src/utils/index.js +6 -0
- package/src/utils/index.js.map +1 -0
- package/src/utils/path.utils.d.ts +20 -0
- package/src/utils/path.utils.js +66 -0
- package/src/utils/path.utils.js.map +1 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.authorizationSchema = exports.sessionIdSchema = exports.sessionIdPayloadSchema = exports.userClaimSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.userClaimSchema = zod_1.z.object({
|
|
6
|
+
iss: zod_1.z.string(),
|
|
7
|
+
sid: zod_1.z.string().optional(),
|
|
8
|
+
sub: zod_1.z.string(),
|
|
9
|
+
exp: zod_1.z.number().optional(),
|
|
10
|
+
iat: zod_1.z.number().optional(),
|
|
11
|
+
aud: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
12
|
+
email: zod_1.z.string().optional(),
|
|
13
|
+
username: zod_1.z.string().optional(),
|
|
14
|
+
preferred_username: zod_1.z.string().optional(),
|
|
15
|
+
name: zod_1.z.string().optional(),
|
|
16
|
+
picture: zod_1.z.string().optional(),
|
|
17
|
+
}).passthrough();
|
|
18
|
+
exports.sessionIdPayloadSchema = zod_1.z.object({
|
|
19
|
+
nodeId: zod_1.z.string(),
|
|
20
|
+
authSig: zod_1.z.string(),
|
|
21
|
+
uuid: zod_1.z.string().uuid(),
|
|
22
|
+
iat: zod_1.z.number(),
|
|
23
|
+
protocol: zod_1.z.enum([
|
|
24
|
+
'legacy-sse',
|
|
25
|
+
'sse',
|
|
26
|
+
'streamable-http',
|
|
27
|
+
'stateful-http',
|
|
28
|
+
'stateless-http',
|
|
29
|
+
]),
|
|
30
|
+
});
|
|
31
|
+
exports.sessionIdSchema = zod_1.z.object({
|
|
32
|
+
id: zod_1.z.string(),
|
|
33
|
+
payload: exports.sessionIdPayloadSchema,
|
|
34
|
+
});
|
|
35
|
+
exports.authorizationSchema = zod_1.z.object({
|
|
36
|
+
token: zod_1.z.string(),
|
|
37
|
+
session: exports.sessionIdSchema.optional(),
|
|
38
|
+
user: exports.userClaimSchema,
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=session.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.types.js","sourceRoot":"","sources":["../../../../src/types/auth/session.types.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAmBX,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,GAAG,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC1D,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,kBAAkB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACzC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACE,CAAC,CAAC,WAAW,EAAE,CAAC;AAerC,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACvB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;IACf,QAAQ,EAAE,OAAC,CAAC,IAAI,CAAC;QACf,YAAY;QACZ,KAAK;QACL,iBAAiB;QACjB,eAAe;QACf,gBAAgB;KACjB,CAAC;CACqC,CAAC,CAAC;AAY9B,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC;IACtC,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;IACd,OAAO,EAAE,8BAAsB;CACiC,CAAC,CAAC;AAEvD,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,uBAAe,CAAC,QAAQ,EAAE;IACnC,IAAI,EAAE,uBAAe;CACe,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { HttpRequestIntent, RawZodShape } from '@frontmcp/sdk';\n\n/**\n * Decoded JWT payload (if any) or empty object\n */\nexport type UserClaim = {\n iss: string;\n sid?: string;\n sub: string;\n exp?: number;\n iat?: number;\n aud?: string | string[];\n email?: string;\n username?: string;\n preferred_username?: string;\n name?: string;\n picture?: string;\n}\nexport const userClaimSchema = z.object({\n iss: z.string(),\n sid: z.string().optional(),\n sub: z.string(),\n exp: z.number().optional(),\n iat: z.number().optional(),\n aud: z.union([z.string(), z.array(z.string())]).optional(),\n email: z.string().optional(),\n username: z.string().optional(),\n preferred_username: z.string().optional(),\n name: z.string().optional(),\n picture: z.string().optional(),\n} satisfies RawZodShape<UserClaim>).passthrough();\n\n\nexport type SessionIdPayload = {\n /* The actual node id that handle the transport session */\n nodeId: string;\n /* The signature of the token used to create the session */\n authSig: string;\n /* The unique id of the session */\n uuid: string;\n /* The timestamp of the session creation */\n iat: number;\n /* The protocol used in existing transport */\n protocol: HttpRequestIntent;\n}\nexport const sessionIdPayloadSchema = z.object({\n nodeId: z.string(),\n authSig: z.string(),\n uuid: z.string().uuid(),\n iat: z.number(),\n protocol: z.enum([\n 'legacy-sse',\n 'sse',\n 'streamable-http',\n 'stateful-http',\n 'stateless-http',\n ]),\n} satisfies RawZodShape<SessionIdPayload>);\n\n\nexport interface Authorization {\n token: string;\n user: UserClaim;\n session?: {\n id: string;\n payload: SessionIdPayload;\n };\n}\n\nexport const sessionIdSchema = z.object({\n id: z.string(),\n payload: sessionIdPayloadSchema,\n} satisfies RawZodShape<{ id: string, payload: SessionIdPayload }>);\n\nexport const authorizationSchema = z.object({\n token: z.string(),\n session: sessionIdSchema.optional(),\n user: userClaimSchema,\n} satisfies RawZodShape<Authorization>);\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export type RawZodShape<Type, Base = {}> = {
|
|
3
|
+
[K in keyof Omit<Type, keyof Base>]-?: z.ZodTypeAny;
|
|
4
|
+
};
|
|
5
|
+
export type RawMetadataShape<Type, Base = {}> = ({
|
|
6
|
+
[K in keyof Omit<Type, keyof Base>]-?: symbol;
|
|
7
|
+
} & {
|
|
8
|
+
type: symbol;
|
|
9
|
+
} & {
|
|
10
|
+
[K in any]: symbol;
|
|
11
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.types.js","sourceRoot":"","sources":["../../../src/types/common.types.ts"],"names":[],"mappings":"","sourcesContent":["import { z } from 'zod';\n\nexport type RawZodShape<Type, Base = {}> = {\n [K in keyof Omit<Type, keyof Base>]-?: z.ZodTypeAny;\n}\nexport type RawMetadataShape<Type, Base = {}> = ({\n [K in keyof Omit<Type, keyof Base>]-?: symbol;\n} & { type: symbol }& { [K in any]: symbol })"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./auth"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./options"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./common.types"), exports);
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,oDAA0B;AAC1B,yDAA+B","sourcesContent":["export * from './auth';\nexport * from './options';\nexport * from './common.types';\n"]}
|
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { JSONWebKeySet, JWK } from '../auth';
|
|
3
|
+
export type RemoteAuthOptions = {
|
|
4
|
+
type: 'remote';
|
|
5
|
+
/**
|
|
6
|
+
* unique id for the provider
|
|
7
|
+
*/
|
|
8
|
+
id?: string;
|
|
9
|
+
/**
|
|
10
|
+
* human-readable name for the provider
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* base url of the provider
|
|
15
|
+
* if the provider does not support dcr it will be used with local auth provider proxy
|
|
16
|
+
* to register client dynamically you have to provide client id for the registration flow
|
|
17
|
+
* @example https://my-company.frontegg.com
|
|
18
|
+
*/
|
|
19
|
+
baseUrl: string;
|
|
20
|
+
/**
|
|
21
|
+
* enable dynamic client registration (DCR) flow, if your provider does not support DCR
|
|
22
|
+
* you can set this to false and provide clientId for authorization flow, we will use local auth provider proxy
|
|
23
|
+
* to register a dynamic client with the provided clientId or by called clientId function with client info
|
|
24
|
+
* by default, the provider will use the registration endpoint to register the client dynamically
|
|
25
|
+
*/
|
|
26
|
+
dcrEnabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Only used if your auth provider does not support DCR.
|
|
29
|
+
* for Dcr auth provider the client id acquired by the registration flow
|
|
30
|
+
*/
|
|
31
|
+
clientId?: string | ((clientInfo: {
|
|
32
|
+
clientId: string;
|
|
33
|
+
}) => string);
|
|
34
|
+
/**
|
|
35
|
+
* Set default gateway oauth server mode, this will be overridden by discovery flow.
|
|
36
|
+
* if set to transparent and the discovery flow detect orchestrated mode it will switch to orchestrated mode
|
|
37
|
+
* @default 'transparent'
|
|
38
|
+
*/
|
|
39
|
+
mode?: 'orchestrated' | 'transparent';
|
|
40
|
+
/**
|
|
41
|
+
* allow anonymous access to the provider
|
|
42
|
+
* @default false - allowing anonymous access will make the provider to issue an orchestrated token
|
|
43
|
+
*/
|
|
44
|
+
allowAnonymous?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* allow consent mode to select tools/resource/prompts after authorization
|
|
47
|
+
* for scoped based access token
|
|
48
|
+
* @default false - allowing anonymous access will make the provider to issue an orchestrated token
|
|
49
|
+
*/
|
|
50
|
+
consent?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* scopes for the token endpoint
|
|
53
|
+
* @default undefined - all scopes supported by th provider
|
|
54
|
+
*/
|
|
55
|
+
scopes?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* authorization provider supported grant types, currently only authorization_code and refresh_token are supported
|
|
58
|
+
* @default undefined - default is what presented in the /.well-known/oauth-authorization-server
|
|
59
|
+
*/
|
|
60
|
+
grantTypes?: ('authorization_code' | 'refresh_token')[];
|
|
61
|
+
/**
|
|
62
|
+
* authorization endpoint for the provider
|
|
63
|
+
* @default undefined - default is what presented in the /.well-known/oauth-authorization-server
|
|
64
|
+
*/
|
|
65
|
+
authEndpoint?: string;
|
|
66
|
+
/**
|
|
67
|
+
* token endpoint for the provider
|
|
68
|
+
* @default undefined - default is what presented in the /.well-known/oauth-authorization-server
|
|
69
|
+
*/
|
|
70
|
+
tokenEndpoint?: string;
|
|
71
|
+
/**
|
|
72
|
+
* registration endpoint for the provider (DCR)
|
|
73
|
+
* @default undefined - default is what presented in the /.well-known/oauth-authorization-server
|
|
74
|
+
*/
|
|
75
|
+
registrationEndpoint?: string;
|
|
76
|
+
/**
|
|
77
|
+
* user info endpoint for the provider
|
|
78
|
+
* @default undefined - default is what presented in the /.well-known/oauth-authorization-server
|
|
79
|
+
*/
|
|
80
|
+
userInfoEndpoint?: string;
|
|
81
|
+
/**
|
|
82
|
+
* Inline JWKS for the provider to verify tokens without automatic fetching
|
|
83
|
+
* @default undefined - default is what presented in the /.well-known/jwks.json
|
|
84
|
+
*/
|
|
85
|
+
jwks?: JSONWebKeySet;
|
|
86
|
+
/**
|
|
87
|
+
* jwks uri for the provider
|
|
88
|
+
* @default undefined - default is what presented in the /.well-known/oauth-authorization-server
|
|
89
|
+
*/
|
|
90
|
+
jwksUri?: string;
|
|
91
|
+
};
|
|
92
|
+
export declare const remoteAuthOptionsSchema: z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"remote">;
|
|
94
|
+
id: z.ZodOptional<z.ZodString>;
|
|
95
|
+
name: z.ZodString;
|
|
96
|
+
baseUrl: z.ZodString;
|
|
97
|
+
dcrEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
98
|
+
clientId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
99
|
+
clientId: z.ZodString;
|
|
100
|
+
}, "strip", z.ZodTypeAny, {
|
|
101
|
+
clientId: string;
|
|
102
|
+
}, {
|
|
103
|
+
clientId: string;
|
|
104
|
+
}>], z.ZodUnknown>, z.ZodString>]>>;
|
|
105
|
+
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"orchestrated">, z.ZodLiteral<"transparent">]>>;
|
|
106
|
+
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
107
|
+
consent: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
jwks: z.ZodOptional<z.ZodObject<{
|
|
109
|
+
keys: z.ZodArray<z.ZodType<JWK, z.ZodTypeDef, JWK>, "many">;
|
|
110
|
+
}, "strip", z.ZodTypeAny, {
|
|
111
|
+
keys: JWK[];
|
|
112
|
+
}, {
|
|
113
|
+
keys: JWK[];
|
|
114
|
+
}>>;
|
|
115
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
116
|
+
grantTypes: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>, "many">>;
|
|
117
|
+
authEndpoint: z.ZodOptional<z.ZodString>;
|
|
118
|
+
tokenEndpoint: z.ZodOptional<z.ZodString>;
|
|
119
|
+
registrationEndpoint: z.ZodOptional<z.ZodString>;
|
|
120
|
+
userInfoEndpoint: z.ZodOptional<z.ZodString>;
|
|
121
|
+
jwksUri: z.ZodOptional<z.ZodString>;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
name: string;
|
|
124
|
+
type: "remote";
|
|
125
|
+
baseUrl: string;
|
|
126
|
+
id?: string | undefined;
|
|
127
|
+
dcrEnabled?: boolean | undefined;
|
|
128
|
+
clientId?: string | ((args_0: {
|
|
129
|
+
clientId: string;
|
|
130
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
131
|
+
mode?: "orchestrated" | "transparent" | undefined;
|
|
132
|
+
allowAnonymous?: boolean | undefined;
|
|
133
|
+
consent?: boolean | undefined;
|
|
134
|
+
scopes?: string[] | undefined;
|
|
135
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
136
|
+
authEndpoint?: string | undefined;
|
|
137
|
+
tokenEndpoint?: string | undefined;
|
|
138
|
+
registrationEndpoint?: string | undefined;
|
|
139
|
+
userInfoEndpoint?: string | undefined;
|
|
140
|
+
jwks?: {
|
|
141
|
+
keys: JWK[];
|
|
142
|
+
} | undefined;
|
|
143
|
+
jwksUri?: string | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
name: string;
|
|
146
|
+
type: "remote";
|
|
147
|
+
baseUrl: string;
|
|
148
|
+
id?: string | undefined;
|
|
149
|
+
dcrEnabled?: boolean | undefined;
|
|
150
|
+
clientId?: string | ((args_0: {
|
|
151
|
+
clientId: string;
|
|
152
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
153
|
+
mode?: "orchestrated" | "transparent" | undefined;
|
|
154
|
+
allowAnonymous?: boolean | undefined;
|
|
155
|
+
consent?: boolean | undefined;
|
|
156
|
+
scopes?: string[] | undefined;
|
|
157
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
158
|
+
authEndpoint?: string | undefined;
|
|
159
|
+
tokenEndpoint?: string | undefined;
|
|
160
|
+
registrationEndpoint?: string | undefined;
|
|
161
|
+
userInfoEndpoint?: string | undefined;
|
|
162
|
+
jwks?: {
|
|
163
|
+
keys: JWK[];
|
|
164
|
+
} | undefined;
|
|
165
|
+
jwksUri?: string | undefined;
|
|
166
|
+
}>;
|
|
167
|
+
export type LocalAuthOptions = {
|
|
168
|
+
type: 'local';
|
|
169
|
+
/**
|
|
170
|
+
* unique id for the provider
|
|
171
|
+
*/
|
|
172
|
+
id: string;
|
|
173
|
+
/**
|
|
174
|
+
* human-readable name for the provider
|
|
175
|
+
*/
|
|
176
|
+
name: string;
|
|
177
|
+
/**
|
|
178
|
+
* scopes for the token endpoint
|
|
179
|
+
* @default undefined - all scopes supported by th provider
|
|
180
|
+
*/
|
|
181
|
+
scopes?: string[];
|
|
182
|
+
/**
|
|
183
|
+
* currently only authorization_code and refresh_token are supported
|
|
184
|
+
* @default ['authorization_code', 'refresh_token']
|
|
185
|
+
*/
|
|
186
|
+
grantTypes?: ('authorization_code' | 'refresh_token')[];
|
|
187
|
+
/**
|
|
188
|
+
* allow anonymous access to the provider
|
|
189
|
+
* in this case the provider will act as an authorization server
|
|
190
|
+
* @default true
|
|
191
|
+
*/
|
|
192
|
+
allowAnonymous?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* allow consent mode to select tools/resource/prompts after authorization
|
|
195
|
+
* for scoped based access token
|
|
196
|
+
* @default false - allowing anonymous access will make the provider to issue an orchestrated token
|
|
197
|
+
*/
|
|
198
|
+
consent?: boolean;
|
|
199
|
+
/**
|
|
200
|
+
* Inline JWKS for the provider to verify tokens for local provider
|
|
201
|
+
* it will also used in /.well-known/jwks.json
|
|
202
|
+
* @default undefined - default is auto generated keys and saved in the temp folder
|
|
203
|
+
*/
|
|
204
|
+
jwks?: JSONWebKeySet;
|
|
205
|
+
/**
|
|
206
|
+
* private key signing tokens for local provider
|
|
207
|
+
* @default undefined - default is auto generated keys and saved in the temp folder
|
|
208
|
+
*/
|
|
209
|
+
signKey?: JWK | Uint8Array;
|
|
210
|
+
};
|
|
211
|
+
export declare const localAuthOptionsSchema: z.ZodObject<{
|
|
212
|
+
type: z.ZodLiteral<"local">;
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
name: z.ZodString;
|
|
215
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
216
|
+
grantTypes: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>, "many">>;
|
|
217
|
+
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
218
|
+
consent: z.ZodOptional<z.ZodBoolean>;
|
|
219
|
+
jwks: z.ZodOptional<z.ZodObject<{
|
|
220
|
+
keys: z.ZodArray<z.ZodType<JWK, z.ZodTypeDef, JWK>, "many">;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
keys: JWK[];
|
|
223
|
+
}, {
|
|
224
|
+
keys: JWK[];
|
|
225
|
+
}>>;
|
|
226
|
+
signKey: z.ZodOptional<z.ZodUnion<[z.ZodType<JWK, z.ZodTypeDef, JWK>, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>>;
|
|
227
|
+
}, "strip", z.ZodTypeAny, {
|
|
228
|
+
name: string;
|
|
229
|
+
id: string;
|
|
230
|
+
type: "local";
|
|
231
|
+
allowAnonymous?: boolean | undefined;
|
|
232
|
+
consent?: boolean | undefined;
|
|
233
|
+
scopes?: string[] | undefined;
|
|
234
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
235
|
+
jwks?: {
|
|
236
|
+
keys: JWK[];
|
|
237
|
+
} | undefined;
|
|
238
|
+
signKey?: JWK | Uint8Array<ArrayBuffer> | undefined;
|
|
239
|
+
}, {
|
|
240
|
+
name: string;
|
|
241
|
+
id: string;
|
|
242
|
+
type: "local";
|
|
243
|
+
allowAnonymous?: boolean | undefined;
|
|
244
|
+
consent?: boolean | undefined;
|
|
245
|
+
scopes?: string[] | undefined;
|
|
246
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
247
|
+
jwks?: {
|
|
248
|
+
keys: JWK[];
|
|
249
|
+
} | undefined;
|
|
250
|
+
signKey?: JWK | Uint8Array<ArrayBuffer> | undefined;
|
|
251
|
+
}>;
|
|
252
|
+
export declare const authOptionsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
253
|
+
type: z.ZodLiteral<"remote">;
|
|
254
|
+
id: z.ZodOptional<z.ZodString>;
|
|
255
|
+
name: z.ZodString;
|
|
256
|
+
baseUrl: z.ZodString;
|
|
257
|
+
dcrEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
258
|
+
clientId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
259
|
+
clientId: z.ZodString;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
clientId: string;
|
|
262
|
+
}, {
|
|
263
|
+
clientId: string;
|
|
264
|
+
}>], z.ZodUnknown>, z.ZodString>]>>;
|
|
265
|
+
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"orchestrated">, z.ZodLiteral<"transparent">]>>;
|
|
266
|
+
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
267
|
+
consent: z.ZodOptional<z.ZodBoolean>;
|
|
268
|
+
jwks: z.ZodOptional<z.ZodObject<{
|
|
269
|
+
keys: z.ZodArray<z.ZodType<JWK, z.ZodTypeDef, JWK>, "many">;
|
|
270
|
+
}, "strip", z.ZodTypeAny, {
|
|
271
|
+
keys: JWK[];
|
|
272
|
+
}, {
|
|
273
|
+
keys: JWK[];
|
|
274
|
+
}>>;
|
|
275
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
276
|
+
grantTypes: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>, "many">>;
|
|
277
|
+
authEndpoint: z.ZodOptional<z.ZodString>;
|
|
278
|
+
tokenEndpoint: z.ZodOptional<z.ZodString>;
|
|
279
|
+
registrationEndpoint: z.ZodOptional<z.ZodString>;
|
|
280
|
+
userInfoEndpoint: z.ZodOptional<z.ZodString>;
|
|
281
|
+
jwksUri: z.ZodOptional<z.ZodString>;
|
|
282
|
+
}, "strip", z.ZodTypeAny, {
|
|
283
|
+
name: string;
|
|
284
|
+
type: "remote";
|
|
285
|
+
baseUrl: string;
|
|
286
|
+
id?: string | undefined;
|
|
287
|
+
dcrEnabled?: boolean | undefined;
|
|
288
|
+
clientId?: string | ((args_0: {
|
|
289
|
+
clientId: string;
|
|
290
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
291
|
+
mode?: "orchestrated" | "transparent" | undefined;
|
|
292
|
+
allowAnonymous?: boolean | undefined;
|
|
293
|
+
consent?: boolean | undefined;
|
|
294
|
+
scopes?: string[] | undefined;
|
|
295
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
296
|
+
authEndpoint?: string | undefined;
|
|
297
|
+
tokenEndpoint?: string | undefined;
|
|
298
|
+
registrationEndpoint?: string | undefined;
|
|
299
|
+
userInfoEndpoint?: string | undefined;
|
|
300
|
+
jwks?: {
|
|
301
|
+
keys: JWK[];
|
|
302
|
+
} | undefined;
|
|
303
|
+
jwksUri?: string | undefined;
|
|
304
|
+
}, {
|
|
305
|
+
name: string;
|
|
306
|
+
type: "remote";
|
|
307
|
+
baseUrl: string;
|
|
308
|
+
id?: string | undefined;
|
|
309
|
+
dcrEnabled?: boolean | undefined;
|
|
310
|
+
clientId?: string | ((args_0: {
|
|
311
|
+
clientId: string;
|
|
312
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
313
|
+
mode?: "orchestrated" | "transparent" | undefined;
|
|
314
|
+
allowAnonymous?: boolean | undefined;
|
|
315
|
+
consent?: boolean | undefined;
|
|
316
|
+
scopes?: string[] | undefined;
|
|
317
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
318
|
+
authEndpoint?: string | undefined;
|
|
319
|
+
tokenEndpoint?: string | undefined;
|
|
320
|
+
registrationEndpoint?: string | undefined;
|
|
321
|
+
userInfoEndpoint?: string | undefined;
|
|
322
|
+
jwks?: {
|
|
323
|
+
keys: JWK[];
|
|
324
|
+
} | undefined;
|
|
325
|
+
jwksUri?: string | undefined;
|
|
326
|
+
}>, z.ZodObject<{
|
|
327
|
+
type: z.ZodLiteral<"local">;
|
|
328
|
+
id: z.ZodString;
|
|
329
|
+
name: z.ZodString;
|
|
330
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
331
|
+
grantTypes: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>, "many">>;
|
|
332
|
+
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
333
|
+
consent: z.ZodOptional<z.ZodBoolean>;
|
|
334
|
+
jwks: z.ZodOptional<z.ZodObject<{
|
|
335
|
+
keys: z.ZodArray<z.ZodType<JWK, z.ZodTypeDef, JWK>, "many">;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
keys: JWK[];
|
|
338
|
+
}, {
|
|
339
|
+
keys: JWK[];
|
|
340
|
+
}>>;
|
|
341
|
+
signKey: z.ZodOptional<z.ZodUnion<[z.ZodType<JWK, z.ZodTypeDef, JWK>, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>>;
|
|
342
|
+
}, "strip", z.ZodTypeAny, {
|
|
343
|
+
name: string;
|
|
344
|
+
id: string;
|
|
345
|
+
type: "local";
|
|
346
|
+
allowAnonymous?: boolean | undefined;
|
|
347
|
+
consent?: boolean | undefined;
|
|
348
|
+
scopes?: string[] | undefined;
|
|
349
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
350
|
+
jwks?: {
|
|
351
|
+
keys: JWK[];
|
|
352
|
+
} | undefined;
|
|
353
|
+
signKey?: JWK | Uint8Array<ArrayBuffer> | undefined;
|
|
354
|
+
}, {
|
|
355
|
+
name: string;
|
|
356
|
+
id: string;
|
|
357
|
+
type: "local";
|
|
358
|
+
allowAnonymous?: boolean | undefined;
|
|
359
|
+
consent?: boolean | undefined;
|
|
360
|
+
scopes?: string[] | undefined;
|
|
361
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
362
|
+
jwks?: {
|
|
363
|
+
keys: JWK[];
|
|
364
|
+
} | undefined;
|
|
365
|
+
signKey?: JWK | Uint8Array<ArrayBuffer> | undefined;
|
|
366
|
+
}>]>;
|
|
367
|
+
export type AuthOptions = RemoteAuthOptions | LocalAuthOptions;
|
|
368
|
+
type StandaloneOption = {
|
|
369
|
+
/**
|
|
370
|
+
* if the provider is standalone or not, if standalone it will register an oauth service provider
|
|
371
|
+
* on app's entry path, if not standalone it will be registered as a child provider
|
|
372
|
+
* under the root provider
|
|
373
|
+
* @default false
|
|
374
|
+
*/
|
|
375
|
+
standalone?: boolean;
|
|
376
|
+
/**
|
|
377
|
+
* if the provider should be excluded from the parent provider's discovery
|
|
378
|
+
* this used for standalone providers
|
|
379
|
+
* @default false
|
|
380
|
+
*/
|
|
381
|
+
excludeFromParent?: boolean;
|
|
382
|
+
};
|
|
383
|
+
export declare const appAuthOptionsSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
384
|
+
type: z.ZodLiteral<"remote">;
|
|
385
|
+
id: z.ZodOptional<z.ZodString>;
|
|
386
|
+
name: z.ZodString;
|
|
387
|
+
baseUrl: z.ZodString;
|
|
388
|
+
dcrEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
389
|
+
clientId: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
390
|
+
clientId: z.ZodString;
|
|
391
|
+
}, "strip", z.ZodTypeAny, {
|
|
392
|
+
clientId: string;
|
|
393
|
+
}, {
|
|
394
|
+
clientId: string;
|
|
395
|
+
}>], z.ZodUnknown>, z.ZodString>]>>;
|
|
396
|
+
mode: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"orchestrated">, z.ZodLiteral<"transparent">]>>;
|
|
397
|
+
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
398
|
+
consent: z.ZodOptional<z.ZodBoolean>;
|
|
399
|
+
jwks: z.ZodOptional<z.ZodObject<{
|
|
400
|
+
keys: z.ZodArray<z.ZodType<JWK, z.ZodTypeDef, JWK>, "many">;
|
|
401
|
+
}, "strip", z.ZodTypeAny, {
|
|
402
|
+
keys: JWK[];
|
|
403
|
+
}, {
|
|
404
|
+
keys: JWK[];
|
|
405
|
+
}>>;
|
|
406
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
407
|
+
grantTypes: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>, "many">>;
|
|
408
|
+
authEndpoint: z.ZodOptional<z.ZodString>;
|
|
409
|
+
tokenEndpoint: z.ZodOptional<z.ZodString>;
|
|
410
|
+
registrationEndpoint: z.ZodOptional<z.ZodString>;
|
|
411
|
+
userInfoEndpoint: z.ZodOptional<z.ZodString>;
|
|
412
|
+
jwksUri: z.ZodOptional<z.ZodString>;
|
|
413
|
+
} & {
|
|
414
|
+
standalone: z.ZodOptional<z.ZodBoolean>;
|
|
415
|
+
excludeFromParent: z.ZodOptional<z.ZodBoolean>;
|
|
416
|
+
}, "strip", z.ZodTypeAny, {
|
|
417
|
+
name: string;
|
|
418
|
+
type: "remote";
|
|
419
|
+
baseUrl: string;
|
|
420
|
+
id?: string | undefined;
|
|
421
|
+
dcrEnabled?: boolean | undefined;
|
|
422
|
+
clientId?: string | ((args_0: {
|
|
423
|
+
clientId: string;
|
|
424
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
425
|
+
mode?: "orchestrated" | "transparent" | undefined;
|
|
426
|
+
allowAnonymous?: boolean | undefined;
|
|
427
|
+
consent?: boolean | undefined;
|
|
428
|
+
scopes?: string[] | undefined;
|
|
429
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
430
|
+
authEndpoint?: string | undefined;
|
|
431
|
+
tokenEndpoint?: string | undefined;
|
|
432
|
+
registrationEndpoint?: string | undefined;
|
|
433
|
+
userInfoEndpoint?: string | undefined;
|
|
434
|
+
jwks?: {
|
|
435
|
+
keys: JWK[];
|
|
436
|
+
} | undefined;
|
|
437
|
+
jwksUri?: string | undefined;
|
|
438
|
+
standalone?: boolean | undefined;
|
|
439
|
+
excludeFromParent?: boolean | undefined;
|
|
440
|
+
}, {
|
|
441
|
+
name: string;
|
|
442
|
+
type: "remote";
|
|
443
|
+
baseUrl: string;
|
|
444
|
+
id?: string | undefined;
|
|
445
|
+
dcrEnabled?: boolean | undefined;
|
|
446
|
+
clientId?: string | ((args_0: {
|
|
447
|
+
clientId: string;
|
|
448
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
449
|
+
mode?: "orchestrated" | "transparent" | undefined;
|
|
450
|
+
allowAnonymous?: boolean | undefined;
|
|
451
|
+
consent?: boolean | undefined;
|
|
452
|
+
scopes?: string[] | undefined;
|
|
453
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
454
|
+
authEndpoint?: string | undefined;
|
|
455
|
+
tokenEndpoint?: string | undefined;
|
|
456
|
+
registrationEndpoint?: string | undefined;
|
|
457
|
+
userInfoEndpoint?: string | undefined;
|
|
458
|
+
jwks?: {
|
|
459
|
+
keys: JWK[];
|
|
460
|
+
} | undefined;
|
|
461
|
+
jwksUri?: string | undefined;
|
|
462
|
+
standalone?: boolean | undefined;
|
|
463
|
+
excludeFromParent?: boolean | undefined;
|
|
464
|
+
}>, z.ZodObject<{
|
|
465
|
+
type: z.ZodLiteral<"local">;
|
|
466
|
+
id: z.ZodString;
|
|
467
|
+
name: z.ZodString;
|
|
468
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
469
|
+
grantTypes: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodLiteral<"authorization_code">, z.ZodLiteral<"refresh_token">]>, "many">>;
|
|
470
|
+
allowAnonymous: z.ZodOptional<z.ZodBoolean>;
|
|
471
|
+
consent: z.ZodOptional<z.ZodBoolean>;
|
|
472
|
+
jwks: z.ZodOptional<z.ZodObject<{
|
|
473
|
+
keys: z.ZodArray<z.ZodType<JWK, z.ZodTypeDef, JWK>, "many">;
|
|
474
|
+
}, "strip", z.ZodTypeAny, {
|
|
475
|
+
keys: JWK[];
|
|
476
|
+
}, {
|
|
477
|
+
keys: JWK[];
|
|
478
|
+
}>>;
|
|
479
|
+
signKey: z.ZodOptional<z.ZodUnion<[z.ZodType<JWK, z.ZodTypeDef, JWK>, z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>]>>;
|
|
480
|
+
} & {
|
|
481
|
+
standalone: z.ZodOptional<z.ZodBoolean>;
|
|
482
|
+
excludeFromParent: z.ZodOptional<z.ZodBoolean>;
|
|
483
|
+
}, "strip", z.ZodTypeAny, {
|
|
484
|
+
name: string;
|
|
485
|
+
id: string;
|
|
486
|
+
type: "local";
|
|
487
|
+
allowAnonymous?: boolean | undefined;
|
|
488
|
+
consent?: boolean | undefined;
|
|
489
|
+
scopes?: string[] | undefined;
|
|
490
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
491
|
+
jwks?: {
|
|
492
|
+
keys: JWK[];
|
|
493
|
+
} | undefined;
|
|
494
|
+
signKey?: JWK | Uint8Array<ArrayBuffer> | undefined;
|
|
495
|
+
standalone?: boolean | undefined;
|
|
496
|
+
excludeFromParent?: boolean | undefined;
|
|
497
|
+
}, {
|
|
498
|
+
name: string;
|
|
499
|
+
id: string;
|
|
500
|
+
type: "local";
|
|
501
|
+
allowAnonymous?: boolean | undefined;
|
|
502
|
+
consent?: boolean | undefined;
|
|
503
|
+
scopes?: string[] | undefined;
|
|
504
|
+
grantTypes?: ("authorization_code" | "refresh_token")[] | undefined;
|
|
505
|
+
jwks?: {
|
|
506
|
+
keys: JWK[];
|
|
507
|
+
} | undefined;
|
|
508
|
+
signKey?: JWK | Uint8Array<ArrayBuffer> | undefined;
|
|
509
|
+
standalone?: boolean | undefined;
|
|
510
|
+
excludeFromParent?: boolean | undefined;
|
|
511
|
+
}>]>;
|
|
512
|
+
export type AppAuthOptions = (RemoteAuthOptions | LocalAuthOptions) & StandaloneOption;
|
|
513
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.appAuthOptionsSchema = exports.authOptionsSchema = exports.localAuthOptionsSchema = exports.remoteAuthOptionsSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
exports.remoteAuthOptionsSchema = zod_1.z.object({
|
|
7
|
+
type: zod_1.z.literal('remote'),
|
|
8
|
+
id: zod_1.z.string().optional(),
|
|
9
|
+
name: zod_1.z.string(),
|
|
10
|
+
baseUrl: zod_1.z.string(),
|
|
11
|
+
dcrEnabled: zod_1.z.boolean().optional(),
|
|
12
|
+
clientId: zod_1.z
|
|
13
|
+
.union([
|
|
14
|
+
zod_1.z.string(),
|
|
15
|
+
zod_1.z.function().args(zod_1.z.object({ clientId: zod_1.z.string() })).returns(zod_1.z.string())
|
|
16
|
+
])
|
|
17
|
+
.optional(),
|
|
18
|
+
mode: zod_1.z.union([zod_1.z.literal('orchestrated'), zod_1.z.literal('transparent')]).optional(),
|
|
19
|
+
allowAnonymous: zod_1.z.boolean().optional(),
|
|
20
|
+
consent: zod_1.z.boolean().optional(),
|
|
21
|
+
jwks: auth_1.jsonWebKeySetSchema.optional(),
|
|
22
|
+
scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
23
|
+
grantTypes: zod_1.z.array(zod_1.z.union([zod_1.z.literal('authorization_code'), zod_1.z.literal('refresh_token')])).optional(),
|
|
24
|
+
authEndpoint: zod_1.z.string().optional(),
|
|
25
|
+
tokenEndpoint: zod_1.z.string().optional(),
|
|
26
|
+
registrationEndpoint: zod_1.z.string().optional(),
|
|
27
|
+
userInfoEndpoint: zod_1.z.string().optional(),
|
|
28
|
+
jwksUri: zod_1.z.string().optional(),
|
|
29
|
+
});
|
|
30
|
+
exports.localAuthOptionsSchema = zod_1.z.object({
|
|
31
|
+
type: zod_1.z.literal('local'),
|
|
32
|
+
id: zod_1.z.string(),
|
|
33
|
+
name: zod_1.z.string(),
|
|
34
|
+
scopes: zod_1.z.array(zod_1.z.string()).optional(),
|
|
35
|
+
grantTypes: zod_1.z.array(zod_1.z.union([zod_1.z.literal('authorization_code'), zod_1.z.literal('refresh_token')])).optional(),
|
|
36
|
+
allowAnonymous: zod_1.z.boolean().optional(),
|
|
37
|
+
consent: zod_1.z.boolean().optional(),
|
|
38
|
+
jwks: auth_1.jsonWebKeySetSchema.optional(),
|
|
39
|
+
signKey: auth_1.jwkSchema.or(zod_1.z.instanceof(Uint8Array)).optional(),
|
|
40
|
+
});
|
|
41
|
+
exports.authOptionsSchema = zod_1.z.discriminatedUnion('type', [
|
|
42
|
+
exports.remoteAuthOptionsSchema,
|
|
43
|
+
exports.localAuthOptionsSchema,
|
|
44
|
+
]);
|
|
45
|
+
const standaloneOptionSchema = {
|
|
46
|
+
standalone: zod_1.z.boolean().optional(),
|
|
47
|
+
excludeFromParent: zod_1.z.boolean().optional(),
|
|
48
|
+
};
|
|
49
|
+
exports.appAuthOptionsSchema = zod_1.z.discriminatedUnion('type', [
|
|
50
|
+
exports.remoteAuthOptionsSchema.extend(standaloneOptionSchema),
|
|
51
|
+
exports.localAuthOptionsSchema.extend(standaloneOptionSchema),
|
|
52
|
+
]);
|
|
53
|
+
//# sourceMappingURL=auth.options.js.map
|