toolception 0.6.1 → 0.6.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/README.md +1 -1
- package/dist/core/DynamicToolManager.d.ts +33 -22
- package/dist/core/DynamicToolManager.d.ts.map +1 -1
- package/dist/core/ServerOrchestrator.d.ts +33 -25
- package/dist/core/ServerOrchestrator.d.ts.map +1 -1
- package/dist/core/ToolRegistry.d.ts +5 -3
- package/dist/core/ToolRegistry.d.ts.map +1 -1
- package/dist/core/core.types.d.ts +29 -0
- package/dist/core/core.types.d.ts.map +1 -0
- package/dist/http/FastifyTransport.d.ts +49 -41
- package/dist/http/FastifyTransport.d.ts.map +1 -1
- package/dist/http/{customEndpoints.d.ts → http.types.d.ts} +33 -86
- package/dist/http/http.types.d.ts.map +1 -0
- package/dist/http/http.utils.d.ts +121 -0
- package/dist/http/http.utils.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1087 -850
- package/dist/index.js.map +1 -1
- package/dist/mode/ModeResolver.d.ts +11 -10
- package/dist/mode/ModeResolver.d.ts.map +1 -1
- package/dist/mode/ModuleResolver.d.ts +18 -4
- package/dist/mode/ModuleResolver.d.ts.map +1 -1
- package/dist/mode/mode.types.d.ts +15 -0
- package/dist/mode/mode.types.d.ts.map +1 -0
- package/dist/permissions/PermissionAwareFastifyTransport.d.ts +15 -39
- package/dist/permissions/PermissionAwareFastifyTransport.d.ts.map +1 -1
- package/dist/permissions/PermissionResolver.d.ts +9 -24
- package/dist/permissions/PermissionResolver.d.ts.map +1 -1
- package/dist/permissions/{createPermissionAwareBundle.d.ts → permissions.types.d.ts} +17 -18
- package/dist/permissions/permissions.types.d.ts.map +1 -0
- package/dist/permissions/permissions.utils.d.ts +31 -0
- package/dist/permissions/permissions.utils.d.ts.map +1 -0
- package/dist/server/createMcpServer.d.ts +3 -46
- package/dist/server/createMcpServer.d.ts.map +1 -1
- package/dist/server/createPermissionBasedMcpServer.d.ts +2 -64
- package/dist/server/createPermissionBasedMcpServer.d.ts.map +1 -1
- package/dist/server/server.types.d.ts +71 -0
- package/dist/server/server.types.d.ts.map +1 -0
- package/dist/server/server.utils.d.ts +45 -0
- package/dist/server/server.utils.d.ts.map +1 -0
- package/dist/session/ClientResourceCache.d.ts +8 -27
- package/dist/session/ClientResourceCache.d.ts.map +1 -1
- package/dist/session/SessionContextResolver.d.ts +21 -72
- package/dist/session/SessionContextResolver.d.ts.map +1 -1
- package/dist/session/session.types.d.ts +29 -0
- package/dist/session/session.types.d.ts.map +1 -0
- package/dist/session/{validateSessionContextConfig.d.ts → session.utils.d.ts} +1 -2
- package/dist/session/session.utils.d.ts.map +1 -0
- package/dist/types/index.d.ts +0 -24
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/http/customEndpoints.d.ts.map +0 -1
- package/dist/http/endpointRegistration.d.ts +0 -35
- package/dist/http/endpointRegistration.d.ts.map +0 -1
- package/dist/permissions/createPermissionAwareBundle.d.ts.map +0 -1
- package/dist/permissions/validatePermissionConfig.d.ts +0 -9
- package/dist/permissions/validatePermissionConfig.d.ts.map +0 -1
- package/dist/session/validateSessionContextConfig.d.ts.map +0 -1
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
maxSize?: number;
|
|
3
|
-
ttlMs?: number;
|
|
4
|
-
pruneIntervalMs?: number;
|
|
5
|
-
/**
|
|
6
|
-
* Optional cleanup callback called when a resource is removed from the cache.
|
|
7
|
-
* Use this to close connections, clean up sessions, etc.
|
|
8
|
-
* @param key - The cache key being removed
|
|
9
|
-
* @param resource - The resource being removed
|
|
10
|
-
*/
|
|
11
|
-
onEvict?: (key: string, resource: T) => void | Promise<void>;
|
|
12
|
-
}
|
|
1
|
+
import { ClientResourceCacheOptions } from './session.types.js';
|
|
13
2
|
export declare class ClientResourceCache<T> {
|
|
14
3
|
#private;
|
|
15
4
|
private storage;
|
|
@@ -18,36 +7,28 @@ export declare class ClientResourceCache<T> {
|
|
|
18
7
|
private onEvict?;
|
|
19
8
|
private pruneInterval?;
|
|
20
9
|
constructor(options?: ClientResourceCacheOptions<T>);
|
|
10
|
+
static builder<T>(): {
|
|
11
|
+
maxSize(value: number): /*elided*/ any;
|
|
12
|
+
ttlMs(value: number): /*elided*/ any;
|
|
13
|
+
pruneIntervalMs(value: number): /*elided*/ any;
|
|
14
|
+
onEvict(value: (key: string, resource: T) => void | Promise<void>): /*elided*/ any;
|
|
15
|
+
build(): ClientResourceCache<T>;
|
|
16
|
+
};
|
|
21
17
|
getEntryCount(): number;
|
|
22
18
|
getMaxSize(): number;
|
|
23
19
|
getTtl(): number;
|
|
24
20
|
get(key: string): T | null;
|
|
25
21
|
set(key: string, resource: T): void;
|
|
26
22
|
/**
|
|
27
|
-
* Removes an entry from the cache.
|
|
28
|
-
* Calls the onEvict callback if configured.
|
|
29
23
|
* @param key - The key to remove
|
|
30
24
|
*/
|
|
31
25
|
delete(key: string): void;
|
|
32
26
|
/**
|
|
33
|
-
* Stops the background pruning interval and optionally clears all entries.
|
|
34
27
|
* @param clearEntries - If true, also removes all entries and calls onEvict for each
|
|
35
28
|
*/
|
|
36
29
|
stop(clearEntries?: boolean): void;
|
|
37
|
-
/**
|
|
38
|
-
* Clears all entries from the cache.
|
|
39
|
-
* Calls onEvict for each entry being removed.
|
|
40
|
-
*/
|
|
41
30
|
clear(): void;
|
|
42
|
-
/**
|
|
43
|
-
* Evicts the least recently used entry from the cache.
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
31
|
private evictLeastRecentlyUsed;
|
|
47
|
-
/**
|
|
48
|
-
* Removes all expired entries from the cache.
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
32
|
private pruneExpired;
|
|
52
33
|
}
|
|
53
34
|
//# sourceMappingURL=ClientResourceCache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientResourceCache.d.ts","sourceRoot":"","sources":["../../src/session/ClientResourceCache.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ClientResourceCache.d.ts","sourceRoot":"","sources":["../../src/session/ClientResourceCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAS,MAAM,oBAAoB,CAAC;AAE5E,qBAAa,mBAAmB,CAAC,CAAC;;IAChC,OAAO,CAAC,OAAO,CAA+B;IAC9C,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,OAAO,CAAC,CAAqD;IAErE,OAAO,CAAC,aAAa,CAAC,CAAiC;gBAE3C,OAAO,GAAE,0BAA0B,CAAC,CAAC,CAAM;IAQvD,MAAM,CAAC,OAAO,CAAC,CAAC;uBAGG,MAAM;qBACR,MAAM;+BACI,MAAM;uBACd,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;;;IAM9D,aAAa,IAAI,MAAM;IAIvB,UAAU,IAAI,MAAM;IAIpB,MAAM,IAAI,MAAM;IAIhB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAa1B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI;IAQ1C;;OAEG;IACI,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAQhC;;OAEG;IACI,IAAI,CAAC,YAAY,UAAQ,GAAG,IAAI;IAUhC,KAAK,IAAI,IAAI;IASpB,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,YAAY;CAgCrB"}
|
|
@@ -1,55 +1,5 @@
|
|
|
1
1
|
import { SessionContextConfig, SessionRequestContext } from '../types/index.js';
|
|
2
|
-
|
|
3
|
-
* Result of session context resolution including the merged context
|
|
4
|
-
* and a cache key suffix for differentiating sessions with different configs.
|
|
5
|
-
*/
|
|
6
|
-
export interface SessionContextResult {
|
|
7
|
-
/**
|
|
8
|
-
* The merged context to pass to module loaders.
|
|
9
|
-
*/
|
|
10
|
-
context: unknown;
|
|
11
|
-
/**
|
|
12
|
-
* A deterministic hash suffix based on the session config values.
|
|
13
|
-
* Used to differentiate cache entries: `${clientId}:${cacheKeySuffix}`
|
|
14
|
-
* Returns 'default' when no session config is present.
|
|
15
|
-
*/
|
|
16
|
-
cacheKeySuffix: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Resolves per-session context from request query parameters and merges
|
|
20
|
-
* it with the base server context.
|
|
21
|
-
*
|
|
22
|
-
* Features:
|
|
23
|
-
* - Parses query parameter (base64 or JSON encoded)
|
|
24
|
-
* - Filters allowed keys (whitelist enforcement)
|
|
25
|
-
* - Merges session context with base context (shallow or deep)
|
|
26
|
-
* - Generates cache key suffix for session differentiation
|
|
27
|
-
*
|
|
28
|
-
* Security considerations:
|
|
29
|
-
* - Always specify allowedKeys to whitelist permitted session config keys
|
|
30
|
-
* - Invalid encoding silently returns empty session config (fail secure)
|
|
31
|
-
* - Disallowed keys are filtered without logging (prevents info leakage)
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```typescript
|
|
35
|
-
* const resolver = new SessionContextResolver({
|
|
36
|
-
* enabled: true,
|
|
37
|
-
* queryParam: {
|
|
38
|
-
* name: 'config',
|
|
39
|
-
* encoding: 'base64',
|
|
40
|
-
* allowedKeys: ['API_TOKEN', 'USER_ID'],
|
|
41
|
-
* },
|
|
42
|
-
* merge: 'shallow',
|
|
43
|
-
* });
|
|
44
|
-
*
|
|
45
|
-
* const result = resolver.resolve(
|
|
46
|
-
* { clientId: 'client-1', headers: {}, query: { config: 'eyJBUElfVE9LRU4iOiJ0b2tlbiJ9' } },
|
|
47
|
-
* { baseValue: 'foo' }
|
|
48
|
-
* );
|
|
49
|
-
* // result.context = { baseValue: 'foo', API_TOKEN: 'token' }
|
|
50
|
-
* // result.cacheKeySuffix = 'abc123...'
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
2
|
+
import { SessionContextResult } from './session.types.js';
|
|
53
3
|
export declare class SessionContextResolver {
|
|
54
4
|
private readonly config;
|
|
55
5
|
private readonly queryParamName;
|
|
@@ -57,58 +7,57 @@ export declare class SessionContextResolver {
|
|
|
57
7
|
private readonly allowedKeys;
|
|
58
8
|
private readonly mergeStrategy;
|
|
59
9
|
constructor(config: SessionContextConfig);
|
|
10
|
+
static builder(): {
|
|
11
|
+
enabled(value: boolean): /*elided*/ any;
|
|
12
|
+
queryParam(value: SessionContextConfig["queryParam"]): /*elided*/ any;
|
|
13
|
+
contextResolver(value: SessionContextConfig["contextResolver"]): /*elided*/ any;
|
|
14
|
+
merge(value: "shallow" | "deep"): /*elided*/ any;
|
|
15
|
+
build(): SessionContextResolver;
|
|
16
|
+
};
|
|
60
17
|
/**
|
|
61
|
-
* Resolves the session context for a request.
|
|
62
|
-
*
|
|
63
18
|
* @param request - The request context (clientId, headers, query)
|
|
64
19
|
* @param baseContext - The base context from server configuration
|
|
65
20
|
* @returns The resolved context and cache key suffix
|
|
66
21
|
*/
|
|
67
22
|
resolve(request: SessionRequestContext, baseContext: unknown): SessionContextResult;
|
|
68
23
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
24
|
+
* @param request - The request context
|
|
25
|
+
* @param baseContext - The base context from server configuration
|
|
26
|
+
* @param parsedConfig - The parsed query parameter config
|
|
27
|
+
* @returns The resolved context and cache key suffix
|
|
28
|
+
*/
|
|
29
|
+
private resolveWithCustomResolver;
|
|
30
|
+
/**
|
|
31
|
+
* @param baseContext - The base context from server configuration
|
|
32
|
+
* @param parsedConfig - The parsed query parameter config
|
|
33
|
+
* @returns The merged context and cache key suffix
|
|
34
|
+
*/
|
|
35
|
+
private resolveWithDefaultMerge;
|
|
36
|
+
/**
|
|
72
37
|
* @param query - Query parameters from the request
|
|
73
38
|
* @returns Parsed and filtered config object
|
|
74
|
-
* @private
|
|
75
39
|
*/
|
|
76
40
|
private parseQueryConfig;
|
|
77
41
|
/**
|
|
78
|
-
* Filters the parsed config to only include allowed keys.
|
|
79
|
-
* If no allowedKeys whitelist is configured, returns the full object.
|
|
80
|
-
*
|
|
81
42
|
* @param parsed - The parsed config object
|
|
82
43
|
* @returns Filtered config with only allowed keys
|
|
83
|
-
* @private
|
|
84
44
|
*/
|
|
85
45
|
private filterAllowedKeys;
|
|
86
46
|
/**
|
|
87
|
-
* Merges the base context with the session config.
|
|
88
|
-
*
|
|
89
47
|
* @param baseContext - The base context from server configuration
|
|
90
48
|
* @param sessionConfig - The parsed session config
|
|
91
49
|
* @returns Merged context
|
|
92
|
-
* @private
|
|
93
50
|
*/
|
|
94
51
|
private mergeContexts;
|
|
95
52
|
/**
|
|
96
|
-
* Performs a deep merge of two objects.
|
|
97
|
-
* Session config values override base context values.
|
|
98
|
-
*
|
|
99
53
|
* @param base - The base object
|
|
100
54
|
* @param override - The override object
|
|
101
55
|
* @returns Deep merged object
|
|
102
|
-
* @private
|
|
103
56
|
*/
|
|
104
57
|
private deepMerge;
|
|
105
58
|
/**
|
|
106
|
-
* Generates a deterministic cache key suffix based on the session config.
|
|
107
|
-
* Returns 'default' when no session config is present.
|
|
108
|
-
*
|
|
109
59
|
* @param sessionConfig - The parsed session config
|
|
110
60
|
* @returns Hash string or 'default'
|
|
111
|
-
* @private
|
|
112
61
|
*/
|
|
113
62
|
private generateCacheKeySuffix;
|
|
114
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SessionContextResolver.d.ts","sourceRoot":"","sources":["../../src/session/SessionContextResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"SessionContextResolver.d.ts","sourceRoot":"","sources":["../../src/session/SessionContextResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAC9C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAS;IACxC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAoB;IAC7C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;gBAEvC,MAAM,EAAE,oBAAoB;IAUxC,MAAM,CAAC,OAAO;uBAGK,OAAO;0BACJ,oBAAoB,CAAC,YAAY,CAAC;+BAC7B,oBAAoB,CAAC,iBAAiB,CAAC;qBACjD,SAAS,GAAG,MAAM;;;IAMnC;;;;OAIG;IACH,OAAO,CACL,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,OAAO,GACnB,oBAAoB;IAkBvB;;;;;OAKG;IACH,OAAO,CAAC,yBAAyB;IA6BjC;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAW/B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAkCxB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAgBzB;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAgCrB;;;;OAIG;IACH,OAAO,CAAC,SAAS;IA+BjB;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CAiB/B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface SessionContextResult {
|
|
2
|
+
/**
|
|
3
|
+
* The merged context to pass to module loaders.
|
|
4
|
+
*/
|
|
5
|
+
context: unknown;
|
|
6
|
+
/**
|
|
7
|
+
* A deterministic hash suffix based on the session config values.
|
|
8
|
+
* Used to differentiate cache entries: `${clientId}:${cacheKeySuffix}`
|
|
9
|
+
* Returns 'default' when no session config is present.
|
|
10
|
+
*/
|
|
11
|
+
cacheKeySuffix: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ClientResourceCacheOptions<T> {
|
|
14
|
+
maxSize?: number;
|
|
15
|
+
ttlMs?: number;
|
|
16
|
+
pruneIntervalMs?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Optional cleanup callback called when a resource is removed from the cache.
|
|
19
|
+
* Use this to close connections, clean up sessions, etc.
|
|
20
|
+
* @param key - The cache key being removed
|
|
21
|
+
* @param resource - The resource being removed
|
|
22
|
+
*/
|
|
23
|
+
onEvict?: (key: string, resource: T) => void | Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export interface Entry<T> {
|
|
26
|
+
resource: T;
|
|
27
|
+
lastAccessed: number;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=session.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.types.d.ts","sourceRoot":"","sources":["../../src/session/session.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,KAAK,CAAC,CAAC;IACtB,QAAQ,EAAE,CAAC,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -4,7 +4,6 @@ import { SessionContextConfig } from '../types/index.js';
|
|
|
4
4
|
* Throws descriptive errors for any validation failures.
|
|
5
5
|
*
|
|
6
6
|
* @param config - The session context configuration to validate
|
|
7
|
-
* @throws {Error} If the configuration is invalid or has incorrect types
|
|
8
7
|
*/
|
|
9
8
|
export declare function validateSessionContextConfig(config: SessionContextConfig): void;
|
|
10
|
-
//# sourceMappingURL=
|
|
9
|
+
//# sourceMappingURL=session.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.utils.d.ts","sourceRoot":"","sources":["../../src/session/session.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAM/E"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CreateMcpServerOptions } from '../server/createMcpServer.js';
|
|
2
1
|
export type McpToolDefinition = {
|
|
3
2
|
name: string;
|
|
4
3
|
description: string;
|
|
@@ -347,27 +346,4 @@ export interface SessionRequestContext {
|
|
|
347
346
|
*/
|
|
348
347
|
query: Record<string, string>;
|
|
349
348
|
}
|
|
350
|
-
export type CreatePermissionBasedMcpServerOptions = Omit<CreateMcpServerOptions, "startup"> & {
|
|
351
|
-
/**
|
|
352
|
-
* Permission configuration defining how client access control is enforced.
|
|
353
|
-
*
|
|
354
|
-
* This field is required for permission-based servers. It determines whether
|
|
355
|
-
* permissions are read from request headers or resolved server-side using
|
|
356
|
-
* static maps or resolver functions.
|
|
357
|
-
*
|
|
358
|
-
* @see {@link PermissionConfig} for detailed configuration options and examples
|
|
359
|
-
*/
|
|
360
|
-
permissions: PermissionConfig;
|
|
361
|
-
/**
|
|
362
|
-
* Startup configuration is not allowed for permission-based servers.
|
|
363
|
-
*
|
|
364
|
-
* Permission-based servers automatically determine which toolsets to load for
|
|
365
|
-
* each client based on the `permissions` configuration. The server internally
|
|
366
|
-
* uses STATIC mode per client to ensure isolation and prevent dynamic toolset
|
|
367
|
-
* changes during a session.
|
|
368
|
-
*
|
|
369
|
-
* @deprecated Do not use - permission-based servers determine toolsets from client permissions
|
|
370
|
-
*/
|
|
371
|
-
startup?: never;
|
|
372
|
-
};
|
|
373
349
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC;IAC3C;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,eAAe,CAAC,EAAE,OAAO,CAAC;QAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAE5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAE/D,MAAM,MAAM,IAAI,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,wBAAwB,CAAC,EA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,EAAE;QACX;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,CAAC;QAEd;;;;;WAKG;QACH,QAAQ,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;QAE7B;;;;WAIG;QACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;KACxB,CAAC;IAEF;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,CAChB,OAAO,EAAE,qBAAqB,EAC9B,WAAW,EAAE,OAAO,EACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KACxC,OAAO,CAAC;IAEb;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"customEndpoints.d.ts","sourceRoot":"","sources":["../../src/http/customEndpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErE;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CACpC,KAAK,GAAG,OAAO,EACf,MAAM,GAAG,OAAO,EAChB,OAAO,GAAG,OAAO;IAEjB;;OAEG;IACH,IAAI,EAAE,KAAK,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,OAAO,EAAE,M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M,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAI9D"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { FastifyInstance, FastifyRequest } from 'fastify';
|
|
2
|
-
import { CustomEndpointDefinition } from './customEndpoints.js';
|
|
3
|
-
/**
|
|
4
|
-
* Options for registering custom endpoints
|
|
5
|
-
*/
|
|
6
|
-
export interface RegisterCustomEndpointsOptions {
|
|
7
|
-
/**
|
|
8
|
-
* Optional function to extract additional context for each request.
|
|
9
|
-
* Used by permission-aware transport to inject permission data.
|
|
10
|
-
*/
|
|
11
|
-
contextExtractor?: (req: FastifyRequest) => Promise<Record<string, any>> | Record<string, any>;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Registers custom endpoints on a Fastify instance.
|
|
15
|
-
* Handles Zod validation, error responses, and type-safe request mapping.
|
|
16
|
-
*
|
|
17
|
-
* @param app - Fastify instance to register endpoints on
|
|
18
|
-
* @param basePath - Base path for all endpoints (e.g., "/" or "/api")
|
|
19
|
-
* @param endpoints - Array of custom endpoint definitions
|
|
20
|
-
* @param options - Optional configuration for endpoint registration
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* registerCustomEndpoints(app, "/api", [
|
|
25
|
-
* defineEndpoint({
|
|
26
|
-
* method: "GET",
|
|
27
|
-
* path: "/users",
|
|
28
|
-
* querySchema: z.object({ limit: z.coerce.number() }),
|
|
29
|
-
* handler: async (req) => ({ users: [] }),
|
|
30
|
-
* }),
|
|
31
|
-
* ]);
|
|
32
|
-
* ```
|
|
33
|
-
*/
|
|
34
|
-
export declare function registerCustomEndpoints(app: FastifyInstance, basePath: string, endpoints: CustomEndpointDefinition[], options?: RegisterCustomEndpointsOptions): void;
|
|
35
|
-
//# sourceMappingURL=endpointRegistration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpointRegistration.d.ts","sourceRoot":"","sources":["../../src/http/endpointRegistration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAgB,MAAM,SAAS,CAAC;AAG7E,OAAO,KAAK,EACV,wBAAwB,EAGzB,MAAM,sBAAsB,CAAC;AAE9B;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;OAGG;IACH,gBAAgB,CAAC,EAAE,CACjB,GAAG,EAAE,cAAc,KAChB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,eAAe,EACpB,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,wBAAwB,EAAE,EACrC,OAAO,CAAC,EAAE,8BAA8B,GACvC,IAAI,CAgIN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createPermissionAwareBundle.d.ts","sourceRoot":"","sources":["../../src/permissions/createPermissionAwareBundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,MAAM,EAAE,SAAS,CAAC;IAElB;;OAEG;IACH,YAAY,EAAE,kBAAkB,CAAC;IAEjC;;;OAGG;IACH,eAAe,EAAE,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,oBAAoB,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK;IACnD,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,EAAE,kBAAkB,CAAC;CAClC,EACD,kBAAkB,EAAE,kBAAkB,IAcpC,SAAS,oBAAoB,KAC5B,OAAO,CAAC,qBAAqB,CAAC,CAkDlC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { PermissionConfig } from '../types/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Validates a permission configuration object to ensure it meets all requirements.
|
|
4
|
-
* Throws descriptive errors for any validation failures.
|
|
5
|
-
* @param config - The permission configuration to validate
|
|
6
|
-
* @throws {Error} If the configuration is invalid or missing required fields
|
|
7
|
-
*/
|
|
8
|
-
export declare function validatePermissionConfig(config: PermissionConfig): void;
|
|
9
|
-
//# sourceMappingURL=validatePermissionConfig.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validatePermissionConfig.d.ts","sourceRoot":"","sources":["../../src/permissions/validatePermissionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAKvE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validateSessionContextConfig.d.ts","sourceRoot":"","sources":["../../src/session/validateSessionContextConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI,CAM/E"}
|