@microverse.ts/runtime-zod 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/application/contracts/BridgeContractSchema.d.ts +6 -0
- package/dist/application/contracts/BridgeContractSchema.d.ts.map +1 -0
- package/dist/application/ports/ContractValidatorPort.d.ts +5 -0
- package/dist/application/ports/ContractValidatorPort.d.ts.map +1 -0
- package/dist/domain/contracts/ContractRef.d.ts +5 -0
- package/dist/domain/contracts/ContractRef.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/composition/placeholder.d.ts +5 -0
- package/dist/infrastructure/composition/placeholder.d.ts.map +1 -0
- package/dist/infrastructure/validation/ZodContractValidator.d.ts +8 -0
- package/dist/infrastructure/validation/ZodContractValidator.d.ts.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 QADRAX
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BridgeContractSchema.d.ts","sourceRoot":"","sources":["../../../src/application/contracts/BridgeContractSchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,MAAM,oBAAoB,CAAC,CAAC,IAAI;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContractValidatorPort.d.ts","sourceRoot":"","sources":["../../../src/application/ports/ContractValidatorPort.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;CAChH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContractRef.d.ts","sourceRoot":"","sources":["../../../src/domain/contracts/ContractRef.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { ContractRef } from './domain/contracts/ContractRef';
|
|
2
|
+
export type { BridgeContractSchema } from './application/contracts/BridgeContractSchema';
|
|
3
|
+
export { validateWithZodSchema, ZodContractValidator, } from './infrastructure/validation/ZodContractValidator';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,YAAY,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,kDAAkD,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { err, ok } from "@microverse.ts/shared";
|
|
2
|
+
//#region src/infrastructure/validation/ZodContractValidator.ts
|
|
3
|
+
var ZodContractValidator = class {
|
|
4
|
+
validate = (payload, validate) => {
|
|
5
|
+
return validate(payload);
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
function validateWithZodSchema(schema, payload) {
|
|
9
|
+
const parsed = schema.safeParse(payload);
|
|
10
|
+
return parsed.success ? ok(parsed.data) : err(parsed.error.message);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ZodContractValidator, validateWithZodSchema };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/infrastructure/validation/ZodContractValidator.ts"],"sourcesContent":["import { err, ok, type Result } from '@microverse.ts/shared';\nimport type { z } from 'zod';\n\nimport type { ContractValidatorPort } from '../../application/ports/ContractValidatorPort';\n\nexport class ZodContractValidator implements ContractValidatorPort {\n readonly validate = <T>(\n payload: unknown,\n validate: (value: unknown) => Result<T, string>,\n ): Result<T, string> => {\n return validate(payload);\n };\n}\n\nexport function validateWithZodSchema<T>(schema: z.ZodType<T>, payload: unknown): Result<T, string> {\n const parsed = schema.safeParse(payload);\n return parsed.success ? ok(parsed.data) : err(parsed.error.message);\n}\n"],"mappings":";;AAKA,IAAa,uBAAb,MAAmE;CACjE,YACE,SACA,aACsB;EACtB,OAAO,SAAS,OAAO;CACzB;AACF;AAEA,SAAgB,sBAAyB,QAAsB,SAAqC;CAClG,MAAM,SAAS,OAAO,UAAU,OAAO;CACvC,OAAO,OAAO,UAAU,GAAG,OAAO,IAAI,IAAI,IAAI,OAAO,MAAM,OAAO;AACpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"placeholder.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/composition/placeholder.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,gCAAgC,OAAO,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Result } from '@microverse.ts/shared';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { ContractValidatorPort } from '../../application/ports/ContractValidatorPort';
|
|
4
|
+
export declare class ZodContractValidator implements ContractValidatorPort {
|
|
5
|
+
readonly validate: <T>(payload: unknown, validate: (value: unknown) => Result<T, string>) => Result<T, string>;
|
|
6
|
+
}
|
|
7
|
+
export declare function validateWithZodSchema<T>(schema: z.ZodType<T>, payload: unknown): Result<T, string>;
|
|
8
|
+
//# sourceMappingURL=ZodContractValidator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZodContractValidator.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/ZodContractValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAC;AAE3F,qBAAa,oBAAqB,YAAW,qBAAqB;IAChE,QAAQ,CAAC,QAAQ,GAAI,CAAC,EACpB,SAAS,OAAO,EAChB,UAAU,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,KAC9C,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAElB;CACH;AAED,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAGlG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@microverse.ts/runtime-zod",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/QADRAX/Microverse.ts.git",
|
|
10
|
+
"directory": "packages/runtime-zod"
|
|
11
|
+
},
|
|
12
|
+
"bugs": "https://github.com/QADRAX/Microverse.ts/issues",
|
|
13
|
+
"homepage": "https://github.com/QADRAX/Microverse.ts/tree/main/packages/runtime-zod",
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public",
|
|
16
|
+
"provenance": true
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"import": "./dist/index.js"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@microverse.ts/runtime-bridge": "0.1.0",
|
|
29
|
+
"@microverse.ts/shared": "0.1.0"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"zod": "^3.24.0"
|
|
33
|
+
},
|
|
34
|
+
"peerDependenciesMeta": {
|
|
35
|
+
"zod": {
|
|
36
|
+
"optional": true
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"typescript": "^5.8.3",
|
|
41
|
+
"vite": "^8.0.0",
|
|
42
|
+
"vite-plugin-dts": "^4.5.4",
|
|
43
|
+
"vitest": "^3.1.4",
|
|
44
|
+
"zod": "^3.24.4"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "vite build",
|
|
48
|
+
"lint": "eslint .",
|
|
49
|
+
"test": "vitest run",
|
|
50
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
51
|
+
}
|
|
52
|
+
}
|