From 5bfe95a2290aed4ab6ad96d6e64cc34250ceab6f Mon Sep 17 00:00:00 2001 From: Sandros94 Date: Fri, 31 May 2024 18:20:04 +0200 Subject: [PATCH] refactor: standardize parameters names --- src/runtime/composables/surreal-db.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/runtime/composables/surreal-db.ts b/src/runtime/composables/surreal-db.ts index 4fd81e3..ae688c5 100644 --- a/src/runtime/composables/surreal-db.ts +++ b/src/runtime/composables/surreal-db.ts @@ -30,9 +30,9 @@ export function useSurrealDB(overrides?: Overrides) { // create [ thing, data ] async function $create( thing: MROGParam, - opts?: Overrides & { data?: MROGParam }, + options?: Overrides & { data?: MROGParam }, ) { - const { data, ...ovr } = opts || {} + const { data, ...ovr } = options || {} return $surrealRPC({ method: 'create', params: [toValue(thing), toValue(data)] }, ovr) } async function create( @@ -57,9 +57,9 @@ export function useSurrealDB(overrides?: Overrides) { // insert [ thing, data ] async function $insert( thing: MROGParam, - opts?: Overrides & { data?: MROGParam }, + options?: Overrides & { data?: MROGParam }, ) { - const { data, ...ovr } = opts || {} + const { data, ...ovr } = options || {} return $surrealRPC({ method: 'insert', params: [toValue(thing), toValue(data)] }, ovr) } async function insert( @@ -84,16 +84,16 @@ export function useSurrealDB(overrides?: Overrides) { // merge [ thing, data ] async function $merge( thing: MROGParam, - opts: Overrides & { data: MROGParam }, + options: Overrides & { data: MROGParam }, ) { - const { data, ...ovr } = opts || {} + const { data, ...ovr } = options return $surrealRPC({ method: 'merge', params: [toValue(thing), toValue(data)] }, ovr) } async function merge( thing: MROGParam, options: SurrealRpcOptions & { data: MROGParam }, ): Promise | null, FetchError | null>> { - const { data, immediate, key, watch, ...opts } = options || {} + const { data, immediate, key, watch, ...opts } = options const params = computed['params']>(() => ([toValue(thing), toValue(data)])) const _key = key ?? 'Sur_' + hash(['surreal', 'merge', toValue(params)]) @@ -134,9 +134,9 @@ export function useSurrealDB(overrides?: Overrides) { // query [ sql, vars ] async function $query( sql: MROGParam, - opts?: Overrides & { vars?: MROGParam }, + options?: Overrides & { vars?: MROGParam }, ) { - const { vars, ...ovr } = opts || {} + const { vars, ...ovr } = options || {} return $surrealRPC({ method: 'query', params: [toValue(sql), toValue(vars)] }, ovr) } async function query( @@ -158,9 +158,9 @@ export function useSurrealDB(overrides?: Overrides) { // remove [ thing ] (`delete` is a js reserved name) async function $remove( thing: MROGParam, - ovr?: Overrides, + overrides?: Overrides, ) { - return $surrealRPC({ method: 'delete', params: [toValue(thing)] }, ovr) + return $surrealRPC({ method: 'delete', params: [toValue(thing)] }, overrides) } async function remove( thing: MROGParam, @@ -182,9 +182,9 @@ export function useSurrealDB(overrides?: Overrides) { // select [ thing ] async function $select( thing: MROGParam, - ovr?: Overrides, + overrides?: Overrides, ) { - return $surrealRPC({ method: 'select', params: [toValue(thing)] }, ovr) + return $surrealRPC({ method: 'select', params: [toValue(thing)] }, overrides) } async function select( thing: MROGParam,