mclimate-payload-helper 1.0.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/.prettierrc ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "printWidth": 120,
3
+ "useTabs": true,
4
+ "tabWidth": 1,
5
+ "semi": false,
6
+ "bracketSpacing": true,
7
+ "arrowParens": "always",
8
+ "singleQuote": true,
9
+ "bracketSameLine": false,
10
+ "endOfLine": "lf"
11
+ }
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # mclimate-payload-helper
@@ -0,0 +1,3 @@
1
+ export { validateUser } from './validation';
2
+ export type { UserType } from './types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateUser = void 0;
4
+ var validation_1 = require("./validation");
5
+ Object.defineProperty(exports, "validateUser", { enumerable: true, get: function () { return validation_1.validateUser; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,2CAA2C;AAAlC,0GAAA,YAAY,OAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB"}
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ export declare const userSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ age: z.ZodNumber;
5
+ }, "strip", z.ZodTypeAny, {
6
+ name: string;
7
+ age: number;
8
+ }, {
9
+ name: string;
10
+ age: number;
11
+ }>;
12
+ export type UserType = z.infer<typeof userSchema>;
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,UAAU;;;;;;;;;EAGrB,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.userSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ exports.userSchema = zod_1.z.object({
6
+ name: zod_1.z.string(),
7
+ age: zod_1.z.number().min(18),
8
+ });
9
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,UAAU,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC;CACvB,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { UserType } from '@/types';
2
+ export declare function validateUser(data: unknown): UserType;
3
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,QAAQ,EAAE,MAAM,SAAS,CAAA;AAE9C,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAEpD"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateUser = validateUser;
4
+ const types_1 = require("@/types");
5
+ function validateUser(data) {
6
+ return types_1.userSchema.parse(data);
7
+ }
8
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":";;AAEA,oCAEC;AAJD,mCAA8C;AAE9C,SAAgB,YAAY,CAAC,IAAa;IACzC,OAAO,kBAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC9B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "mclimate-payload-helper",
3
+ "version": "1.0.0",
4
+ "description": "Mclimate payload helper",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc --build",
9
+ "prepublishOnly": "npm run build"
10
+ },
11
+ "author": "Mclimate",
12
+ "license": "ISC",
13
+ "devDependencies": {
14
+ "@types/node": "^22.5.2",
15
+ "prettier": "^3.3.3",
16
+ "typescript": "^5.5.4"
17
+ },
18
+ "dependencies": {
19
+ "zod": "^3.23.8"
20
+ }
21
+ }
package/src/index.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { validateUser } from './validation'
2
+ export type { UserType } from './types'
@@ -0,0 +1 @@
1
+ export * from './types'
@@ -0,0 +1,8 @@
1
+ import { z } from 'zod'
2
+
3
+ export const userSchema = z.object({
4
+ name: z.string(),
5
+ age: z.number().min(18),
6
+ })
7
+
8
+ export type UserType = z.infer<typeof userSchema>
@@ -0,0 +1,5 @@
1
+ import { userSchema, UserType } from '@/types'
2
+
3
+ export function validateUser(data: unknown): UserType {
4
+ return userSchema.parse(data)
5
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2016",
4
+ "module": "commonjs",
5
+ "moduleResolution": "node",
6
+ "rootDir": "./src",
7
+ "outDir": "./dist",
8
+ "baseUrl": ".",
9
+ "paths": {
10
+ "@/*": ["./src/*"]
11
+ },
12
+ "esModuleInterop": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "strict": true,
15
+ "skipLibCheck": true,
16
+ "declaration": true, // Generates .d.ts files
17
+ "declarationMap": true, // (Optional) Generates sourcemaps for .d.ts files
18
+ "sourceMap": true // (Optional) Generates sourcemaps for JS files
19
+ },
20
+ "include": ["src/**/*.ts"], // Include all .ts files in the src directory
21
+ "exclude": ["node_modules", "dist"] // Exclude node_modules and output directory
22
+ }