UNPKG

acp-sdk

Version:

Agent Communication Protocol SDK

40 lines (35 loc) 1.03 kB
'use strict'; var z = require('zod'); function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n.default = e; return Object.freeze(n); } var z__namespace = /*#__PURE__*/_interopNamespace(z); function createSchemaTypePredicate(schema) { return (data) => { return schema.safeParse(data).success; }; } const nullishObject = (schema) => { const nullishShape = Object.fromEntries( Object.entries(schema.shape).map(([key, schema2]) => [key, schema2.nullish()]) ); return z__namespace.object(nullishShape); }; exports.createSchemaTypePredicate = createSchemaTypePredicate; exports.nullishObject = nullishObject; //# sourceMappingURL=utils.cjs.map //# sourceMappingURL=utils.cjs.map