npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

lomkit-rest-client

v1.0.7

Published

SDK for easily consuming lomkit/laravel-rest-api endpoints in Nuxt.js applications. Provides a typed, intuitive interface for handling resources.

Readme

🔗 lomkit-rest-client

A Nuxt 3 SDK to easily interact with lomkit/laravel-rest-api endpoints — powered by TypeScript, designed for Nuxt ⚡️

Note: This package is community-built and not officially affiliated with Lomkit. It’s fully open-source and contributions are welcome!


✨ Features

  • 📦 Resource-based client
  • 🔐 Built-in token handling via cookies
  • ⚙️ Configurable base API URL and token cookie name
  • 🌍 Works seamlessly with Nuxt 3 and TypeScript

📦 Installation

npm install lomkit-rest-client

⚙️ Configuration

to use the Lomkit REST client, you need to configure it in your Nuxt 3 application. You can do this by creating a plugin file in your plugins directory.

// plugins/restClient.ts
export default defineNuxtPlugin(() => {
	const lomkitRestClient = useNuxtApp().$lomkitRestClient;
	lomkitRestClient.addApiClient({
		slug: "default",
		url: "https://localhost",
		requestInit: () => {
			const access_token = useCookie("cookie");
			return {
				headers: {
					Authorization: `Bearer ${access_token.value}`,
				},
				credentials: "include",
			};
		},
	});
});

explanation:

  • slug: A unique identifier for the API client.
  • url: The base URL of your Lomkit REST API.
  • requestInit: A function that returns an object containing the request headers and credentials. In this case, it retrieves the access token from a cookie named cookie and includes it in the Authorization header.
  • credentials: Set to include to include cookies in cross-origin requests.

you can add multiple API clients with different configurations by calling addApiClient multiple times with different slug values.

📚 useResource

The useResource composable is the main entry point for interacting with the Lomkit REST API. It allows you to create a resource client that can perform various operations on a specific resource.

The useResource<T>(resourceName, resourceConfig?) composable returns an object with methods to interact with a specific resource via the Lomkit REST API. See the methods section for more details.

const preset = {
	search: {
		includes: [
			{
				relation: "category",
			},
			{
				relation: "stars",
			},
		],
		limit: 12,
	},
};

const productsResource = useResource<IProducts>("products", preset);

//you can also destructure the result to get the methods directly
const { mutate, findOne, search } = useResource<IProducts>("products", preset);

🧩 Methods

🔎 search(request?)

Search for resources based on the request parameters. (See Search for more details.) search also add to the response methods for pagination, nextPage(), previousPage(), goToPage()

const res = await productsResource.search({
    filters: [{
        field: "name",
        name: "Product Name",
    }],
    includes: [
        {
            relation: "category",
        }
    ]
}).catch((err) => console.error("Error during search: " ,err));

//pagination methods
const products = ref(res);
const handleNextPage = () => {
    products.value = await products.nextPage();
};

🔎 findOne(request?)

Returns the first matching resource. (See Search for more details.)

const product = await productsResource.findOne({
    filters: [{
        field: "name",
        name: "Product Name",
    }],
});

🔎 findOneById(id)

Returns a resource by its ID.

const product = await productsResource.findOneById(1);

🧾 details()

Returns the details of a resource. (See Details for more details.)

const details = await productsResource.details();

✏️ mutate(mutations)

Mutate a resource with the provided mutations. (See Mutate for more details.)

const response = await productsResource.mutate([
        {
            operation: "update",
            key: 2,
            relations: {
                star: {
                    operation: "attach",
                    key: 1
                }
            }
        },
]).catch((err) => console.error("Error during mutation: " ,err));

⚙️ actions(actionName, params?)

Execute a specific action on a resource. (See Actions for more details.)

const response = await productsResource.actions("publish", {
  search: {
    filters: [{ field: 'id', value: 1 }]
  }
});

🗑️ remove(ids)

Delete resources by their IDs. (See Delete for more details.)

const response = await productsResource.remove([1, 2]);

Contributions

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.