Giter VIP home page Giter VIP logo

nuxt-surrealdb's Introduction

Sandros94 Nuxter profile

My name is Sandro Circi, formally a photographer, insanely curious and passioned optimizer.

Both my passion and work splits up evenly in Media Creation and Software Development. With a particular focus on technical reproduction for the first, while Nuxt for the latter.

My EDC

Softwares I use everyday

What I'm still learning

Softwares I need to know better

Other Favourites

UnJS · Directus · SurrealDB

github contribution grid snake animation

repositories · websiteWIP · mastodon · X · sponsor

nuxt-surrealdb's People

Contributors

sandros94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

danielroe

nuxt-surrealdb's Issues

Nuxt DevTools integration

Integrate DevTools to incorporate incoming and outgoing data and requests, ability to send custom queries; also potentially embedding Surrealist or atleast a fraction of Surrealists features i.e. view tables, data etc.

auth tokens are always used regardless of db preset

I realized this issue when I was writing a reply for #13 and it applies to both client and server side.

Lets say a user has been authenticated to the database preset A, while the next request points to database preset B. This request could error out because SurrealDB will forcefully try to use the token since I passed it regardless of the database preset in use.

Potential solutions:

  • Store the auth database preset with the token inside the cookie and only pass to the request if the presets match (this both requires a breaking change and store the db preset in plain sight)
  • only use the token if the db preset matches the default auth preset (but then how do I handle if the db preset has been overwritten in the useSurrealAuth params?).
  • Any suggestions?

Roadmap

Roadmap

  • custom fetch plugin and useFetch composable.
  • Database presets
  • support official SurrealDB Rest integration.
    Discarded in favor of RPC. Can still be manually used via $surrealFetch and useSurrealFetch.
  • support official SurrealDB RPC integration.
  • server side surrealFetch and surrealRPC utils
  • catch Surreal errors
  • built-in auth composable.
  • custom websocket composable.
  • unwrap RPC responses by default
  • doublecheck types
  • docs
  • study Concise Binary Object Representation (waiting for reply on undio#18)
  • vitests

Experiment with SurrealDB 2.0 alpha

  • headers prefix
  • new auth

`query` and `sql` return types

The query and sql functions should return proper types instead of any.

This could go against the unwrapResponse if set to false, should I deprecate the possibility to unwrap it?

websocket `onConnected` firing late sometimes

onConnected(ws) {
ws.send(JSON.stringify({
id: idCounter.value++,
method: 'use',
params: [_database.value.NS, _database.value.DB],
}))
if (userAuth.value && options?.auth !== false && _database.value === databases[authDatabase as keyof typeof databases]) {
ws.send(JSON.stringify({
id: idCounter.value++,
method: 'authenticate',
params: [userAuth.value],
}))
}
else if (options?.auth) {
ws.send(JSON.stringify({
id: idCounter.value++,
method: 'authenticate',
params: [toValue(options.auth)],
}))
}
_onConnected?.(ws)
},

Currently, like in the example below, it can happen that the use message within onConnected is sent after the live message, although it should be the other way around. It suggests a racing condition not being respected with the useBuffer.

const { data, live } = useSurrealWS({ database: 'nasa' })
live('eva_missions')

In the following screenshot the request with id 1 is the configuration message (method: 'use'), while the request with id 0 is the live('products'). For no reason, at random, they switch order like this.
image

feat: handle `token: true` inside overrides

Currently the token override only accepts a string, undefined or false. I should also implement true and object.

Cases:

  • token === undefined: try auth > current db > default db
  • token === string: use string as token
  • token === true: try current db > default db auth
  • token === false: don't use any tokens
  • token === object: use as basic auth

Normalize the return data of the select & query methods

I think it's a good idea to normalize the return data of the select & query methods or at least to have a flag that we can opt into, from this:

[
	{
		"result": [
			{
				"id": "tests:z4ie6eum4qbh6j9xugzp",
				"name": "title 1",
			},
			{
				"id": "tests:fwr424wum4qbh6j9xug5",
				"name": "title 2",
			},
		],
		"status": "OK",
		"time": "3.7952ms"
	}
]

to this:

[
	{
		"id": "tests:z4ie6eum4qbh6j9xugzp",
		"name": "title 1",
	},
	{
		"id": "tests:fwr424wum4qbh6j9xug5",
		"name": "title 2",
	},
]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.