Skip to content

Releases: defer-run/defer.client

v1.13.0

11 Oct 13:22
c64782b
Compare
Choose a tag to compare

Minor Changes

  • #102 5613d53 Thanks @charlypoly! - Add assignOptions() helper

    assignOptions is helpful to change the behavior of a given Background Function
    by combining multiple options such as delay, metadata or discardAfter:

    import { assignOptions, delay } from "@defer/client";
    import handleStripeWebhookFn from "./defer/handleStripeWebhook.js";
    
    // ...
    
    const handleStripeWebhook = assignOptions(handleStripeWebhookFn, {
      discardAfter: '12h'
      // process webhooks in the right order
      delay: event.created + 60 * 10,
      // add metadata for the the Defer Console
      metadata: {
        livemode: event.livemode,
        type: event.type,
        apiVersion: event.api_version,
      },
    });
    
    handleStripeWebhook(event.id)
      .then((executionID) => {
        response.sendStatus(
          200,
          "application/json",
          JSON.stringify({ executionID })
        );
      })
      .catch((err) => {
        response.sendStatus(400);
      });
    
    // ...

v1.12.1

05 Oct 12:44
28f6716
Compare
Choose a tag to compare

Minor Changes

Patch Changes

  • #100 4e367da Thanks @estubmo! - Bun support: Use crypto rather than URL/Blob API for generating random UUID

v1.11.0

19 Sep 17:22
9063b0e
Compare
Choose a tag to compare

Minor Changes

v1.10.0

31 Aug 15:06
8daf919
Compare
Choose a tag to compare

Minor Changes

v1.9.0

18 Aug 15:59
4912172
Compare
Choose a tag to compare

Minor Changes

Patch Changes

v1.8.1

20 Jul 15:37
20c285a
Compare
Choose a tag to compare

Patch Changes

v1.8.0

14 Jul 15:30
cb4e3e1
Compare
Choose a tag to compare

Minor Changes

  • #80 27a1d46 Thanks @gearnode! - Remove running state

  • #80 27a1d46 Thanks @gearnode! - Add cancel execution:

    import { cancelExecution } from "@defer/client";
    
    // ...
    
    const { id } = await cancelExecution(executionId);
    
    // ...

v1.7.2

12 Jul 09:41
60125d0
Compare
Choose a tag to compare

Patch Changes

v1.7.1

11 Jul 09:07
5375be0
Compare
Choose a tag to compare

Patch Changes

v1.7.0

11 Jul 08:46
d4c002a
Compare
Choose a tag to compare

Minor Changes

  • #66 b9973d5 Thanks @charlypoly! - Introducing @defer/client/next integration

    This release introduces two new helpers that makes Defer deeply integrated with NextJS:

    • asNextRoute(): used in combination of useDeferRoute() to trigger background functions from Client-side Components
    • useDeferRoute(): trigger and wait for the result of a background functions from Client-side Components

    Next API Routes

    import { asNextRoute } from "@defer/client/next";
    import createThumbnails from "../../defer/createThumbnails";
    
    const { GetHandler, PostHandler } = asNextRoute(createThumbnails);
    
    export const GET = GetHandler;
    export const POST = PostHandler;

    React client-side component

    import { useDeferRoute } from "@defer/client/next";
    import createThumbnails from "../../defer/createThumbnails";
    
    export function MyComp() {
      const { request, loading, result } = useDeferRoute(createThumbnails);
      return (
        <div>
          <span>Loading: {loading ? "Yes" : "No"}</span>
          <span>Result: {result ? JSON.stringify(result) : "--"}</span>
          <button onClick={() => request("")}>Call</button>
        </div>
      );
    }