Skip to content

Releases: janglad/safe-fn

safe-fn-react@0.2.0

19 Sep 19:25
a9918c4
Compare
Choose a tag to compare

Minor Changes

Patch Changes

  • Updated dependencies [9fbfa68]
    • safe-fn@0.3.0

safe-fn@0.2.1

18 Sep 16:00
381efa7
Compare
Choose a tag to compare

Patch Changes

  • 172faf3: Temporary fix for #15. By default errors are now not passed along but logged.

  • 382bb1a: ## Changes

    • Type unparsedInput as never when there is no input

    Fixes

    • Fix bug when typing merged unparsed inputs where one is unknown
    • Fix bug when typing merged parsed input when one schema is not defined
    • Prettify user facing types where needed (and missing before)
    • Fix bug in Generator typing when no error is yielded
    • Fix bug where transformed errors from action() were not correctly typed
  • 3194b4a: Add callbacks (onError, onStart, onComplete, onSuccess)

  • 2bcb820: - Fix bad inference when not yielding an error in an async generator safeHandler

  • c8f8132: - Add InferActionErrError and InferActionOkData types

    • Add InferAsyncOkData and InferAsyncErrError types
    • Rename some types for clarity
    • Improve type docs
  • f55152a: Fix errors not being typed when coming from parent
    Fix parse errors not being typed correct when parent has them

  • cf9893e: IDK a lot lol. Nobody reads this anyway.

safe-fn-react@0.1.3

18 Sep 16:00
381efa7
Compare
Choose a tag to compare

Patch Changes

  • ef41088: Return ResultAsync instead of Promise from hook
  • cf9893e: IDK a lot lol. Nobody reads this anyway.
  • Updated dependencies [172faf3]
  • Updated dependencies [382bb1a]
  • Updated dependencies [3194b4a]
  • Updated dependencies [2bcb820]
  • Updated dependencies [c8f8132]
  • Updated dependencies [f55152a]
  • Updated dependencies [cf9893e]
    • safe-fn@0.2.1

safe-fn@0.2.0

03 Sep 19:14
ff9bd3e
Compare
Choose a tag to compare

Minor Changes

  • 9b6b0d0: Implements safeHandler, a function that takes in an async generator similar to Neverthrow's own safeTry enabling an ergonomic way to deal with return early upon error.

safe-fn@0.1.3

03 Sep 07:58
3455319
Compare
Choose a tag to compare

Patch Changes

  • 7b2cb2b: Fix #7 where UnparsedInput type if not properly merged.

  • 92bb8e5: Features

    • Implement NeverThrow instead of own Result type
    • Add separate typing for running as a server action, in which case Zod errors are stripped from stack traces etc.
    • move Zod to peer dependency
  • 687640d: Clean up internal workings

    • set up Knip
    • Move safe-fn to separate builder and runnable classes
    • clean up types

safe-fn-react@0.1.2

03 Sep 19:14
ff9bd3e
Compare
Choose a tag to compare

Patch Changes

  • Updated dependencies [9b6b0d0]
    • safe-fn@0.2.0

safe-fn-react@0.1.1

03 Sep 07:58
3455319
Compare
Choose a tag to compare

Patch Changes

  • eb4a12e: - Update library to also use neverthrow. Internal types are updated accordingly, returned result is now a Result<T,E>
  • Updated dependencies [7b2cb2b]
  • Updated dependencies [92bb8e5]
  • Updated dependencies [687640d]
    • safe-fn@0.1.3

safe-fn@0.1.2

16 Aug 13:09
82cb49e
Compare
Choose a tag to compare

Patch Changes

  • 3572d25: - Add new types to infer result, ok/err data from action
    • Fix bug in not exporting ok()/err() properly
    • Add createAction() and add AnyCompleteSafeFn to easily use as server action
    • Add types for inferring result and argument for completeSafeFns
    • Fix Result type union by typing data and cause as undefined instead of never
    • Don't catch framework errors (currently only filtering Next redirect() and notFound())

safe-fn-react@0.1.0

16 Aug 13:09
82cb49e
Compare
Choose a tag to compare

Minor Changes

  • 170ba35: Add simple useServerAction hook, handling transitions etc

Patch Changes

  • Updated dependencies [3572d25]
    • safe-fn@0.1.2

safe-fn@0.1.1

11 Aug 14:41
94c56cf
Compare
Choose a tag to compare

Patch Changes

  • 2b72e15: Renames Ok() and Err() to ok() and err() to avoid overlap with types. Exports ok(), err(), Ok, Err, Result to be available to users.