@casys/mcp-erpnext 0.1.8 → 0.1.9
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 +44 -12
- package/mcp-erpnext.mjs +1740 -509
- package/package.json +19 -5
- package/ui-dist/chart-viewer/index.html +217 -0
- package/ui-dist/doclist-viewer/index.html +152 -0
- package/ui-dist/funnel-viewer/index.html +150 -0
- package/ui-dist/invoice-viewer/index.html +150 -0
- package/ui-dist/kanban-viewer/index.html +150 -0
- package/ui-dist/kpi-viewer/index.html +150 -0
- package/ui-dist/stock-viewer/index.html +150 -0
package/mcp-erpnext.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createRequire } from "node:module"; const require = createRequire(import.meta.url);
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -6808,13 +6809,13 @@ var require_dist = __commonJS({
|
|
|
6808
6809
|
var require_identity = __commonJS({
|
|
6809
6810
|
"node_modules/yaml/dist/nodes/identity.js"(exports) {
|
|
6810
6811
|
"use strict";
|
|
6811
|
-
var ALIAS =
|
|
6812
|
-
var DOC =
|
|
6813
|
-
var MAP =
|
|
6814
|
-
var PAIR =
|
|
6815
|
-
var SCALAR =
|
|
6816
|
-
var SEQ =
|
|
6817
|
-
var NODE_TYPE =
|
|
6812
|
+
var ALIAS = Symbol.for("yaml.alias");
|
|
6813
|
+
var DOC = Symbol.for("yaml.document");
|
|
6814
|
+
var MAP = Symbol.for("yaml.map");
|
|
6815
|
+
var PAIR = Symbol.for("yaml.pair");
|
|
6816
|
+
var SCALAR = Symbol.for("yaml.scalar");
|
|
6817
|
+
var SEQ = Symbol.for("yaml.seq");
|
|
6818
|
+
var NODE_TYPE = Symbol.for("yaml.node.type");
|
|
6818
6819
|
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
|
|
6819
6820
|
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
6820
6821
|
var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
@@ -6866,9 +6867,9 @@ var require_visit = __commonJS({
|
|
|
6866
6867
|
"node_modules/yaml/dist/visit.js"(exports) {
|
|
6867
6868
|
"use strict";
|
|
6868
6869
|
var identity = require_identity();
|
|
6869
|
-
var BREAK =
|
|
6870
|
-
var SKIP =
|
|
6871
|
-
var REMOVE =
|
|
6870
|
+
var BREAK = Symbol("break visit");
|
|
6871
|
+
var SKIP = Symbol("skip children");
|
|
6872
|
+
var REMOVE = Symbol("remove node");
|
|
6872
6873
|
function visit(node, visitor) {
|
|
6873
6874
|
const visitor_ = initVisitor(visitor);
|
|
6874
6875
|
if (identity.isDocument(node)) {
|
|
@@ -11412,12 +11413,12 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
11412
11413
|
};
|
|
11413
11414
|
}
|
|
11414
11415
|
const valueEnd = offset + source.length;
|
|
11415
|
-
const
|
|
11416
|
+
const re2 = resolveEnd.resolveEnd(end, valueEnd, strict, onError);
|
|
11416
11417
|
return {
|
|
11417
11418
|
value,
|
|
11418
11419
|
type: _type,
|
|
11419
|
-
comment:
|
|
11420
|
-
range: [offset, valueEnd,
|
|
11420
|
+
comment: re2.comment,
|
|
11421
|
+
range: [offset, valueEnd, re2.offset]
|
|
11421
11422
|
};
|
|
11422
11423
|
}
|
|
11423
11424
|
function plainValue(source, onError) {
|
|
@@ -11797,10 +11798,10 @@ var require_compose_node = __commonJS({
|
|
|
11797
11798
|
if (alias.source.endsWith(":"))
|
|
11798
11799
|
onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
|
|
11799
11800
|
const valueEnd = offset + source.length;
|
|
11800
|
-
const
|
|
11801
|
-
alias.range = [offset, valueEnd,
|
|
11802
|
-
if (
|
|
11803
|
-
alias.comment =
|
|
11801
|
+
const re2 = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);
|
|
11802
|
+
alias.range = [offset, valueEnd, re2.offset];
|
|
11803
|
+
if (re2.comment)
|
|
11804
|
+
alias.comment = re2.comment;
|
|
11804
11805
|
return alias;
|
|
11805
11806
|
}
|
|
11806
11807
|
exports.composeEmptyNode = composeEmptyNode;
|
|
@@ -11841,10 +11842,10 @@ var require_compose_doc = __commonJS({
|
|
|
11841
11842
|
}
|
|
11842
11843
|
doc.contents = value ? composeNode.composeNode(ctx, value, props, onError) : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
|
|
11843
11844
|
const contentEnd = doc.contents.range[2];
|
|
11844
|
-
const
|
|
11845
|
-
if (
|
|
11846
|
-
doc.comment =
|
|
11847
|
-
doc.range = [offset, contentEnd,
|
|
11845
|
+
const re2 = resolveEnd.resolveEnd(end, contentEnd, false, onError);
|
|
11846
|
+
if (re2.comment)
|
|
11847
|
+
doc.comment = re2.comment;
|
|
11848
|
+
doc.range = [offset, contentEnd, re2.offset];
|
|
11848
11849
|
return doc;
|
|
11849
11850
|
}
|
|
11850
11851
|
exports.composeDoc = composeDoc;
|
|
@@ -12307,9 +12308,9 @@ var require_cst_stringify = __commonJS({
|
|
|
12307
12308
|
var require_cst_visit = __commonJS({
|
|
12308
12309
|
"node_modules/yaml/dist/parse/cst-visit.js"(exports) {
|
|
12309
12310
|
"use strict";
|
|
12310
|
-
var BREAK =
|
|
12311
|
-
var SKIP =
|
|
12312
|
-
var REMOVE =
|
|
12311
|
+
var BREAK = Symbol("break visit");
|
|
12312
|
+
var SKIP = Symbol("skip children");
|
|
12313
|
+
var REMOVE = Symbol("remove item");
|
|
12313
12314
|
function visit(cst, visitor) {
|
|
12314
12315
|
if ("type" in cst && cst.type === "document")
|
|
12315
12316
|
cst = { start: cst.start, value: cst.value };
|
|
@@ -17801,6 +17802,7 @@ ZodNaN.create = (params) => {
|
|
|
17801
17802
|
...processCreateParams(params)
|
|
17802
17803
|
});
|
|
17803
17804
|
};
|
|
17805
|
+
var BRAND = Symbol("zod_brand");
|
|
17804
17806
|
var ZodBranded = class extends ZodType {
|
|
17805
17807
|
_parse(input) {
|
|
17806
17808
|
const { ctx } = this._processInputParams(input);
|
|
@@ -18025,6 +18027,7 @@ function $constructor(name, initializer3, params) {
|
|
|
18025
18027
|
Object.defineProperty(_, "name", { value: name });
|
|
18026
18028
|
return _;
|
|
18027
18029
|
}
|
|
18030
|
+
var $brand = Symbol("zod_brand");
|
|
18028
18031
|
var $ZodAsyncError = class extends Error {
|
|
18029
18032
|
constructor() {
|
|
18030
18033
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -18171,7 +18174,7 @@ function floatSafeRemainder2(val, step) {
|
|
|
18171
18174
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
18172
18175
|
return valInt % stepInt / 10 ** decCount;
|
|
18173
18176
|
}
|
|
18174
|
-
var EVALUATING =
|
|
18177
|
+
var EVALUATING = Symbol("evaluating");
|
|
18175
18178
|
function defineLazy(object3, key, getter) {
|
|
18176
18179
|
let value = void 0;
|
|
18177
18180
|
Object.defineProperty(object3, key, {
|
|
@@ -21698,6 +21701,8 @@ function en_default2() {
|
|
|
21698
21701
|
|
|
21699
21702
|
// node_modules/zod/v4/core/registries.js
|
|
21700
21703
|
var _a;
|
|
21704
|
+
var $output = Symbol("ZodOutput");
|
|
21705
|
+
var $input = Symbol("ZodInput");
|
|
21701
21706
|
var $ZodRegistry = class {
|
|
21702
21707
|
constructor() {
|
|
21703
21708
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -26555,7 +26560,7 @@ function isTerminal(status) {
|
|
|
26555
26560
|
}
|
|
26556
26561
|
|
|
26557
26562
|
// node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
26558
|
-
var ignoreOverride =
|
|
26563
|
+
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
26559
26564
|
var defaultOptions = {
|
|
26560
26565
|
name: void 0,
|
|
26561
26566
|
$refStrategy: "root",
|
|
@@ -29525,7 +29530,7 @@ var Server = class extends Protocol {
|
|
|
29525
29530
|
};
|
|
29526
29531
|
|
|
29527
29532
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
29528
|
-
var COMPLETABLE_SYMBOL =
|
|
29533
|
+
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
29529
29534
|
function isCompletable(schema) {
|
|
29530
29535
|
return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
|
|
29531
29536
|
}
|
|
@@ -32203,7 +32208,7 @@ var RegExpRouter = class {
|
|
|
32203
32208
|
}
|
|
32204
32209
|
const paramCount = (path.match(/\/:/g) || []).length;
|
|
32205
32210
|
if (/\*$/.test(path)) {
|
|
32206
|
-
const
|
|
32211
|
+
const re2 = buildWildcardRegExp(path);
|
|
32207
32212
|
if (method === METHOD_NAME_ALL) {
|
|
32208
32213
|
Object.keys(middleware).forEach((m) => {
|
|
32209
32214
|
middleware[m][path] ||= findMiddleware(middleware[m], path) || findMiddleware(middleware[METHOD_NAME_ALL], path) || [];
|
|
@@ -32214,14 +32219,14 @@ var RegExpRouter = class {
|
|
|
32214
32219
|
Object.keys(middleware).forEach((m) => {
|
|
32215
32220
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
32216
32221
|
Object.keys(middleware[m]).forEach((p) => {
|
|
32217
|
-
|
|
32222
|
+
re2.test(p) && middleware[m][p].push([handler, paramCount]);
|
|
32218
32223
|
});
|
|
32219
32224
|
}
|
|
32220
32225
|
});
|
|
32221
32226
|
Object.keys(routes).forEach((m) => {
|
|
32222
32227
|
if (method === METHOD_NAME_ALL || method === m) {
|
|
32223
32228
|
Object.keys(routes[m]).forEach(
|
|
32224
|
-
(p) =>
|
|
32229
|
+
(p) => re2.test(p) && routes[m][p].push([handler, paramCount])
|
|
32225
32230
|
);
|
|
32226
32231
|
}
|
|
32227
32232
|
});
|
|
@@ -33319,11 +33324,758 @@ function collectBody(req, maxBytes) {
|
|
|
33319
33324
|
});
|
|
33320
33325
|
}
|
|
33321
33326
|
|
|
33327
|
+
// node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
|
|
33328
|
+
var _globalThis = typeof globalThis === "object" ? globalThis : global;
|
|
33329
|
+
|
|
33330
|
+
// node_modules/@opentelemetry/api/build/esm/version.js
|
|
33331
|
+
var VERSION = "1.9.0";
|
|
33332
|
+
|
|
33333
|
+
// node_modules/@opentelemetry/api/build/esm/internal/semver.js
|
|
33334
|
+
var re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
33335
|
+
function _makeCompatibilityCheck(ownVersion) {
|
|
33336
|
+
var acceptedVersions = /* @__PURE__ */ new Set([ownVersion]);
|
|
33337
|
+
var rejectedVersions = /* @__PURE__ */ new Set();
|
|
33338
|
+
var myVersionMatch = ownVersion.match(re);
|
|
33339
|
+
if (!myVersionMatch) {
|
|
33340
|
+
return function() {
|
|
33341
|
+
return false;
|
|
33342
|
+
};
|
|
33343
|
+
}
|
|
33344
|
+
var ownVersionParsed = {
|
|
33345
|
+
major: +myVersionMatch[1],
|
|
33346
|
+
minor: +myVersionMatch[2],
|
|
33347
|
+
patch: +myVersionMatch[3],
|
|
33348
|
+
prerelease: myVersionMatch[4]
|
|
33349
|
+
};
|
|
33350
|
+
if (ownVersionParsed.prerelease != null) {
|
|
33351
|
+
return function isExactmatch(globalVersion) {
|
|
33352
|
+
return globalVersion === ownVersion;
|
|
33353
|
+
};
|
|
33354
|
+
}
|
|
33355
|
+
function _reject(v) {
|
|
33356
|
+
rejectedVersions.add(v);
|
|
33357
|
+
return false;
|
|
33358
|
+
}
|
|
33359
|
+
function _accept(v) {
|
|
33360
|
+
acceptedVersions.add(v);
|
|
33361
|
+
return true;
|
|
33362
|
+
}
|
|
33363
|
+
return function isCompatible2(globalVersion) {
|
|
33364
|
+
if (acceptedVersions.has(globalVersion)) {
|
|
33365
|
+
return true;
|
|
33366
|
+
}
|
|
33367
|
+
if (rejectedVersions.has(globalVersion)) {
|
|
33368
|
+
return false;
|
|
33369
|
+
}
|
|
33370
|
+
var globalVersionMatch = globalVersion.match(re);
|
|
33371
|
+
if (!globalVersionMatch) {
|
|
33372
|
+
return _reject(globalVersion);
|
|
33373
|
+
}
|
|
33374
|
+
var globalVersionParsed = {
|
|
33375
|
+
major: +globalVersionMatch[1],
|
|
33376
|
+
minor: +globalVersionMatch[2],
|
|
33377
|
+
patch: +globalVersionMatch[3],
|
|
33378
|
+
prerelease: globalVersionMatch[4]
|
|
33379
|
+
};
|
|
33380
|
+
if (globalVersionParsed.prerelease != null) {
|
|
33381
|
+
return _reject(globalVersion);
|
|
33382
|
+
}
|
|
33383
|
+
if (ownVersionParsed.major !== globalVersionParsed.major) {
|
|
33384
|
+
return _reject(globalVersion);
|
|
33385
|
+
}
|
|
33386
|
+
if (ownVersionParsed.major === 0) {
|
|
33387
|
+
if (ownVersionParsed.minor === globalVersionParsed.minor && ownVersionParsed.patch <= globalVersionParsed.patch) {
|
|
33388
|
+
return _accept(globalVersion);
|
|
33389
|
+
}
|
|
33390
|
+
return _reject(globalVersion);
|
|
33391
|
+
}
|
|
33392
|
+
if (ownVersionParsed.minor <= globalVersionParsed.minor) {
|
|
33393
|
+
return _accept(globalVersion);
|
|
33394
|
+
}
|
|
33395
|
+
return _reject(globalVersion);
|
|
33396
|
+
};
|
|
33397
|
+
}
|
|
33398
|
+
var isCompatible = _makeCompatibilityCheck(VERSION);
|
|
33399
|
+
|
|
33400
|
+
// node_modules/@opentelemetry/api/build/esm/internal/global-utils.js
|
|
33401
|
+
var major = VERSION.split(".")[0];
|
|
33402
|
+
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
33403
|
+
var _global = _globalThis;
|
|
33404
|
+
function registerGlobal(type, instance, diag, allowOverride) {
|
|
33405
|
+
var _a2;
|
|
33406
|
+
if (allowOverride === void 0) {
|
|
33407
|
+
allowOverride = false;
|
|
33408
|
+
}
|
|
33409
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a2 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a2 !== void 0 ? _a2 : {
|
|
33410
|
+
version: VERSION
|
|
33411
|
+
};
|
|
33412
|
+
if (!allowOverride && api[type]) {
|
|
33413
|
+
var err = new Error("@opentelemetry/api: Attempted duplicate registration of API: " + type);
|
|
33414
|
+
diag.error(err.stack || err.message);
|
|
33415
|
+
return false;
|
|
33416
|
+
}
|
|
33417
|
+
if (api.version !== VERSION) {
|
|
33418
|
+
var err = new Error("@opentelemetry/api: Registration of version v" + api.version + " for " + type + " does not match previously registered API v" + VERSION);
|
|
33419
|
+
diag.error(err.stack || err.message);
|
|
33420
|
+
return false;
|
|
33421
|
+
}
|
|
33422
|
+
api[type] = instance;
|
|
33423
|
+
diag.debug("@opentelemetry/api: Registered a global for " + type + " v" + VERSION + ".");
|
|
33424
|
+
return true;
|
|
33425
|
+
}
|
|
33426
|
+
function getGlobal(type) {
|
|
33427
|
+
var _a2, _b;
|
|
33428
|
+
var globalVersion = (_a2 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a2 === void 0 ? void 0 : _a2.version;
|
|
33429
|
+
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
33430
|
+
return;
|
|
33431
|
+
}
|
|
33432
|
+
return (_b = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _b === void 0 ? void 0 : _b[type];
|
|
33433
|
+
}
|
|
33434
|
+
function unregisterGlobal(type, diag) {
|
|
33435
|
+
diag.debug("@opentelemetry/api: Unregistering a global for " + type + " v" + VERSION + ".");
|
|
33436
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
33437
|
+
if (api) {
|
|
33438
|
+
delete api[type];
|
|
33439
|
+
}
|
|
33440
|
+
}
|
|
33441
|
+
|
|
33442
|
+
// node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js
|
|
33443
|
+
var __read = function(o, n) {
|
|
33444
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
33445
|
+
if (!m) return o;
|
|
33446
|
+
var i = m.call(o), r, ar = [], e;
|
|
33447
|
+
try {
|
|
33448
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
33449
|
+
} catch (error2) {
|
|
33450
|
+
e = { error: error2 };
|
|
33451
|
+
} finally {
|
|
33452
|
+
try {
|
|
33453
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
33454
|
+
} finally {
|
|
33455
|
+
if (e) throw e.error;
|
|
33456
|
+
}
|
|
33457
|
+
}
|
|
33458
|
+
return ar;
|
|
33459
|
+
};
|
|
33460
|
+
var __spreadArray = function(to, from, pack) {
|
|
33461
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
33462
|
+
if (ar || !(i in from)) {
|
|
33463
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33464
|
+
ar[i] = from[i];
|
|
33465
|
+
}
|
|
33466
|
+
}
|
|
33467
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33468
|
+
};
|
|
33469
|
+
var DiagComponentLogger = (
|
|
33470
|
+
/** @class */
|
|
33471
|
+
(function() {
|
|
33472
|
+
function DiagComponentLogger2(props) {
|
|
33473
|
+
this._namespace = props.namespace || "DiagComponentLogger";
|
|
33474
|
+
}
|
|
33475
|
+
DiagComponentLogger2.prototype.debug = function() {
|
|
33476
|
+
var args = [];
|
|
33477
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33478
|
+
args[_i] = arguments[_i];
|
|
33479
|
+
}
|
|
33480
|
+
return logProxy("debug", this._namespace, args);
|
|
33481
|
+
};
|
|
33482
|
+
DiagComponentLogger2.prototype.error = function() {
|
|
33483
|
+
var args = [];
|
|
33484
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33485
|
+
args[_i] = arguments[_i];
|
|
33486
|
+
}
|
|
33487
|
+
return logProxy("error", this._namespace, args);
|
|
33488
|
+
};
|
|
33489
|
+
DiagComponentLogger2.prototype.info = function() {
|
|
33490
|
+
var args = [];
|
|
33491
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33492
|
+
args[_i] = arguments[_i];
|
|
33493
|
+
}
|
|
33494
|
+
return logProxy("info", this._namespace, args);
|
|
33495
|
+
};
|
|
33496
|
+
DiagComponentLogger2.prototype.warn = function() {
|
|
33497
|
+
var args = [];
|
|
33498
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33499
|
+
args[_i] = arguments[_i];
|
|
33500
|
+
}
|
|
33501
|
+
return logProxy("warn", this._namespace, args);
|
|
33502
|
+
};
|
|
33503
|
+
DiagComponentLogger2.prototype.verbose = function() {
|
|
33504
|
+
var args = [];
|
|
33505
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33506
|
+
args[_i] = arguments[_i];
|
|
33507
|
+
}
|
|
33508
|
+
return logProxy("verbose", this._namespace, args);
|
|
33509
|
+
};
|
|
33510
|
+
return DiagComponentLogger2;
|
|
33511
|
+
})()
|
|
33512
|
+
);
|
|
33513
|
+
function logProxy(funcName, namespace, args) {
|
|
33514
|
+
var logger = getGlobal("diag");
|
|
33515
|
+
if (!logger) {
|
|
33516
|
+
return;
|
|
33517
|
+
}
|
|
33518
|
+
args.unshift(namespace);
|
|
33519
|
+
return logger[funcName].apply(logger, __spreadArray([], __read(args), false));
|
|
33520
|
+
}
|
|
33521
|
+
|
|
33522
|
+
// node_modules/@opentelemetry/api/build/esm/diag/types.js
|
|
33523
|
+
var DiagLogLevel;
|
|
33524
|
+
(function(DiagLogLevel2) {
|
|
33525
|
+
DiagLogLevel2[DiagLogLevel2["NONE"] = 0] = "NONE";
|
|
33526
|
+
DiagLogLevel2[DiagLogLevel2["ERROR"] = 30] = "ERROR";
|
|
33527
|
+
DiagLogLevel2[DiagLogLevel2["WARN"] = 50] = "WARN";
|
|
33528
|
+
DiagLogLevel2[DiagLogLevel2["INFO"] = 60] = "INFO";
|
|
33529
|
+
DiagLogLevel2[DiagLogLevel2["DEBUG"] = 70] = "DEBUG";
|
|
33530
|
+
DiagLogLevel2[DiagLogLevel2["VERBOSE"] = 80] = "VERBOSE";
|
|
33531
|
+
DiagLogLevel2[DiagLogLevel2["ALL"] = 9999] = "ALL";
|
|
33532
|
+
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
33533
|
+
|
|
33534
|
+
// node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js
|
|
33535
|
+
function createLogLevelDiagLogger(maxLevel, logger) {
|
|
33536
|
+
if (maxLevel < DiagLogLevel.NONE) {
|
|
33537
|
+
maxLevel = DiagLogLevel.NONE;
|
|
33538
|
+
} else if (maxLevel > DiagLogLevel.ALL) {
|
|
33539
|
+
maxLevel = DiagLogLevel.ALL;
|
|
33540
|
+
}
|
|
33541
|
+
logger = logger || {};
|
|
33542
|
+
function _filterFunc(funcName, theLevel) {
|
|
33543
|
+
var theFunc = logger[funcName];
|
|
33544
|
+
if (typeof theFunc === "function" && maxLevel >= theLevel) {
|
|
33545
|
+
return theFunc.bind(logger);
|
|
33546
|
+
}
|
|
33547
|
+
return function() {
|
|
33548
|
+
};
|
|
33549
|
+
}
|
|
33550
|
+
return {
|
|
33551
|
+
error: _filterFunc("error", DiagLogLevel.ERROR),
|
|
33552
|
+
warn: _filterFunc("warn", DiagLogLevel.WARN),
|
|
33553
|
+
info: _filterFunc("info", DiagLogLevel.INFO),
|
|
33554
|
+
debug: _filterFunc("debug", DiagLogLevel.DEBUG),
|
|
33555
|
+
verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
|
|
33556
|
+
};
|
|
33557
|
+
}
|
|
33558
|
+
|
|
33559
|
+
// node_modules/@opentelemetry/api/build/esm/api/diag.js
|
|
33560
|
+
var __read2 = function(o, n) {
|
|
33561
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
33562
|
+
if (!m) return o;
|
|
33563
|
+
var i = m.call(o), r, ar = [], e;
|
|
33564
|
+
try {
|
|
33565
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
33566
|
+
} catch (error2) {
|
|
33567
|
+
e = { error: error2 };
|
|
33568
|
+
} finally {
|
|
33569
|
+
try {
|
|
33570
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
33571
|
+
} finally {
|
|
33572
|
+
if (e) throw e.error;
|
|
33573
|
+
}
|
|
33574
|
+
}
|
|
33575
|
+
return ar;
|
|
33576
|
+
};
|
|
33577
|
+
var __spreadArray2 = function(to, from, pack) {
|
|
33578
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
33579
|
+
if (ar || !(i in from)) {
|
|
33580
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33581
|
+
ar[i] = from[i];
|
|
33582
|
+
}
|
|
33583
|
+
}
|
|
33584
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33585
|
+
};
|
|
33586
|
+
var API_NAME = "diag";
|
|
33587
|
+
var DiagAPI = (
|
|
33588
|
+
/** @class */
|
|
33589
|
+
(function() {
|
|
33590
|
+
function DiagAPI2() {
|
|
33591
|
+
function _logProxy(funcName) {
|
|
33592
|
+
return function() {
|
|
33593
|
+
var args = [];
|
|
33594
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
33595
|
+
args[_i] = arguments[_i];
|
|
33596
|
+
}
|
|
33597
|
+
var logger = getGlobal("diag");
|
|
33598
|
+
if (!logger)
|
|
33599
|
+
return;
|
|
33600
|
+
return logger[funcName].apply(logger, __spreadArray2([], __read2(args), false));
|
|
33601
|
+
};
|
|
33602
|
+
}
|
|
33603
|
+
var self = this;
|
|
33604
|
+
var setLogger = function(logger, optionsOrLogLevel) {
|
|
33605
|
+
var _a2, _b, _c;
|
|
33606
|
+
if (optionsOrLogLevel === void 0) {
|
|
33607
|
+
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
33608
|
+
}
|
|
33609
|
+
if (logger === self) {
|
|
33610
|
+
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
33611
|
+
self.error((_a2 = err.stack) !== null && _a2 !== void 0 ? _a2 : err.message);
|
|
33612
|
+
return false;
|
|
33613
|
+
}
|
|
33614
|
+
if (typeof optionsOrLogLevel === "number") {
|
|
33615
|
+
optionsOrLogLevel = {
|
|
33616
|
+
logLevel: optionsOrLogLevel
|
|
33617
|
+
};
|
|
33618
|
+
}
|
|
33619
|
+
var oldLogger = getGlobal("diag");
|
|
33620
|
+
var newLogger = createLogLevelDiagLogger((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
|
|
33621
|
+
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
33622
|
+
var stack = (_c = new Error().stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
33623
|
+
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
33624
|
+
newLogger.warn("Current logger will overwrite one already registered from " + stack);
|
|
33625
|
+
}
|
|
33626
|
+
return registerGlobal("diag", newLogger, self, true);
|
|
33627
|
+
};
|
|
33628
|
+
self.setLogger = setLogger;
|
|
33629
|
+
self.disable = function() {
|
|
33630
|
+
unregisterGlobal(API_NAME, self);
|
|
33631
|
+
};
|
|
33632
|
+
self.createComponentLogger = function(options) {
|
|
33633
|
+
return new DiagComponentLogger(options);
|
|
33634
|
+
};
|
|
33635
|
+
self.verbose = _logProxy("verbose");
|
|
33636
|
+
self.debug = _logProxy("debug");
|
|
33637
|
+
self.info = _logProxy("info");
|
|
33638
|
+
self.warn = _logProxy("warn");
|
|
33639
|
+
self.error = _logProxy("error");
|
|
33640
|
+
}
|
|
33641
|
+
DiagAPI2.instance = function() {
|
|
33642
|
+
if (!this._instance) {
|
|
33643
|
+
this._instance = new DiagAPI2();
|
|
33644
|
+
}
|
|
33645
|
+
return this._instance;
|
|
33646
|
+
};
|
|
33647
|
+
return DiagAPI2;
|
|
33648
|
+
})()
|
|
33649
|
+
);
|
|
33650
|
+
|
|
33651
|
+
// node_modules/@opentelemetry/api/build/esm/context/context.js
|
|
33652
|
+
function createContextKey(description) {
|
|
33653
|
+
return Symbol.for(description);
|
|
33654
|
+
}
|
|
33655
|
+
var BaseContext = (
|
|
33656
|
+
/** @class */
|
|
33657
|
+
/* @__PURE__ */ (function() {
|
|
33658
|
+
function BaseContext2(parentContext) {
|
|
33659
|
+
var self = this;
|
|
33660
|
+
self._currentContext = parentContext ? new Map(parentContext) : /* @__PURE__ */ new Map();
|
|
33661
|
+
self.getValue = function(key) {
|
|
33662
|
+
return self._currentContext.get(key);
|
|
33663
|
+
};
|
|
33664
|
+
self.setValue = function(key, value) {
|
|
33665
|
+
var context = new BaseContext2(self._currentContext);
|
|
33666
|
+
context._currentContext.set(key, value);
|
|
33667
|
+
return context;
|
|
33668
|
+
};
|
|
33669
|
+
self.deleteValue = function(key) {
|
|
33670
|
+
var context = new BaseContext2(self._currentContext);
|
|
33671
|
+
context._currentContext.delete(key);
|
|
33672
|
+
return context;
|
|
33673
|
+
};
|
|
33674
|
+
}
|
|
33675
|
+
return BaseContext2;
|
|
33676
|
+
})()
|
|
33677
|
+
);
|
|
33678
|
+
var ROOT_CONTEXT = new BaseContext();
|
|
33679
|
+
|
|
33680
|
+
// node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js
|
|
33681
|
+
var __read3 = function(o, n) {
|
|
33682
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
33683
|
+
if (!m) return o;
|
|
33684
|
+
var i = m.call(o), r, ar = [], e;
|
|
33685
|
+
try {
|
|
33686
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
33687
|
+
} catch (error2) {
|
|
33688
|
+
e = { error: error2 };
|
|
33689
|
+
} finally {
|
|
33690
|
+
try {
|
|
33691
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
33692
|
+
} finally {
|
|
33693
|
+
if (e) throw e.error;
|
|
33694
|
+
}
|
|
33695
|
+
}
|
|
33696
|
+
return ar;
|
|
33697
|
+
};
|
|
33698
|
+
var __spreadArray3 = function(to, from, pack) {
|
|
33699
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
33700
|
+
if (ar || !(i in from)) {
|
|
33701
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33702
|
+
ar[i] = from[i];
|
|
33703
|
+
}
|
|
33704
|
+
}
|
|
33705
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33706
|
+
};
|
|
33707
|
+
var NoopContextManager = (
|
|
33708
|
+
/** @class */
|
|
33709
|
+
(function() {
|
|
33710
|
+
function NoopContextManager2() {
|
|
33711
|
+
}
|
|
33712
|
+
NoopContextManager2.prototype.active = function() {
|
|
33713
|
+
return ROOT_CONTEXT;
|
|
33714
|
+
};
|
|
33715
|
+
NoopContextManager2.prototype.with = function(_context, fn, thisArg) {
|
|
33716
|
+
var args = [];
|
|
33717
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
33718
|
+
args[_i - 3] = arguments[_i];
|
|
33719
|
+
}
|
|
33720
|
+
return fn.call.apply(fn, __spreadArray3([thisArg], __read3(args), false));
|
|
33721
|
+
};
|
|
33722
|
+
NoopContextManager2.prototype.bind = function(_context, target) {
|
|
33723
|
+
return target;
|
|
33724
|
+
};
|
|
33725
|
+
NoopContextManager2.prototype.enable = function() {
|
|
33726
|
+
return this;
|
|
33727
|
+
};
|
|
33728
|
+
NoopContextManager2.prototype.disable = function() {
|
|
33729
|
+
return this;
|
|
33730
|
+
};
|
|
33731
|
+
return NoopContextManager2;
|
|
33732
|
+
})()
|
|
33733
|
+
);
|
|
33734
|
+
|
|
33735
|
+
// node_modules/@opentelemetry/api/build/esm/api/context.js
|
|
33736
|
+
var __read4 = function(o, n) {
|
|
33737
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
33738
|
+
if (!m) return o;
|
|
33739
|
+
var i = m.call(o), r, ar = [], e;
|
|
33740
|
+
try {
|
|
33741
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
33742
|
+
} catch (error2) {
|
|
33743
|
+
e = { error: error2 };
|
|
33744
|
+
} finally {
|
|
33745
|
+
try {
|
|
33746
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
33747
|
+
} finally {
|
|
33748
|
+
if (e) throw e.error;
|
|
33749
|
+
}
|
|
33750
|
+
}
|
|
33751
|
+
return ar;
|
|
33752
|
+
};
|
|
33753
|
+
var __spreadArray4 = function(to, from, pack) {
|
|
33754
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
33755
|
+
if (ar || !(i in from)) {
|
|
33756
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
33757
|
+
ar[i] = from[i];
|
|
33758
|
+
}
|
|
33759
|
+
}
|
|
33760
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
33761
|
+
};
|
|
33762
|
+
var API_NAME2 = "context";
|
|
33763
|
+
var NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
33764
|
+
var ContextAPI = (
|
|
33765
|
+
/** @class */
|
|
33766
|
+
(function() {
|
|
33767
|
+
function ContextAPI2() {
|
|
33768
|
+
}
|
|
33769
|
+
ContextAPI2.getInstance = function() {
|
|
33770
|
+
if (!this._instance) {
|
|
33771
|
+
this._instance = new ContextAPI2();
|
|
33772
|
+
}
|
|
33773
|
+
return this._instance;
|
|
33774
|
+
};
|
|
33775
|
+
ContextAPI2.prototype.setGlobalContextManager = function(contextManager) {
|
|
33776
|
+
return registerGlobal(API_NAME2, contextManager, DiagAPI.instance());
|
|
33777
|
+
};
|
|
33778
|
+
ContextAPI2.prototype.active = function() {
|
|
33779
|
+
return this._getContextManager().active();
|
|
33780
|
+
};
|
|
33781
|
+
ContextAPI2.prototype.with = function(context, fn, thisArg) {
|
|
33782
|
+
var _a2;
|
|
33783
|
+
var args = [];
|
|
33784
|
+
for (var _i = 3; _i < arguments.length; _i++) {
|
|
33785
|
+
args[_i - 3] = arguments[_i];
|
|
33786
|
+
}
|
|
33787
|
+
return (_a2 = this._getContextManager()).with.apply(_a2, __spreadArray4([context, fn, thisArg], __read4(args), false));
|
|
33788
|
+
};
|
|
33789
|
+
ContextAPI2.prototype.bind = function(context, target) {
|
|
33790
|
+
return this._getContextManager().bind(context, target);
|
|
33791
|
+
};
|
|
33792
|
+
ContextAPI2.prototype._getContextManager = function() {
|
|
33793
|
+
return getGlobal(API_NAME2) || NOOP_CONTEXT_MANAGER;
|
|
33794
|
+
};
|
|
33795
|
+
ContextAPI2.prototype.disable = function() {
|
|
33796
|
+
this._getContextManager().disable();
|
|
33797
|
+
unregisterGlobal(API_NAME2, DiagAPI.instance());
|
|
33798
|
+
};
|
|
33799
|
+
return ContextAPI2;
|
|
33800
|
+
})()
|
|
33801
|
+
);
|
|
33802
|
+
|
|
33803
|
+
// node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js
|
|
33804
|
+
var TraceFlags;
|
|
33805
|
+
(function(TraceFlags2) {
|
|
33806
|
+
TraceFlags2[TraceFlags2["NONE"] = 0] = "NONE";
|
|
33807
|
+
TraceFlags2[TraceFlags2["SAMPLED"] = 1] = "SAMPLED";
|
|
33808
|
+
})(TraceFlags || (TraceFlags = {}));
|
|
33809
|
+
|
|
33810
|
+
// node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js
|
|
33811
|
+
var INVALID_SPANID = "0000000000000000";
|
|
33812
|
+
var INVALID_TRACEID = "00000000000000000000000000000000";
|
|
33813
|
+
var INVALID_SPAN_CONTEXT = {
|
|
33814
|
+
traceId: INVALID_TRACEID,
|
|
33815
|
+
spanId: INVALID_SPANID,
|
|
33816
|
+
traceFlags: TraceFlags.NONE
|
|
33817
|
+
};
|
|
33818
|
+
|
|
33819
|
+
// node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js
|
|
33820
|
+
var NonRecordingSpan = (
|
|
33821
|
+
/** @class */
|
|
33822
|
+
(function() {
|
|
33823
|
+
function NonRecordingSpan2(_spanContext) {
|
|
33824
|
+
if (_spanContext === void 0) {
|
|
33825
|
+
_spanContext = INVALID_SPAN_CONTEXT;
|
|
33826
|
+
}
|
|
33827
|
+
this._spanContext = _spanContext;
|
|
33828
|
+
}
|
|
33829
|
+
NonRecordingSpan2.prototype.spanContext = function() {
|
|
33830
|
+
return this._spanContext;
|
|
33831
|
+
};
|
|
33832
|
+
NonRecordingSpan2.prototype.setAttribute = function(_key, _value) {
|
|
33833
|
+
return this;
|
|
33834
|
+
};
|
|
33835
|
+
NonRecordingSpan2.prototype.setAttributes = function(_attributes) {
|
|
33836
|
+
return this;
|
|
33837
|
+
};
|
|
33838
|
+
NonRecordingSpan2.prototype.addEvent = function(_name, _attributes) {
|
|
33839
|
+
return this;
|
|
33840
|
+
};
|
|
33841
|
+
NonRecordingSpan2.prototype.addLink = function(_link) {
|
|
33842
|
+
return this;
|
|
33843
|
+
};
|
|
33844
|
+
NonRecordingSpan2.prototype.addLinks = function(_links) {
|
|
33845
|
+
return this;
|
|
33846
|
+
};
|
|
33847
|
+
NonRecordingSpan2.prototype.setStatus = function(_status) {
|
|
33848
|
+
return this;
|
|
33849
|
+
};
|
|
33850
|
+
NonRecordingSpan2.prototype.updateName = function(_name) {
|
|
33851
|
+
return this;
|
|
33852
|
+
};
|
|
33853
|
+
NonRecordingSpan2.prototype.end = function(_endTime) {
|
|
33854
|
+
};
|
|
33855
|
+
NonRecordingSpan2.prototype.isRecording = function() {
|
|
33856
|
+
return false;
|
|
33857
|
+
};
|
|
33858
|
+
NonRecordingSpan2.prototype.recordException = function(_exception, _time) {
|
|
33859
|
+
};
|
|
33860
|
+
return NonRecordingSpan2;
|
|
33861
|
+
})()
|
|
33862
|
+
);
|
|
33863
|
+
|
|
33864
|
+
// node_modules/@opentelemetry/api/build/esm/trace/context-utils.js
|
|
33865
|
+
var SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
33866
|
+
function getSpan(context) {
|
|
33867
|
+
return context.getValue(SPAN_KEY) || void 0;
|
|
33868
|
+
}
|
|
33869
|
+
function getActiveSpan() {
|
|
33870
|
+
return getSpan(ContextAPI.getInstance().active());
|
|
33871
|
+
}
|
|
33872
|
+
function setSpan(context, span) {
|
|
33873
|
+
return context.setValue(SPAN_KEY, span);
|
|
33874
|
+
}
|
|
33875
|
+
function deleteSpan(context) {
|
|
33876
|
+
return context.deleteValue(SPAN_KEY);
|
|
33877
|
+
}
|
|
33878
|
+
function setSpanContext(context, spanContext) {
|
|
33879
|
+
return setSpan(context, new NonRecordingSpan(spanContext));
|
|
33880
|
+
}
|
|
33881
|
+
function getSpanContext(context) {
|
|
33882
|
+
var _a2;
|
|
33883
|
+
return (_a2 = getSpan(context)) === null || _a2 === void 0 ? void 0 : _a2.spanContext();
|
|
33884
|
+
}
|
|
33885
|
+
|
|
33886
|
+
// node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
33887
|
+
var VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;
|
|
33888
|
+
var VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
|
|
33889
|
+
function isValidTraceId(traceId) {
|
|
33890
|
+
return VALID_TRACEID_REGEX.test(traceId) && traceId !== INVALID_TRACEID;
|
|
33891
|
+
}
|
|
33892
|
+
function isValidSpanId(spanId) {
|
|
33893
|
+
return VALID_SPANID_REGEX.test(spanId) && spanId !== INVALID_SPANID;
|
|
33894
|
+
}
|
|
33895
|
+
function isSpanContextValid(spanContext) {
|
|
33896
|
+
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
33897
|
+
}
|
|
33898
|
+
function wrapSpanContext(spanContext) {
|
|
33899
|
+
return new NonRecordingSpan(spanContext);
|
|
33900
|
+
}
|
|
33901
|
+
|
|
33902
|
+
// node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js
|
|
33903
|
+
var contextApi = ContextAPI.getInstance();
|
|
33904
|
+
var NoopTracer = (
|
|
33905
|
+
/** @class */
|
|
33906
|
+
(function() {
|
|
33907
|
+
function NoopTracer2() {
|
|
33908
|
+
}
|
|
33909
|
+
NoopTracer2.prototype.startSpan = function(name, options, context) {
|
|
33910
|
+
if (context === void 0) {
|
|
33911
|
+
context = contextApi.active();
|
|
33912
|
+
}
|
|
33913
|
+
var root = Boolean(options === null || options === void 0 ? void 0 : options.root);
|
|
33914
|
+
if (root) {
|
|
33915
|
+
return new NonRecordingSpan();
|
|
33916
|
+
}
|
|
33917
|
+
var parentFromContext = context && getSpanContext(context);
|
|
33918
|
+
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) {
|
|
33919
|
+
return new NonRecordingSpan(parentFromContext);
|
|
33920
|
+
} else {
|
|
33921
|
+
return new NonRecordingSpan();
|
|
33922
|
+
}
|
|
33923
|
+
};
|
|
33924
|
+
NoopTracer2.prototype.startActiveSpan = function(name, arg2, arg3, arg4) {
|
|
33925
|
+
var opts;
|
|
33926
|
+
var ctx;
|
|
33927
|
+
var fn;
|
|
33928
|
+
if (arguments.length < 2) {
|
|
33929
|
+
return;
|
|
33930
|
+
} else if (arguments.length === 2) {
|
|
33931
|
+
fn = arg2;
|
|
33932
|
+
} else if (arguments.length === 3) {
|
|
33933
|
+
opts = arg2;
|
|
33934
|
+
fn = arg3;
|
|
33935
|
+
} else {
|
|
33936
|
+
opts = arg2;
|
|
33937
|
+
ctx = arg3;
|
|
33938
|
+
fn = arg4;
|
|
33939
|
+
}
|
|
33940
|
+
var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
33941
|
+
var span = this.startSpan(name, opts, parentContext);
|
|
33942
|
+
var contextWithSpanSet = setSpan(parentContext, span);
|
|
33943
|
+
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
33944
|
+
};
|
|
33945
|
+
return NoopTracer2;
|
|
33946
|
+
})()
|
|
33947
|
+
);
|
|
33948
|
+
function isSpanContext(spanContext) {
|
|
33949
|
+
return typeof spanContext === "object" && typeof spanContext["spanId"] === "string" && typeof spanContext["traceId"] === "string" && typeof spanContext["traceFlags"] === "number";
|
|
33950
|
+
}
|
|
33951
|
+
|
|
33952
|
+
// node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js
|
|
33953
|
+
var NOOP_TRACER = new NoopTracer();
|
|
33954
|
+
var ProxyTracer = (
|
|
33955
|
+
/** @class */
|
|
33956
|
+
(function() {
|
|
33957
|
+
function ProxyTracer2(_provider, name, version2, options) {
|
|
33958
|
+
this._provider = _provider;
|
|
33959
|
+
this.name = name;
|
|
33960
|
+
this.version = version2;
|
|
33961
|
+
this.options = options;
|
|
33962
|
+
}
|
|
33963
|
+
ProxyTracer2.prototype.startSpan = function(name, options, context) {
|
|
33964
|
+
return this._getTracer().startSpan(name, options, context);
|
|
33965
|
+
};
|
|
33966
|
+
ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
|
|
33967
|
+
var tracer = this._getTracer();
|
|
33968
|
+
return Reflect.apply(tracer.startActiveSpan, tracer, arguments);
|
|
33969
|
+
};
|
|
33970
|
+
ProxyTracer2.prototype._getTracer = function() {
|
|
33971
|
+
if (this._delegate) {
|
|
33972
|
+
return this._delegate;
|
|
33973
|
+
}
|
|
33974
|
+
var tracer = this._provider.getDelegateTracer(this.name, this.version, this.options);
|
|
33975
|
+
if (!tracer) {
|
|
33976
|
+
return NOOP_TRACER;
|
|
33977
|
+
}
|
|
33978
|
+
this._delegate = tracer;
|
|
33979
|
+
return this._delegate;
|
|
33980
|
+
};
|
|
33981
|
+
return ProxyTracer2;
|
|
33982
|
+
})()
|
|
33983
|
+
);
|
|
33984
|
+
|
|
33985
|
+
// node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js
|
|
33986
|
+
var NoopTracerProvider = (
|
|
33987
|
+
/** @class */
|
|
33988
|
+
(function() {
|
|
33989
|
+
function NoopTracerProvider2() {
|
|
33990
|
+
}
|
|
33991
|
+
NoopTracerProvider2.prototype.getTracer = function(_name, _version, _options) {
|
|
33992
|
+
return new NoopTracer();
|
|
33993
|
+
};
|
|
33994
|
+
return NoopTracerProvider2;
|
|
33995
|
+
})()
|
|
33996
|
+
);
|
|
33997
|
+
|
|
33998
|
+
// node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js
|
|
33999
|
+
var NOOP_TRACER_PROVIDER = new NoopTracerProvider();
|
|
34000
|
+
var ProxyTracerProvider = (
|
|
34001
|
+
/** @class */
|
|
34002
|
+
(function() {
|
|
34003
|
+
function ProxyTracerProvider2() {
|
|
34004
|
+
}
|
|
34005
|
+
ProxyTracerProvider2.prototype.getTracer = function(name, version2, options) {
|
|
34006
|
+
var _a2;
|
|
34007
|
+
return (_a2 = this.getDelegateTracer(name, version2, options)) !== null && _a2 !== void 0 ? _a2 : new ProxyTracer(this, name, version2, options);
|
|
34008
|
+
};
|
|
34009
|
+
ProxyTracerProvider2.prototype.getDelegate = function() {
|
|
34010
|
+
var _a2;
|
|
34011
|
+
return (_a2 = this._delegate) !== null && _a2 !== void 0 ? _a2 : NOOP_TRACER_PROVIDER;
|
|
34012
|
+
};
|
|
34013
|
+
ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
|
|
34014
|
+
this._delegate = delegate;
|
|
34015
|
+
};
|
|
34016
|
+
ProxyTracerProvider2.prototype.getDelegateTracer = function(name, version2, options) {
|
|
34017
|
+
var _a2;
|
|
34018
|
+
return (_a2 = this._delegate) === null || _a2 === void 0 ? void 0 : _a2.getTracer(name, version2, options);
|
|
34019
|
+
};
|
|
34020
|
+
return ProxyTracerProvider2;
|
|
34021
|
+
})()
|
|
34022
|
+
);
|
|
34023
|
+
|
|
34024
|
+
// node_modules/@opentelemetry/api/build/esm/trace/status.js
|
|
34025
|
+
var SpanStatusCode;
|
|
34026
|
+
(function(SpanStatusCode2) {
|
|
34027
|
+
SpanStatusCode2[SpanStatusCode2["UNSET"] = 0] = "UNSET";
|
|
34028
|
+
SpanStatusCode2[SpanStatusCode2["OK"] = 1] = "OK";
|
|
34029
|
+
SpanStatusCode2[SpanStatusCode2["ERROR"] = 2] = "ERROR";
|
|
34030
|
+
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
34031
|
+
|
|
34032
|
+
// node_modules/@opentelemetry/api/build/esm/api/trace.js
|
|
34033
|
+
var API_NAME3 = "trace";
|
|
34034
|
+
var TraceAPI = (
|
|
34035
|
+
/** @class */
|
|
34036
|
+
(function() {
|
|
34037
|
+
function TraceAPI2() {
|
|
34038
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
34039
|
+
this.wrapSpanContext = wrapSpanContext;
|
|
34040
|
+
this.isSpanContextValid = isSpanContextValid;
|
|
34041
|
+
this.deleteSpan = deleteSpan;
|
|
34042
|
+
this.getSpan = getSpan;
|
|
34043
|
+
this.getActiveSpan = getActiveSpan;
|
|
34044
|
+
this.getSpanContext = getSpanContext;
|
|
34045
|
+
this.setSpan = setSpan;
|
|
34046
|
+
this.setSpanContext = setSpanContext;
|
|
34047
|
+
}
|
|
34048
|
+
TraceAPI2.getInstance = function() {
|
|
34049
|
+
if (!this._instance) {
|
|
34050
|
+
this._instance = new TraceAPI2();
|
|
34051
|
+
}
|
|
34052
|
+
return this._instance;
|
|
34053
|
+
};
|
|
34054
|
+
TraceAPI2.prototype.setGlobalTracerProvider = function(provider) {
|
|
34055
|
+
var success2 = registerGlobal(API_NAME3, this._proxyTracerProvider, DiagAPI.instance());
|
|
34056
|
+
if (success2) {
|
|
34057
|
+
this._proxyTracerProvider.setDelegate(provider);
|
|
34058
|
+
}
|
|
34059
|
+
return success2;
|
|
34060
|
+
};
|
|
34061
|
+
TraceAPI2.prototype.getTracerProvider = function() {
|
|
34062
|
+
return getGlobal(API_NAME3) || this._proxyTracerProvider;
|
|
34063
|
+
};
|
|
34064
|
+
TraceAPI2.prototype.getTracer = function(name, version2) {
|
|
34065
|
+
return this.getTracerProvider().getTracer(name, version2);
|
|
34066
|
+
};
|
|
34067
|
+
TraceAPI2.prototype.disable = function() {
|
|
34068
|
+
unregisterGlobal(API_NAME3, DiagAPI.instance());
|
|
34069
|
+
this._proxyTracerProvider = new ProxyTracerProvider();
|
|
34070
|
+
};
|
|
34071
|
+
return TraceAPI2;
|
|
34072
|
+
})()
|
|
34073
|
+
);
|
|
34074
|
+
|
|
34075
|
+
// node_modules/@opentelemetry/api/build/esm/trace-api.js
|
|
34076
|
+
var trace = TraceAPI.getInstance();
|
|
34077
|
+
|
|
33322
34078
|
// node_modules/@casys/mcp-server/src/observability/otel.ts
|
|
33323
|
-
import {
|
|
33324
|
-
SpanStatusCode,
|
|
33325
|
-
trace
|
|
33326
|
-
} from "@opentelemetry/api";
|
|
33327
34079
|
var serverTracer = null;
|
|
33328
34080
|
function getServerTracer() {
|
|
33329
34081
|
if (!serverTracer) {
|
|
@@ -33549,98 +34301,17 @@ function decode3(input) {
|
|
|
33549
34301
|
}
|
|
33550
34302
|
}
|
|
33551
34303
|
|
|
33552
|
-
// node_modules/jose/dist/webapi/util/errors.js
|
|
33553
|
-
var JOSEError = class extends Error {
|
|
33554
|
-
static code = "ERR_JOSE_GENERIC";
|
|
33555
|
-
code = "ERR_JOSE_GENERIC";
|
|
33556
|
-
constructor(message2, options) {
|
|
33557
|
-
super(message2, options);
|
|
33558
|
-
this.name = this.constructor.name;
|
|
33559
|
-
Error.captureStackTrace?.(this, this.constructor);
|
|
33560
|
-
}
|
|
33561
|
-
};
|
|
33562
|
-
var JWTClaimValidationFailed = class extends JOSEError {
|
|
33563
|
-
static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
33564
|
-
code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
33565
|
-
claim;
|
|
33566
|
-
reason;
|
|
33567
|
-
payload;
|
|
33568
|
-
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
33569
|
-
super(message2, { cause: { claim, reason, payload } });
|
|
33570
|
-
this.claim = claim;
|
|
33571
|
-
this.reason = reason;
|
|
33572
|
-
this.payload = payload;
|
|
33573
|
-
}
|
|
33574
|
-
};
|
|
33575
|
-
var JWTExpired = class extends JOSEError {
|
|
33576
|
-
static code = "ERR_JWT_EXPIRED";
|
|
33577
|
-
code = "ERR_JWT_EXPIRED";
|
|
33578
|
-
claim;
|
|
33579
|
-
reason;
|
|
33580
|
-
payload;
|
|
33581
|
-
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
33582
|
-
super(message2, { cause: { claim, reason, payload } });
|
|
33583
|
-
this.claim = claim;
|
|
33584
|
-
this.reason = reason;
|
|
33585
|
-
this.payload = payload;
|
|
33586
|
-
}
|
|
33587
|
-
};
|
|
33588
|
-
var JOSEAlgNotAllowed = class extends JOSEError {
|
|
33589
|
-
static code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
33590
|
-
code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
33591
|
-
};
|
|
33592
|
-
var JOSENotSupported = class extends JOSEError {
|
|
33593
|
-
static code = "ERR_JOSE_NOT_SUPPORTED";
|
|
33594
|
-
code = "ERR_JOSE_NOT_SUPPORTED";
|
|
33595
|
-
};
|
|
33596
|
-
var JWSInvalid = class extends JOSEError {
|
|
33597
|
-
static code = "ERR_JWS_INVALID";
|
|
33598
|
-
code = "ERR_JWS_INVALID";
|
|
33599
|
-
};
|
|
33600
|
-
var JWTInvalid = class extends JOSEError {
|
|
33601
|
-
static code = "ERR_JWT_INVALID";
|
|
33602
|
-
code = "ERR_JWT_INVALID";
|
|
33603
|
-
};
|
|
33604
|
-
var JWKSInvalid = class extends JOSEError {
|
|
33605
|
-
static code = "ERR_JWKS_INVALID";
|
|
33606
|
-
code = "ERR_JWKS_INVALID";
|
|
33607
|
-
};
|
|
33608
|
-
var JWKSNoMatchingKey = class extends JOSEError {
|
|
33609
|
-
static code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
33610
|
-
code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
33611
|
-
constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
|
|
33612
|
-
super(message2, options);
|
|
33613
|
-
}
|
|
33614
|
-
};
|
|
33615
|
-
var JWKSMultipleMatchingKeys = class extends JOSEError {
|
|
33616
|
-
[Symbol.asyncIterator];
|
|
33617
|
-
static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
33618
|
-
code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
33619
|
-
constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
33620
|
-
super(message2, options);
|
|
33621
|
-
}
|
|
33622
|
-
};
|
|
33623
|
-
var JWKSTimeout = class extends JOSEError {
|
|
33624
|
-
static code = "ERR_JWKS_TIMEOUT";
|
|
33625
|
-
code = "ERR_JWKS_TIMEOUT";
|
|
33626
|
-
constructor(message2 = "request timed out", options) {
|
|
33627
|
-
super(message2, options);
|
|
33628
|
-
}
|
|
33629
|
-
};
|
|
33630
|
-
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
33631
|
-
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
33632
|
-
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
33633
|
-
constructor(message2 = "signature verification failed", options) {
|
|
33634
|
-
super(message2, options);
|
|
33635
|
-
}
|
|
33636
|
-
};
|
|
33637
|
-
|
|
33638
34304
|
// node_modules/jose/dist/webapi/lib/crypto_key.js
|
|
33639
34305
|
var unusable = (name, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
33640
34306
|
var isAlgorithm = (algorithm, name) => algorithm.name === name;
|
|
33641
34307
|
function getHashLength(hash2) {
|
|
33642
34308
|
return parseInt(hash2.name.slice(4), 10);
|
|
33643
34309
|
}
|
|
34310
|
+
function checkHashLength(algorithm, expected) {
|
|
34311
|
+
const actual = getHashLength(algorithm.hash);
|
|
34312
|
+
if (actual !== expected)
|
|
34313
|
+
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
34314
|
+
}
|
|
33644
34315
|
function getNamedCurve(alg) {
|
|
33645
34316
|
switch (alg) {
|
|
33646
34317
|
case "ES256":
|
|
@@ -33665,10 +34336,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
33665
34336
|
case "HS512": {
|
|
33666
34337
|
if (!isAlgorithm(key.algorithm, "HMAC"))
|
|
33667
34338
|
throw unusable("HMAC");
|
|
33668
|
-
|
|
33669
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
33670
|
-
if (actual !== expected)
|
|
33671
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
34339
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
33672
34340
|
break;
|
|
33673
34341
|
}
|
|
33674
34342
|
case "RS256":
|
|
@@ -33676,10 +34344,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
33676
34344
|
case "RS512": {
|
|
33677
34345
|
if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
33678
34346
|
throw unusable("RSASSA-PKCS1-v1_5");
|
|
33679
|
-
|
|
33680
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
33681
|
-
if (actual !== expected)
|
|
33682
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
34347
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
33683
34348
|
break;
|
|
33684
34349
|
}
|
|
33685
34350
|
case "PS256":
|
|
@@ -33687,10 +34352,7 @@ function checkSigCryptoKey(key, alg, usage) {
|
|
|
33687
34352
|
case "PS512": {
|
|
33688
34353
|
if (!isAlgorithm(key.algorithm, "RSA-PSS"))
|
|
33689
34354
|
throw unusable("RSA-PSS");
|
|
33690
|
-
|
|
33691
|
-
const actual = getHashLength(key.algorithm.hash);
|
|
33692
|
-
if (actual !== expected)
|
|
33693
|
-
throw unusable(`SHA-${expected}`, "algorithm.hash");
|
|
34355
|
+
checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
|
|
33694
34356
|
break;
|
|
33695
34357
|
}
|
|
33696
34358
|
case "Ed25519":
|
|
@@ -33748,6 +34410,92 @@ function message(msg, actual, ...types) {
|
|
|
33748
34410
|
var invalidKeyInput = (actual, ...types) => message("Key must be ", actual, ...types);
|
|
33749
34411
|
var withAlg = (alg, actual, ...types) => message(`Key for the ${alg} algorithm must be `, actual, ...types);
|
|
33750
34412
|
|
|
34413
|
+
// node_modules/jose/dist/webapi/util/errors.js
|
|
34414
|
+
var JOSEError = class extends Error {
|
|
34415
|
+
static code = "ERR_JOSE_GENERIC";
|
|
34416
|
+
code = "ERR_JOSE_GENERIC";
|
|
34417
|
+
constructor(message2, options) {
|
|
34418
|
+
super(message2, options);
|
|
34419
|
+
this.name = this.constructor.name;
|
|
34420
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
34421
|
+
}
|
|
34422
|
+
};
|
|
34423
|
+
var JWTClaimValidationFailed = class extends JOSEError {
|
|
34424
|
+
static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
34425
|
+
code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
34426
|
+
claim;
|
|
34427
|
+
reason;
|
|
34428
|
+
payload;
|
|
34429
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
34430
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
34431
|
+
this.claim = claim;
|
|
34432
|
+
this.reason = reason;
|
|
34433
|
+
this.payload = payload;
|
|
34434
|
+
}
|
|
34435
|
+
};
|
|
34436
|
+
var JWTExpired = class extends JOSEError {
|
|
34437
|
+
static code = "ERR_JWT_EXPIRED";
|
|
34438
|
+
code = "ERR_JWT_EXPIRED";
|
|
34439
|
+
claim;
|
|
34440
|
+
reason;
|
|
34441
|
+
payload;
|
|
34442
|
+
constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
|
|
34443
|
+
super(message2, { cause: { claim, reason, payload } });
|
|
34444
|
+
this.claim = claim;
|
|
34445
|
+
this.reason = reason;
|
|
34446
|
+
this.payload = payload;
|
|
34447
|
+
}
|
|
34448
|
+
};
|
|
34449
|
+
var JOSEAlgNotAllowed = class extends JOSEError {
|
|
34450
|
+
static code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
34451
|
+
code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
34452
|
+
};
|
|
34453
|
+
var JOSENotSupported = class extends JOSEError {
|
|
34454
|
+
static code = "ERR_JOSE_NOT_SUPPORTED";
|
|
34455
|
+
code = "ERR_JOSE_NOT_SUPPORTED";
|
|
34456
|
+
};
|
|
34457
|
+
var JWSInvalid = class extends JOSEError {
|
|
34458
|
+
static code = "ERR_JWS_INVALID";
|
|
34459
|
+
code = "ERR_JWS_INVALID";
|
|
34460
|
+
};
|
|
34461
|
+
var JWTInvalid = class extends JOSEError {
|
|
34462
|
+
static code = "ERR_JWT_INVALID";
|
|
34463
|
+
code = "ERR_JWT_INVALID";
|
|
34464
|
+
};
|
|
34465
|
+
var JWKSInvalid = class extends JOSEError {
|
|
34466
|
+
static code = "ERR_JWKS_INVALID";
|
|
34467
|
+
code = "ERR_JWKS_INVALID";
|
|
34468
|
+
};
|
|
34469
|
+
var JWKSNoMatchingKey = class extends JOSEError {
|
|
34470
|
+
static code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
34471
|
+
code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
34472
|
+
constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
|
|
34473
|
+
super(message2, options);
|
|
34474
|
+
}
|
|
34475
|
+
};
|
|
34476
|
+
var JWKSMultipleMatchingKeys = class extends JOSEError {
|
|
34477
|
+
[Symbol.asyncIterator];
|
|
34478
|
+
static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
34479
|
+
code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
34480
|
+
constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
|
|
34481
|
+
super(message2, options);
|
|
34482
|
+
}
|
|
34483
|
+
};
|
|
34484
|
+
var JWKSTimeout = class extends JOSEError {
|
|
34485
|
+
static code = "ERR_JWKS_TIMEOUT";
|
|
34486
|
+
code = "ERR_JWKS_TIMEOUT";
|
|
34487
|
+
constructor(message2 = "request timed out", options) {
|
|
34488
|
+
super(message2, options);
|
|
34489
|
+
}
|
|
34490
|
+
};
|
|
34491
|
+
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
34492
|
+
static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
34493
|
+
code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
34494
|
+
constructor(message2 = "signature verification failed", options) {
|
|
34495
|
+
super(message2, options);
|
|
34496
|
+
}
|
|
34497
|
+
};
|
|
34498
|
+
|
|
33751
34499
|
// node_modules/jose/dist/webapi/lib/is_key_like.js
|
|
33752
34500
|
var isCryptoKey = (key) => {
|
|
33753
34501
|
if (key?.[Symbol.toStringTag] === "CryptoKey")
|
|
@@ -33761,7 +34509,31 @@ var isCryptoKey = (key) => {
|
|
|
33761
34509
|
var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
|
|
33762
34510
|
var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
|
|
33763
34511
|
|
|
33764
|
-
// node_modules/jose/dist/webapi/lib/
|
|
34512
|
+
// node_modules/jose/dist/webapi/lib/helpers.js
|
|
34513
|
+
var unprotected = Symbol();
|
|
34514
|
+
function decodeBase64url(value, label, ErrorClass) {
|
|
34515
|
+
try {
|
|
34516
|
+
return decode3(value);
|
|
34517
|
+
} catch {
|
|
34518
|
+
throw new ErrorClass(`Failed to base64url decode the ${label}`);
|
|
34519
|
+
}
|
|
34520
|
+
}
|
|
34521
|
+
|
|
34522
|
+
// node_modules/jose/dist/webapi/lib/type_checks.js
|
|
34523
|
+
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
34524
|
+
function isObject2(input) {
|
|
34525
|
+
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
34526
|
+
return false;
|
|
34527
|
+
}
|
|
34528
|
+
if (Object.getPrototypeOf(input) === null) {
|
|
34529
|
+
return true;
|
|
34530
|
+
}
|
|
34531
|
+
let proto = input;
|
|
34532
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
34533
|
+
proto = Object.getPrototypeOf(proto);
|
|
34534
|
+
}
|
|
34535
|
+
return Object.getPrototypeOf(input) === proto;
|
|
34536
|
+
}
|
|
33765
34537
|
function isDisjoint(...headers) {
|
|
33766
34538
|
const sources = headers.filter(Boolean);
|
|
33767
34539
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -33783,24 +34555,12 @@ function isDisjoint(...headers) {
|
|
|
33783
34555
|
}
|
|
33784
34556
|
return true;
|
|
33785
34557
|
}
|
|
34558
|
+
var isJWK = (key) => isObject2(key) && typeof key.kty === "string";
|
|
34559
|
+
var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
34560
|
+
var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
34561
|
+
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
33786
34562
|
|
|
33787
|
-
// node_modules/jose/dist/webapi/lib/
|
|
33788
|
-
var isObjectLike = (value) => typeof value === "object" && value !== null;
|
|
33789
|
-
function isObject2(input) {
|
|
33790
|
-
if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
|
|
33791
|
-
return false;
|
|
33792
|
-
}
|
|
33793
|
-
if (Object.getPrototypeOf(input) === null) {
|
|
33794
|
-
return true;
|
|
33795
|
-
}
|
|
33796
|
-
let proto = input;
|
|
33797
|
-
while (Object.getPrototypeOf(proto) !== null) {
|
|
33798
|
-
proto = Object.getPrototypeOf(proto);
|
|
33799
|
-
}
|
|
33800
|
-
return Object.getPrototypeOf(input) === proto;
|
|
33801
|
-
}
|
|
33802
|
-
|
|
33803
|
-
// node_modules/jose/dist/webapi/lib/check_key_length.js
|
|
34563
|
+
// node_modules/jose/dist/webapi/lib/signing.js
|
|
33804
34564
|
function checkKeyLength(alg, key) {
|
|
33805
34565
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
33806
34566
|
const { modulusLength } = key.algorithm;
|
|
@@ -33809,8 +34569,59 @@ function checkKeyLength(alg, key) {
|
|
|
33809
34569
|
}
|
|
33810
34570
|
}
|
|
33811
34571
|
}
|
|
34572
|
+
function subtleAlgorithm(alg, algorithm) {
|
|
34573
|
+
const hash2 = `SHA-${alg.slice(-3)}`;
|
|
34574
|
+
switch (alg) {
|
|
34575
|
+
case "HS256":
|
|
34576
|
+
case "HS384":
|
|
34577
|
+
case "HS512":
|
|
34578
|
+
return { hash: hash2, name: "HMAC" };
|
|
34579
|
+
case "PS256":
|
|
34580
|
+
case "PS384":
|
|
34581
|
+
case "PS512":
|
|
34582
|
+
return { hash: hash2, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
34583
|
+
case "RS256":
|
|
34584
|
+
case "RS384":
|
|
34585
|
+
case "RS512":
|
|
34586
|
+
return { hash: hash2, name: "RSASSA-PKCS1-v1_5" };
|
|
34587
|
+
case "ES256":
|
|
34588
|
+
case "ES384":
|
|
34589
|
+
case "ES512":
|
|
34590
|
+
return { hash: hash2, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
34591
|
+
case "Ed25519":
|
|
34592
|
+
case "EdDSA":
|
|
34593
|
+
return { name: "Ed25519" };
|
|
34594
|
+
case "ML-DSA-44":
|
|
34595
|
+
case "ML-DSA-65":
|
|
34596
|
+
case "ML-DSA-87":
|
|
34597
|
+
return { name: alg };
|
|
34598
|
+
default:
|
|
34599
|
+
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
34600
|
+
}
|
|
34601
|
+
}
|
|
34602
|
+
async function getSigKey(alg, key, usage) {
|
|
34603
|
+
if (key instanceof Uint8Array) {
|
|
34604
|
+
if (!alg.startsWith("HS")) {
|
|
34605
|
+
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
34606
|
+
}
|
|
34607
|
+
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
34608
|
+
}
|
|
34609
|
+
checkSigCryptoKey(key, alg, usage);
|
|
34610
|
+
return key;
|
|
34611
|
+
}
|
|
34612
|
+
async function verify(alg, key, signature, data) {
|
|
34613
|
+
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
34614
|
+
checkKeyLength(alg, cryptoKey);
|
|
34615
|
+
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
34616
|
+
try {
|
|
34617
|
+
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
34618
|
+
} catch {
|
|
34619
|
+
return false;
|
|
34620
|
+
}
|
|
34621
|
+
}
|
|
33812
34622
|
|
|
33813
34623
|
// node_modules/jose/dist/webapi/lib/jwk_to_key.js
|
|
34624
|
+
var unsupportedAlg = 'Invalid or unsupported JWK "alg" (Algorithm) Parameter value';
|
|
33814
34625
|
function subtleMapping(jwk) {
|
|
33815
34626
|
let algorithm;
|
|
33816
34627
|
let keyUsages;
|
|
@@ -33824,7 +34635,7 @@ function subtleMapping(jwk) {
|
|
|
33824
34635
|
keyUsages = jwk.priv ? ["sign"] : ["verify"];
|
|
33825
34636
|
break;
|
|
33826
34637
|
default:
|
|
33827
|
-
throw new JOSENotSupported(
|
|
34638
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
33828
34639
|
}
|
|
33829
34640
|
break;
|
|
33830
34641
|
}
|
|
@@ -33853,22 +34664,19 @@ function subtleMapping(jwk) {
|
|
|
33853
34664
|
keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
|
|
33854
34665
|
break;
|
|
33855
34666
|
default:
|
|
33856
|
-
throw new JOSENotSupported(
|
|
34667
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
33857
34668
|
}
|
|
33858
34669
|
break;
|
|
33859
34670
|
}
|
|
33860
34671
|
case "EC": {
|
|
33861
34672
|
switch (jwk.alg) {
|
|
33862
34673
|
case "ES256":
|
|
33863
|
-
algorithm = { name: "ECDSA", namedCurve: "P-256" };
|
|
33864
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
33865
|
-
break;
|
|
33866
34674
|
case "ES384":
|
|
33867
|
-
algorithm = { name: "ECDSA", namedCurve: "P-384" };
|
|
33868
|
-
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
33869
|
-
break;
|
|
33870
34675
|
case "ES512":
|
|
33871
|
-
algorithm = {
|
|
34676
|
+
algorithm = {
|
|
34677
|
+
name: "ECDSA",
|
|
34678
|
+
namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[jwk.alg]
|
|
34679
|
+
};
|
|
33872
34680
|
keyUsages = jwk.d ? ["sign"] : ["verify"];
|
|
33873
34681
|
break;
|
|
33874
34682
|
case "ECDH-ES":
|
|
@@ -33879,7 +34687,7 @@ function subtleMapping(jwk) {
|
|
|
33879
34687
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
33880
34688
|
break;
|
|
33881
34689
|
default:
|
|
33882
|
-
throw new JOSENotSupported(
|
|
34690
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
33883
34691
|
}
|
|
33884
34692
|
break;
|
|
33885
34693
|
}
|
|
@@ -33898,7 +34706,7 @@ function subtleMapping(jwk) {
|
|
|
33898
34706
|
keyUsages = jwk.d ? ["deriveBits"] : [];
|
|
33899
34707
|
break;
|
|
33900
34708
|
default:
|
|
33901
|
-
throw new JOSENotSupported(
|
|
34709
|
+
throw new JOSENotSupported(unsupportedAlg);
|
|
33902
34710
|
}
|
|
33903
34711
|
break;
|
|
33904
34712
|
}
|
|
@@ -33920,91 +34728,8 @@ async function jwkToKey(jwk) {
|
|
|
33920
34728
|
return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
|
|
33921
34729
|
}
|
|
33922
34730
|
|
|
33923
|
-
// node_modules/jose/dist/webapi/key/import.js
|
|
33924
|
-
async function importJWK(jwk, alg, options) {
|
|
33925
|
-
if (!isObject2(jwk)) {
|
|
33926
|
-
throw new TypeError("JWK must be an object");
|
|
33927
|
-
}
|
|
33928
|
-
let ext;
|
|
33929
|
-
alg ??= jwk.alg;
|
|
33930
|
-
ext ??= options?.extractable ?? jwk.ext;
|
|
33931
|
-
switch (jwk.kty) {
|
|
33932
|
-
case "oct":
|
|
33933
|
-
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
33934
|
-
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
33935
|
-
}
|
|
33936
|
-
return decode3(jwk.k);
|
|
33937
|
-
case "RSA":
|
|
33938
|
-
if ("oth" in jwk && jwk.oth !== void 0) {
|
|
33939
|
-
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
33940
|
-
}
|
|
33941
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
33942
|
-
case "AKP": {
|
|
33943
|
-
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
33944
|
-
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
33945
|
-
}
|
|
33946
|
-
if (alg !== void 0 && alg !== jwk.alg) {
|
|
33947
|
-
throw new TypeError("JWK alg and alg option value mismatch");
|
|
33948
|
-
}
|
|
33949
|
-
return jwkToKey({ ...jwk, ext });
|
|
33950
|
-
}
|
|
33951
|
-
case "EC":
|
|
33952
|
-
case "OKP":
|
|
33953
|
-
return jwkToKey({ ...jwk, alg, ext });
|
|
33954
|
-
default:
|
|
33955
|
-
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
33956
|
-
}
|
|
33957
|
-
}
|
|
33958
|
-
|
|
33959
|
-
// node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
33960
|
-
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
33961
|
-
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
33962
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
33963
|
-
}
|
|
33964
|
-
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
33965
|
-
return /* @__PURE__ */ new Set();
|
|
33966
|
-
}
|
|
33967
|
-
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
33968
|
-
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
33969
|
-
}
|
|
33970
|
-
let recognized;
|
|
33971
|
-
if (recognizedOption !== void 0) {
|
|
33972
|
-
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
33973
|
-
} else {
|
|
33974
|
-
recognized = recognizedDefault;
|
|
33975
|
-
}
|
|
33976
|
-
for (const parameter of protectedHeader.crit) {
|
|
33977
|
-
if (!recognized.has(parameter)) {
|
|
33978
|
-
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
33979
|
-
}
|
|
33980
|
-
if (joseHeader[parameter] === void 0) {
|
|
33981
|
-
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
33982
|
-
}
|
|
33983
|
-
if (recognized.get(parameter) && protectedHeader[parameter] === void 0) {
|
|
33984
|
-
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
33985
|
-
}
|
|
33986
|
-
}
|
|
33987
|
-
return new Set(protectedHeader.crit);
|
|
33988
|
-
}
|
|
33989
|
-
|
|
33990
|
-
// node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
33991
|
-
function validateAlgorithms(option, algorithms) {
|
|
33992
|
-
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
33993
|
-
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
33994
|
-
}
|
|
33995
|
-
if (!algorithms) {
|
|
33996
|
-
return void 0;
|
|
33997
|
-
}
|
|
33998
|
-
return new Set(algorithms);
|
|
33999
|
-
}
|
|
34000
|
-
|
|
34001
|
-
// node_modules/jose/dist/webapi/lib/is_jwk.js
|
|
34002
|
-
var isJWK = (key) => isObject2(key) && typeof key.kty === "string";
|
|
34003
|
-
var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
|
|
34004
|
-
var isPublicJWK = (key) => key.kty !== "oct" && key.d === void 0 && key.priv === void 0;
|
|
34005
|
-
var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
|
|
34006
|
-
|
|
34007
34731
|
// node_modules/jose/dist/webapi/lib/normalize_key.js
|
|
34732
|
+
var unusableForAlg = "given KeyObject instance cannot be used for this algorithm";
|
|
34008
34733
|
var cache;
|
|
34009
34734
|
var handleJWK = async (key, jwk, alg, freeze = false) => {
|
|
34010
34735
|
cache ||= /* @__PURE__ */ new WeakMap();
|
|
@@ -34039,13 +34764,13 @@ var handleKeyObject = (keyObject, alg) => {
|
|
|
34039
34764
|
case "ECDH-ES+A256KW":
|
|
34040
34765
|
break;
|
|
34041
34766
|
default:
|
|
34042
|
-
throw new TypeError(
|
|
34767
|
+
throw new TypeError(unusableForAlg);
|
|
34043
34768
|
}
|
|
34044
34769
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ["deriveBits"]);
|
|
34045
34770
|
}
|
|
34046
34771
|
if (keyObject.asymmetricKeyType === "ed25519") {
|
|
34047
34772
|
if (alg !== "EdDSA" && alg !== "Ed25519") {
|
|
34048
|
-
throw new TypeError(
|
|
34773
|
+
throw new TypeError(unusableForAlg);
|
|
34049
34774
|
}
|
|
34050
34775
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
34051
34776
|
isPublic ? "verify" : "sign"
|
|
@@ -34056,7 +34781,7 @@ var handleKeyObject = (keyObject, alg) => {
|
|
|
34056
34781
|
case "ml-dsa-65":
|
|
34057
34782
|
case "ml-dsa-87": {
|
|
34058
34783
|
if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
|
|
34059
|
-
throw new TypeError(
|
|
34784
|
+
throw new TypeError(unusableForAlg);
|
|
34060
34785
|
}
|
|
34061
34786
|
cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
|
|
34062
34787
|
isPublic ? "verify" : "sign"
|
|
@@ -34085,7 +34810,7 @@ var handleKeyObject = (keyObject, alg) => {
|
|
|
34085
34810
|
hash2 = "SHA-512";
|
|
34086
34811
|
break;
|
|
34087
34812
|
default:
|
|
34088
|
-
throw new TypeError(
|
|
34813
|
+
throw new TypeError(unusableForAlg);
|
|
34089
34814
|
}
|
|
34090
34815
|
if (alg.startsWith("RSA-OAEP")) {
|
|
34091
34816
|
return keyObject.toCryptoKey({
|
|
@@ -34106,21 +34831,10 @@ var handleKeyObject = (keyObject, alg) => {
|
|
|
34106
34831
|
]);
|
|
34107
34832
|
const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
|
|
34108
34833
|
if (!namedCurve) {
|
|
34109
|
-
throw new TypeError(
|
|
34834
|
+
throw new TypeError(unusableForAlg);
|
|
34110
34835
|
}
|
|
34111
|
-
|
|
34112
|
-
|
|
34113
|
-
name: "ECDSA",
|
|
34114
|
-
namedCurve
|
|
34115
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
34116
|
-
}
|
|
34117
|
-
if (alg === "ES384" && namedCurve === "P-384") {
|
|
34118
|
-
cryptoKey = keyObject.toCryptoKey({
|
|
34119
|
-
name: "ECDSA",
|
|
34120
|
-
namedCurve
|
|
34121
|
-
}, extractable, [isPublic ? "verify" : "sign"]);
|
|
34122
|
-
}
|
|
34123
|
-
if (alg === "ES512" && namedCurve === "P-521") {
|
|
34836
|
+
const expectedCurve = { ES256: "P-256", ES384: "P-384", ES512: "P-521" };
|
|
34837
|
+
if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
|
|
34124
34838
|
cryptoKey = keyObject.toCryptoKey({
|
|
34125
34839
|
name: "ECDSA",
|
|
34126
34840
|
namedCurve
|
|
@@ -34134,7 +34848,7 @@ var handleKeyObject = (keyObject, alg) => {
|
|
|
34134
34848
|
}
|
|
34135
34849
|
}
|
|
34136
34850
|
if (!cryptoKey) {
|
|
34137
|
-
throw new TypeError(
|
|
34851
|
+
throw new TypeError(unusableForAlg);
|
|
34138
34852
|
}
|
|
34139
34853
|
if (!cached2) {
|
|
34140
34854
|
cache.set(keyObject, { [alg]: cryptoKey });
|
|
@@ -34175,6 +34889,84 @@ async function normalizeKey(key, alg) {
|
|
|
34175
34889
|
throw new Error("unreachable");
|
|
34176
34890
|
}
|
|
34177
34891
|
|
|
34892
|
+
// node_modules/jose/dist/webapi/key/import.js
|
|
34893
|
+
async function importJWK(jwk, alg, options) {
|
|
34894
|
+
if (!isObject2(jwk)) {
|
|
34895
|
+
throw new TypeError("JWK must be an object");
|
|
34896
|
+
}
|
|
34897
|
+
let ext;
|
|
34898
|
+
alg ??= jwk.alg;
|
|
34899
|
+
ext ??= options?.extractable ?? jwk.ext;
|
|
34900
|
+
switch (jwk.kty) {
|
|
34901
|
+
case "oct":
|
|
34902
|
+
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
34903
|
+
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
34904
|
+
}
|
|
34905
|
+
return decode3(jwk.k);
|
|
34906
|
+
case "RSA":
|
|
34907
|
+
if ("oth" in jwk && jwk.oth !== void 0) {
|
|
34908
|
+
throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
34909
|
+
}
|
|
34910
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
34911
|
+
case "AKP": {
|
|
34912
|
+
if (typeof jwk.alg !== "string" || !jwk.alg) {
|
|
34913
|
+
throw new TypeError('missing "alg" (Algorithm) Parameter value');
|
|
34914
|
+
}
|
|
34915
|
+
if (alg !== void 0 && alg !== jwk.alg) {
|
|
34916
|
+
throw new TypeError("JWK alg and alg option value mismatch");
|
|
34917
|
+
}
|
|
34918
|
+
return jwkToKey({ ...jwk, ext });
|
|
34919
|
+
}
|
|
34920
|
+
case "EC":
|
|
34921
|
+
case "OKP":
|
|
34922
|
+
return jwkToKey({ ...jwk, alg, ext });
|
|
34923
|
+
default:
|
|
34924
|
+
throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
|
|
34925
|
+
}
|
|
34926
|
+
}
|
|
34927
|
+
|
|
34928
|
+
// node_modules/jose/dist/webapi/lib/validate_crit.js
|
|
34929
|
+
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
34930
|
+
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
34931
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
34932
|
+
}
|
|
34933
|
+
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
34934
|
+
return /* @__PURE__ */ new Set();
|
|
34935
|
+
}
|
|
34936
|
+
if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
|
|
34937
|
+
throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
|
|
34938
|
+
}
|
|
34939
|
+
let recognized;
|
|
34940
|
+
if (recognizedOption !== void 0) {
|
|
34941
|
+
recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
|
|
34942
|
+
} else {
|
|
34943
|
+
recognized = recognizedDefault;
|
|
34944
|
+
}
|
|
34945
|
+
for (const parameter of protectedHeader.crit) {
|
|
34946
|
+
if (!recognized.has(parameter)) {
|
|
34947
|
+
throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
|
|
34948
|
+
}
|
|
34949
|
+
if (joseHeader[parameter] === void 0) {
|
|
34950
|
+
throw new Err(`Extension Header Parameter "${parameter}" is missing`);
|
|
34951
|
+
}
|
|
34952
|
+
if (recognized.get(parameter) && protectedHeader[parameter] === void 0) {
|
|
34953
|
+
throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
|
|
34954
|
+
}
|
|
34955
|
+
}
|
|
34956
|
+
return new Set(protectedHeader.crit);
|
|
34957
|
+
}
|
|
34958
|
+
|
|
34959
|
+
// node_modules/jose/dist/webapi/lib/validate_algorithms.js
|
|
34960
|
+
function validateAlgorithms(option, algorithms) {
|
|
34961
|
+
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
34962
|
+
throw new TypeError(`"${option}" option must be an array of strings`);
|
|
34963
|
+
}
|
|
34964
|
+
if (!algorithms) {
|
|
34965
|
+
return void 0;
|
|
34966
|
+
}
|
|
34967
|
+
return new Set(algorithms);
|
|
34968
|
+
}
|
|
34969
|
+
|
|
34178
34970
|
// node_modules/jose/dist/webapi/lib/check_key_type.js
|
|
34179
34971
|
var tag = (key) => key?.[Symbol.toStringTag];
|
|
34180
34972
|
var jwkMatchesOp = (alg, key, usage) => {
|
|
@@ -34295,62 +35087,6 @@ function checkKeyType(alg, key, usage) {
|
|
|
34295
35087
|
}
|
|
34296
35088
|
}
|
|
34297
35089
|
|
|
34298
|
-
// node_modules/jose/dist/webapi/lib/subtle_dsa.js
|
|
34299
|
-
function subtleAlgorithm(alg, algorithm) {
|
|
34300
|
-
const hash2 = `SHA-${alg.slice(-3)}`;
|
|
34301
|
-
switch (alg) {
|
|
34302
|
-
case "HS256":
|
|
34303
|
-
case "HS384":
|
|
34304
|
-
case "HS512":
|
|
34305
|
-
return { hash: hash2, name: "HMAC" };
|
|
34306
|
-
case "PS256":
|
|
34307
|
-
case "PS384":
|
|
34308
|
-
case "PS512":
|
|
34309
|
-
return { hash: hash2, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
|
|
34310
|
-
case "RS256":
|
|
34311
|
-
case "RS384":
|
|
34312
|
-
case "RS512":
|
|
34313
|
-
return { hash: hash2, name: "RSASSA-PKCS1-v1_5" };
|
|
34314
|
-
case "ES256":
|
|
34315
|
-
case "ES384":
|
|
34316
|
-
case "ES512":
|
|
34317
|
-
return { hash: hash2, name: "ECDSA", namedCurve: algorithm.namedCurve };
|
|
34318
|
-
case "Ed25519":
|
|
34319
|
-
case "EdDSA":
|
|
34320
|
-
return { name: "Ed25519" };
|
|
34321
|
-
case "ML-DSA-44":
|
|
34322
|
-
case "ML-DSA-65":
|
|
34323
|
-
case "ML-DSA-87":
|
|
34324
|
-
return { name: alg };
|
|
34325
|
-
default:
|
|
34326
|
-
throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
34327
|
-
}
|
|
34328
|
-
}
|
|
34329
|
-
|
|
34330
|
-
// node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
|
|
34331
|
-
async function getSigKey(alg, key, usage) {
|
|
34332
|
-
if (key instanceof Uint8Array) {
|
|
34333
|
-
if (!alg.startsWith("HS")) {
|
|
34334
|
-
throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
|
|
34335
|
-
}
|
|
34336
|
-
return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
|
|
34337
|
-
}
|
|
34338
|
-
checkSigCryptoKey(key, alg, usage);
|
|
34339
|
-
return key;
|
|
34340
|
-
}
|
|
34341
|
-
|
|
34342
|
-
// node_modules/jose/dist/webapi/lib/verify.js
|
|
34343
|
-
async function verify(alg, key, signature, data) {
|
|
34344
|
-
const cryptoKey = await getSigKey(alg, key, "verify");
|
|
34345
|
-
checkKeyLength(alg, cryptoKey);
|
|
34346
|
-
const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
|
|
34347
|
-
try {
|
|
34348
|
-
return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
|
|
34349
|
-
} catch {
|
|
34350
|
-
return false;
|
|
34351
|
-
}
|
|
34352
|
-
}
|
|
34353
|
-
|
|
34354
35090
|
// node_modules/jose/dist/webapi/jws/flattened/verify.js
|
|
34355
35091
|
async function flattenedVerify(jws, key, options) {
|
|
34356
35092
|
if (!isObject2(jws)) {
|
|
@@ -34417,12 +35153,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
34417
35153
|
}
|
|
34418
35154
|
checkKeyType(alg, key, "verify");
|
|
34419
35155
|
const data = concat(jws.protected !== void 0 ? encode3(jws.protected) : new Uint8Array(), encode3("."), typeof jws.payload === "string" ? b64 ? encode3(jws.payload) : encoder.encode(jws.payload) : jws.payload);
|
|
34420
|
-
|
|
34421
|
-
try {
|
|
34422
|
-
signature = decode3(jws.signature);
|
|
34423
|
-
} catch {
|
|
34424
|
-
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
34425
|
-
}
|
|
35156
|
+
const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
|
|
34426
35157
|
const k = await normalizeKey(key, alg);
|
|
34427
35158
|
const verified = await verify(alg, k, signature, data);
|
|
34428
35159
|
if (!verified) {
|
|
@@ -34430,11 +35161,7 @@ async function flattenedVerify(jws, key, options) {
|
|
|
34430
35161
|
}
|
|
34431
35162
|
let payload;
|
|
34432
35163
|
if (b64) {
|
|
34433
|
-
|
|
34434
|
-
payload = decode3(jws.payload);
|
|
34435
|
-
} catch {
|
|
34436
|
-
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
34437
|
-
}
|
|
35164
|
+
payload = decodeBase64url(jws.payload, "payload", JWSInvalid);
|
|
34438
35165
|
} else if (typeof jws.payload === "string") {
|
|
34439
35166
|
payload = encoder.encode(jws.payload);
|
|
34440
35167
|
} else {
|
|
@@ -34766,10 +35493,10 @@ function isCloudflareWorkers() {
|
|
|
34766
35493
|
var USER_AGENT;
|
|
34767
35494
|
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
34768
35495
|
const NAME = "jose";
|
|
34769
|
-
const
|
|
34770
|
-
USER_AGENT = `${NAME}/${
|
|
35496
|
+
const VERSION2 = "v6.2.1";
|
|
35497
|
+
USER_AGENT = `${NAME}/${VERSION2}`;
|
|
34771
35498
|
}
|
|
34772
|
-
var customFetch =
|
|
35499
|
+
var customFetch = Symbol();
|
|
34773
35500
|
async function fetchJwks(url2, headers, signal, fetchImpl = fetch) {
|
|
34774
35501
|
const response = await fetchImpl(url2, {
|
|
34775
35502
|
method: "GET",
|
|
@@ -34791,7 +35518,7 @@ async function fetchJwks(url2, headers, signal, fetchImpl = fetch) {
|
|
|
34791
35518
|
throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON");
|
|
34792
35519
|
}
|
|
34793
35520
|
}
|
|
34794
|
-
var jwksCache =
|
|
35521
|
+
var jwksCache = Symbol();
|
|
34795
35522
|
function isFreshJwksCache(input, cacheMaxAge) {
|
|
34796
35523
|
if (typeof input !== "object" || input === null) {
|
|
34797
35524
|
return false;
|
|
@@ -36585,22 +37312,6 @@ var ConcurrentMCPServer = class _ConcurrentMCPServer {
|
|
|
36585
37312
|
});
|
|
36586
37313
|
}
|
|
36587
37314
|
}
|
|
36588
|
-
if (method === "ping") {
|
|
36589
|
-
return c.json({ jsonrpc: "2.0", id, result: {} });
|
|
36590
|
-
}
|
|
36591
|
-
if (method === "prompts/list") {
|
|
36592
|
-
return c.json({ jsonrpc: "2.0", id, result: { prompts: [] } });
|
|
36593
|
-
}
|
|
36594
|
-
if (method === "logging/setLevel") {
|
|
36595
|
-
return c.json({ jsonrpc: "2.0", id, result: {} });
|
|
36596
|
-
}
|
|
36597
|
-
if (method === "completion/complete") {
|
|
36598
|
-
return c.json({
|
|
36599
|
-
jsonrpc: "2.0",
|
|
36600
|
-
id,
|
|
36601
|
-
result: { completion: { values: [] } }
|
|
36602
|
-
});
|
|
36603
|
-
}
|
|
36604
37315
|
if (method && !id) {
|
|
36605
37316
|
return new Response(null, { status: 202 });
|
|
36606
37317
|
}
|
|
@@ -40967,89 +41678,8 @@ var setupTools = [
|
|
|
40967
41678
|
// src/tools/analytics.ts
|
|
40968
41679
|
var CHART_UI = { ui: { resourceUri: "ui://mcp-erpnext/chart-viewer" } };
|
|
40969
41680
|
var KPI_UI = { ui: { resourceUri: "ui://mcp-erpnext/kpi-viewer" } };
|
|
40970
|
-
var PIPELINE_UI = { ui: { resourceUri: "ui://mcp-erpnext/order-pipeline-viewer" } };
|
|
40971
41681
|
var FUNNEL_UI = { ui: { resourceUri: "ui://mcp-erpnext/funnel-viewer" } };
|
|
40972
41682
|
var analyticsTools = [
|
|
40973
|
-
// ── Order Pipeline ────────────────────────────────────────────────────────
|
|
40974
|
-
{
|
|
40975
|
-
name: "erpnext_order_pipeline",
|
|
40976
|
-
_meta: PIPELINE_UI,
|
|
40977
|
-
description: "Get sales orders grouped by workflow status as a kanban pipeline. Returns columns (Draft, Open, To Deliver, To Bill, Completed, Cancelled) with order count, total value, and individual order cards. Ideal for seeing the current state of your sales pipeline at a glance.",
|
|
40978
|
-
category: "analytics",
|
|
40979
|
-
inputSchema: {
|
|
40980
|
-
type: "object",
|
|
40981
|
-
properties: {
|
|
40982
|
-
limit: { type: "number", description: "Max total orders to fetch (default 200)" },
|
|
40983
|
-
customer: { type: "string", description: "Filter by customer name" },
|
|
40984
|
-
exclude_cancelled: {
|
|
40985
|
-
type: "boolean",
|
|
40986
|
-
description: "Exclude cancelled orders from results (default false)"
|
|
40987
|
-
}
|
|
40988
|
-
}
|
|
40989
|
-
},
|
|
40990
|
-
handler: async (input, ctx) => {
|
|
40991
|
-
const limit = input.limit ?? 200;
|
|
40992
|
-
const filters = [];
|
|
40993
|
-
if (input.customer) {
|
|
40994
|
-
filters.push(["customer", "=", input.customer]);
|
|
40995
|
-
}
|
|
40996
|
-
if (input.exclude_cancelled) {
|
|
40997
|
-
filters.push(["status", "!=", "Cancelled"]);
|
|
40998
|
-
}
|
|
40999
|
-
const orders = await ctx.client.list("Sales Order", {
|
|
41000
|
-
fields: [
|
|
41001
|
-
"name",
|
|
41002
|
-
"customer",
|
|
41003
|
-
"customer_name",
|
|
41004
|
-
"status",
|
|
41005
|
-
"grand_total",
|
|
41006
|
-
"transaction_date",
|
|
41007
|
-
"delivery_date"
|
|
41008
|
-
],
|
|
41009
|
-
filters,
|
|
41010
|
-
limit,
|
|
41011
|
-
order_by: "modified desc"
|
|
41012
|
-
});
|
|
41013
|
-
const STATUS_MAP = {
|
|
41014
|
-
"Draft": { label: "Draft", color: "#78716c" },
|
|
41015
|
-
"Open": { label: "Open", color: "#fbbf24" },
|
|
41016
|
-
"To Deliver and Bill": { label: "To Deliver", color: "#60a5fa" },
|
|
41017
|
-
"To Bill": { label: "To Bill", color: "#c084fc" },
|
|
41018
|
-
"Completed": { label: "Completed", color: "#4ade80" },
|
|
41019
|
-
"Cancelled": { label: "Cancelled", color: "#f87171" }
|
|
41020
|
-
};
|
|
41021
|
-
const grouped = {};
|
|
41022
|
-
for (const order of orders) {
|
|
41023
|
-
const status = order.status ?? "Draft";
|
|
41024
|
-
if (!grouped[status]) grouped[status] = [];
|
|
41025
|
-
grouped[status].push(order);
|
|
41026
|
-
}
|
|
41027
|
-
const columns = Object.entries(STATUS_MAP).filter(([status]) => grouped[status]?.length > 0).map(([status, { label, color }]) => {
|
|
41028
|
-
const statusOrders = grouped[status] ?? [];
|
|
41029
|
-
return {
|
|
41030
|
-
status,
|
|
41031
|
-
label,
|
|
41032
|
-
color,
|
|
41033
|
-
count: statusOrders.length,
|
|
41034
|
-
total: statusOrders.reduce((sum, o) => sum + (Number(o.grand_total) || 0), 0),
|
|
41035
|
-
orders: statusOrders.map((o) => ({
|
|
41036
|
-
name: o.name,
|
|
41037
|
-
customer: o.customer_name ?? o.customer,
|
|
41038
|
-
amount: Number(o.grand_total) || 0,
|
|
41039
|
-
date: o.transaction_date,
|
|
41040
|
-
delivery_date: o.delivery_date
|
|
41041
|
-
}))
|
|
41042
|
-
};
|
|
41043
|
-
});
|
|
41044
|
-
return {
|
|
41045
|
-
title: "Sales Order Pipeline",
|
|
41046
|
-
currency: "EUR",
|
|
41047
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
41048
|
-
columns,
|
|
41049
|
-
_meta: PIPELINE_UI
|
|
41050
|
-
};
|
|
41051
|
-
}
|
|
41052
|
-
},
|
|
41053
41683
|
// ── Stock Chart ───────────────────────────────────────────────────────────
|
|
41054
41684
|
{
|
|
41055
41685
|
name: "erpnext_stock_chart",
|
|
@@ -42232,79 +42862,625 @@ var analyticsTools = [
|
|
|
42232
42862
|
_meta: CHART_UI
|
|
42233
42863
|
};
|
|
42234
42864
|
}
|
|
42865
|
+
}
|
|
42866
|
+
];
|
|
42867
|
+
|
|
42868
|
+
// src/kanban/definitions.ts
|
|
42869
|
+
var KANBAN_BOARD_DEFINITIONS = [
|
|
42870
|
+
{
|
|
42871
|
+
doctype: "Task",
|
|
42872
|
+
title: "Task Board",
|
|
42873
|
+
adapterKey: "task",
|
|
42874
|
+
moveToolName: "erpnext_kanban_move_card"
|
|
42235
42875
|
},
|
|
42236
|
-
// ── Purchase Pipeline ─────────────────────────────────────────────────────
|
|
42237
42876
|
{
|
|
42238
|
-
|
|
42239
|
-
|
|
42240
|
-
|
|
42241
|
-
|
|
42877
|
+
doctype: "Opportunity",
|
|
42878
|
+
title: "Opportunity Board",
|
|
42879
|
+
adapterKey: "opportunity",
|
|
42880
|
+
moveToolName: "erpnext_kanban_move_card"
|
|
42881
|
+
},
|
|
42882
|
+
{
|
|
42883
|
+
doctype: "Issue",
|
|
42884
|
+
title: "Issue Board",
|
|
42885
|
+
adapterKey: "issue",
|
|
42886
|
+
moveToolName: "erpnext_kanban_move_card"
|
|
42887
|
+
}
|
|
42888
|
+
];
|
|
42889
|
+
function getKanbanBoardDefinition(doctype) {
|
|
42890
|
+
return KANBAN_BOARD_DEFINITIONS.find((definition) => definition.doctype === doctype);
|
|
42891
|
+
}
|
|
42892
|
+
|
|
42893
|
+
// src/kanban/adapters/task.ts
|
|
42894
|
+
var TASK_COLUMNS = [
|
|
42895
|
+
{ id: "open", label: "Open", color: "#60a5fa", status: "Open" },
|
|
42896
|
+
{ id: "working", label: "Working", color: "#f59e0b", status: "Working" },
|
|
42897
|
+
{ id: "pending-review", label: "Pending Review", color: "#a78bfa", status: "Pending Review" },
|
|
42898
|
+
{ id: "overdue", label: "Overdue", color: "#ef4444", status: "Overdue" },
|
|
42899
|
+
{ id: "completed", label: "Completed", color: "#22c55e", status: "Completed" },
|
|
42900
|
+
{ id: "cancelled", label: "Cancelled", color: "#78716c", status: "Cancelled" }
|
|
42901
|
+
];
|
|
42902
|
+
var STATUS_BY_COLUMN = new Map(TASK_COLUMNS.map((column) => [column.id, column.status]));
|
|
42903
|
+
var COLUMN_BY_STATUS = new Map(TASK_COLUMNS.map((column) => [column.status, column.id]));
|
|
42904
|
+
var TASK_LIST_FIELDS = [
|
|
42905
|
+
"name",
|
|
42906
|
+
"subject",
|
|
42907
|
+
"project",
|
|
42908
|
+
"status",
|
|
42909
|
+
"priority",
|
|
42910
|
+
"progress"
|
|
42911
|
+
];
|
|
42912
|
+
var TASK_ALLOWED_TRANSITIONS = [
|
|
42913
|
+
{ fromColumn: "open", toColumn: "working", allowed: true, label: "Start work" },
|
|
42914
|
+
{ fromColumn: "open", toColumn: "pending-review", allowed: true },
|
|
42915
|
+
{ fromColumn: "open", toColumn: "completed", allowed: true },
|
|
42916
|
+
{ fromColumn: "open", toColumn: "cancelled", allowed: true },
|
|
42917
|
+
{ fromColumn: "working", toColumn: "open", allowed: true },
|
|
42918
|
+
{ fromColumn: "working", toColumn: "pending-review", allowed: true, label: "Request review" },
|
|
42919
|
+
{ fromColumn: "working", toColumn: "completed", allowed: true },
|
|
42920
|
+
{ fromColumn: "working", toColumn: "cancelled", allowed: true },
|
|
42921
|
+
{ fromColumn: "pending-review", toColumn: "working", allowed: true, label: "Resume work" },
|
|
42922
|
+
{ fromColumn: "pending-review", toColumn: "completed", allowed: true, label: "Approve" },
|
|
42923
|
+
{ fromColumn: "pending-review", toColumn: "open", allowed: true },
|
|
42924
|
+
{ fromColumn: "pending-review", toColumn: "cancelled", allowed: true },
|
|
42925
|
+
{ fromColumn: "completed", toColumn: "working", allowed: true, label: "Reopen" },
|
|
42926
|
+
{ fromColumn: "completed", toColumn: "open", allowed: true },
|
|
42927
|
+
{ fromColumn: "cancelled", toColumn: "open", allowed: true, label: "Reopen" }
|
|
42928
|
+
];
|
|
42929
|
+
function buildTaskCard(row) {
|
|
42930
|
+
const status = String(row.status ?? "Open");
|
|
42931
|
+
const columnId = columnIdForTaskStatus(status);
|
|
42932
|
+
const priority = typeof row.priority === "string" ? row.priority : void 0;
|
|
42933
|
+
const progress = typeof row.progress === "number" ? row.progress : Number.isFinite(Number(row.progress)) ? Number(row.progress) : void 0;
|
|
42934
|
+
return {
|
|
42935
|
+
id: String(row.name ?? ""),
|
|
42936
|
+
title: String(row.subject ?? row.name ?? "Untitled task"),
|
|
42937
|
+
subtitle: typeof row.project === "string" ? row.project : void 0,
|
|
42938
|
+
columnId,
|
|
42939
|
+
accent: TASK_COLUMNS.find((column) => column.id === columnId)?.color,
|
|
42940
|
+
badges: priority ? [{ label: priority, tone: priorityTone(priority) }] : [],
|
|
42941
|
+
metrics: progress === void 0 ? [] : [{ label: "Progress", value: `${progress}%` }]
|
|
42942
|
+
};
|
|
42943
|
+
}
|
|
42944
|
+
function priorityTone(priority) {
|
|
42945
|
+
if (priority === "Urgent") return "error";
|
|
42946
|
+
if (priority === "High") return "warning";
|
|
42947
|
+
return "neutral";
|
|
42948
|
+
}
|
|
42949
|
+
function columnIdForTaskStatus(status) {
|
|
42950
|
+
return COLUMN_BY_STATUS.get(String(status ?? "Open")) ?? "open";
|
|
42951
|
+
}
|
|
42952
|
+
var taskKanbanAdapter = {
|
|
42953
|
+
doctype: "Task",
|
|
42954
|
+
getColumns() {
|
|
42955
|
+
return TASK_COLUMNS.map((column) => ({
|
|
42956
|
+
id: column.id,
|
|
42957
|
+
label: column.label,
|
|
42958
|
+
color: column.color,
|
|
42959
|
+
count: 0
|
|
42960
|
+
}));
|
|
42961
|
+
},
|
|
42962
|
+
getAllowedTransitions() {
|
|
42963
|
+
return TASK_ALLOWED_TRANSITIONS;
|
|
42964
|
+
},
|
|
42965
|
+
getListFields() {
|
|
42966
|
+
return TASK_LIST_FIELDS;
|
|
42967
|
+
},
|
|
42968
|
+
buildListFilters(input) {
|
|
42969
|
+
const filters = [];
|
|
42970
|
+
if (typeof input.project === "string" && input.project.length > 0) {
|
|
42971
|
+
filters.push(["project", "=", input.project]);
|
|
42972
|
+
}
|
|
42973
|
+
if (typeof input.priority === "string" && input.priority.length > 0) {
|
|
42974
|
+
filters.push(["priority", "=", input.priority]);
|
|
42975
|
+
}
|
|
42976
|
+
return filters;
|
|
42977
|
+
},
|
|
42978
|
+
buildCards(rows) {
|
|
42979
|
+
return rows.map(buildTaskCard);
|
|
42980
|
+
},
|
|
42981
|
+
validateTransition(move) {
|
|
42982
|
+
if (move.toColumn === "overdue") {
|
|
42983
|
+
return { allowed: false, reason: "Overdue is system-managed" };
|
|
42984
|
+
}
|
|
42985
|
+
const match2 = TASK_ALLOWED_TRANSITIONS.find(
|
|
42986
|
+
(transition) => transition.fromColumn === move.fromColumn && transition.toColumn === move.toColumn && transition.allowed
|
|
42987
|
+
);
|
|
42988
|
+
if (!match2) {
|
|
42989
|
+
return { allowed: false, reason: "Task transition is not allowed" };
|
|
42990
|
+
}
|
|
42991
|
+
return { allowed: true };
|
|
42992
|
+
},
|
|
42993
|
+
async executeMove(move, ctx) {
|
|
42994
|
+
const currentTask = await ctx.client.get("Task", move.cardId);
|
|
42995
|
+
const serverColumn = columnIdForTaskStatus(currentTask.status);
|
|
42996
|
+
if (serverColumn !== move.fromColumn) {
|
|
42997
|
+
return {
|
|
42998
|
+
ok: false,
|
|
42999
|
+
cardId: move.cardId,
|
|
43000
|
+
fromColumn: serverColumn,
|
|
43001
|
+
toColumn: move.toColumn,
|
|
43002
|
+
errorMessage: `Task moved on the server from ${move.fromColumn} to ${serverColumn}. Refresh the board and try again.`
|
|
43003
|
+
};
|
|
43004
|
+
}
|
|
43005
|
+
const validation = this.validateTransition(move);
|
|
43006
|
+
if (!validation.allowed) {
|
|
43007
|
+
return {
|
|
43008
|
+
ok: false,
|
|
43009
|
+
cardId: move.cardId,
|
|
43010
|
+
fromColumn: move.fromColumn,
|
|
43011
|
+
toColumn: move.toColumn,
|
|
43012
|
+
errorMessage: validation.reason
|
|
43013
|
+
};
|
|
43014
|
+
}
|
|
43015
|
+
const status = STATUS_BY_COLUMN.get(move.toColumn);
|
|
43016
|
+
if (!status) {
|
|
43017
|
+
return {
|
|
43018
|
+
ok: false,
|
|
43019
|
+
cardId: move.cardId,
|
|
43020
|
+
fromColumn: move.fromColumn,
|
|
43021
|
+
toColumn: move.toColumn,
|
|
43022
|
+
errorMessage: "Unknown Task column"
|
|
43023
|
+
};
|
|
43024
|
+
}
|
|
43025
|
+
const serverTask = await ctx.client.update("Task", move.cardId, { status });
|
|
43026
|
+
return {
|
|
43027
|
+
ok: true,
|
|
43028
|
+
cardId: move.cardId,
|
|
43029
|
+
fromColumn: serverColumn,
|
|
43030
|
+
toColumn: move.toColumn,
|
|
43031
|
+
serverCard: buildTaskCard(serverTask)
|
|
43032
|
+
};
|
|
43033
|
+
}
|
|
43034
|
+
};
|
|
43035
|
+
|
|
43036
|
+
// src/kanban/adapters/opportunity.ts
|
|
43037
|
+
var OPPORTUNITY_COLUMNS = [
|
|
43038
|
+
{ id: "open", label: "Open", color: "#60a5fa", status: "Open" },
|
|
43039
|
+
{ id: "replied", label: "Replied", color: "#f59e0b", status: "Replied" },
|
|
43040
|
+
{ id: "quotation", label: "Quotation", color: "#a78bfa", status: "Quotation" },
|
|
43041
|
+
{ id: "converted", label: "Converted", color: "#22c55e", status: "Converted" },
|
|
43042
|
+
{ id: "closed", label: "Closed", color: "#64748b", status: "Closed" },
|
|
43043
|
+
{ id: "lost", label: "Lost", color: "#ef4444", status: "Lost" }
|
|
43044
|
+
];
|
|
43045
|
+
var STATUS_BY_COLUMN2 = new Map(OPPORTUNITY_COLUMNS.map((column) => [column.id, column.status]));
|
|
43046
|
+
var COLUMN_BY_STATUS2 = new Map(OPPORTUNITY_COLUMNS.map((column) => [column.status, column.id]));
|
|
43047
|
+
var OPPORTUNITY_LIST_FIELDS = [
|
|
43048
|
+
"name",
|
|
43049
|
+
"title",
|
|
43050
|
+
"opportunity_from",
|
|
43051
|
+
"party_name",
|
|
43052
|
+
"status",
|
|
43053
|
+
"opportunity_amount",
|
|
43054
|
+
"currency",
|
|
43055
|
+
"probability",
|
|
43056
|
+
"opportunity_owner"
|
|
43057
|
+
];
|
|
43058
|
+
var OPPORTUNITY_ALLOWED_TRANSITIONS = [
|
|
43059
|
+
{ fromColumn: "open", toColumn: "replied", allowed: true, label: "Reply" },
|
|
43060
|
+
{ fromColumn: "open", toColumn: "quotation", allowed: true, label: "Send quotation" },
|
|
43061
|
+
{ fromColumn: "open", toColumn: "converted", allowed: true, label: "Convert" },
|
|
43062
|
+
{ fromColumn: "open", toColumn: "closed", allowed: true, label: "Close" },
|
|
43063
|
+
{ fromColumn: "open", toColumn: "lost", allowed: true, label: "Mark lost" },
|
|
43064
|
+
{ fromColumn: "replied", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43065
|
+
{ fromColumn: "replied", toColumn: "quotation", allowed: true, label: "Send quotation" },
|
|
43066
|
+
{ fromColumn: "replied", toColumn: "converted", allowed: true, label: "Convert" },
|
|
43067
|
+
{ fromColumn: "replied", toColumn: "closed", allowed: true, label: "Close" },
|
|
43068
|
+
{ fromColumn: "replied", toColumn: "lost", allowed: true, label: "Mark lost" },
|
|
43069
|
+
{ fromColumn: "quotation", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43070
|
+
{ fromColumn: "quotation", toColumn: "replied", allowed: true, label: "Resume conversation" },
|
|
43071
|
+
{ fromColumn: "quotation", toColumn: "converted", allowed: true, label: "Convert" },
|
|
43072
|
+
{ fromColumn: "quotation", toColumn: "closed", allowed: true, label: "Close" },
|
|
43073
|
+
{ fromColumn: "quotation", toColumn: "lost", allowed: true, label: "Mark lost" },
|
|
43074
|
+
{ fromColumn: "converted", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43075
|
+
{ fromColumn: "converted", toColumn: "closed", allowed: true, label: "Close" },
|
|
43076
|
+
{ fromColumn: "closed", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43077
|
+
{ fromColumn: "closed", toColumn: "replied", allowed: true, label: "Resume" },
|
|
43078
|
+
{ fromColumn: "lost", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43079
|
+
{ fromColumn: "lost", toColumn: "replied", allowed: true, label: "Resume" }
|
|
43080
|
+
];
|
|
43081
|
+
function columnIdForOpportunityStatus(status) {
|
|
43082
|
+
return COLUMN_BY_STATUS2.get(String(status ?? "Open")) ?? "open";
|
|
43083
|
+
}
|
|
43084
|
+
function formatOpportunityAmount(amount, currency) {
|
|
43085
|
+
const numeric = Number(amount);
|
|
43086
|
+
if (!Number.isFinite(numeric)) return null;
|
|
43087
|
+
const currencyCode = typeof currency === "string" && currency.length > 0 ? currency : "Amount";
|
|
43088
|
+
return `${currencyCode} ${numeric}`;
|
|
43089
|
+
}
|
|
43090
|
+
function buildOpportunityCard(row) {
|
|
43091
|
+
const status = String(row.status ?? "Open");
|
|
43092
|
+
const columnId = columnIdForOpportunityStatus(status);
|
|
43093
|
+
const amountValue = formatOpportunityAmount(row.opportunity_amount, row.currency);
|
|
43094
|
+
const probability = Number(row.probability);
|
|
43095
|
+
const probabilityValue = Number.isFinite(probability) ? `${probability}%` : null;
|
|
43096
|
+
const title = typeof row.title === "string" && row.title.length > 0 ? row.title : typeof row.party_name === "string" && row.party_name.length > 0 ? row.party_name : String(row.name ?? "Untitled opportunity");
|
|
43097
|
+
return {
|
|
43098
|
+
id: String(row.name ?? ""),
|
|
43099
|
+
title,
|
|
43100
|
+
subtitle: typeof row.party_name === "string" ? row.party_name : void 0,
|
|
43101
|
+
columnId,
|
|
43102
|
+
accent: OPPORTUNITY_COLUMNS.find((column) => column.id === columnId)?.color,
|
|
43103
|
+
badges: typeof row.opportunity_from === "string" && row.opportunity_from.length > 0 ? [{ label: row.opportunity_from, tone: "neutral" }] : [],
|
|
43104
|
+
metrics: [
|
|
43105
|
+
...amountValue ? [{ label: "Amount", value: amountValue }] : [],
|
|
43106
|
+
...probabilityValue ? [{ label: "Probability", value: probabilityValue }] : []
|
|
43107
|
+
]
|
|
43108
|
+
};
|
|
43109
|
+
}
|
|
43110
|
+
var opportunityKanbanAdapter = {
|
|
43111
|
+
doctype: "Opportunity",
|
|
43112
|
+
getColumns() {
|
|
43113
|
+
return OPPORTUNITY_COLUMNS.map((column) => ({
|
|
43114
|
+
id: column.id,
|
|
43115
|
+
label: column.label,
|
|
43116
|
+
color: column.color,
|
|
43117
|
+
count: 0
|
|
43118
|
+
}));
|
|
43119
|
+
},
|
|
43120
|
+
getAllowedTransitions() {
|
|
43121
|
+
return OPPORTUNITY_ALLOWED_TRANSITIONS;
|
|
43122
|
+
},
|
|
43123
|
+
getListFields() {
|
|
43124
|
+
return OPPORTUNITY_LIST_FIELDS;
|
|
43125
|
+
},
|
|
43126
|
+
buildListFilters(input) {
|
|
43127
|
+
const filters = [];
|
|
43128
|
+
if (typeof input.status === "string" && input.status.length > 0) {
|
|
43129
|
+
filters.push(["status", "=", input.status]);
|
|
43130
|
+
}
|
|
43131
|
+
if (typeof input.opportunity_owner === "string" && input.opportunity_owner.length > 0) {
|
|
43132
|
+
filters.push(["opportunity_owner", "=", input.opportunity_owner]);
|
|
43133
|
+
}
|
|
43134
|
+
if (typeof input.party_name === "string" && input.party_name.length > 0) {
|
|
43135
|
+
filters.push(["party_name", "=", input.party_name]);
|
|
43136
|
+
}
|
|
43137
|
+
return filters;
|
|
43138
|
+
},
|
|
43139
|
+
buildCards(rows) {
|
|
43140
|
+
return rows.map(buildOpportunityCard);
|
|
43141
|
+
},
|
|
43142
|
+
validateTransition(move) {
|
|
43143
|
+
const match2 = OPPORTUNITY_ALLOWED_TRANSITIONS.find(
|
|
43144
|
+
(transition) => transition.fromColumn === move.fromColumn && transition.toColumn === move.toColumn && transition.allowed
|
|
43145
|
+
);
|
|
43146
|
+
if (!match2) {
|
|
43147
|
+
return { allowed: false, reason: "Opportunity transition is not allowed" };
|
|
43148
|
+
}
|
|
43149
|
+
return { allowed: true };
|
|
43150
|
+
},
|
|
43151
|
+
async executeMove(move, ctx) {
|
|
43152
|
+
const currentOpportunity = await ctx.client.get("Opportunity", move.cardId);
|
|
43153
|
+
const serverColumn = columnIdForOpportunityStatus(currentOpportunity.status);
|
|
43154
|
+
if (serverColumn !== move.fromColumn) {
|
|
43155
|
+
return {
|
|
43156
|
+
ok: false,
|
|
43157
|
+
cardId: move.cardId,
|
|
43158
|
+
fromColumn: serverColumn,
|
|
43159
|
+
toColumn: move.toColumn,
|
|
43160
|
+
errorMessage: `Opportunity moved on the server from ${move.fromColumn} to ${serverColumn}. Refresh the board and try again.`
|
|
43161
|
+
};
|
|
43162
|
+
}
|
|
43163
|
+
const validation = this.validateTransition(move);
|
|
43164
|
+
if (!validation.allowed) {
|
|
43165
|
+
return {
|
|
43166
|
+
ok: false,
|
|
43167
|
+
cardId: move.cardId,
|
|
43168
|
+
fromColumn: move.fromColumn,
|
|
43169
|
+
toColumn: move.toColumn,
|
|
43170
|
+
errorMessage: validation.reason
|
|
43171
|
+
};
|
|
43172
|
+
}
|
|
43173
|
+
const status = STATUS_BY_COLUMN2.get(move.toColumn);
|
|
43174
|
+
if (!status) {
|
|
43175
|
+
return {
|
|
43176
|
+
ok: false,
|
|
43177
|
+
cardId: move.cardId,
|
|
43178
|
+
fromColumn: move.fromColumn,
|
|
43179
|
+
toColumn: move.toColumn,
|
|
43180
|
+
errorMessage: "Unknown Opportunity column"
|
|
43181
|
+
};
|
|
43182
|
+
}
|
|
43183
|
+
const serverOpportunity = await ctx.client.update("Opportunity", move.cardId, {
|
|
43184
|
+
status
|
|
43185
|
+
});
|
|
43186
|
+
return {
|
|
43187
|
+
ok: true,
|
|
43188
|
+
cardId: move.cardId,
|
|
43189
|
+
fromColumn: serverColumn,
|
|
43190
|
+
toColumn: move.toColumn,
|
|
43191
|
+
serverCard: buildOpportunityCard(serverOpportunity)
|
|
43192
|
+
};
|
|
43193
|
+
}
|
|
43194
|
+
};
|
|
43195
|
+
|
|
43196
|
+
// src/kanban/adapters/issue.ts
|
|
43197
|
+
var ISSUE_COLUMNS = [
|
|
43198
|
+
{ id: "open", label: "Open", color: "#60a5fa", status: "Open" },
|
|
43199
|
+
{ id: "replied", label: "Replied", color: "#f59e0b", status: "Replied" },
|
|
43200
|
+
{ id: "on-hold", label: "On Hold", color: "#a78bfa", status: "On Hold" },
|
|
43201
|
+
{ id: "resolved", label: "Resolved", color: "#22c55e", status: "Resolved" },
|
|
43202
|
+
{ id: "closed", label: "Closed", color: "#64748b", status: "Closed" }
|
|
43203
|
+
];
|
|
43204
|
+
var STATUS_BY_COLUMN3 = new Map(ISSUE_COLUMNS.map((column) => [column.id, column.status]));
|
|
43205
|
+
var COLUMN_BY_STATUS3 = new Map(ISSUE_COLUMNS.map((column) => [column.status, column.id]));
|
|
43206
|
+
var ISSUE_LIST_FIELDS = [
|
|
43207
|
+
"name",
|
|
43208
|
+
"subject",
|
|
43209
|
+
"status",
|
|
43210
|
+
"priority",
|
|
43211
|
+
"customer",
|
|
43212
|
+
"raised_by"
|
|
43213
|
+
];
|
|
43214
|
+
var ISSUE_ALLOWED_TRANSITIONS = [
|
|
43215
|
+
{ fromColumn: "open", toColumn: "replied", allowed: true, label: "Reply" },
|
|
43216
|
+
{ fromColumn: "open", toColumn: "on-hold", allowed: true, label: "Put on hold" },
|
|
43217
|
+
{ fromColumn: "open", toColumn: "resolved", allowed: true, label: "Resolve" },
|
|
43218
|
+
{ fromColumn: "open", toColumn: "closed", allowed: true, label: "Close" },
|
|
43219
|
+
{ fromColumn: "replied", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43220
|
+
{ fromColumn: "replied", toColumn: "on-hold", allowed: true, label: "Put on hold" },
|
|
43221
|
+
{ fromColumn: "replied", toColumn: "resolved", allowed: true, label: "Resolve" },
|
|
43222
|
+
{ fromColumn: "replied", toColumn: "closed", allowed: true, label: "Close" },
|
|
43223
|
+
{ fromColumn: "on-hold", toColumn: "open", allowed: true, label: "Resume" },
|
|
43224
|
+
{ fromColumn: "on-hold", toColumn: "replied", allowed: true, label: "Reply" },
|
|
43225
|
+
{ fromColumn: "on-hold", toColumn: "resolved", allowed: true, label: "Resolve" },
|
|
43226
|
+
{ fromColumn: "on-hold", toColumn: "closed", allowed: true, label: "Close" },
|
|
43227
|
+
{ fromColumn: "resolved", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43228
|
+
{ fromColumn: "resolved", toColumn: "replied", allowed: true, label: "Reply" },
|
|
43229
|
+
{ fromColumn: "resolved", toColumn: "closed", allowed: true, label: "Close" },
|
|
43230
|
+
{ fromColumn: "closed", toColumn: "open", allowed: true, label: "Reopen" },
|
|
43231
|
+
{ fromColumn: "closed", toColumn: "replied", allowed: true, label: "Reply" }
|
|
43232
|
+
];
|
|
43233
|
+
function columnIdForIssueStatus(status) {
|
|
43234
|
+
return COLUMN_BY_STATUS3.get(String(status ?? "Open")) ?? "open";
|
|
43235
|
+
}
|
|
43236
|
+
function priorityTone2(priority) {
|
|
43237
|
+
if (priority === "Urgent") return "error";
|
|
43238
|
+
if (priority === "High") return "warning";
|
|
43239
|
+
return "neutral";
|
|
43240
|
+
}
|
|
43241
|
+
function buildIssueCard(row) {
|
|
43242
|
+
const status = String(row.status ?? "Open");
|
|
43243
|
+
const columnId = columnIdForIssueStatus(status);
|
|
43244
|
+
const priority = typeof row.priority === "string" ? row.priority : void 0;
|
|
43245
|
+
const subtitle = typeof row.customer === "string" && row.customer.length > 0 ? row.customer : typeof row.raised_by === "string" && row.raised_by.length > 0 ? row.raised_by : void 0;
|
|
43246
|
+
return {
|
|
43247
|
+
id: String(row.name ?? ""),
|
|
43248
|
+
title: String(row.subject ?? row.name ?? "Untitled issue"),
|
|
43249
|
+
subtitle,
|
|
43250
|
+
columnId,
|
|
43251
|
+
accent: ISSUE_COLUMNS.find((column) => column.id === columnId)?.color,
|
|
43252
|
+
badges: priority ? [{ label: priority, tone: priorityTone2(priority) }] : [],
|
|
43253
|
+
metrics: typeof row.raised_by === "string" && row.raised_by.length > 0 ? [{ label: "Raised By", value: row.raised_by }] : []
|
|
43254
|
+
};
|
|
43255
|
+
}
|
|
43256
|
+
var issueKanbanAdapter = {
|
|
43257
|
+
doctype: "Issue",
|
|
43258
|
+
getColumns() {
|
|
43259
|
+
return ISSUE_COLUMNS.map((column) => ({
|
|
43260
|
+
id: column.id,
|
|
43261
|
+
label: column.label,
|
|
43262
|
+
color: column.color,
|
|
43263
|
+
count: 0
|
|
43264
|
+
}));
|
|
43265
|
+
},
|
|
43266
|
+
getAllowedTransitions() {
|
|
43267
|
+
return ISSUE_ALLOWED_TRANSITIONS;
|
|
43268
|
+
},
|
|
43269
|
+
getListFields() {
|
|
43270
|
+
return ISSUE_LIST_FIELDS;
|
|
43271
|
+
},
|
|
43272
|
+
buildListFilters(input) {
|
|
43273
|
+
const filters = [];
|
|
43274
|
+
if (typeof input.status === "string" && input.status.length > 0) {
|
|
43275
|
+
filters.push(["status", "=", input.status]);
|
|
43276
|
+
}
|
|
43277
|
+
if (typeof input.priority === "string" && input.priority.length > 0) {
|
|
43278
|
+
filters.push(["priority", "=", input.priority]);
|
|
43279
|
+
}
|
|
43280
|
+
if (typeof input.customer === "string" && input.customer.length > 0) {
|
|
43281
|
+
filters.push(["customer", "=", input.customer]);
|
|
43282
|
+
}
|
|
43283
|
+
if (typeof input.raised_by === "string" && input.raised_by.length > 0) {
|
|
43284
|
+
filters.push(["raised_by", "=", input.raised_by]);
|
|
43285
|
+
}
|
|
43286
|
+
return filters;
|
|
43287
|
+
},
|
|
43288
|
+
buildCards(rows) {
|
|
43289
|
+
return rows.map(buildIssueCard);
|
|
43290
|
+
},
|
|
43291
|
+
validateTransition(move) {
|
|
43292
|
+
const match2 = ISSUE_ALLOWED_TRANSITIONS.find(
|
|
43293
|
+
(transition) => transition.fromColumn === move.fromColumn && transition.toColumn === move.toColumn && transition.allowed
|
|
43294
|
+
);
|
|
43295
|
+
if (!match2) {
|
|
43296
|
+
return { allowed: false, reason: "Issue transition is not allowed" };
|
|
43297
|
+
}
|
|
43298
|
+
return { allowed: true };
|
|
43299
|
+
},
|
|
43300
|
+
async executeMove(move, ctx) {
|
|
43301
|
+
const currentIssue = await ctx.client.get("Issue", move.cardId);
|
|
43302
|
+
const serverColumn = columnIdForIssueStatus(currentIssue.status);
|
|
43303
|
+
if (serverColumn !== move.fromColumn) {
|
|
43304
|
+
return {
|
|
43305
|
+
ok: false,
|
|
43306
|
+
cardId: move.cardId,
|
|
43307
|
+
fromColumn: serverColumn,
|
|
43308
|
+
toColumn: move.toColumn,
|
|
43309
|
+
errorMessage: `Issue moved on the server from ${move.fromColumn} to ${serverColumn}. Refresh the board and try again.`
|
|
43310
|
+
};
|
|
43311
|
+
}
|
|
43312
|
+
const validation = this.validateTransition(move);
|
|
43313
|
+
if (!validation.allowed) {
|
|
43314
|
+
return {
|
|
43315
|
+
ok: false,
|
|
43316
|
+
cardId: move.cardId,
|
|
43317
|
+
fromColumn: move.fromColumn,
|
|
43318
|
+
toColumn: move.toColumn,
|
|
43319
|
+
errorMessage: validation.reason
|
|
43320
|
+
};
|
|
43321
|
+
}
|
|
43322
|
+
const status = STATUS_BY_COLUMN3.get(move.toColumn);
|
|
43323
|
+
if (!status) {
|
|
43324
|
+
return {
|
|
43325
|
+
ok: false,
|
|
43326
|
+
cardId: move.cardId,
|
|
43327
|
+
fromColumn: move.fromColumn,
|
|
43328
|
+
toColumn: move.toColumn,
|
|
43329
|
+
errorMessage: "Unknown Issue column"
|
|
43330
|
+
};
|
|
43331
|
+
}
|
|
43332
|
+
const serverIssue = await ctx.client.update("Issue", move.cardId, { status });
|
|
43333
|
+
return {
|
|
43334
|
+
ok: true,
|
|
43335
|
+
cardId: move.cardId,
|
|
43336
|
+
fromColumn: serverColumn,
|
|
43337
|
+
toColumn: move.toColumn,
|
|
43338
|
+
serverCard: buildIssueCard(serverIssue)
|
|
43339
|
+
};
|
|
43340
|
+
}
|
|
43341
|
+
};
|
|
43342
|
+
|
|
43343
|
+
// src/tools/kanban.ts
|
|
43344
|
+
var KANBAN_UI = { ui: { resourceUri: "ui://mcp-erpnext/kanban-viewer" } };
|
|
43345
|
+
var ADAPTERS = {
|
|
43346
|
+
task: taskKanbanAdapter,
|
|
43347
|
+
opportunity: opportunityKanbanAdapter,
|
|
43348
|
+
issue: issueKanbanAdapter
|
|
43349
|
+
};
|
|
43350
|
+
function getAdapter(doctype) {
|
|
43351
|
+
const definition = getKanbanBoardDefinition(doctype);
|
|
43352
|
+
if (!definition) {
|
|
43353
|
+
throw new Error(`[erpnext_kanban] Unsupported kanban doctype: ${doctype}`);
|
|
43354
|
+
}
|
|
43355
|
+
const adapter = ADAPTERS[definition.adapterKey];
|
|
43356
|
+
if (!adapter) {
|
|
43357
|
+
throw new Error(`[erpnext_kanban] No adapter registered for ${doctype}`);
|
|
43358
|
+
}
|
|
43359
|
+
return { definition, adapter };
|
|
43360
|
+
}
|
|
43361
|
+
function withColumnCounts(columns, cards) {
|
|
43362
|
+
const counts = /* @__PURE__ */ new Map();
|
|
43363
|
+
for (const card of cards) {
|
|
43364
|
+
counts.set(card.columnId, (counts.get(card.columnId) ?? 0) + 1);
|
|
43365
|
+
}
|
|
43366
|
+
return columns.map((column) => ({
|
|
43367
|
+
...column,
|
|
43368
|
+
count: counts.get(column.id) ?? 0
|
|
43369
|
+
}));
|
|
43370
|
+
}
|
|
43371
|
+
var kanbanTools = [
|
|
43372
|
+
{
|
|
43373
|
+
name: "erpnext_kanban_get_board",
|
|
43374
|
+
category: "kanban",
|
|
43375
|
+
_meta: KANBAN_UI,
|
|
43376
|
+
description: "Get a normalized kanban board for a supported ERPNext DocType. Supports Task, Opportunity, and Issue, with pagination and MCP App metadata.",
|
|
42242
43377
|
inputSchema: {
|
|
42243
43378
|
type: "object",
|
|
42244
43379
|
properties: {
|
|
42245
|
-
|
|
42246
|
-
|
|
42247
|
-
|
|
43380
|
+
doctype: {
|
|
43381
|
+
type: "string",
|
|
43382
|
+
description: "Kanban-enabled ERPNext DocType",
|
|
43383
|
+
enum: ["Task", "Opportunity", "Issue"]
|
|
43384
|
+
},
|
|
43385
|
+
limit: { type: "number", description: "Page size (default 50)" },
|
|
43386
|
+
offset: { type: "number", description: "Pagination offset (default 0)" },
|
|
43387
|
+
project: { type: "string", description: "Optional Task project filter" },
|
|
43388
|
+
priority: {
|
|
43389
|
+
type: "string",
|
|
43390
|
+
description: "Optional Task priority filter",
|
|
43391
|
+
enum: ["Low", "Medium", "High", "Urgent"]
|
|
43392
|
+
},
|
|
43393
|
+
status: {
|
|
43394
|
+
type: "string",
|
|
43395
|
+
description: "Optional Opportunity status filter",
|
|
43396
|
+
enum: ["Open", "Replied", "Quotation", "Converted", "Closed", "Lost"]
|
|
43397
|
+
},
|
|
43398
|
+
opportunity_owner: {
|
|
43399
|
+
type: "string",
|
|
43400
|
+
description: "Optional Opportunity owner filter"
|
|
43401
|
+
},
|
|
43402
|
+
party_name: {
|
|
43403
|
+
type: "string",
|
|
43404
|
+
description: "Optional Opportunity party filter"
|
|
43405
|
+
},
|
|
43406
|
+
customer: {
|
|
43407
|
+
type: "string",
|
|
43408
|
+
description: "Optional Issue customer filter"
|
|
43409
|
+
},
|
|
43410
|
+
raised_by: {
|
|
43411
|
+
type: "string",
|
|
43412
|
+
description: "Optional Issue reporter email filter"
|
|
43413
|
+
}
|
|
43414
|
+
},
|
|
43415
|
+
required: ["doctype"]
|
|
42248
43416
|
},
|
|
42249
43417
|
handler: async (input, ctx) => {
|
|
42250
|
-
const
|
|
42251
|
-
const
|
|
42252
|
-
|
|
42253
|
-
|
|
42254
|
-
|
|
42255
|
-
|
|
42256
|
-
|
|
42257
|
-
|
|
42258
|
-
|
|
42259
|
-
"supplier_name",
|
|
42260
|
-
"status",
|
|
42261
|
-
"grand_total",
|
|
42262
|
-
"transaction_date",
|
|
42263
|
-
"schedule_date"
|
|
42264
|
-
],
|
|
42265
|
-
filters,
|
|
42266
|
-
limit,
|
|
43418
|
+
const doctype = String(input.doctype ?? "");
|
|
43419
|
+
const { definition, adapter } = getAdapter(doctype);
|
|
43420
|
+
const limit = Math.max(1, Number(input.limit ?? 50));
|
|
43421
|
+
const offset = Math.max(0, Number(input.offset ?? 0));
|
|
43422
|
+
const rows = await ctx.client.list(doctype, {
|
|
43423
|
+
fields: adapter.getListFields(),
|
|
43424
|
+
filters: adapter.buildListFilters(input),
|
|
43425
|
+
limit: limit + 1,
|
|
43426
|
+
limit_start: offset,
|
|
42267
43427
|
order_by: "modified desc"
|
|
42268
43428
|
});
|
|
42269
|
-
const
|
|
42270
|
-
|
|
42271
|
-
|
|
42272
|
-
|
|
42273
|
-
|
|
42274
|
-
|
|
42275
|
-
|
|
43429
|
+
const hasMore = rows.length > limit;
|
|
43430
|
+
const visibleRows = rows.slice(0, limit);
|
|
43431
|
+
const cards = adapter.buildCards(visibleRows);
|
|
43432
|
+
const board = {
|
|
43433
|
+
boardId: `${doctype.toLowerCase()}-board`,
|
|
43434
|
+
title: definition.title,
|
|
43435
|
+
doctype,
|
|
43436
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
43437
|
+
moveToolName: definition.moveToolName,
|
|
43438
|
+
refreshArguments: { ...input, doctype, limit, offset },
|
|
43439
|
+
columns: withColumnCounts(adapter.getColumns(), cards),
|
|
43440
|
+
cards,
|
|
43441
|
+
allowedTransitions: adapter.getAllowedTransitions(),
|
|
43442
|
+
capabilities: { canMoveCards: true },
|
|
43443
|
+
pagination: {
|
|
43444
|
+
limit,
|
|
43445
|
+
offset,
|
|
43446
|
+
loadedCount: offset + visibleRows.length,
|
|
43447
|
+
hasMore
|
|
43448
|
+
}
|
|
42276
43449
|
};
|
|
42277
|
-
const grouped = {};
|
|
42278
|
-
for (const order of orders) {
|
|
42279
|
-
const status = order.status ?? "Draft";
|
|
42280
|
-
if (!grouped[status]) grouped[status] = [];
|
|
42281
|
-
grouped[status].push(order);
|
|
42282
|
-
}
|
|
42283
|
-
const columns = Object.entries(STATUS_MAP).filter(([status]) => grouped[status]?.length > 0).map(([status, { label, color }]) => {
|
|
42284
|
-
const statusOrders = grouped[status] ?? [];
|
|
42285
|
-
return {
|
|
42286
|
-
status,
|
|
42287
|
-
label,
|
|
42288
|
-
color,
|
|
42289
|
-
count: statusOrders.length,
|
|
42290
|
-
total: statusOrders.reduce((sum, o) => sum + (Number(o.grand_total) || 0), 0),
|
|
42291
|
-
orders: statusOrders.map((o) => ({
|
|
42292
|
-
name: o.name,
|
|
42293
|
-
customer: o.supplier_name ?? o.supplier,
|
|
42294
|
-
amount: Number(o.grand_total) || 0,
|
|
42295
|
-
date: o.transaction_date,
|
|
42296
|
-
delivery_date: o.schedule_date
|
|
42297
|
-
}))
|
|
42298
|
-
};
|
|
42299
|
-
});
|
|
42300
43450
|
return {
|
|
42301
|
-
|
|
42302
|
-
|
|
42303
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
42304
|
-
columns,
|
|
42305
|
-
_meta: PIPELINE_UI
|
|
43451
|
+
...board,
|
|
43452
|
+
_meta: KANBAN_UI
|
|
42306
43453
|
};
|
|
42307
43454
|
}
|
|
43455
|
+
},
|
|
43456
|
+
{
|
|
43457
|
+
name: "erpnext_kanban_move_card",
|
|
43458
|
+
category: "kanban",
|
|
43459
|
+
description: "Move a kanban card for a supported ERPNext DocType. Returns structured success or business error details for MCP App reconciliation.",
|
|
43460
|
+
inputSchema: {
|
|
43461
|
+
type: "object",
|
|
43462
|
+
properties: {
|
|
43463
|
+
doctype: {
|
|
43464
|
+
type: "string",
|
|
43465
|
+
description: "Kanban-enabled ERPNext DocType",
|
|
43466
|
+
enum: ["Task", "Opportunity", "Issue"]
|
|
43467
|
+
},
|
|
43468
|
+
card_id: { type: "string", description: "Card/document identifier" },
|
|
43469
|
+
from_column: { type: "string", description: "Source column identifier" },
|
|
43470
|
+
to_column: { type: "string", description: "Destination column identifier" }
|
|
43471
|
+
},
|
|
43472
|
+
required: ["doctype", "card_id", "from_column", "to_column"]
|
|
43473
|
+
},
|
|
43474
|
+
handler: async (input, ctx) => {
|
|
43475
|
+
const doctype = String(input.doctype ?? "");
|
|
43476
|
+
const { adapter } = getAdapter(doctype);
|
|
43477
|
+
return await adapter.executeMove({
|
|
43478
|
+
doctype,
|
|
43479
|
+
cardId: String(input.card_id ?? ""),
|
|
43480
|
+
fromColumn: String(input.from_column ?? ""),
|
|
43481
|
+
toColumn: String(input.to_column ?? "")
|
|
43482
|
+
}, ctx);
|
|
43483
|
+
}
|
|
42308
43484
|
}
|
|
42309
43485
|
];
|
|
42310
43486
|
|
|
@@ -42322,7 +43498,8 @@ var toolsByCategory = {
|
|
|
42322
43498
|
assets: assetsTools,
|
|
42323
43499
|
operations: operationsTools,
|
|
42324
43500
|
setup: setupTools,
|
|
42325
|
-
analytics: analyticsTools
|
|
43501
|
+
analytics: analyticsTools,
|
|
43502
|
+
kanban: kanbanTools
|
|
42326
43503
|
};
|
|
42327
43504
|
var allTools = [
|
|
42328
43505
|
...salesTools,
|
|
@@ -42337,7 +43514,8 @@ var allTools = [
|
|
|
42337
43514
|
...assetsTools,
|
|
42338
43515
|
...operationsTools,
|
|
42339
43516
|
...setupTools,
|
|
42340
|
-
...analyticsTools
|
|
43517
|
+
...analyticsTools,
|
|
43518
|
+
...kanbanTools
|
|
42341
43519
|
];
|
|
42342
43520
|
function getToolsByCategory(category) {
|
|
42343
43521
|
return toolsByCategory[category] ?? [];
|
|
@@ -42584,6 +43762,34 @@ function getFrappeClient() {
|
|
|
42584
43762
|
return _client;
|
|
42585
43763
|
}
|
|
42586
43764
|
|
|
43765
|
+
// src/tools/ui-refresh.ts
|
|
43766
|
+
function isRecord(value) {
|
|
43767
|
+
return typeof value === "object" && value !== null;
|
|
43768
|
+
}
|
|
43769
|
+
function hasUiResource(result) {
|
|
43770
|
+
const meta3 = result._meta;
|
|
43771
|
+
if (!isRecord(meta3)) return false;
|
|
43772
|
+
const ui = meta3.ui;
|
|
43773
|
+
if (!isRecord(ui)) return false;
|
|
43774
|
+
return typeof ui.resourceUri === "string" && ui.resourceUri.length > 0;
|
|
43775
|
+
}
|
|
43776
|
+
function withUiRefreshRequest(result, toolName, args) {
|
|
43777
|
+
if (!isRecord(result) || !hasUiResource(result)) {
|
|
43778
|
+
return result;
|
|
43779
|
+
}
|
|
43780
|
+
const refreshable = result;
|
|
43781
|
+
if (refreshable.refreshRequest) {
|
|
43782
|
+
return result;
|
|
43783
|
+
}
|
|
43784
|
+
return {
|
|
43785
|
+
...refreshable,
|
|
43786
|
+
refreshRequest: {
|
|
43787
|
+
toolName,
|
|
43788
|
+
arguments: { ...args }
|
|
43789
|
+
}
|
|
43790
|
+
};
|
|
43791
|
+
}
|
|
43792
|
+
|
|
42587
43793
|
// src/client.ts
|
|
42588
43794
|
var ErpNextToolsClient = class {
|
|
42589
43795
|
tools;
|
|
@@ -42617,9 +43823,10 @@ var ErpNextToolsClient = class {
|
|
|
42617
43823
|
buildHandlersMap() {
|
|
42618
43824
|
const handlers = /* @__PURE__ */ new Map();
|
|
42619
43825
|
for (const tool of this.tools) {
|
|
42620
|
-
handlers.set(tool.name, (args) => {
|
|
43826
|
+
handlers.set(tool.name, async (args) => {
|
|
42621
43827
|
const client = getFrappeClient();
|
|
42622
|
-
|
|
43828
|
+
const result = await tool.handler(args, { client });
|
|
43829
|
+
return withUiRefreshRequest(result, tool.name, args);
|
|
42623
43830
|
});
|
|
42624
43831
|
}
|
|
42625
43832
|
return handlers;
|
|
@@ -42633,7 +43840,8 @@ var ErpNextToolsClient = class {
|
|
|
42633
43840
|
);
|
|
42634
43841
|
}
|
|
42635
43842
|
const client = getFrappeClient();
|
|
42636
|
-
|
|
43843
|
+
const result = await tool.handler(args, { client });
|
|
43844
|
+
return withUiRefreshRequest(result, tool.name, args);
|
|
42637
43845
|
}
|
|
42638
43846
|
/** Get tool count */
|
|
42639
43847
|
get count() {
|
|
@@ -42642,17 +43850,43 @@ var ErpNextToolsClient = class {
|
|
|
42642
43850
|
};
|
|
42643
43851
|
var defaultClient = new ErpNextToolsClient();
|
|
42644
43852
|
|
|
42645
|
-
//
|
|
42646
|
-
var DEFAULT_HTTP_PORT = 3012;
|
|
43853
|
+
// src/ui/viewers.ts
|
|
42647
43854
|
var UI_VIEWERS = [
|
|
42648
43855
|
"invoice-viewer",
|
|
42649
43856
|
"stock-viewer",
|
|
42650
43857
|
"doclist-viewer",
|
|
42651
|
-
"order-pipeline-viewer",
|
|
42652
43858
|
"chart-viewer",
|
|
42653
43859
|
"kpi-viewer",
|
|
42654
|
-
"funnel-viewer"
|
|
43860
|
+
"funnel-viewer",
|
|
43861
|
+
"kanban-viewer"
|
|
42655
43862
|
];
|
|
43863
|
+
|
|
43864
|
+
// src/ui/viewer-resource-paths.ts
|
|
43865
|
+
function fileUrlToPath(url2) {
|
|
43866
|
+
const decodedPath = decodeURIComponent(url2.pathname);
|
|
43867
|
+
if (/^\/[A-Za-z]:\//.test(decodedPath)) {
|
|
43868
|
+
return decodedPath.slice(1);
|
|
43869
|
+
}
|
|
43870
|
+
if (url2.host.length > 0) {
|
|
43871
|
+
return `//${url2.host}${decodedPath}`;
|
|
43872
|
+
}
|
|
43873
|
+
return decodedPath;
|
|
43874
|
+
}
|
|
43875
|
+
function resolveViewerDistPath(moduleUrl, viewerName, exists) {
|
|
43876
|
+
const candidates = [
|
|
43877
|
+
fileUrlToPath(new URL(`./src/ui/dist/${viewerName}/index.html`, moduleUrl)),
|
|
43878
|
+
fileUrlToPath(new URL(`./ui-dist/${viewerName}/index.html`, moduleUrl))
|
|
43879
|
+
];
|
|
43880
|
+
for (const candidate of candidates) {
|
|
43881
|
+
if (exists(candidate)) {
|
|
43882
|
+
return candidate;
|
|
43883
|
+
}
|
|
43884
|
+
}
|
|
43885
|
+
return null;
|
|
43886
|
+
}
|
|
43887
|
+
|
|
43888
|
+
// server.ts
|
|
43889
|
+
var DEFAULT_HTTP_PORT = 3012;
|
|
42656
43890
|
async function main() {
|
|
42657
43891
|
const args = getArgs();
|
|
42658
43892
|
const categoriesArg = args.find((arg) => arg.startsWith("--categories="));
|
|
@@ -42667,7 +43901,7 @@ async function main() {
|
|
|
42667
43901
|
);
|
|
42668
43902
|
const server = new ConcurrentMCPServer({
|
|
42669
43903
|
name: "mcp-erpnext",
|
|
42670
|
-
version: "0.1.
|
|
43904
|
+
version: "0.1.9",
|
|
42671
43905
|
maxConcurrent: 10,
|
|
42672
43906
|
backpressureStrategy: "queue",
|
|
42673
43907
|
validateSchema: true,
|
|
@@ -42677,13 +43911,10 @@ async function main() {
|
|
|
42677
43911
|
const handlers = toolsClient.buildHandlersMap();
|
|
42678
43912
|
server.registerTools(mcpTools, handlers);
|
|
42679
43913
|
for (const viewerName of UI_VIEWERS) {
|
|
42680
|
-
const distPath =
|
|
42681
|
-
`./src/ui/dist/${viewerName}/index.html`,
|
|
42682
|
-
import.meta.url
|
|
42683
|
-
).pathname;
|
|
43914
|
+
const distPath = resolveViewerDistPath(import.meta.url, viewerName, statSync);
|
|
42684
43915
|
const resourceUri = `ui://mcp-erpnext/${viewerName}`;
|
|
42685
43916
|
const humanName = viewerName.split("-").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
|
|
42686
|
-
if (
|
|
43917
|
+
if (distPath) {
|
|
42687
43918
|
server.registerResource(
|
|
42688
43919
|
{
|
|
42689
43920
|
uri: resourceUri,
|
|
@@ -42699,7 +43930,7 @@ async function main() {
|
|
|
42699
43930
|
console.error(`[mcp-erpnext] Registered UI resource: ${resourceUri}`);
|
|
42700
43931
|
} else {
|
|
42701
43932
|
console.error(
|
|
42702
|
-
`[mcp-erpnext] Warning: UI not built for ${resourceUri}. Run 'cd lib/erpnext/src/ui && node build-all.mjs' first.`
|
|
43933
|
+
`[mcp-erpnext] Warning: UI not built for ${resourceUri}. Run 'cd lib/erpnext/src/ui && node build-all.mjs' first or package ui-dist with the npm bundle.`
|
|
42703
43934
|
);
|
|
42704
43935
|
}
|
|
42705
43936
|
}
|