@dereekb/firebase-server 13.12.2 → 13.12.4
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/index.cjs.js +86 -18
- package/index.esm.js +85 -19
- package/mailgun/index.cjs.js +6 -3
- package/mailgun/index.esm.js +6 -3
- package/mailgun/package.json +9 -9
- package/mcp/index.cjs.js +526 -183
- package/mcp/index.esm.js +527 -186
- package/mcp/package.json +12 -11
- package/mcp/src/lib/service/analytics/mcp.analytics.config.d.ts +5 -3
- package/mcp/src/lib/service/analytics/mcp.analytics.service.d.ts +3 -2
- package/mcp/src/lib/service/tools/mcp.tool.model-info.d.ts +90 -10
- package/model/package.json +9 -9
- package/oidc/index.cjs.js +116 -8
- package/oidc/index.esm.js +115 -10
- package/oidc/package.json +10 -10
- package/oidc/src/lib/oidc.config.d.ts +40 -2
- package/oidc/src/lib/oidc.module.d.ts +39 -2
- package/oidc/src/lib/service/oidc.client.service.d.ts +12 -4
- package/package.json +13 -10
- package/src/lib/auth/auth.service.d.ts +84 -17
- package/src/lib/env/env.service.d.ts +2 -2
- package/test/index.cjs.js +29 -0
- package/test/index.esm.js +29 -0
- package/test/package.json +11 -11
- package/test/src/lib/firebase/firebase.admin.auth.d.ts +22 -0
- package/twilio/package.json +8 -8
- package/zoho/package.json +9 -9
package/mcp/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/mcp",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.12.
|
|
6
|
-
"@dereekb/date": "13.12.
|
|
7
|
-
"@dereekb/firebase": "13.12.
|
|
8
|
-
"@dereekb/firebase-server": "13.12.
|
|
9
|
-
"@dereekb/firebase-server/oidc": "13.12.
|
|
10
|
-
"@dereekb/model": "13.12.
|
|
11
|
-
"@dereekb/nestjs": "13.12.
|
|
12
|
-
"@dereekb/rxjs": "13.12.
|
|
13
|
-
"@dereekb/util": "13.12.
|
|
14
|
-
"@dereekb/zoho": "13.12.
|
|
5
|
+
"@dereekb/analytics": "13.12.4",
|
|
6
|
+
"@dereekb/date": "13.12.4",
|
|
7
|
+
"@dereekb/firebase": "13.12.4",
|
|
8
|
+
"@dereekb/firebase-server": "13.12.4",
|
|
9
|
+
"@dereekb/firebase-server/oidc": "13.12.4",
|
|
10
|
+
"@dereekb/model": "13.12.4",
|
|
11
|
+
"@dereekb/nestjs": "13.12.4",
|
|
12
|
+
"@dereekb/rxjs": "13.12.4",
|
|
13
|
+
"@dereekb/util": "13.12.4",
|
|
14
|
+
"@dereekb/zoho": "13.12.4",
|
|
15
15
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
16
16
|
"@nestjs/common": "^11.1.19",
|
|
17
17
|
"@nestjs/core": "^11.1.19",
|
|
18
|
+
"arktype": "^2.2.0",
|
|
18
19
|
"express": "^5.2.1",
|
|
19
20
|
"firebase-admin": "^13.8.0"
|
|
20
21
|
},
|
|
@@ -3,7 +3,7 @@ import { type InjectionToken } from '@nestjs/common';
|
|
|
3
3
|
* Default analytics event name used by {@link FirebaseServerMcpAnalyticsService} when
|
|
4
4
|
* forwarding a completed MCP tool call to the downstream analytics pipeline.
|
|
5
5
|
*/
|
|
6
|
-
export declare const DEFAULT_MCP_ANALYTICS_EVENT_NAME = "
|
|
6
|
+
export declare const DEFAULT_MCP_ANALYTICS_EVENT_NAME = "Mcp Tool Call";
|
|
7
7
|
/**
|
|
8
8
|
* Configuration for {@link FirebaseServerMcpAnalyticsService}.
|
|
9
9
|
*
|
|
@@ -18,7 +18,9 @@ export interface FirebaseServerMcpAnalyticsConfig {
|
|
|
18
18
|
*/
|
|
19
19
|
readonly eventName?: string;
|
|
20
20
|
/**
|
|
21
|
-
* Whether to emit a per-call `Logger` line for each completed tool call.
|
|
21
|
+
* Whether to emit a per-call `Logger` line for each completed tool call.
|
|
22
|
+
*
|
|
23
|
+
* Defaults to `true` on non-production environments.
|
|
22
24
|
*/
|
|
23
25
|
readonly logEvents?: boolean;
|
|
24
26
|
}
|
|
@@ -27,7 +29,7 @@ export interface FirebaseServerMcpAnalyticsConfig {
|
|
|
27
29
|
*
|
|
28
30
|
* @example
|
|
29
31
|
* ```typescript
|
|
30
|
-
* @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: '
|
|
32
|
+
* @Module(appMcpAnalyticsModuleMetadata({ mcpAnalyticsConfig: { eventName: 'Mcp Tool Call', logEvents: true } }))
|
|
31
33
|
* export class AppMcpAnalyticsModule {}
|
|
32
34
|
* ```
|
|
33
35
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FirebaseServerAnalyticsService } from '@dereekb/firebase-server';
|
|
1
|
+
import { FirebaseServerAnalyticsService, FirebaseServerEnvService } from '@dereekb/firebase-server';
|
|
2
2
|
import { McpAnalyticsService, type McpAnalyticsEvent } from './mcp.analytics.handler';
|
|
3
3
|
import { type FirebaseServerMcpAnalyticsConfig } from './mcp.analytics.config';
|
|
4
4
|
/**
|
|
@@ -11,10 +11,11 @@ import { type FirebaseServerMcpAnalyticsConfig } from './mcp.analytics.config';
|
|
|
11
11
|
* no-op aside from the optional log line.
|
|
12
12
|
*/
|
|
13
13
|
export declare class FirebaseServerMcpAnalyticsService extends McpAnalyticsService {
|
|
14
|
+
private readonly firebaseServerEnvService;
|
|
14
15
|
private readonly analyticsService?;
|
|
15
16
|
private readonly _logger;
|
|
16
17
|
private readonly _eventName;
|
|
17
18
|
private readonly _logEvents;
|
|
18
|
-
constructor(analyticsService?: FirebaseServerAnalyticsService | undefined, config?: FirebaseServerMcpAnalyticsConfig);
|
|
19
|
+
constructor(firebaseServerEnvService: FirebaseServerEnvService, analyticsService?: FirebaseServerAnalyticsService | undefined, config?: FirebaseServerMcpAnalyticsConfig);
|
|
19
20
|
handleMcpAnalyticsEvent(event: McpAnalyticsEvent): void;
|
|
20
21
|
}
|
|
@@ -14,6 +14,15 @@ export declare const MODEL_INFO_DISPATCH_CALL = "info";
|
|
|
14
14
|
* apps avoiding collisions should not register a real model literally named "model".
|
|
15
15
|
*/
|
|
16
16
|
export declare const MODEL_INFO_DISPATCH_MODEL_TYPE = "model";
|
|
17
|
+
/**
|
|
18
|
+
* Group label applied to manifest entries that declare no `modelGroup`. Keeps the `groups` mode
|
|
19
|
+
* total reconcilable with the catalog size (sum of group counts always equals `totalModels`).
|
|
20
|
+
*/
|
|
21
|
+
export declare const MODEL_INFO_UNGROUPED_LABEL = "(ungrouped)";
|
|
22
|
+
/**
|
|
23
|
+
* Hint string surfaced alongside the default `groups` response so callers know how to drill in.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MODEL_INFO_GROUPS_HINT = "Pass `model` for one/many models, `modelGroup` for a group, or `all:true` for the full catalog.";
|
|
17
26
|
/**
|
|
18
27
|
* Constructor dependencies for {@link createModelInfoTool}.
|
|
19
28
|
*/
|
|
@@ -25,13 +34,43 @@ export interface CreateModelInfoToolDeps {
|
|
|
25
34
|
readonly manifest: readonly McpManifestModelEntry[];
|
|
26
35
|
}
|
|
27
36
|
/**
|
|
28
|
-
*
|
|
37
|
+
* Public shape of the `model-info` tool input. Every field is optional; the combination selects
|
|
38
|
+
* the response mode (see {@link createModelInfoTool}).
|
|
29
39
|
*/
|
|
30
40
|
export interface ModelInfoToolInput {
|
|
31
|
-
|
|
41
|
+
/**
|
|
42
|
+
* One model (string) or many (string array), each matched by `modelType`, `identityConst`, or
|
|
43
|
+
* `collectionPrefix`. A string yields `mode: 'single'`; an array yields `mode: 'multiple'`.
|
|
44
|
+
*/
|
|
45
|
+
readonly model?: string | ReadonlyArray<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Returns the summary list of models in this group (`mode: 'list'`). Matched case-insensitively.
|
|
48
|
+
*/
|
|
49
|
+
readonly modelGroup?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Opt in to the full catalog summary (every model). Never the default.
|
|
52
|
+
*/
|
|
53
|
+
readonly all?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Forces (`true`) or suppresses (`false`) full persisted-field detail in `list` / `multiple`
|
|
56
|
+
* modes. Defaults to summary rows for `list`, full entries for `single` / `multiple`.
|
|
57
|
+
*/
|
|
58
|
+
readonly fields?: boolean;
|
|
32
59
|
}
|
|
33
60
|
/**
|
|
34
|
-
*
|
|
61
|
+
* Normalized form of {@link ModelInfoToolInput} produced by {@link parseModelInfoInput}. The
|
|
62
|
+
* `model` arg is collapsed to a query array plus a flag recording whether it arrived as an array
|
|
63
|
+
* (which drives `single` vs `multiple` mode).
|
|
64
|
+
*/
|
|
65
|
+
export interface ParsedModelInfoInput {
|
|
66
|
+
readonly modelQueries?: ReadonlyArray<string>;
|
|
67
|
+
readonly modelIsArray: boolean;
|
|
68
|
+
readonly modelGroup?: string;
|
|
69
|
+
readonly all: boolean;
|
|
70
|
+
readonly fields?: boolean;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Summary row returned in list/group modes and (when `fields: false`) in single/multiple modes.
|
|
35
74
|
*/
|
|
36
75
|
export interface ModelInfoSummaryRow {
|
|
37
76
|
readonly modelType: string;
|
|
@@ -47,22 +86,63 @@ export interface ModelInfoSummaryRow {
|
|
|
47
86
|
readonly serviceFactoryExport?: string;
|
|
48
87
|
}
|
|
49
88
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
89
|
+
* One row in a model-bearing response: either a compact {@link ModelInfoSummaryRow} or the full
|
|
90
|
+
* {@link McpManifestModelEntry} (including persisted `fields`). The `fields` toggle and the active
|
|
91
|
+
* mode decide which form is emitted.
|
|
92
|
+
*/
|
|
93
|
+
export type ModelInfoModelRow = ModelInfoSummaryRow | McpManifestModelEntry;
|
|
94
|
+
/**
|
|
95
|
+
* One model group and the number of models it contains. Returned in the default `groups` mode.
|
|
96
|
+
*/
|
|
97
|
+
export interface ModelInfoGroupCount {
|
|
98
|
+
readonly modelGroup: string;
|
|
99
|
+
readonly modelCount: number;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A model query that matched nothing. Mirrors `model-get`'s per-key `{ key, message }` error shape
|
|
103
|
+
* with `query` standing in for `key`.
|
|
104
|
+
*/
|
|
105
|
+
export interface ModelInfoNotFound {
|
|
106
|
+
readonly query: string;
|
|
107
|
+
readonly message: string;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Output payload for the `model-info` tool. The `mode` field discriminates the variant:
|
|
111
|
+
* - `groups`: model groups + counts (the default, no-arg response).
|
|
112
|
+
* - `list`: a summary (or, with `fields: true`, full) list — used by `modelGroup` and `all`.
|
|
113
|
+
* - `single`: full detail for one `model` string.
|
|
114
|
+
* - `multiple`: full detail per match for a `model` array, with misses in `notFound`.
|
|
52
115
|
*/
|
|
53
116
|
export type ModelInfoToolOutput = {
|
|
117
|
+
readonly mode: 'groups';
|
|
118
|
+
readonly groups: ReadonlyArray<ModelInfoGroupCount>;
|
|
119
|
+
readonly totalModels: number;
|
|
120
|
+
readonly hint: string;
|
|
121
|
+
} | {
|
|
54
122
|
readonly mode: 'list';
|
|
55
|
-
readonly models: ReadonlyArray<
|
|
123
|
+
readonly models: ReadonlyArray<ModelInfoModelRow>;
|
|
124
|
+
readonly modelGroup?: string;
|
|
56
125
|
} | {
|
|
57
126
|
readonly mode: 'single';
|
|
58
|
-
readonly model:
|
|
127
|
+
readonly model: ModelInfoModelRow;
|
|
128
|
+
} | {
|
|
129
|
+
readonly mode: 'multiple';
|
|
130
|
+
readonly models: ReadonlyArray<ModelInfoModelRow>;
|
|
131
|
+
readonly notFound?: ReadonlyArray<ModelInfoNotFound>;
|
|
59
132
|
};
|
|
60
133
|
/**
|
|
61
134
|
* Builds the built-in `model-info` MCP tool definition.
|
|
62
135
|
*
|
|
63
|
-
*
|
|
64
|
-
* -
|
|
65
|
-
* -
|
|
136
|
+
* Modes (selected by input):
|
|
137
|
+
* - No args: returns model groups + counts (`mode: 'groups'`) — the cheap default for browsing.
|
|
138
|
+
* - `model` (string): returns the full entry for one model (`mode: 'single'`).
|
|
139
|
+
* - `model` (string array): returns full detail per match (`mode: 'multiple'`); misses land in `notFound`.
|
|
140
|
+
* - `modelGroup`: returns the summary list of that group's models (`mode: 'list'`).
|
|
141
|
+
* - `all: true`: returns the full catalog summary (`mode: 'list'`).
|
|
142
|
+
* - `fields`: forces (`true`) or suppresses (`false`) full persisted-field detail in list/multiple modes.
|
|
143
|
+
*
|
|
144
|
+
* Each `model` query matches by `modelType`, `identityConst`, or `collectionPrefix`. When several
|
|
145
|
+
* params are supplied, precedence is `model` > `modelGroup` > `all` > the default `groups` view.
|
|
66
146
|
*
|
|
67
147
|
* Output is delivered as both stringified JSON in `content[0].text` and `structuredContent`
|
|
68
148
|
* so MCP clients can consume either form.
|
package/model/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase-server/model",
|
|
3
|
-
"version": "13.12.
|
|
3
|
+
"version": "13.12.4",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/analytics": "13.12.
|
|
6
|
-
"@dereekb/date": "13.12.
|
|
7
|
-
"@dereekb/firebase": "13.12.
|
|
8
|
-
"@dereekb/firebase-server": "13.12.
|
|
9
|
-
"@dereekb/model": "13.12.
|
|
10
|
-
"@dereekb/nestjs": "13.12.
|
|
11
|
-
"@dereekb/rxjs": "13.12.
|
|
12
|
-
"@dereekb/util": "13.12.
|
|
5
|
+
"@dereekb/analytics": "13.12.4",
|
|
6
|
+
"@dereekb/date": "13.12.4",
|
|
7
|
+
"@dereekb/firebase": "13.12.4",
|
|
8
|
+
"@dereekb/firebase-server": "13.12.4",
|
|
9
|
+
"@dereekb/model": "13.12.4",
|
|
10
|
+
"@dereekb/nestjs": "13.12.4",
|
|
11
|
+
"@dereekb/rxjs": "13.12.4",
|
|
12
|
+
"@dereekb/util": "13.12.4",
|
|
13
13
|
"@nestjs/common": "^11.1.19",
|
|
14
14
|
"@nestjs/config": "^4.0.4",
|
|
15
15
|
"archiver": "^7.0.1",
|
package/oidc/index.cjs.js
CHANGED
|
@@ -80,6 +80,31 @@ function _define_property$f(obj, key, value) {
|
|
|
80
80
|
}
|
|
81
81
|
return obj;
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Default {@link OidcRenderErrorFunction} that emits a JSON body with `error` and
|
|
85
|
+
* `error_description` fields, with `Content-Type: application/json`.
|
|
86
|
+
*
|
|
87
|
+
* Wired by {@link oidcModuleMetadata} when {@link OidcModuleConfig.renderError} is
|
|
88
|
+
* not provided. API-focused OIDC providers (the common case in dbx-components apps)
|
|
89
|
+
* want JSON errors rather than the HTML page oidc-provider renders by default.
|
|
90
|
+
*/ var OIDC_JSON_RENDER_ERROR_FUNCTION = function OIDC_JSON_RENDER_ERROR_FUNCTION(ctx, out) {
|
|
91
|
+
ctx.type = 'application/json';
|
|
92
|
+
ctx.body = JSON.stringify({
|
|
93
|
+
error: out.error,
|
|
94
|
+
error_description: out.error_description
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Returns the space-delimited list of every scope declared on `providerConfig.claims`.
|
|
99
|
+
*
|
|
100
|
+
* Suitable as the `scope` value on an {@link OidcResourceServerInfo} when the
|
|
101
|
+
* resource server should accept any scope the provider issues.
|
|
102
|
+
*
|
|
103
|
+
* @param providerConfig - The OIDC provider configuration whose scopes to enumerate.
|
|
104
|
+
* @returns Space-delimited string of all scope names from `providerConfig.claims`.
|
|
105
|
+
*/ function allOidcScopesStringForProviderConfig(providerConfig) {
|
|
106
|
+
return Object.keys(providerConfig.claims).join(' ');
|
|
107
|
+
}
|
|
83
108
|
/**
|
|
84
109
|
* Default global ceiling for a client-requested login duration, in seconds. 90 days.
|
|
85
110
|
*/ var DEFAULT_MAX_REQUESTED_LOGIN_DURATION_SECONDS = 90 * util.SECONDS_IN_DAY;
|
|
@@ -158,8 +183,10 @@ function _define_property$f(obj, key, value) {
|
|
|
158
183
|
/**
|
|
159
184
|
* Custom error rendering function for the oidc-provider.
|
|
160
185
|
*
|
|
161
|
-
* When not provided,
|
|
162
|
-
*
|
|
186
|
+
* When not provided, {@link OIDC_JSON_RENDER_ERROR_FUNCTION} is wired by
|
|
187
|
+
* {@link oidcModuleMetadata} so OIDC errors are returned as a JSON body with
|
|
188
|
+
* `error` and `error_description` fields. Set this to customize how OIDC
|
|
189
|
+
* errors are presented (e.g. redirect to an error page).
|
|
163
190
|
*
|
|
164
191
|
* The function signature matches oidc-provider's `renderError` configuration option.
|
|
165
192
|
*/ _define_property$f(this, "renderError", void 0);
|
|
@@ -205,6 +232,22 @@ function _define_property$f(obj, key, value) {
|
|
|
205
232
|
* ```
|
|
206
233
|
*/ _define_property$f(this, "resourceServers", void 0);
|
|
207
234
|
/**
|
|
235
|
+
* When `true`, {@link oidcModuleMetadata} automatically derives a resource-server
|
|
236
|
+
* entry from `envService.appMcpUrl` and the registered {@link OidcAccountService}'s
|
|
237
|
+
* provider config, then merges it into {@link resourceServers}. Any explicit entry
|
|
238
|
+
* supplied via {@link resourceServers} wins on key collisions.
|
|
239
|
+
*
|
|
240
|
+
* Required for OAuth-aware MCP clients (Claude, mcp-inspector) — they pass the
|
|
241
|
+
* MCP URL as the `resource` parameter on `/authorize` and `/token`, and oidc-provider
|
|
242
|
+
* rejects every such request with `invalid_target` unless that URL is registered.
|
|
243
|
+
*
|
|
244
|
+
* No effect when `envService.appMcpUrl` is unset.
|
|
245
|
+
*
|
|
246
|
+
* Defaults to `false`.
|
|
247
|
+
*
|
|
248
|
+
* @see buildFirebaseServerMcpResourceServer
|
|
249
|
+
*/ _define_property$f(this, "configureMcpResourceServer", void 0);
|
|
250
|
+
/**
|
|
208
251
|
* Absolute URL of the OAuth 2.0 Protected Resource Metadata document
|
|
209
252
|
* (RFC 9728) for the resources guarded by {@link protectedPaths}.
|
|
210
253
|
*
|
|
@@ -2203,14 +2246,19 @@ function _ts_generator$7(thisArg, body) {
|
|
|
2203
2246
|
value: /**
|
|
2204
2247
|
* Creates a new OIDC client through the oidc-provider.
|
|
2205
2248
|
*
|
|
2206
|
-
* Generates `client_id` and `client_secret` using the
|
|
2207
|
-
* registration flow, validates via `Client.validate`, and
|
|
2249
|
+
* Generates `client_id` (and, when the auth method requires one, a `client_secret`) using the
|
|
2250
|
+
* same defaults as oidc-provider's registration flow, validates via `Client.validate`, and
|
|
2251
|
+
* persists through the adapter.
|
|
2252
|
+
*
|
|
2253
|
+
* A secret is only generated when `ProviderClient.needsSecret()` returns `true`. The secret-less
|
|
2254
|
+
* methods `private_key_jwt` and `'none'` (public PKCE client) therefore persist no secret and the
|
|
2255
|
+
* returned `client_secret` is `undefined`.
|
|
2208
2256
|
*
|
|
2209
2257
|
* @param params - Client registration parameters.
|
|
2210
2258
|
* @param validatedMetadata - Optional pre-validated metadata to merge into the client properties.
|
|
2211
2259
|
* Use this for server-side fields (e.g., inline `jwks`) that have already been validated
|
|
2212
2260
|
* and should not be exposed through the API params.
|
|
2213
|
-
* @returns The generated client ID and secret (plaintext, returned only once).
|
|
2261
|
+
* @returns The generated client ID and, for secret-based methods, the secret (plaintext, returned only once).
|
|
2214
2262
|
*/ function createClient(params, validatedMetadata) {
|
|
2215
2263
|
return _async_to_generator$7(function() {
|
|
2216
2264
|
var provider, ProviderClient, clientId, firestoreOwnerKey, properties, clientSecret, client, payload;
|
|
@@ -2372,9 +2420,12 @@ function _ts_generator$7(thisArg, body) {
|
|
|
2372
2420
|
* Generates a new `client_secret`, re-validates via `Client.validate()`, and persists.
|
|
2373
2421
|
* The new secret is returned in plaintext — this is the only time it is available.
|
|
2374
2422
|
*
|
|
2423
|
+
* Rejects public PKCE clients (`token_endpoint_auth_method === 'none'`): they have no secret,
|
|
2424
|
+
* so there is nothing to rotate.
|
|
2425
|
+
*
|
|
2375
2426
|
* @param clientId - The client's document/adapter entry ID.
|
|
2376
2427
|
* @returns The client ID and new secret (plaintext, returned only once).
|
|
2377
|
-
* @throws {Error} When the client is not found.
|
|
2428
|
+
* @throws {Error} When the client is not found, or is a public PKCE (`none`) client.
|
|
2378
2429
|
*/ function rotateClientSecret(clientId) {
|
|
2379
2430
|
return _async_to_generator$7(function() {
|
|
2380
2431
|
var provider, ProviderClient, existing, newSecret, updatedMetadata, client;
|
|
@@ -2397,6 +2448,9 @@ function _ts_generator$7(thisArg, body) {
|
|
|
2397
2448
|
if (!existing) {
|
|
2398
2449
|
throw new Error('Client not found.');
|
|
2399
2450
|
}
|
|
2451
|
+
if (existing.token_endpoint_auth_method === firebase.PUBLIC_PKCE_TOKEN_ENDPOINT_AUTH_METHOD) {
|
|
2452
|
+
throw new Error('Cannot rotate a client secret for a public PKCE client (token_endpoint_auth_method "none"). Public clients have no secret.');
|
|
2453
|
+
}
|
|
2400
2454
|
newSecret = node_crypto.randomBytes(64).toString('base64url');
|
|
2401
2455
|
updatedMetadata = _object_spread_props$2(_object_spread$5({}, existing), {
|
|
2402
2456
|
client_secret: newSecret,
|
|
@@ -6575,6 +6629,40 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
6575
6629
|
var trimmedPath = parsed.pathname.replace(/\/[^/]*\/?$/, '');
|
|
6576
6630
|
return "".concat(parsed.origin).concat(trimmedPath, "/.well-known/oauth-protected-resource");
|
|
6577
6631
|
}
|
|
6632
|
+
/**
|
|
6633
|
+
* Builds a single-entry {@link OidcResourceServerInfo} map for the MCP endpoint
|
|
6634
|
+
* declared on `envService.appMcpUrl`, with `scope` set to every scope declared
|
|
6635
|
+
* on `providerConfig.claims` (so any scope the provider issues is valid on the
|
|
6636
|
+
* resource server) and `audience` set to the MCP URL.
|
|
6637
|
+
*
|
|
6638
|
+
* Returns `undefined` when no `appMcpUrl` is configured.
|
|
6639
|
+
*
|
|
6640
|
+
* Used internally by {@link oidcModuleMetadata} when {@link OidcModuleConfig.configureMcpResourceServer}
|
|
6641
|
+
* is enabled, and exported for apps that need to combine the MCP resource server
|
|
6642
|
+
* with additional app-specific entries:
|
|
6643
|
+
*
|
|
6644
|
+
* @example
|
|
6645
|
+
* ```ts
|
|
6646
|
+
* resourceServers: {
|
|
6647
|
+
* ...(buildFirebaseServerMcpResourceServer({ envService, providerConfig: APP_PROVIDER_CONFIG }) ?? {}),
|
|
6648
|
+
* 'https://api.example.com/extras': {
|
|
6649
|
+
* scope: 'openid profile',
|
|
6650
|
+
* audience: 'https://api.example.com/extras'
|
|
6651
|
+
* }
|
|
6652
|
+
* }
|
|
6653
|
+
* ```
|
|
6654
|
+
*/ function buildFirebaseServerMcpResourceServer(input) {
|
|
6655
|
+
var envService = input.envService, providerConfig = input.providerConfig;
|
|
6656
|
+
var mcpUrl = envService.appMcpUrl;
|
|
6657
|
+
var result;
|
|
6658
|
+
if (mcpUrl) {
|
|
6659
|
+
result = _define_property({}, mcpUrl, {
|
|
6660
|
+
scope: allOidcScopesStringForProviderConfig(providerConfig),
|
|
6661
|
+
audience: mcpUrl
|
|
6662
|
+
});
|
|
6663
|
+
}
|
|
6664
|
+
return result;
|
|
6665
|
+
}
|
|
6578
6666
|
/**
|
|
6579
6667
|
* Factory that creates {@link OidcServerFirestoreCollections} using the provided Firestore context
|
|
6580
6668
|
* and JWKS encryption config from {@link OidcModuleConfig}.
|
|
@@ -6631,9 +6719,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
6631
6719
|
provide: OidcModuleConfig,
|
|
6632
6720
|
inject: [
|
|
6633
6721
|
config.ConfigService,
|
|
6634
|
-
firebaseServer.FirebaseServerEnvService
|
|
6722
|
+
firebaseServer.FirebaseServerEnvService,
|
|
6723
|
+
OidcAccountService
|
|
6635
6724
|
],
|
|
6636
|
-
useFactory: function useFactory(configService, envService) {
|
|
6725
|
+
useFactory: function useFactory(configService, envService, oidcAccountService) {
|
|
6637
6726
|
var moduleConfig = oidcModuleConfigFactory(configService, envService);
|
|
6638
6727
|
var dynamicOverrides = configFactory ? configFactory(envService, configService) : undefined;
|
|
6639
6728
|
var merged = config$1 || dynamicOverrides ? _object_spread({}, config$1, dynamicOverrides) : undefined;
|
|
@@ -6644,6 +6733,22 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
6644
6733
|
result.trustProxy = true;
|
|
6645
6734
|
}
|
|
6646
6735
|
}
|
|
6736
|
+
// Apply the default JSON error renderer when no custom renderError is configured.
|
|
6737
|
+
if (!result.renderError) {
|
|
6738
|
+
result.renderError = OIDC_JSON_RENDER_ERROR_FUNCTION;
|
|
6739
|
+
}
|
|
6740
|
+
// Auto-derive the MCP resource-server entry from envService.appMcpUrl and the
|
|
6741
|
+
// registered OidcAccountService's providerConfig. Any explicit resourceServers
|
|
6742
|
+
// entry from the consumer wins on key collisions.
|
|
6743
|
+
if (result.configureMcpResourceServer) {
|
|
6744
|
+
var mcpResourceServer = buildFirebaseServerMcpResourceServer({
|
|
6745
|
+
envService: envService,
|
|
6746
|
+
providerConfig: oidcAccountService.providerConfig
|
|
6747
|
+
});
|
|
6748
|
+
if (mcpResourceServer) {
|
|
6749
|
+
result.resourceServers = _object_spread({}, mcpResourceServer, result.resourceServers);
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6647
6752
|
return result;
|
|
6648
6753
|
}
|
|
6649
6754
|
},
|
|
@@ -6750,6 +6855,7 @@ exports.JwksKeyDocument = JwksKeyDocument;
|
|
|
6750
6855
|
exports.JwksServiceConfig = JwksServiceConfig;
|
|
6751
6856
|
exports.JwksServiceStorageConfig = JwksServiceStorageConfig;
|
|
6752
6857
|
exports.OIDC_ENCRYPTED_PAYLOAD_FIELDS = OIDC_ENCRYPTED_PAYLOAD_FIELDS;
|
|
6858
|
+
exports.OIDC_JSON_RENDER_ERROR_FUNCTION = OIDC_JSON_RENDER_ERROR_FUNCTION;
|
|
6753
6859
|
exports.OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY = OIDC_JWKS_ENCRYPTION_SECRET_ENV_KEY;
|
|
6754
6860
|
exports.OidcAccountService = OidcAccountService;
|
|
6755
6861
|
exports.OidcAccountServiceDelegate = OidcAccountServiceDelegate;
|
|
@@ -6761,10 +6867,12 @@ exports.OidcModelServerActions = OidcModelServerActions;
|
|
|
6761
6867
|
exports.OidcModuleConfig = OidcModuleConfig;
|
|
6762
6868
|
exports.OidcServerFirestoreCollections = OidcServerFirestoreCollections;
|
|
6763
6869
|
exports.activeJwksKeysQuery = activeJwksKeysQuery;
|
|
6870
|
+
exports.allOidcScopesStringForProviderConfig = allOidcScopesStringForProviderConfig;
|
|
6764
6871
|
exports.appOidcModelModuleMetadata = appOidcModelModuleMetadata;
|
|
6765
6872
|
exports.applyOidcAuthMiddleware = applyOidcAuthMiddleware;
|
|
6766
6873
|
exports.applyOidcCorsMiddleware = applyOidcCorsMiddleware;
|
|
6767
6874
|
exports.buildBearerChallenge = buildBearerChallenge;
|
|
6875
|
+
exports.buildFirebaseServerMcpResourceServer = buildFirebaseServerMcpResourceServer;
|
|
6768
6876
|
exports.createAdapterFactory = createAdapterFactory;
|
|
6769
6877
|
exports.createOidcClientFactory = createOidcClientFactory;
|
|
6770
6878
|
exports.deleteOidcClientFactory = deleteOidcClientFactory;
|