@vendure/mcp-sdk 3.8.1 → 3.8.2-master-202610240212
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/lib/src/id-schema.d.ts +2 -1
- package/lib/src/id-schema.js +16 -2
- package/lib/src/id-schema.js.map +1 -1
- package/package.json +3 -3
package/lib/src/id-schema.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { z } from 'zod';
|
|
|
2
2
|
/**
|
|
3
3
|
* @description
|
|
4
4
|
* A Zod schema for a Vendure entity ID. It accepts a string or a number, because the
|
|
5
|
-
* project's ID strategy decides which one an ID is.
|
|
5
|
+
* project's ID strategy decides which one an ID is. With an auto-increment ID strategy, a string
|
|
6
|
+
* of digits such as `"9"` becomes the number `9`, because core services expect a number.
|
|
6
7
|
*
|
|
7
8
|
* @example
|
|
8
9
|
* ```ts
|
package/lib/src/id-schema.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MAX_ID_LIST_LENGTH = exports.idSchema = void 0;
|
|
4
|
+
const core_1 = require("@vendure/core");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
/**
|
|
6
7
|
* @description
|
|
7
8
|
* A Zod schema for a Vendure entity ID. It accepts a string or a number, because the
|
|
8
|
-
* project's ID strategy decides which one an ID is.
|
|
9
|
+
* project's ID strategy decides which one an ID is. With an auto-increment ID strategy, a string
|
|
10
|
+
* of digits such as `"9"` becomes the number `9`, because core services expect a number.
|
|
9
11
|
*
|
|
10
12
|
* @example
|
|
11
13
|
* ```ts
|
|
@@ -21,8 +23,20 @@ const zod_1 = require("zod");
|
|
|
21
23
|
* @docsCategory mcp-sdk
|
|
22
24
|
* @since 3.8.0
|
|
23
25
|
*/
|
|
24
|
-
exports.idSchema = zod_1.z
|
|
26
|
+
exports.idSchema = zod_1.z
|
|
27
|
+
.union([zod_1.z.string(), zod_1.z.number()], {
|
|
25
28
|
error: 'must be a Vendure entity id (a string or a number)',
|
|
29
|
+
})
|
|
30
|
+
.overwrite(id => {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
if (typeof id !== 'string' || !/^\d+$/.test(id) || !Number.isSafeInteger(+id)) {
|
|
33
|
+
return id;
|
|
34
|
+
}
|
|
35
|
+
// A Zod schema cannot inject ConfigService, so it reads the active config. getConfig() returns
|
|
36
|
+
// undefined in a test runtime that cannot load the default config.
|
|
37
|
+
const config = (0, core_1.getConfig)();
|
|
38
|
+
const strategy = (_b = (_a = config === null || config === void 0 ? void 0 : config.entityOptions) === null || _a === void 0 ? void 0 : _a.entityIdStrategy) !== null && _b !== void 0 ? _b : config === null || config === void 0 ? void 0 : config.entityIdStrategy;
|
|
39
|
+
return (strategy === null || strategy === void 0 ? void 0 : strategy.primaryKeyType) === 'increment' ? +id : id;
|
|
26
40
|
});
|
|
27
41
|
/**
|
|
28
42
|
* @description
|
package/lib/src/id-schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-schema.js","sourceRoot":"","sources":["../../src/id-schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB
|
|
1
|
+
{"version":3,"file":"id-schema.js","sourceRoot":"","sources":["../../src/id-schema.ts"],"names":[],"mappings":";;;AAAA,wCAA0C;AAC1C,6BAAwB;AAExB;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,QAAQ,GAAG,OAAC;KACpB,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,EAAE;IAC7B,KAAK,EAAE,oDAAoD;CAC9D,CAAC;KACD,SAAS,CAAC,EAAE,CAAC,EAAE;;IACZ,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;QAC5E,OAAO,EAAE,CAAC;IACd,CAAC;IACD,+FAA+F;IAC/F,mEAAmE;IACnE,MAAM,MAAM,GAAG,IAAA,gBAAS,GAAE,CAAC;IAC3B,MAAM,QAAQ,GAAG,MAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,0CAAE,gBAAgB,mCAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,gBAAgB,CAAC;IACrF,OAAO,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,cAAc,MAAK,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEP;;;;;;GAMG;AACU,QAAA,kBAAkB,GAAG,GAAG,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/mcp-sdk",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.2-master-202610240212",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@nestjs/core": "^12.0.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@vendure/common": "3.8.
|
|
36
|
-
"@vendure/core": "3.8.
|
|
35
|
+
"@vendure/common": "^3.8.2-master-202610240212",
|
|
36
|
+
"@vendure/core": "^3.8.2-master-202610240212"
|
|
37
37
|
}
|
|
38
38
|
}
|