Skip to content

Releases: lilnasy/gratelets

@emotion-extract/[email protected]

24 Mar 17:48
85e2d27
Compare
Choose a tag to compare

Patch Changes

  • #146 159b4a9 Thanks @lilnasy! - Fixes a packaging mistake that prevented the library from being used.

[email protected]

14 Feb 13:36
df07e0a
Compare
Choose a tag to compare

Patch Changes

  • 5dc5f8c Thanks @lilnasy! - Fixes a bug that resulted in a compilation error in dev mode.

[email protected]

31 Jan 15:25
e9de129
Compare
Choose a tag to compare

Patch Changes

  • #136 462bfa9 Thanks @lilnasy! - Removed an unused dependency from the package's dependency list.

  • #136 462bfa9 Thanks @lilnasy! - Fixed an issue where the platform proxy was not available for websocket requests in dev mode.

[email protected]

31 Jan 15:25
e9de129
Compare
Choose a tag to compare

Patch Changes

  • #136 462bfa9 Thanks @lilnasy! - Removed an unused dependency from the package's dependency list.

[email protected]

30 Jan 15:49
55d3425
Compare
Choose a tag to compare

Patch Changes

[email protected]

30 Jan 15:49
55d3425
Compare
Choose a tag to compare

Patch Changes

[email protected]

30 Jan 15:49
55d3425
Compare
Choose a tag to compare

Patch Changes

[email protected]

13 Jan 20:28
aa8b598
Compare
Choose a tag to compare

Minor Changes

  • #132 cf3311b Thanks @lilnasy! - Typed API routes are now reusable throughout your project!

    You can define your main application logic in API routes, and then use it for server-side rendering static HTML by calling it from the frontmatter of your pages.

    ---
    import { api } from "astro-typed-api/client"
    const results = await api.search.GET.fetch({ query: Astro.params.query })
    ---
    {results.map(result => <div>{result.title}</div>)}

    The cookies, headers, locals, and request objects are automatically populated with the current request's values.

[email protected]

13 Jan 18:58
24e65cf
Compare
Choose a tag to compare

Minor Changes

  • #129 dc95fdb Thanks @lilnasy! - Adds support for type-safe custom error handling!

    On the server-side, you now have access to the error() function in the TypedAPIContext.

    // src/api/search.ts
    import { defineApiRoute } from "astro-typed-api/server";
    
    export const GET = defineApiRoute({
      fetch({ query }: { query: string }, { locals, error }) {
        if (locals.loggedInInfo) {
          return ["search result 1", "search result 2"];
        } else {
          return error("login required");
        }
      },
    });

    On the client-side, the error details are available inside the .catch handler.

    import { api, CustomError } from "astro-typed-api/client"
    
    const searchResults =
        await api.search.GET.fetch({ query: "science" })
            .catch(error => {
                if (error instance of CustomError) {
                    // error.reason is inferred from the server-side error() call
                    const reason: "login required" = error.reason
                }
            })
  • #129 dc95fdb Thanks @lilnasy! - Adds support for using devalue for sending complex objects over the network.

    To use devalue instead of JSON, set the serialization option to "devalue" in the astro.config.js file:

    // astro.config.js
    import { defineConfig } from "astro/config";
    import typedApi from "astro-typed-api";
    
    export default defineConfig({
      integrations: [typedApi({ serialization: "devalue" })],
    });

[email protected]

08 Jan 05:52
56163fb
Compare
Choose a tag to compare

Patch Changes

  • #125 ce0b7b6 Thanks @spacedawwwg! - Fixes an issue introduced in v2.0.2 where the types for the "astro:import" would not be added to the project.