iom-sdk 0.1.2

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.
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Validation error class for handling Zod validation errors
4
+ */
5
+ export declare class ValidationError extends Error {
6
+ errors: Record<string, string[]>;
7
+ constructor(error: z.ZodError);
8
+ }
9
+ /**
10
+ * Format Zod error into a more readable format
11
+ * @param error - Zod error object
12
+ * @returns Record of field paths to error messages
13
+ */
14
+ export declare function formatZodError(error: z.ZodError): Record<string, string[]>;
15
+ /**
16
+ * Generic validation function for validating data against a Zod schema
17
+ *
18
+ * @param schema - Zod schema to validate against
19
+ * @param data - Data to validate
20
+ * @returns Validated data or throws ValidationError
21
+ */
22
+ export declare function validate<T>(schema: z.ZodType<T>, data: unknown): T;
23
+ /**
24
+ * Safe validation function that doesn't throw errors but returns a result
25
+ *
26
+ * @param schema - Zod schema to validate against
27
+ * @param data - Data to validate
28
+ * @returns Object with success flag and either validated data or validation errors
29
+ */
30
+ export declare function validateSafe<T>(schema: z.ZodType<T>, data: unknown): {
31
+ success: true;
32
+ data: T;
33
+ } | {
34
+ success: false;
35
+ errors: Record<string, string[]>;
36
+ };
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "version": "0.1.2",
3
+ "name": "iom-sdk",
4
+ "author": "MaEconomy Org",
5
+ "description": "TypeScript SDK for Internet of Materials (IoM) - A client library for interacting with UUProtocol-based building/material management systems",
6
+ "keywords": [
7
+ "iom",
8
+ "iob",
9
+ "internet-of-buildings",
10
+ "internet-of-materials",
11
+ "uuprotocol",
12
+ "building-management",
13
+ "material-management",
14
+ "typescript",
15
+ "sdk"
16
+ ],
17
+ "homepage": "https://github.com/maeconomy-org/iom-sdk#readme",
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/maeconomy-org/iom-sdk.git"
21
+ },
22
+ "bugs": {
23
+ "url": "https://github.com/maeconomy-org/iom-sdk/issues"
24
+ },
25
+ "license": "MIT",
26
+ "type": "module",
27
+ "main": "dist/index.js",
28
+ "module": "dist/index.esm.js",
29
+ "types": "dist/index.d.ts",
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "scripts": {
34
+ "build": "rollup -c",
35
+ "dev": "rollup -c -w",
36
+ "lint": "eslint . --ext .ts",
37
+ "lint:fix": "eslint . --ext .ts --fix",
38
+ "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\"",
39
+ "format:check": "prettier --check \"src/**/*.ts\" \"tests/**/*.ts\"",
40
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
41
+ "test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
42
+ "prepublishOnly": "npm run lint && npm run test && npm run build",
43
+ "version": "npm run build",
44
+ "release:patch": "npm version patch",
45
+ "release:minor": "npm version minor",
46
+ "release:major": "npm version major"
47
+ },
48
+ "dependencies": {
49
+ "axios": "^1.6.0",
50
+ "isomorphic-unfetch": "^4.0.2",
51
+ "zod": "^3.24.2"
52
+ },
53
+ "devDependencies": {
54
+ "@babel/core": "^7.23.2",
55
+ "@babel/preset-env": "^7.23.2",
56
+ "@babel/preset-typescript": "^7.23.2",
57
+ "@rollup/plugin-commonjs": "^25.0.7",
58
+ "@rollup/plugin-json": "^6.0.1",
59
+ "@rollup/plugin-node-resolve": "^15.2.3",
60
+ "@rollup/plugin-typescript": "^11.1.5",
61
+ "@types/jest": "^29.5.6",
62
+ "@types/node": "^20.8.9",
63
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
64
+ "@typescript-eslint/parser": "^6.21.0",
65
+ "eslint": "^8.57.1",
66
+ "eslint-config-prettier": "^10.1.2",
67
+ "eslint-plugin-prettier": "^5.2.6",
68
+ "jest": "^29.7.0",
69
+ "prettier": "^3.5.3",
70
+ "rollup": "^4.1.4",
71
+ "rollup-plugin-alias": "^2.2.0",
72
+ "rollup-plugin-dts": "^6.1.0",
73
+ "rollup-plugin-peer-deps-external": "^2.2.4",
74
+ "rollup-plugin-terser": "^7.0.2",
75
+ "ts-jest": "^29.1.1",
76
+ "tslib": "^2.6.2",
77
+ "typescript": "^5.2.2"
78
+ },
79
+ "peerDependencies": {
80
+ "axios": "^1.6.0"
81
+ }
82
+ }