@dereekb/firebase-server 13.37.0 → 13.39.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/calcom/package.json +15 -15
- package/discord/package.json +15 -15
- package/index.esm.js +1716 -512
- package/mailgun/package.json +14 -14
- package/mcp/index.esm.js +561 -40
- package/mcp/package.json +16 -16
- package/mcp/src/lib/mcp.config.d.ts +22 -1
- package/mcp/src/lib/service/index.d.ts +1 -0
- package/mcp/src/lib/service/mcp.server.factory.d.ts +3 -2
- package/mcp/src/lib/service/tools/mcp.tool.model-roles.d.ts +95 -0
- package/model/package.json +14 -14
- package/model/src/lib/notification/notification.module.d.ts +1 -1
- package/oidc/package.json +15 -15
- package/package.json +36 -45
- package/src/lib/env/env.service.d.ts +27 -3
- package/src/lib/nest/controller/api.scope.d.ts +63 -0
- package/src/lib/nest/controller/index.d.ts +2 -0
- package/src/lib/nest/controller/model/model.api.get.service.d.ts +146 -1
- package/src/lib/nest/controller/model/model.api.scope.d.ts +3 -2
- package/src/lib/nest/controller/session/index.d.ts +4 -0
- package/src/lib/nest/controller/session/session.api.config.d.ts +104 -0
- package/src/lib/nest/controller/session/session.api.controller.d.ts +26 -0
- package/src/lib/nest/controller/session/session.api.module.d.ts +49 -0
- package/src/lib/nest/controller/session/session.api.service.d.ts +71 -0
- package/test/package.json +16 -16
- package/twilio/package.json +13 -13
- package/zoho/package.json +15 -15
- package/calcom/index.cjs.default.js +0 -1
- package/calcom/index.cjs.js +0 -1451
- package/calcom/index.cjs.mjs +0 -2
- package/discord/index.cjs.default.js +0 -1
- package/discord/index.cjs.js +0 -761
- package/discord/index.cjs.mjs +0 -2
- package/index.cjs.default.js +0 -1
- package/index.cjs.js +0 -13491
- package/index.cjs.mjs +0 -2
- package/mailgun/index.cjs.default.js +0 -1
- package/mailgun/index.cjs.js +0 -436
- package/mailgun/index.cjs.mjs +0 -2
- package/mcp/index.cjs.default.js +0 -1
- package/mcp/index.cjs.js +0 -8254
- package/mcp/index.cjs.mjs +0 -2
- package/model/index.cjs.default.js +0 -1
- package/model/index.cjs.js +0 -19965
- package/model/index.cjs.mjs +0 -2
- package/oidc/index.cjs.default.js +0 -1
- package/oidc/index.cjs.js +0 -8085
- package/oidc/index.cjs.mjs +0 -2
- package/test/index.cjs.default.js +0 -1
- package/test/index.cjs.js +0 -5728
- package/test/index.cjs.mjs +0 -2
- package/twilio/index.cjs.default.js +0 -1
- package/twilio/index.cjs.js +0 -404
- package/twilio/index.cjs.mjs +0 -2
- package/zoho/index.cjs.default.js +0 -1
- package/zoho/index.cjs.js +0 -1810
- package/zoho/index.cjs.mjs +0 -2
package/mcp/index.esm.js
CHANGED
|
@@ -14,7 +14,7 @@ function _class_call_check$5(instance, Constructor) {
|
|
|
14
14
|
throw new TypeError("Cannot call a class as a function");
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
function _define_property$
|
|
17
|
+
function _define_property$a(obj, key, value) {
|
|
18
18
|
if (key in obj) {
|
|
19
19
|
Object.defineProperty(obj, key, {
|
|
20
20
|
value: value,
|
|
@@ -85,7 +85,7 @@ function _define_property$9(obj, key, value) {
|
|
|
85
85
|
* discovery document. Claude custom-connector reads this to discover the OIDC issuer.
|
|
86
86
|
*
|
|
87
87
|
* @example 'https://api.example.com/oidc'
|
|
88
|
-
*/ _define_property$
|
|
88
|
+
*/ _define_property$a(this, "oidcIssuer", void 0);
|
|
89
89
|
/**
|
|
90
90
|
* The canonical resource URL of the MCP endpoint.
|
|
91
91
|
*
|
|
@@ -93,7 +93,7 @@ function _define_property$9(obj, key, value) {
|
|
|
93
93
|
* and used as the audience the access token's `aud` claim should match.
|
|
94
94
|
*
|
|
95
95
|
* @example 'https://api.example.com/mcp'
|
|
96
|
-
*/ _define_property$
|
|
96
|
+
*/ _define_property$a(this, "mcpUrl", void 0);
|
|
97
97
|
/**
|
|
98
98
|
* Optional filter applied to the OIDC provider's scope list when building the
|
|
99
99
|
* protected-resource discovery document's `scopes_supported` (RFC 9728 §2).
|
|
@@ -112,19 +112,19 @@ function _define_property$9(obj, key, value) {
|
|
|
112
112
|
* the OIDC provider nothing to grant and ending the interaction in `access_denied`.
|
|
113
113
|
*
|
|
114
114
|
* @example (allScopes) => allScopes.filter((scope) => scope === 'openid' || scope.startsWith('model.'))
|
|
115
|
-
*/ _define_property$
|
|
115
|
+
*/ _define_property$a(this, "scopesSupported", void 0);
|
|
116
116
|
/**
|
|
117
117
|
* Optional name advertised on the MCP `initialize` handshake. Defaults to
|
|
118
118
|
* {@link DEFAULT_MCP_SERVER_NAME}.
|
|
119
|
-
*/ _define_property$
|
|
119
|
+
*/ _define_property$a(this, "serverName", void 0);
|
|
120
120
|
/**
|
|
121
121
|
* Optional version advertised on the MCP `initialize` handshake.
|
|
122
|
-
*/ _define_property$
|
|
122
|
+
*/ _define_property$a(this, "serverVersion", void 0);
|
|
123
123
|
/**
|
|
124
124
|
* Optional override for the `instructions` string passed to `new McpServer(...)` and
|
|
125
125
|
* advertised on the JSON-RPC `initialize` handshake. Defaults to
|
|
126
126
|
* {@link DEFAULT_MCP_SERVER_INSTRUCTIONS}.
|
|
127
|
-
*/ _define_property$
|
|
127
|
+
*/ _define_property$a(this, "serverInstructions", void 0);
|
|
128
128
|
/**
|
|
129
129
|
* Absolute path to a pre-rendered MCP manifest JSON file produced by
|
|
130
130
|
* `dbx-cli-generate-mcp-manifest`. When set, the runtime reads it once at
|
|
@@ -134,7 +134,7 @@ function _define_property$9(obj, key, value) {
|
|
|
134
134
|
* Optional. When unset or the file is missing, the runtime falls back to
|
|
135
135
|
* today's behavior (auto-generated descriptions, ArkType-derived input
|
|
136
136
|
* schemas, no output schemas) and emits a single boot warning.
|
|
137
|
-
*/ _define_property$
|
|
137
|
+
*/ _define_property$a(this, "mcpManifestPath", void 0);
|
|
138
138
|
/**
|
|
139
139
|
* Absolute path to a pre-rendered route manifest JSON file produced by
|
|
140
140
|
* `dbx-cli-generate-route-manifest`. When set, the runtime reads it once at
|
|
@@ -144,7 +144,7 @@ function _define_property$9(obj, key, value) {
|
|
|
144
144
|
* Optional. When unset or the file is missing, the runtime skips registering
|
|
145
145
|
* `url-models` and emits a single boot warning when the path was set but
|
|
146
146
|
* unreadable.
|
|
147
|
-
*/ _define_property$
|
|
147
|
+
*/ _define_property$a(this, "mcpRouteManifestPath", void 0);
|
|
148
148
|
/**
|
|
149
149
|
* When `true`, the MCP server only advertises tools whose effective read-only classification is `true`.
|
|
150
150
|
*
|
|
@@ -154,7 +154,7 @@ function _define_property$9(obj, key, value) {
|
|
|
154
154
|
*
|
|
155
155
|
* The advertised `serverName` on the JSON-RPC `initialize` handshake is suffixed with
|
|
156
156
|
* ` (read-only)` so the client surface reflects the mode.
|
|
157
|
-
*/ _define_property$
|
|
157
|
+
*/ _define_property$a(this, "readOnly", void 0);
|
|
158
158
|
/**
|
|
159
159
|
* Controls the auto-injected `reason` parameter added to every advertised tool's input schema.
|
|
160
160
|
*
|
|
@@ -164,7 +164,7 @@ function _define_property$9(obj, key, value) {
|
|
|
164
164
|
* When enabled, every advertised tool's `inputSchema` carries a required `reason` string the model
|
|
165
165
|
* fills with a short justification for the call. The value is forwarded to analytics and stripped
|
|
166
166
|
* from the dispatched handler body. See {@link McpReasonParameterConfig}.
|
|
167
|
-
*/ _define_property$
|
|
167
|
+
*/ _define_property$a(this, "reasonParameter", void 0);
|
|
168
168
|
/**
|
|
169
169
|
* Default OIDC scope group term required on EVERY `callModel` op, mirrored into MCP tool-list
|
|
170
170
|
* visibility, unless a finer term overrides it (a per-function `requiredScope`, then a
|
|
@@ -174,17 +174,20 @@ function _define_property$9(obj, key, value) {
|
|
|
174
174
|
*
|
|
175
175
|
* Set this to the SAME value passed to `ModelApiDispatchConfig.defaultRequiredScope` to
|
|
176
176
|
* keep tool visibility and enforcement in lockstep.
|
|
177
|
-
*/ _define_property$
|
|
177
|
+
*/ _define_property$a(this, "defaultRequiredScope", void 0);
|
|
178
178
|
/**
|
|
179
179
|
* Per-model OIDC scope group-term overrides, keyed by {@link FirestoreModelType}, mirrored into MCP
|
|
180
180
|
* tool-list visibility. Set this to the SAME value passed to
|
|
181
181
|
* `ModelApiDispatchConfig.modelRequiredScopes` so per-model / verb-keyed restrictions that
|
|
182
182
|
* confine a subset client apply identically to the advertised tool list.
|
|
183
|
-
*/ _define_property$
|
|
183
|
+
*/ _define_property$a(this, "modelRequiredScopes", void 0);
|
|
184
184
|
};
|
|
185
185
|
/**
|
|
186
186
|
* NestJS injection token for the optional {@link McpAuthRoleReader} provider.
|
|
187
187
|
*/ var MCP_AUTH_ROLE_READER = 'MCP_AUTH_ROLE_READER';
|
|
188
|
+
/**
|
|
189
|
+
* NestJS injection token for the optional {@link McpModelRolesTargetUidPredicate} provider.
|
|
190
|
+
*/ var MCP_MODEL_ROLES_TARGET_UID_PREDICATE = 'MCP_MODEL_ROLES_TARGET_UID_PREDICATE';
|
|
188
191
|
|
|
189
192
|
function _type_of$5(obj) {
|
|
190
193
|
"@swc/helpers - typeof";
|
|
@@ -214,7 +217,7 @@ function _array_like_to_array$b(arr, len) {
|
|
|
214
217
|
function _array_without_holes$8(arr) {
|
|
215
218
|
if (Array.isArray(arr)) return _array_like_to_array$b(arr);
|
|
216
219
|
}
|
|
217
|
-
function _define_property$
|
|
220
|
+
function _define_property$9(obj, key, value) {
|
|
218
221
|
if (key in obj) {
|
|
219
222
|
Object.defineProperty(obj, key, {
|
|
220
223
|
value: value,
|
|
@@ -233,7 +236,7 @@ function _iterable_to_array$8(iter) {
|
|
|
233
236
|
function _non_iterable_spread$8() {
|
|
234
237
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
235
238
|
}
|
|
236
|
-
function _object_spread$
|
|
239
|
+
function _object_spread$7(target) {
|
|
237
240
|
for(var i = 1; i < arguments.length; i++){
|
|
238
241
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
239
242
|
var ownKeys = Object.keys(source);
|
|
@@ -243,7 +246,7 @@ function _object_spread$6(target) {
|
|
|
243
246
|
}));
|
|
244
247
|
}
|
|
245
248
|
ownKeys.forEach(function(key) {
|
|
246
|
-
_define_property$
|
|
249
|
+
_define_property$9(target, key, source[key]);
|
|
247
250
|
});
|
|
248
251
|
}
|
|
249
252
|
return target;
|
|
@@ -353,9 +356,9 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
353
356
|
var _base_type;
|
|
354
357
|
var base = (typeof inputSchema === "undefined" ? "undefined" : _type_of$4(inputSchema)) === 'object' && inputSchema != null ? inputSchema : {};
|
|
355
358
|
var existingProperties = _type_of$4(base.properties) === 'object' && base.properties != null ? base.properties : {};
|
|
356
|
-
var next = _object_spread_props$3(_object_spread$
|
|
359
|
+
var next = _object_spread_props$3(_object_spread$7({}, base), {
|
|
357
360
|
type: (_base_type = base.type) !== null && _base_type !== void 0 ? _base_type : 'object',
|
|
358
|
-
properties: _object_spread_props$3(_object_spread$
|
|
361
|
+
properties: _object_spread_props$3(_object_spread$7({}, existingProperties), _define_property$9({}, resolved.parameterName, {
|
|
359
362
|
type: 'string',
|
|
360
363
|
maxLength: resolved.maxLength,
|
|
361
364
|
description: resolved.description
|
|
@@ -389,7 +392,7 @@ function _unsupported_iterable_to_array$b(o, minLen) {
|
|
|
389
392
|
var result;
|
|
390
393
|
if (resolved.enabled && !toolDeclaresOwnReason && Object.prototype.hasOwnProperty.call(args, resolved.parameterName)) {
|
|
391
394
|
var rawValue = args[resolved.parameterName];
|
|
392
|
-
var nextArgs = _object_spread$
|
|
395
|
+
var nextArgs = _object_spread$7({}, args);
|
|
393
396
|
delete nextArgs[resolved.parameterName];
|
|
394
397
|
var stringValue = rawValue == null ? '' : String(rawValue);
|
|
395
398
|
var clamped = stringValue.length > resolved.maxLength ? stringValue.slice(0, resolved.maxLength) : stringValue;
|
|
@@ -744,7 +747,7 @@ function scoreCandidates(states, pathname) {
|
|
|
744
747
|
});
|
|
745
748
|
}
|
|
746
749
|
|
|
747
|
-
function asyncGeneratorStep$
|
|
750
|
+
function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
|
|
748
751
|
try {
|
|
749
752
|
var info = gen[key](arg);
|
|
750
753
|
var value = info.value;
|
|
@@ -758,16 +761,16 @@ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
758
761
|
Promise.resolve(value).then(_next, _throw);
|
|
759
762
|
}
|
|
760
763
|
}
|
|
761
|
-
function _async_to_generator$
|
|
764
|
+
function _async_to_generator$7(fn) {
|
|
762
765
|
return function() {
|
|
763
766
|
var self = this, args = arguments;
|
|
764
767
|
return new Promise(function(resolve, reject) {
|
|
765
768
|
var gen = fn.apply(self, args);
|
|
766
769
|
function _next(value) {
|
|
767
|
-
asyncGeneratorStep$
|
|
770
|
+
asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
|
|
768
771
|
}
|
|
769
772
|
function _throw(err) {
|
|
770
|
-
asyncGeneratorStep$
|
|
773
|
+
asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
|
|
771
774
|
}
|
|
772
775
|
_next(undefined);
|
|
773
776
|
});
|
|
@@ -781,7 +784,7 @@ function _instanceof$1(left, right) {
|
|
|
781
784
|
return left instanceof right;
|
|
782
785
|
}
|
|
783
786
|
}
|
|
784
|
-
function _ts_generator$
|
|
787
|
+
function _ts_generator$7(thisArg, body) {
|
|
785
788
|
var f, y, t, _ = {
|
|
786
789
|
label: 0,
|
|
787
790
|
sent: function() {
|
|
@@ -909,9 +912,9 @@ function _ts_generator$6(thisArg, body) {
|
|
|
909
912
|
* @param details - The handler-level API details (carries the mapper + Tier 2/3 formatters).
|
|
910
913
|
* @returns The MCP tool response content.
|
|
911
914
|
*/ function formatMcpToolResponse(result, params, details) {
|
|
912
|
-
return _async_to_generator$
|
|
915
|
+
return _async_to_generator$7(function() {
|
|
913
916
|
var mcp, value, _tmp, context, response, summary;
|
|
914
|
-
return _ts_generator$
|
|
917
|
+
return _ts_generator$7(this, function(_state) {
|
|
915
918
|
switch(_state.label){
|
|
916
919
|
case 0:
|
|
917
920
|
mcp = details === null || details === void 0 ? void 0 : details.mcp;
|
|
@@ -1771,7 +1774,7 @@ function _array_like_to_array$8(arr, len) {
|
|
|
1771
1774
|
function _array_without_holes$7(arr) {
|
|
1772
1775
|
if (Array.isArray(arr)) return _array_like_to_array$8(arr);
|
|
1773
1776
|
}
|
|
1774
|
-
function asyncGeneratorStep$
|
|
1777
|
+
function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1775
1778
|
try {
|
|
1776
1779
|
var info = gen[key](arg);
|
|
1777
1780
|
var value = info.value;
|
|
@@ -1785,16 +1788,16 @@ function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
1785
1788
|
Promise.resolve(value).then(_next, _throw);
|
|
1786
1789
|
}
|
|
1787
1790
|
}
|
|
1788
|
-
function _async_to_generator$
|
|
1791
|
+
function _async_to_generator$6(fn) {
|
|
1789
1792
|
return function() {
|
|
1790
1793
|
var self = this, args = arguments;
|
|
1791
1794
|
return new Promise(function(resolve, reject) {
|
|
1792
1795
|
var gen = fn.apply(self, args);
|
|
1793
1796
|
function _next(value) {
|
|
1794
|
-
asyncGeneratorStep$
|
|
1797
|
+
asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
|
|
1795
1798
|
}
|
|
1796
1799
|
function _throw(err) {
|
|
1797
|
-
asyncGeneratorStep$
|
|
1800
|
+
asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1798
1801
|
}
|
|
1799
1802
|
_next(undefined);
|
|
1800
1803
|
});
|
|
@@ -1817,7 +1820,7 @@ function _unsupported_iterable_to_array$8(o, minLen) {
|
|
|
1817
1820
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1818
1821
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$8(o, minLen);
|
|
1819
1822
|
}
|
|
1820
|
-
function _ts_generator$
|
|
1823
|
+
function _ts_generator$6(thisArg, body) {
|
|
1821
1824
|
var f, y, t, _ = {
|
|
1822
1825
|
label: 0,
|
|
1823
1826
|
sent: function() {
|
|
@@ -1978,9 +1981,9 @@ function _ts_generator$5(thisArg, body) {
|
|
|
1978
1981
|
}
|
|
1979
1982
|
// MARK: Handler
|
|
1980
1983
|
function modelGetToolHandler(args, ctx, deps) {
|
|
1981
|
-
return _async_to_generator$
|
|
1984
|
+
return _async_to_generator$6(function() {
|
|
1982
1985
|
var result, input, identity, resolvedKeys, merged, error;
|
|
1983
|
-
return _ts_generator$
|
|
1986
|
+
return _ts_generator$6(this, function(_state) {
|
|
1984
1987
|
switch(_state.label){
|
|
1985
1988
|
case 0:
|
|
1986
1989
|
_state.trys.push([
|
|
@@ -1994,7 +1997,7 @@ function modelGetToolHandler(args, ctx, deps) {
|
|
|
1994
1997
|
if (identity == null) {
|
|
1995
1998
|
throw new Error("Unknown modelType: ".concat(input.modelType));
|
|
1996
1999
|
}
|
|
1997
|
-
resolvedKeys = resolveKeys(input.keys, identity);
|
|
2000
|
+
resolvedKeys = resolveKeys$1(input.keys, identity);
|
|
1998
2001
|
return [
|
|
1999
2002
|
4,
|
|
2000
2003
|
readInChunks$1({
|
|
@@ -2055,7 +2058,7 @@ function parseModelGetInput(args) {
|
|
|
2055
2058
|
keys: normalizedKeys
|
|
2056
2059
|
};
|
|
2057
2060
|
}
|
|
2058
|
-
function resolveKeys(keys, identity) {
|
|
2061
|
+
function resolveKeys$1(keys, identity) {
|
|
2059
2062
|
var isRoot = identity.type === 'root';
|
|
2060
2063
|
var resolved = [];
|
|
2061
2064
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
@@ -2087,9 +2090,9 @@ function resolveKeys(keys, identity) {
|
|
|
2087
2090
|
return resolved;
|
|
2088
2091
|
}
|
|
2089
2092
|
function readInChunks$1(input) {
|
|
2090
|
-
return _async_to_generator$
|
|
2093
|
+
return _async_to_generator$6(function() {
|
|
2091
2094
|
var modelType, keys, auth, readDocuments, merged, offset, _merged_results, _merged_errors, batch, partial;
|
|
2092
|
-
return _ts_generator$
|
|
2095
|
+
return _ts_generator$6(this, function(_state) {
|
|
2093
2096
|
switch(_state.label){
|
|
2094
2097
|
case 0:
|
|
2095
2098
|
modelType = input.modelType, keys = input.keys, auth = input.auth, readDocuments = input.readDocuments;
|
|
@@ -2203,6 +2206,512 @@ var MODEL_GET_OUTPUT_SCHEMA = {
|
|
|
2203
2206
|
}
|
|
2204
2207
|
};
|
|
2205
2208
|
|
|
2209
|
+
function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2210
|
+
try {
|
|
2211
|
+
var info = gen[key](arg);
|
|
2212
|
+
var value = info.value;
|
|
2213
|
+
} catch (error) {
|
|
2214
|
+
reject(error);
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
if (info.done) {
|
|
2218
|
+
resolve(value);
|
|
2219
|
+
} else {
|
|
2220
|
+
Promise.resolve(value).then(_next, _throw);
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
function _async_to_generator$5(fn) {
|
|
2224
|
+
return function() {
|
|
2225
|
+
var self = this, args = arguments;
|
|
2226
|
+
return new Promise(function(resolve, reject) {
|
|
2227
|
+
var gen = fn.apply(self, args);
|
|
2228
|
+
function _next(value) {
|
|
2229
|
+
asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "next", value);
|
|
2230
|
+
}
|
|
2231
|
+
function _throw(err) {
|
|
2232
|
+
asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2233
|
+
}
|
|
2234
|
+
_next(undefined);
|
|
2235
|
+
});
|
|
2236
|
+
};
|
|
2237
|
+
}
|
|
2238
|
+
function _define_property$8(obj, key, value) {
|
|
2239
|
+
if (key in obj) {
|
|
2240
|
+
Object.defineProperty(obj, key, {
|
|
2241
|
+
value: value,
|
|
2242
|
+
enumerable: true,
|
|
2243
|
+
configurable: true,
|
|
2244
|
+
writable: true
|
|
2245
|
+
});
|
|
2246
|
+
} else {
|
|
2247
|
+
obj[key] = value;
|
|
2248
|
+
}
|
|
2249
|
+
return obj;
|
|
2250
|
+
}
|
|
2251
|
+
function _object_spread$6(target) {
|
|
2252
|
+
for(var i = 1; i < arguments.length; i++){
|
|
2253
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
2254
|
+
var ownKeys = Object.keys(source);
|
|
2255
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
2256
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
2257
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
2258
|
+
}));
|
|
2259
|
+
}
|
|
2260
|
+
ownKeys.forEach(function(key) {
|
|
2261
|
+
_define_property$8(target, key, source[key]);
|
|
2262
|
+
});
|
|
2263
|
+
}
|
|
2264
|
+
return target;
|
|
2265
|
+
}
|
|
2266
|
+
function _ts_generator$5(thisArg, body) {
|
|
2267
|
+
var f, y, t, _ = {
|
|
2268
|
+
label: 0,
|
|
2269
|
+
sent: function() {
|
|
2270
|
+
if (t[0] & 1) throw t[1];
|
|
2271
|
+
return t[1];
|
|
2272
|
+
},
|
|
2273
|
+
trys: [],
|
|
2274
|
+
ops: []
|
|
2275
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
2276
|
+
return d(g, "next", {
|
|
2277
|
+
value: verb(0)
|
|
2278
|
+
}), d(g, "throw", {
|
|
2279
|
+
value: verb(1)
|
|
2280
|
+
}), d(g, "return", {
|
|
2281
|
+
value: verb(2)
|
|
2282
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
2283
|
+
value: function() {
|
|
2284
|
+
return this;
|
|
2285
|
+
}
|
|
2286
|
+
}), g;
|
|
2287
|
+
function verb(n) {
|
|
2288
|
+
return function(v) {
|
|
2289
|
+
return step([
|
|
2290
|
+
n,
|
|
2291
|
+
v
|
|
2292
|
+
]);
|
|
2293
|
+
};
|
|
2294
|
+
}
|
|
2295
|
+
function step(op) {
|
|
2296
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
2297
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
2298
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
2299
|
+
if (y = 0, t) op = [
|
|
2300
|
+
op[0] & 2,
|
|
2301
|
+
t.value
|
|
2302
|
+
];
|
|
2303
|
+
switch(op[0]){
|
|
2304
|
+
case 0:
|
|
2305
|
+
case 1:
|
|
2306
|
+
t = op;
|
|
2307
|
+
break;
|
|
2308
|
+
case 4:
|
|
2309
|
+
_.label++;
|
|
2310
|
+
return {
|
|
2311
|
+
value: op[1],
|
|
2312
|
+
done: false
|
|
2313
|
+
};
|
|
2314
|
+
case 5:
|
|
2315
|
+
_.label++;
|
|
2316
|
+
y = op[1];
|
|
2317
|
+
op = [
|
|
2318
|
+
0
|
|
2319
|
+
];
|
|
2320
|
+
continue;
|
|
2321
|
+
case 7:
|
|
2322
|
+
op = _.ops.pop();
|
|
2323
|
+
_.trys.pop();
|
|
2324
|
+
continue;
|
|
2325
|
+
default:
|
|
2326
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
2327
|
+
_ = 0;
|
|
2328
|
+
continue;
|
|
2329
|
+
}
|
|
2330
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
2331
|
+
_.label = op[1];
|
|
2332
|
+
break;
|
|
2333
|
+
}
|
|
2334
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
2335
|
+
_.label = t[1];
|
|
2336
|
+
t = op;
|
|
2337
|
+
break;
|
|
2338
|
+
}
|
|
2339
|
+
if (t && _.label < t[2]) {
|
|
2340
|
+
_.label = t[2];
|
|
2341
|
+
_.ops.push(op);
|
|
2342
|
+
break;
|
|
2343
|
+
}
|
|
2344
|
+
if (t[2]) _.ops.pop();
|
|
2345
|
+
_.trys.pop();
|
|
2346
|
+
continue;
|
|
2347
|
+
}
|
|
2348
|
+
op = body.call(thisArg, _);
|
|
2349
|
+
} catch (e) {
|
|
2350
|
+
op = [
|
|
2351
|
+
6,
|
|
2352
|
+
e
|
|
2353
|
+
];
|
|
2354
|
+
y = 0;
|
|
2355
|
+
} finally{
|
|
2356
|
+
f = t = 0;
|
|
2357
|
+
}
|
|
2358
|
+
if (op[0] & 5) throw op[1];
|
|
2359
|
+
return {
|
|
2360
|
+
value: op[0] ? op[1] : void 0,
|
|
2361
|
+
done: true
|
|
2362
|
+
};
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
// MARK: Constants
|
|
2366
|
+
/**
|
|
2367
|
+
* Reserved tool name for the built-in `model-roles` static tool.
|
|
2368
|
+
*/ var MODEL_ROLES_TOOL_NAME = 'model-roles';
|
|
2369
|
+
/**
|
|
2370
|
+
* Synthetic call type used in the tool's dispatch identity. Distinct from `model-get`'s `get` so
|
|
2371
|
+
* visibility predicates can target the two independently.
|
|
2372
|
+
*/ var MODEL_ROLES_DISPATCH_CALL = 'roles';
|
|
2373
|
+
/**
|
|
2374
|
+
* Synthetic model type used in the tool's dispatch identity. Mirrors {@link MODEL_GET_DISPATCH_MODEL_TYPE}
|
|
2375
|
+
* — the tool isn't bound to one model type, so the literal "model" stands in.
|
|
2376
|
+
*/ var MODEL_ROLES_DISPATCH_MODEL_TYPE = 'model';
|
|
2377
|
+
/**
|
|
2378
|
+
* Maximum number of keys accepted per `model-roles` call. Role resolution runs the model's real
|
|
2379
|
+
* permission delegate per key (which may itself read parent documents), so this is deliberately
|
|
2380
|
+
* lower than the `model-get` batch size.
|
|
2381
|
+
*/ var MCP_MODEL_ROLES_MAX_KEYS = 25;
|
|
2382
|
+
// MARK: Factory
|
|
2383
|
+
/**
|
|
2384
|
+
* Builds the built-in `model-roles` MCP tool definition.
|
|
2385
|
+
*
|
|
2386
|
+
* Answers "what is this user actually allowed to do with this document?" by running the same
|
|
2387
|
+
* `roleMapForModel()` delegate the permission-checked read/write paths use, and returning the
|
|
2388
|
+
* resolved roles instead of consuming them. Because the model's real delegate runs, derived and
|
|
2389
|
+
* cascading roles appear exactly as the API grants them — there is no second implementation of the
|
|
2390
|
+
* rules to drift.
|
|
2391
|
+
*
|
|
2392
|
+
* Two things it disambiguates that a plain read cannot:
|
|
2393
|
+
* - **Missing vs. forbidden.** A key that resolves to a missing document returns
|
|
2394
|
+
* `exists: false, roles: []` rather than an error, so "the document is not there" reads
|
|
2395
|
+
* differently from "it is there and you have no access" (`exists: true, roles: []`).
|
|
2396
|
+
* - **Full access.** Admin short-circuits that grant the full-access marker come back as
|
|
2397
|
+
* `fullAccess: true` rather than as an opaque enumerated set.
|
|
2398
|
+
*
|
|
2399
|
+
* By default roles are resolved for the calling user. Passing `uid` resolves them for another user
|
|
2400
|
+
* and is gated behind {@link CreateModelRolesToolDeps.canTargetOtherUids}.
|
|
2401
|
+
*
|
|
2402
|
+
* @param deps - Role-map reader, identity resolver, and the target-uid authorization predicate.
|
|
2403
|
+
* @returns A statically-registered {@link McpToolDefinition} ready to be appended to the MCP
|
|
2404
|
+
* server factory's tool registry.
|
|
2405
|
+
*/ function createModelRolesTool(deps) {
|
|
2406
|
+
var handler = function handler(args, ctx) {
|
|
2407
|
+
return modelRolesToolHandler(args, ctx, deps);
|
|
2408
|
+
};
|
|
2409
|
+
var name = MODEL_ROLES_TOOL_NAME;
|
|
2410
|
+
var description = 'Resolve which roles the current user (or, with "uid", another user) is granted on one or more model keys — the same permission computation the API runs, returned instead of enforced. Use to answer "why was this forbidden?" and to tell a missing document (exists:false) apart from one you cannot access (exists:true, roles:[]). Admin full-access short-circuits report fullAccess:true. Targeting another uid requires elevated access.';
|
|
2411
|
+
return buildStaticToolDefinition({
|
|
2412
|
+
name: name,
|
|
2413
|
+
description: description,
|
|
2414
|
+
inputSchema: MODEL_ROLES_INPUT_SCHEMA,
|
|
2415
|
+
outputSchema: MODEL_ROLES_OUTPUT_SCHEMA,
|
|
2416
|
+
dispatch: {
|
|
2417
|
+
call: MODEL_ROLES_DISPATCH_CALL,
|
|
2418
|
+
modelType: MODEL_ROLES_DISPATCH_MODEL_TYPE
|
|
2419
|
+
},
|
|
2420
|
+
staticHandler: handler,
|
|
2421
|
+
effectiveReadOnly: true,
|
|
2422
|
+
rule: {
|
|
2423
|
+
requireAuthenticated: true
|
|
2424
|
+
}
|
|
2425
|
+
});
|
|
2426
|
+
}
|
|
2427
|
+
// MARK: Handler
|
|
2428
|
+
function modelRolesToolHandler(args, ctx, deps) {
|
|
2429
|
+
return _async_to_generator$5(function() {
|
|
2430
|
+
var result, input, identity, targetUid, keys, resolved, error;
|
|
2431
|
+
return _ts_generator$5(this, function(_state) {
|
|
2432
|
+
switch(_state.label){
|
|
2433
|
+
case 0:
|
|
2434
|
+
_state.trys.push([
|
|
2435
|
+
0,
|
|
2436
|
+
3,
|
|
2437
|
+
,
|
|
2438
|
+
4
|
|
2439
|
+
]);
|
|
2440
|
+
input = parseModelRolesInput(args);
|
|
2441
|
+
identity = deps.resolveIdentity(input.modelType, ctx.auth);
|
|
2442
|
+
if (identity == null) {
|
|
2443
|
+
throw new Error("Unknown modelType: ".concat(input.modelType));
|
|
2444
|
+
}
|
|
2445
|
+
return [
|
|
2446
|
+
4,
|
|
2447
|
+
resolveTargetUid({
|
|
2448
|
+
requestedUid: input.uid,
|
|
2449
|
+
auth: ctx.auth,
|
|
2450
|
+
canTargetOtherUids: deps.canTargetOtherUids
|
|
2451
|
+
})
|
|
2452
|
+
];
|
|
2453
|
+
case 1:
|
|
2454
|
+
targetUid = _state.sent();
|
|
2455
|
+
keys = resolveKeys(input.keys, identity);
|
|
2456
|
+
return [
|
|
2457
|
+
4,
|
|
2458
|
+
deps.readRoleMaps(_object_spread$6({
|
|
2459
|
+
modelType: input.modelType,
|
|
2460
|
+
keys: keys,
|
|
2461
|
+
auth: ctx.auth
|
|
2462
|
+
}, targetUid == null ? {} : {
|
|
2463
|
+
targetUid: targetUid
|
|
2464
|
+
}))
|
|
2465
|
+
];
|
|
2466
|
+
case 2:
|
|
2467
|
+
resolved = _state.sent();
|
|
2468
|
+
result = {
|
|
2469
|
+
content: [
|
|
2470
|
+
{
|
|
2471
|
+
type: 'text',
|
|
2472
|
+
text: JSON.stringify(resolved)
|
|
2473
|
+
}
|
|
2474
|
+
],
|
|
2475
|
+
structuredContent: resolved
|
|
2476
|
+
};
|
|
2477
|
+
return [
|
|
2478
|
+
3,
|
|
2479
|
+
4
|
|
2480
|
+
];
|
|
2481
|
+
case 3:
|
|
2482
|
+
error = _state.sent();
|
|
2483
|
+
result = formatMcpToolErrorResponse(error);
|
|
2484
|
+
return [
|
|
2485
|
+
3,
|
|
2486
|
+
4
|
|
2487
|
+
];
|
|
2488
|
+
case 4:
|
|
2489
|
+
return [
|
|
2490
|
+
2,
|
|
2491
|
+
result
|
|
2492
|
+
];
|
|
2493
|
+
}
|
|
2494
|
+
});
|
|
2495
|
+
})();
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Resolves the effective target uid for a call, enforcing the elevated-access gate.
|
|
2499
|
+
*
|
|
2500
|
+
* Requesting your own uid is always allowed and is treated as no target at all, so a caller that
|
|
2501
|
+
* passes their own uid never trips the predicate.
|
|
2502
|
+
*
|
|
2503
|
+
* @param input - The requested uid, the caller's auth, and the authorization predicate.
|
|
2504
|
+
* @returns The uid to resolve as, or `undefined` to resolve as the caller.
|
|
2505
|
+
* @throws {Error} When another user's uid is requested and the predicate denies (or is absent).
|
|
2506
|
+
*/ function resolveTargetUid(input) {
|
|
2507
|
+
return _async_to_generator$5(function() {
|
|
2508
|
+
var requestedUid, auth, canTargetOtherUids, result, allowed, _tmp;
|
|
2509
|
+
return _ts_generator$5(this, function(_state) {
|
|
2510
|
+
switch(_state.label){
|
|
2511
|
+
case 0:
|
|
2512
|
+
requestedUid = input.requestedUid, auth = input.auth, canTargetOtherUids = input.canTargetOtherUids;
|
|
2513
|
+
if (!(requestedUid != null && requestedUid !== (auth === null || auth === void 0 ? void 0 : auth.uid))) return [
|
|
2514
|
+
3,
|
|
2515
|
+
4
|
|
2516
|
+
];
|
|
2517
|
+
if (!(canTargetOtherUids == null)) return [
|
|
2518
|
+
3,
|
|
2519
|
+
1
|
|
2520
|
+
];
|
|
2521
|
+
_tmp = false;
|
|
2522
|
+
return [
|
|
2523
|
+
3,
|
|
2524
|
+
3
|
|
2525
|
+
];
|
|
2526
|
+
case 1:
|
|
2527
|
+
return [
|
|
2528
|
+
4,
|
|
2529
|
+
canTargetOtherUids(auth)
|
|
2530
|
+
];
|
|
2531
|
+
case 2:
|
|
2532
|
+
_tmp = _state.sent();
|
|
2533
|
+
_state.label = 3;
|
|
2534
|
+
case 3:
|
|
2535
|
+
allowed = _tmp;
|
|
2536
|
+
if (!allowed) {
|
|
2537
|
+
throw new Error("model-roles: resolving roles for another user's uid requires elevated access.");
|
|
2538
|
+
}
|
|
2539
|
+
result = requestedUid;
|
|
2540
|
+
_state.label = 4;
|
|
2541
|
+
case 4:
|
|
2542
|
+
return [
|
|
2543
|
+
2,
|
|
2544
|
+
result
|
|
2545
|
+
];
|
|
2546
|
+
}
|
|
2547
|
+
});
|
|
2548
|
+
})();
|
|
2549
|
+
}
|
|
2550
|
+
function parseModelRolesInput(args) {
|
|
2551
|
+
var modelType = args['modelType'];
|
|
2552
|
+
var keys = args['keys'];
|
|
2553
|
+
var uid = args['uid'];
|
|
2554
|
+
if (typeof modelType !== 'string' || modelType.length === 0) {
|
|
2555
|
+
throw new Error('model-roles: "modelType" is required and must be a non-empty string.');
|
|
2556
|
+
}
|
|
2557
|
+
if (!Array.isArray(keys) || keys.length === 0) {
|
|
2558
|
+
throw new Error('model-roles: "keys" is required and must be a non-empty array.');
|
|
2559
|
+
}
|
|
2560
|
+
if (keys.length > MCP_MODEL_ROLES_MAX_KEYS) {
|
|
2561
|
+
throw new Error("model-roles: at most ".concat(MCP_MODEL_ROLES_MAX_KEYS, " keys may be resolved per call (received ").concat(keys.length, ")."));
|
|
2562
|
+
}
|
|
2563
|
+
if (uid !== undefined && (typeof uid !== 'string' || uid.length === 0)) {
|
|
2564
|
+
throw new Error('model-roles: "uid" must be a non-empty string when provided.');
|
|
2565
|
+
}
|
|
2566
|
+
var normalizedKeys = keys.map(function(value, index) {
|
|
2567
|
+
if (typeof value !== 'string' || value.length === 0) {
|
|
2568
|
+
throw new Error("model-roles: keys[".concat(index, "] must be a non-empty string."));
|
|
2569
|
+
}
|
|
2570
|
+
return value;
|
|
2571
|
+
});
|
|
2572
|
+
return _object_spread$6({
|
|
2573
|
+
modelType: modelType,
|
|
2574
|
+
keys: normalizedKeys
|
|
2575
|
+
}, uid === undefined ? {} : {
|
|
2576
|
+
uid: uid
|
|
2577
|
+
});
|
|
2578
|
+
}
|
|
2579
|
+
function resolveKeys(keys, identity) {
|
|
2580
|
+
var isRoot = identity.type === 'root';
|
|
2581
|
+
var resolved = [];
|
|
2582
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2583
|
+
try {
|
|
2584
|
+
for(var _iterator = keys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2585
|
+
var value = _step.value;
|
|
2586
|
+
if (value.includes('/')) {
|
|
2587
|
+
resolved.push(value);
|
|
2588
|
+
} else if (isRoot) {
|
|
2589
|
+
resolved.push("".concat(identity.collectionName, "/").concat(value));
|
|
2590
|
+
} else {
|
|
2591
|
+
throw new Error('model-roles: modelType "'.concat(identity.modelType, '" is a subcollection; bare ids are not allowed. Provide full keys (e.g. "parentPrefix/parentId/').concat(identity.collectionName, "/").concat(value, '").'));
|
|
2592
|
+
}
|
|
2593
|
+
}
|
|
2594
|
+
} catch (err) {
|
|
2595
|
+
_didIteratorError = true;
|
|
2596
|
+
_iteratorError = err;
|
|
2597
|
+
} finally{
|
|
2598
|
+
try {
|
|
2599
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2600
|
+
_iterator.return();
|
|
2601
|
+
}
|
|
2602
|
+
} finally{
|
|
2603
|
+
if (_didIteratorError) {
|
|
2604
|
+
throw _iteratorError;
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
}
|
|
2608
|
+
return resolved;
|
|
2609
|
+
}
|
|
2610
|
+
// MARK: Schemas
|
|
2611
|
+
var MODEL_ROLES_INPUT_SCHEMA = {
|
|
2612
|
+
type: 'object',
|
|
2613
|
+
required: [
|
|
2614
|
+
'modelType',
|
|
2615
|
+
'keys'
|
|
2616
|
+
],
|
|
2617
|
+
properties: {
|
|
2618
|
+
modelType: {
|
|
2619
|
+
type: 'string',
|
|
2620
|
+
minLength: 1,
|
|
2621
|
+
description: 'Firestore model type to resolve roles on (e.g. "guestbook", "profile").'
|
|
2622
|
+
},
|
|
2623
|
+
keys: {
|
|
2624
|
+
type: 'array',
|
|
2625
|
+
minItems: 1,
|
|
2626
|
+
maxItems: MCP_MODEL_ROLES_MAX_KEYS,
|
|
2627
|
+
description: 'Full keys ("prefix/id") or bare ids (root models only).',
|
|
2628
|
+
items: {
|
|
2629
|
+
type: 'string',
|
|
2630
|
+
minLength: 1
|
|
2631
|
+
}
|
|
2632
|
+
},
|
|
2633
|
+
uid: {
|
|
2634
|
+
type: 'string',
|
|
2635
|
+
minLength: 1,
|
|
2636
|
+
description: 'Resolve roles as this user instead of the caller. Requires elevated access; passing your own uid is always allowed.'
|
|
2637
|
+
}
|
|
2638
|
+
},
|
|
2639
|
+
additionalProperties: false
|
|
2640
|
+
};
|
|
2641
|
+
var MODEL_ROLES_OUTPUT_SCHEMA = {
|
|
2642
|
+
type: 'object',
|
|
2643
|
+
required: [
|
|
2644
|
+
'targeted',
|
|
2645
|
+
'results',
|
|
2646
|
+
'errors'
|
|
2647
|
+
],
|
|
2648
|
+
properties: {
|
|
2649
|
+
uid: {
|
|
2650
|
+
type: 'string',
|
|
2651
|
+
description: 'The uid the roles were resolved for.'
|
|
2652
|
+
},
|
|
2653
|
+
targeted: {
|
|
2654
|
+
type: 'boolean',
|
|
2655
|
+
description: 'True when the roles were resolved for a user other than the caller.'
|
|
2656
|
+
},
|
|
2657
|
+
results: {
|
|
2658
|
+
type: 'array',
|
|
2659
|
+
description: 'Per-key resolved permission state.',
|
|
2660
|
+
items: {
|
|
2661
|
+
type: 'object',
|
|
2662
|
+
required: [
|
|
2663
|
+
'key',
|
|
2664
|
+
'exists',
|
|
2665
|
+
'fullAccess',
|
|
2666
|
+
'roles'
|
|
2667
|
+
],
|
|
2668
|
+
properties: {
|
|
2669
|
+
key: {
|
|
2670
|
+
type: 'string'
|
|
2671
|
+
},
|
|
2672
|
+
exists: {
|
|
2673
|
+
type: 'boolean',
|
|
2674
|
+
description: 'Whether the document exists. Roles are only computed for documents that exist.'
|
|
2675
|
+
},
|
|
2676
|
+
fullAccess: {
|
|
2677
|
+
type: 'boolean',
|
|
2678
|
+
description: 'True when the full-access marker was granted; every role is implicitly held and "roles" is empty.'
|
|
2679
|
+
},
|
|
2680
|
+
roles: {
|
|
2681
|
+
type: 'array',
|
|
2682
|
+
items: {
|
|
2683
|
+
type: 'string'
|
|
2684
|
+
},
|
|
2685
|
+
description: 'Granted role names, sorted.'
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
}
|
|
2689
|
+
},
|
|
2690
|
+
errors: {
|
|
2691
|
+
type: 'array',
|
|
2692
|
+
description: 'Per-key failures. A missing document is NOT an error — it appears in results with exists:false.',
|
|
2693
|
+
items: {
|
|
2694
|
+
type: 'object',
|
|
2695
|
+
required: [
|
|
2696
|
+
'key',
|
|
2697
|
+
'message'
|
|
2698
|
+
],
|
|
2699
|
+
properties: {
|
|
2700
|
+
key: {
|
|
2701
|
+
type: 'string'
|
|
2702
|
+
},
|
|
2703
|
+
message: {
|
|
2704
|
+
type: 'string'
|
|
2705
|
+
},
|
|
2706
|
+
code: {
|
|
2707
|
+
type: 'string'
|
|
2708
|
+
}
|
|
2709
|
+
}
|
|
2710
|
+
}
|
|
2711
|
+
}
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
|
|
2206
2715
|
function _array_like_to_array$7(arr, len) {
|
|
2207
2716
|
if (len == null || len > arr.length) len = arr.length;
|
|
2208
2717
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -6058,13 +6567,14 @@ var McpServerFactoryService_1;
|
|
|
6058
6567
|
* per request and has no session concept at all — and it is equally what the SDK
|
|
6059
6568
|
* recommends for stateless 2025-era serving, so one factory backs both eras.
|
|
6060
6569
|
*/ var McpServerFactoryService = McpServerFactoryService_1 = /*#__PURE__*/ function() {
|
|
6061
|
-
function McpServerFactoryService(mcpConfig, dispatchService, modelApiGetService, roleReader, analyticsService, storageService) {
|
|
6570
|
+
function McpServerFactoryService(mcpConfig, dispatchService, modelApiGetService, roleReader, analyticsService, storageService, modelRolesTargetUidPredicate) {
|
|
6062
6571
|
_class_call_check$3(this, McpServerFactoryService);
|
|
6063
6572
|
_define_property$3(this, "mcpConfig", void 0);
|
|
6064
6573
|
_define_property$3(this, "dispatchService", void 0);
|
|
6065
6574
|
_define_property$3(this, "modelApiGetService", void 0);
|
|
6066
6575
|
_define_property$3(this, "roleReader", void 0);
|
|
6067
6576
|
_define_property$3(this, "storageService", void 0);
|
|
6577
|
+
_define_property$3(this, "modelRolesTargetUidPredicate", void 0);
|
|
6068
6578
|
_define_property$3(this, "_logger", new Logger(McpServerFactoryService_1.name));
|
|
6069
6579
|
_define_property$3(this, "_cachedTools", void 0);
|
|
6070
6580
|
_define_property$3(this, "_cachedStaticTools", void 0);
|
|
@@ -6084,6 +6594,7 @@ var McpServerFactoryService_1;
|
|
|
6084
6594
|
this.modelApiGetService = modelApiGetService;
|
|
6085
6595
|
this.roleReader = roleReader;
|
|
6086
6596
|
this.storageService = storageService;
|
|
6597
|
+
this.modelRolesTargetUidPredicate = modelRolesTargetUidPredicate;
|
|
6087
6598
|
this._analyticsService = analyticsService !== null && analyticsService !== void 0 ? analyticsService : noopMcpAnalyticsService();
|
|
6088
6599
|
}
|
|
6089
6600
|
_create_class$3(McpServerFactoryService, [
|
|
@@ -6354,6 +6865,14 @@ var McpServerFactoryService_1;
|
|
|
6354
6865
|
resolveIdentity: function resolveIdentity(modelType, auth) {
|
|
6355
6866
|
return getService.getModelIdentity(modelType, auth);
|
|
6356
6867
|
}
|
|
6868
|
+
}), createModelRolesTool({
|
|
6869
|
+
readRoleMaps: function readRoleMaps(params) {
|
|
6870
|
+
return getService.readRoleMaps(params);
|
|
6871
|
+
},
|
|
6872
|
+
resolveIdentity: function resolveIdentity(modelType, auth) {
|
|
6873
|
+
return getService.getModelIdentity(modelType, auth);
|
|
6874
|
+
},
|
|
6875
|
+
canTargetOtherUids: this.modelRolesTargetUidPredicate
|
|
6357
6876
|
}));
|
|
6358
6877
|
// `url-models` reuses the model-get read/identity path, so it is only offered when the get
|
|
6359
6878
|
// service is wired AND a route manifest with at least one state was loaded.
|
|
@@ -7107,7 +7626,9 @@ McpServerFactoryService = McpServerFactoryService_1 = __decorate([
|
|
|
7107
7626
|
__param(4, Optional()),
|
|
7108
7627
|
__param(4, Inject(MCP_ANALYTICS_SERVICE)),
|
|
7109
7628
|
__param(5, Optional()),
|
|
7110
|
-
__param(5, Inject(FirebaseServerStorageService))
|
|
7629
|
+
__param(5, Inject(FirebaseServerStorageService)),
|
|
7630
|
+
__param(6, Optional()),
|
|
7631
|
+
__param(6, Inject(MCP_MODEL_ROLES_TARGET_UID_PREDICATE))
|
|
7111
7632
|
], McpServerFactoryService);
|
|
7112
7633
|
|
|
7113
7634
|
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -8165,4 +8686,4 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
8165
8686
|
};
|
|
8166
8687
|
}
|
|
8167
8688
|
|
|
8168
|
-
export { BATCH_EXECUTE_DISPATCH_CALL, BATCH_EXECUTE_DISPATCH_MODEL_TYPE, BATCH_EXECUTE_TOOL_NAME, DEFAULT_BATCH_EXECUTE_MAX_PARALLEL, DEFAULT_JSON_SCHEMA_GENERATION_OPTIONS, DEFAULT_MCP_ANALYTICS_EVENT_NAME, DEFAULT_MCP_PATH, DEFAULT_MCP_REASON_PARAMETER_DESCRIPTION, DEFAULT_MCP_REASON_PARAMETER_MAX_LENGTH, DEFAULT_MCP_REASON_PARAMETER_NAME, DEFAULT_MCP_REASON_PARAMETER_REQUIRED, DEFAULT_MCP_SERVER_INSTRUCTIONS, DEFAULT_MCP_SERVER_NAME, DEFAULT_SPECIFIER_KEY, DEFAULT_VOID_MCP_SUCCESS_VALUE, ENUM_INFO_DISPATCH_CALL, ENUM_INFO_DISPATCH_MODEL_TYPE, ENUM_INFO_TOOL_NAME, ENUM_TABLE_SCHEMA, FIREBASE_SERVER_MCP_ANALYTICS_CONFIG, FIREBASE_SERVER_MCP_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE, FirebaseServerMcpAnalyticsService, MAX_BATCH_EXECUTE_FILE_BYTES, MAX_BATCH_EXECUTE_OPERATIONS, MCP_ANALYTICS_SERVICE, MCP_AUTH_ROLE_READER, MCP_CALL_TYPE_ABBREVIATIONS, MCP_MANIFEST_VERSION, MCP_MODEL_GET_BATCH_SIZE, MCP_TOOL_NAME_MAX_LENGTH, MCP_TOOL_NAME_WARN_LENGTH, MCP_WRITE_TOOL_DESCRIPTION_PREFIX, MODEL_DECODE_DISPATCH_CALL, MODEL_DECODE_DISPATCH_MODEL_TYPE, MODEL_DECODE_TOOL_NAME, MODEL_GET_DISPATCH_CALL, MODEL_GET_DISPATCH_MODEL_TYPE, MODEL_GET_TOOL_NAME, MODEL_INFO_DISPATCH_CALL, MODEL_INFO_DISPATCH_MODEL_TYPE, MODEL_INFO_GROUPS_HINT, MODEL_INFO_TOOL_NAME, MODEL_INFO_UNGROUPED_LABEL, McpAnalyticsService, McpController, McpModuleConfig, McpServerFactoryService, McpWellKnownController, ROUTE_MANIFEST_VERSION, URL_MODELS_DISPATCH_CALL, URL_MODELS_DISPATCH_MODEL_TYPE, URL_MODELS_TOOL_NAME, abbreviateMcpCallType, appMcpAnalyticsModuleMetadata, applyMcpReasonParameterToSchema, applyWriteMarker, batchOperationCoordKey, buildDefaultMcpToolDescription, buildDisambiguatedMcpToolName, buildMcpToolName, buildStaticToolDefinition, buildStaticWireEntry, classifyVisibility, createBatchExecuteTool, createEnumInfoTool, createModelDecodeTool, createModelGetTool, createModelInfoTool, createUrlModelsTool, decodeFirestoreModelKey, extractMcpReasonFromArgs, findModelEntry, formatMcpToolErrorResponse, formatMcpToolResponse, generateMcpToolDefinitions, handleStreamableHttpMcpRequest, matchRouteManifestUrl, mcpManifestKey, mcpModuleMetadata, mcpSchemaDeclaresProperty, noopMcpAnalyticsService, parseUrlModelsPathname, readUrlModelsImpersonationUid, resolveEffectiveReadOnly, resolveEnumInfoOutput, resolveMcpReasonParameterConfig, resolveMcpToolAnnotations, resolveRequiredScope, validateMcpToolName };
|
|
8689
|
+
export { BATCH_EXECUTE_DISPATCH_CALL, BATCH_EXECUTE_DISPATCH_MODEL_TYPE, BATCH_EXECUTE_TOOL_NAME, DEFAULT_BATCH_EXECUTE_MAX_PARALLEL, DEFAULT_JSON_SCHEMA_GENERATION_OPTIONS, DEFAULT_MCP_ANALYTICS_EVENT_NAME, DEFAULT_MCP_PATH, DEFAULT_MCP_REASON_PARAMETER_DESCRIPTION, DEFAULT_MCP_REASON_PARAMETER_MAX_LENGTH, DEFAULT_MCP_REASON_PARAMETER_NAME, DEFAULT_MCP_REASON_PARAMETER_REQUIRED, DEFAULT_MCP_SERVER_INSTRUCTIONS, DEFAULT_MCP_SERVER_NAME, DEFAULT_SPECIFIER_KEY, DEFAULT_VOID_MCP_SUCCESS_VALUE, ENUM_INFO_DISPATCH_CALL, ENUM_INFO_DISPATCH_MODEL_TYPE, ENUM_INFO_TOOL_NAME, ENUM_TABLE_SCHEMA, FIREBASE_SERVER_MCP_ANALYTICS_CONFIG, FIREBASE_SERVER_MCP_ROUTES_FOR_GLOBAL_ROUTE_EXCLUDE, FirebaseServerMcpAnalyticsService, MAX_BATCH_EXECUTE_FILE_BYTES, MAX_BATCH_EXECUTE_OPERATIONS, MCP_ANALYTICS_SERVICE, MCP_AUTH_ROLE_READER, MCP_CALL_TYPE_ABBREVIATIONS, MCP_MANIFEST_VERSION, MCP_MODEL_GET_BATCH_SIZE, MCP_MODEL_ROLES_MAX_KEYS, MCP_MODEL_ROLES_TARGET_UID_PREDICATE, MCP_TOOL_NAME_MAX_LENGTH, MCP_TOOL_NAME_WARN_LENGTH, MCP_WRITE_TOOL_DESCRIPTION_PREFIX, MODEL_DECODE_DISPATCH_CALL, MODEL_DECODE_DISPATCH_MODEL_TYPE, MODEL_DECODE_TOOL_NAME, MODEL_GET_DISPATCH_CALL, MODEL_GET_DISPATCH_MODEL_TYPE, MODEL_GET_TOOL_NAME, MODEL_INFO_DISPATCH_CALL, MODEL_INFO_DISPATCH_MODEL_TYPE, MODEL_INFO_GROUPS_HINT, MODEL_INFO_TOOL_NAME, MODEL_INFO_UNGROUPED_LABEL, MODEL_ROLES_DISPATCH_CALL, MODEL_ROLES_DISPATCH_MODEL_TYPE, MODEL_ROLES_TOOL_NAME, McpAnalyticsService, McpController, McpModuleConfig, McpServerFactoryService, McpWellKnownController, ROUTE_MANIFEST_VERSION, URL_MODELS_DISPATCH_CALL, URL_MODELS_DISPATCH_MODEL_TYPE, URL_MODELS_TOOL_NAME, abbreviateMcpCallType, appMcpAnalyticsModuleMetadata, applyMcpReasonParameterToSchema, applyWriteMarker, batchOperationCoordKey, buildDefaultMcpToolDescription, buildDisambiguatedMcpToolName, buildMcpToolName, buildStaticToolDefinition, buildStaticWireEntry, classifyVisibility, createBatchExecuteTool, createEnumInfoTool, createModelDecodeTool, createModelGetTool, createModelInfoTool, createModelRolesTool, createUrlModelsTool, decodeFirestoreModelKey, extractMcpReasonFromArgs, findModelEntry, formatMcpToolErrorResponse, formatMcpToolResponse, generateMcpToolDefinitions, handleStreamableHttpMcpRequest, matchRouteManifestUrl, mcpManifestKey, mcpModuleMetadata, mcpSchemaDeclaresProperty, noopMcpAnalyticsService, parseUrlModelsPathname, readUrlModelsImpersonationUid, resolveEffectiveReadOnly, resolveEnumInfoOutput, resolveMcpReasonParameterConfig, resolveMcpToolAnnotations, resolveRequiredScope, validateMcpToolName };
|