{"_id":"@35up/tslib-utils","_rev":"6-8e4402b4d9e2e449a857b407d9ab68e9","name":"@35up/tslib-utils","dist-tags":{"latest":"5.0.0"},"versions":{"2.10.0":{"name":"@35up/tslib-utils","version":"2.10.0","keywords":["javascript","utils"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"UNLICENCED","_id":"@35up/tslib-utils@2.10.0","maintainers":[{"name":"enjoythelive1","email":"enjoythelive1@gmail.com"},{"name":"drafter500","email":"vzemtsov@yahoo.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"35up-npm","email":"npm@35up.com"}],"homepage":"https://github.com/35up/tslib-utils#readme","bugs":{"url":"https://github.com/35up/tslib-utils/issues"},"dist":{"shasum":"8fbcadcfa96665ad0dc2eff82f8719a5438c109a","tarball":"https://registry.npmjs.org/@35up/tslib-utils/-/tslib-utils-2.10.0.tgz","fileCount":8,"integrity":"sha512-yWVBQH9i+bUqa3Auwe7ATHWxVwztkjSxKQ3BofcaHx419VwHco0SnrFPs2OPSnRtp8Ld9cBZwDqKGHQousJTqQ==","signatures":[{"sig":"MEUCIElQ3m+0+Oz+o5pDL88fqt8FF3xcsNsezqLSKAXxjwMBAiEAgOtQ6cChbBZSaN7Zpet5aMGjVe+idjuFqG2/AFhevq8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":74604},"main":"build/tslib-utils.cjs","type":"module","module":"build/tslib-utils.esm.js","gitHead":"dd91a9b5331f98f10d677f6d7407d8cb8a784c78","scripts":{"ci":"run-p lint build test","lint":"eslint --ext .js,.ts .","test":"jest --passWithNoTests","build":"rollup --config","clean":"rm -rf ./build","test:watch":"npm test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm run clean && npm run ci"},"_npmUser":{"name":"drafter500","email":"vzemtsov@yahoo.com"},"repository":{"url":"git+https://github.com/35up/tslib-utils.git","type":"git"},"_npmVersion":"10.2.3","description":"Suite of utils for javascript applications","directories":{},"_nodeVersion":"20.10.0","dependencies":{"tslib":"^2.4.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.19.1","chai":"^4.3.6","jest":"^27.5.1","sinon":"^13.0.2","eslint":"^7.32.0","rollup":"^2.70.2","ts-jest":"^27.1.5","sinon-chai":"^3.7.0","typescript":"^4.8.4","@types/chai":"^4.3.1","@types/jest":"^27.4.1","chai-string":"^1.5.0","npm-run-all":"^4.1.5","@types/sinon":"^10.0.11","@35up/http-client":"^2.1.6","@types/sinon-chai":"^3.2.8","rollup-plugin-dts":"^4.2.1","@types/chai-string":"^1.4.2","@35up/tslib-test-utils":"^2.0.0","@rollup/plugin-typescript":"^8.3.2","@rollup/plugin-node-resolve":"^13.2.1","@35up/eslint-config-35up-base":"^2.0.8"},"peerDependencies":{"zod":"^3.19.1","@35up/http-client":"^2.1.6"},"peerDependenciesMeta":{"zod":{"optional":true},"@35up/http-client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/tslib-utils_2.10.0_1711573439734_0.7393102468002526","host":"s3://npm-registry-packages"}},"4.1.4":{"name":"@35up/tslib-utils","version":"4.1.4","keywords":["javascript","utils"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"UNLICENCED","_id":"@35up/tslib-utils@4.1.4","maintainers":[{"name":"35up-npm","email":"npm@35up.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"drafter500","email":"vzemtsov@yahoo.com"},{"name":"enjoythelive1","email":"enjoythelive1@gmail.com"}],"homepage":"https://github.com/35up/tslib-utils#readme","bugs":{"url":"https://github.com/35up/tslib-utils/issues"},"dist":{"shasum":"cc4fe44560678fd40887c960caca2de0bcda1be4","tarball":"https://registry.npmjs.org/@35up/tslib-utils/-/tslib-utils-4.1.4.tgz","fileCount":8,"integrity":"sha512-cW40WRW1wH491i6uFjTBiCMdlouYjx4ecr4ViwPPBXblYIIobjWB3RFjdHZJYi/VPH9axMvfG0DaWcIanP8JfA==","signatures":[{"sig":"MEUCICIuGsp7JrN05WMFNzSk2ZwWAk1t2GJ8wVs6x4S9tRIZAiEAz0Hgbr0extcnnxDJ7FeWWNEZQ9LWsMXzVtv0p1ox4Ho=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":148907},"main":"build/tslib-utils.cjs","type":"module","module":"build/tslib-utils.esm.js","engines":{"node":">=18"},"gitHead":"83c8e6af005062866dc537861ec1c117e9181761","scripts":{"ci":"run-p lint build test","lint":"eslint --ext .js,.ts .","test":"jest --passWithNoTests","build":"rollup --config","clean":"rm -rf ./build","test:watch":"npm test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm run clean && npm run ci"},"_npmUser":{"name":"drafter500","email":"vzemtsov@yahoo.com"},"repository":{"url":"git+https://github.com/35up/tslib-utils.git","type":"git"},"_npmVersion":"10.9.2","description":"Suite of utils for javascript applications","directories":{},"_nodeVersion":"22.14.0","dependencies":{"tslib":"^2.4.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.19.1","chai":"^4.3.6","jest":"^29.7.0","sinon":"^13.0.2","eslint":"^7.32.0","rollup":"^4.18.0","ts-jest":"^29.1.5","sinon-chai":"^3.7.0","typescript":"^5.5.3","@types/chai":"^4.3.1","@types/jest":"^29.5.12","chai-string":"^1.5.0","npm-run-all":"^4.1.5","@types/sinon":"^10.0.11","@35up/ts-configs":"^1.0.0","@35up/http-client":"^2.2.2","@types/sinon-chai":"^3.2.8","rollup-plugin-dts":"^6.1.1","@types/chai-string":"^1.4.2","@35up/tslib-test-utils":"^2.0.0","@rollup/plugin-typescript":"^11.1.6","@rollup/plugin-node-resolve":"^15.2.3","@35up/eslint-config-35up-base":"^2.0.8"},"peerDependencies":{"zod":"^3.19.1","@35up/http-client":"^2.1.6"},"peerDependenciesMeta":{"zod":{"optional":true},"@35up/http-client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/tslib-utils_4.1.4_1748352263393_0.688226244728926","host":"s3://npm-registry-packages-npm-production"}},"4.1.5":{"name":"@35up/tslib-utils","version":"4.1.5","keywords":["javascript","utils"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"UNLICENCED","_id":"@35up/tslib-utils@4.1.5","maintainers":[{"name":"35up-npm","email":"npm@35up.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"drafter500","email":"vzemtsov@yahoo.com"},{"name":"enjoythelive1","email":"enjoythelive1@gmail.com"}],"homepage":"https://github.com/35up/tslib-utils#readme","bugs":{"url":"https://github.com/35up/tslib-utils/issues"},"dist":{"shasum":"cbcce31cd65517f4c6377a287a1e48eece0c122e","tarball":"https://registry.npmjs.org/@35up/tslib-utils/-/tslib-utils-4.1.5.tgz","fileCount":8,"integrity":"sha512-//PXrtzGGzczKeQzjs610fLsS8103yyStTuvV3x99UPX7Eca79N6cIguObAq9mgMs+kzkT5Xf1b4mrEBroq9og==","signatures":[{"sig":"MEUCIAwMwj3bjAxQfek3QmgWFJcuUiMTg5TYn58QaANTC+d6AiEAkYefYJ+U+G2NtpC4aLkKEj/73z803WKaLvTdZDAPuG0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149281},"main":"build/tslib-utils.cjs","type":"module","module":"build/tslib-utils.esm.js","engines":{"node":">=18"},"gitHead":"243b4485e971848552accac52fed273aed5bb39a","scripts":{"ci":"run-p lint build test","lint":"eslint --ext .js,.ts .","test":"jest --passWithNoTests","build":"rollup --config","clean":"rm -rf ./build","test:watch":"npm test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm run clean && npm run ci"},"_npmUser":{"name":"drafter500","email":"vzemtsov@yahoo.com"},"repository":{"url":"git+https://github.com/35up/tslib-utils.git","type":"git"},"_npmVersion":"10.9.2","description":"Suite of utils for javascript applications","directories":{},"_nodeVersion":"22.14.0","dependencies":{"tslib":"^2.4.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^3.19.1","chai":"^4.3.6","jest":"^29.7.0","sinon":"^13.0.2","eslint":"^7.32.0","rollup":"^4.18.0","ts-jest":"^29.1.5","sinon-chai":"^3.7.0","typescript":"^5.5.3","@types/chai":"^4.3.1","@types/jest":"^29.5.12","chai-string":"^1.5.0","npm-run-all":"^4.1.5","@types/sinon":"^10.0.11","@35up/ts-configs":"^1.0.0","@35up/http-client":"^2.2.2","@types/sinon-chai":"^3.2.8","rollup-plugin-dts":"^6.1.1","@types/chai-string":"^1.4.2","@35up/tslib-test-utils":"^2.0.0","@rollup/plugin-typescript":"^11.1.6","@rollup/plugin-node-resolve":"^15.2.3","@35up/eslint-config-35up-base":"^2.0.8"},"peerDependencies":{"zod":"^3.19.1","@35up/http-client":"^2.1.6"},"peerDependenciesMeta":{"zod":{"optional":true},"@35up/http-client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/tslib-utils_4.1.5_1748426201158_0.5117081735843334","host":"s3://npm-registry-packages-npm-production"}},"5.0.0":{"name":"@35up/tslib-utils","version":"5.0.0","keywords":["javascript","utils"],"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"UNLICENCED","_id":"@35up/tslib-utils@5.0.0","maintainers":[{"name":"35up-npm","email":"npm@35up.com"},{"name":"schrodervictor","email":"schrodervictor@gmail.com"},{"name":"drafter500","email":"vzemtsov@yahoo.com"}],"homepage":"https://github.com/35up/tslib-utils#readme","bugs":{"url":"https://github.com/35up/tslib-utils/issues"},"dist":{"shasum":"dd8d3e8261331c0719100439c7c63ca01f89f079","tarball":"https://registry.npmjs.org/@35up/tslib-utils/-/tslib-utils-5.0.0.tgz","fileCount":8,"integrity":"sha512-0kCdzX8leeGCMA3dVYP5Y9HxqdciAFLi9PLc+OdC8MOpxoKVtgleJT9CGl5dh4CA+NS81KANqUjXuZNdxeFrzQ==","signatures":[{"sig":"MEUCIQC7/q/fj5BqBb/MC3s1P1MsCnY5qkSjeUdhEzIiFfqwOwIgRKdWvxsgMYdDx3w1SCpoIm2z7UzXNPnh1/kLpb3ZERg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139040},"main":"build/tslib-utils.cjs","type":"module","types":"build/tslib-utils.esm.d.ts","module":"build/tslib-utils.esm.js","engines":{"node":">=18"},"gitHead":"f912fc038b90af503342db2b85f37b65e5a31647","scripts":{"ci":"run-p lint build test","lint":"eslint --ext .js,.ts .","test":"jest --passWithNoTests","build":"rollup --config","clean":"rm -rf ./build","test:watch":"npm test -- --watch","test:coverage":"npm test -- --ci --json --coverage --testLocationInResults --outputFile=coverage/report.json","prepublishOnly":"npm run clean && npm run ci"},"_npmUser":{"name":"drafter500","email":"vzemtsov@yahoo.com"},"repository":{"url":"git+https://github.com/35up/tslib-utils.git","type":"git"},"_npmVersion":"11.6.2","description":"Suite of utils for javascript applications","directories":{},"_nodeVersion":"24.11.1","dependencies":{"tslib":"^2.4.0"},"_hasShrinkwrap":false,"devDependencies":{"zod":"^4.3.6","chai":"^4.3.6","jest":"^29.7.0","sinon":"^13.0.2","eslint":"^7.32.0","rollup":"^4.18.0","ts-jest":"^29.1.5","sinon-chai":"^3.7.0","typescript":"^5.5.3","@types/chai":"^4.3.1","@types/jest":"^29.5.12","chai-string":"^1.5.0","npm-run-all":"^4.1.5","@types/sinon":"^10.0.11","@35up/ts-configs":"^1.0.0","@35up/http-client":"^2.2.2","@types/sinon-chai":"^3.2.8","rollup-plugin-dts":"^6.1.1","@types/chai-string":"^1.4.2","@35up/tslib-test-utils":"^2.0.0","@rollup/plugin-typescript":"^11.1.6","@rollup/plugin-node-resolve":"^15.2.3","@35up/eslint-config-35up-base":"^2.0.8"},"peerDependencies":{"zod":"^4.3.6","@35up/http-client":"^2.1.6"},"peerDependenciesMeta":{"zod":{"optional":true},"@35up/http-client":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/tslib-utils_5.0.0_1773414431209_0.03826581371131077","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2024-03-27T21:03:59.671Z","modified":"2026-04-01T20:19:22.202Z","2.10.0":"2024-03-27T21:03:59.924Z","4.1.4":"2025-05-27T13:24:23.576Z","4.1.5":"2025-05-28T09:56:41.363Z","5.0.0":"2026-03-13T15:07:11.422Z"},"bugs":{"url":"https://github.com/35up/tslib-utils/issues"},"author":{"name":"35up GmbH","email":"the.engineers@35up.com"},"license":"UNLICENCED","homepage":"https://github.com/35up/tslib-utils#readme","keywords":["javascript","utils"],"repository":{"url":"git+https://github.com/35up/tslib-utils.git","type":"git"},"description":"Suite of utils for javascript applications","maintainers":[{"email":"npm@35up.com","name":"35up-npm"},{"email":"vzemtsov@yahoo.com","name":"drafter500"}],"readme":"# tslib-utils\n\nSuite of utils for javascript applications\n\n\n## Operation and AsyncOperation\n\n`Operation` and `AsyncOperation` are utility classes that helps to gracefully\nhandle situations when we need to perform some operation and handle its status,\nincluding error. Another of their purposes is to make the handling of errors more\nexplicit and harder to forget. \n\nOperation has 3 variants:\n  * Pending Operations: They have a `pending` status while we get a response.\n  * Successful Operations: They have a `success` status when the request succeeds.\n  * Failed Operations: They have a `fail` status when the request fails.\n\nThere is also the concept of a `ResolvedOperation`, which is an operation that\ncan only be \"Successful\" or \"Failed\".\n\n`Operation` is the base monad, containing the `status`, the `data` in case of\nsuccess and the `error` in case of failure.\n\n`AsyncOperation` is a Promise-like wrapper on top of `Operation`, made to\nsimplify the use of operation in async code, as well as to catch some common \nedge-cases related. In instance of an AsyncOperation is still a `Promise`, that\nresolves into an `ResolvedOperation`, and therefore, to access the data, error or status,\nit needs to be treated as a `Promise`.\n\nHere an example on its intended use:\n\n```tsx\n// service.ts\nimport { AsyncOperation } from '@35up/tslib-utils';\n\nfunction expensiveAsyncQuery(...args): AsyncOperation<QueryResult> {\n  return AsyncOperation.try(async () => {\n    // Do some stuff\n  });\n}\n\n// component.tsx\nimport { Operation } from '@35up/tslib-utils';\nimport { expensiveAsyncQuery } from './service';\nimport { Error } from './utilities';\n\n\nexport function Component({ args }) {\n  const [ queryResult, setQueryResult ] = useState(Operation.makePending());\n\n  useEffect(async () => {\n    setQueryResult(\n      await expensiveAsyncQuery(...args)\n        .mapFailure('Failed to performe expencive operation')\n    );\n  }, [args]);\n  \n  return (\n    <div>\n      ...\n      {Operation.isSuccess(queryResult) && (\n        <div>The result was: {queryResult.data}</div>\n      )}\n      ...\n      {Operation.isFailure(queryResult) && (\n        <Error>{queryResult.error.message}</Error>\n      )}\n    </div>\n  );\n}\n\n```\n\n### Most important features\n#### try [`Operation` and `AsyncOperation`]\n\nWraps a callback in a try catch so that it can be safely executed.\nWhen callback executes without errors, then it will return a \"Successful\nOperation\" with the `data` field containing the returned value of the\nprovided callback (or resolved value in the case of `AsyncOperation`). When the\ncallback generate an exception (or rejection in the case of `AsyncOperation`),\nit will return a \"Failed Operation\" with an `error` field containing the `Error`.\n\n```ts\n  const result = AsyncOperation.try(async () => fetch('/url'));\n  \n  if (Operation.isFailure(result)) {\n    console.log(result.data); // fetched data\n  } else {\n    console.error(result.error);\n  }\n```\n\n##### Utilities [only `AsyncOperation`]\n\nTry offer convenience methods to reduce boilerplate. These are provided as the\nfirst argument of the callback.\n\n```ts\n  AsyncOperation.try(async (utilities) => {\n    // Some complicated logic\n  });\n```\n\n###### unwrapData\n\nIt allows you to access the `data` contained in an `ResolvedOperation`. When the\n`ResolvedOperation` is a \"Failure\", it throws; But that is not an issue, as\n`try` will catch it, and result in a \"Failed Operation\".\n\nWhen provided with a promise of an `ResolvedOperation` or an `AsyncOperation`,\nit will return a promise that resolves in the `data` of the `ResolvedOperation`.\n\n```ts\nAsyncOperation.try(async ({ unwrap }) => {\n  const a = await unwrapData(getA());\n  const b = unwrapData(await getB());\n  \n  return a / b;\n});\n```\n\nvs\n\n```ts\n  AsyncOperation.try(async () => {\n    const a = await getA();\n    const b = await getB();\n  \n    if (Operation.isFailure(a)) {\n       throw a.error;\n    }\n    \n    if (Operation.isFailure(b)) {\n      throw b.error;\n    }\n\n    return a.data / b.data;\n  });\n```\n\n#### wrap [`AsyncOperation`]\n\n`Wrap` creates an `AsyncOperation` from an `Operation` or a promise that\nresolves in an `Operation`. Basically when operation is already finished we can \ncreate an instance from the final result.\n\n```ts\nimport { Operation } from './operation';\nimport { AsyncOperation } from './async-operation';\n\nconst operation = await AsyncOperation.wrap(Operation.makeSuccess(7));\nconsole.log(result.data); // 7\nconsole.log(Operation.isSuccess(result)); // true\n\n// or\n\nconst promise = Promise.resolve(Operation.makeSuccess(7));\nconst asyncOperation = AsyncOperation.wrap(promise);\nconsole.log(result.data); // 7\nconsole.log(Operation.isSuccess(result)); // true\n```\n\n\n#### `aggregate` [`Operation` and `AsyncOperation`]\n\nConverts an array of `Operations` (and `AsyncOperations` in the case of\n`AsyncOperation.wrap`) into a single operation containing an array of all the\nresults. In case of one of them failing, it returns \"Failed Operation\" containing\nthe `Error`. In case that multiple fail, it will return a \"Failed Operation\"\nwith an `AggregateError` containing all the underlying errors. This is \nintended to be used similarly to `Promise.all`  \n\n```ts\n  const results = await AsyncOperation.aggregate([\n    Promise.resolve(Operation.makeSuccess('a')),\n    Promise.resolve(Operation.makeSuccess(1)),\n  ]);\n  \n  console.log(results); // ['a', 1]\n```\n\n\n#### Checking the status\n\nUse static methods of `Operation` class to check the status. `AsyncOperations` \ndon't have status out of them selves, but as they are fancy promises, they \nresolve into an `Operation`.\n\n##### Example of checking the status on an `Operation`\n\n```ts\n  import { Operation } from './operation';\n  \n  const operation = Operation.makePending();\n  \n  console.assert(Operation.isPending(operation) === true);\n  console.assert(Operation.isSuccess(operation) === false);\n  console.assert(Operation.isFailure(operation) === false);\n```\n\n##### Example of checking the status on an `AsyncOperation`\n\n```ts\n  const operation = Operation.makePending();\n  operation = await AsyncOperation.try(async () => fetch('/url'));\n\n  console.assert(Operation.isPending(operation) === false);\n  console.assert(Operation.isSuccess(operation) === true);\n  console.assert(Operation.isFailure(operation) === false);\n```\n\n#### Create Operation with specific status\n\nThere are static methods to create `Operations` and `AsyncOperations` in all its\nvariants.\n\n##### For `Operations`\n```ts\n  const emptySuccess = Operation.makeSuccess('test');\n  const success = Operation.makeSuccess('test');\n  const failure = Operation.makeFailure(new Error('fail'));\n  const panding = Operation.makePending();\n```\n\n##### For `AsyncOperations`\n```ts\n  const emptyAsyncSuccess = AsyncOperation.makeSuccess();\n  const asyncSuccess = AsyncOperation.makeSuccess('test');\n  const asyncFailure = AsyncOperation.makeFailure(new Error('fail'));\n```\n\nNote: there is no `makePending` for `AsyncOperation` because it does not make\nsense to have a promise return a \"Pending Operation\" in the majority of valid \nuse cases. We decided to forbid that in our types, to avoid common bugs.\n\n#### Chaining executions\n\nOften times we need to use the result of async operation in another operation.\nThere is a way to compose operations in a monad-like way. For that you can \ncreate a chain of operations using `mapSuccess` to plug into successful result\nor `mapFailure` to plug to a failed result.\n\n```ts\n  AsyncOperation.try(async () => fetch('/settings'))\n    .mapSuccess((settings) => fetch(`/products?lang=${settings.language}`))\n    .mapSuccess((products) => orders.filter(p => p.isStock))\n    .mapFailure('Failed to get data');\n```\n\nNote: `mapFailure` is not necessary to handle errors. It is just a way to \nspecify a bit more concrete error message in case of failure. The original error\nin this case would be just added as a `cause` of the returned error object.\n\n#### Handling Errors\n\nTo access the data of an `Operation`, we have to first check its `status`. This\nforces us to be more mindful of its error state. This is an example on how we \nwould expect errors being handled:\n\n```ts\n  const result = await someExepensiveAsyncOperation()\n    .mapFailure('Could not perform the expensive operation correctly');\n\n  if (Operation.isFailure(result)) {\n    // do something to recover or bail out\n  } else {\n    // do someting with the data\n  }\n\n  \n```\n\n### wrapHttpAsOperation\n\nMost of the services that deal with backend have the same structure:\n  1. Make fetch to the server \n  2. Validate response against schema\n  3. Handle errors \n\nOn order to reduce the boilerplate there is a util function \n`wrapHttpAsOperation` that does all of the above. You just need to pass a url,\nvalidation schema and parameters. \n\nWithout `wrapHttpAsOperation`:\n\n```ts\n  try {\n    const endpoint = '/price-overrides/';\n    const result: TServerPriceOverrides = schema.parse(\n      await post(endpoint, data),\n      {path: [endpoint]},\n    );\n\n    return makeSuccess(result || null);\n  } catch (e) {\n    return makeFail(e as Error);\n  }\n```\n\nWith `wrapHttpAsOperation`:\n\n```ts\n  const wrapperPost = wrapHttpAsOperation(post);\n  return wrappedPost('/price-overrides/', schema, data);\n```\n","readmeFilename":"README.md"}