Compare commits
19 Commits
v1.0.1
...
studio/all
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ff2445969 | |||
| 8bb7665af5 | |||
| 644ccc237d | |||
| 84a2c821e9 | |||
| 386c7dac05 | |||
| 1bec7a703d | |||
| 0b575fa322 | |||
| 4c5a0345a8 | |||
| ea7c7b02d6 | |||
| 9296ae7d78 | |||
| 549b2f30be | |||
| 4bc07425b4 | |||
| b0fb2edc24 | |||
| 9b63877eaa | |||
| ba845931da | |||
| 3d7503e227 | |||
| c570597d06 | |||
| e7c7beb8fd | |||
| 037920620e |
2
.github/workflows/studio.yml
vendored
2
.github/workflows/studio.yml
vendored
@ -58,7 +58,7 @@ jobs:
|
|||||||
cache: ${{ steps.pkgman.outputs.cache }}
|
cache: ${{ steps.pkgman.outputs.cache }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: ${{ steps.pkgman.outputs.package_manager }} install
|
run: ${{ steps.pkgman.outputs.package_manager }} install --no-frozen-lockfile
|
||||||
|
|
||||||
- name: Install @nuxthq/studio
|
- name: Install @nuxthq/studio
|
||||||
run: ${{ steps.pkgman.outputs.package_manager }} add -D @nuxthq/studio
|
run: ${{ steps.pkgman.outputs.package_manager }} add -D @nuxthq/studio
|
||||||
|
|||||||
2
.nuxtrc
Normal file
2
.nuxtrc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# enable TypeScript bundler module resolution - https://www.typescriptlang.org/docs/handbook/modules/reference.html#bundler
|
||||||
|
experimental.typescriptBundlerResolution=true
|
||||||
61
CHANGELOG.md
61
CHANGELOG.md
@ -1,6 +1,67 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
|
||||||
|
## v1.0.3
|
||||||
|
|
||||||
|
[compare changes](https://github.com/arashsheyda/nuxt-mongoose/compare/v1.0.2...v1.0.3)
|
||||||
|
|
||||||
|
### 🩹 Fixes
|
||||||
|
|
||||||
|
- Add schema type ([4bc0742](https://github.com/arashsheyda/nuxt-mongoose/commit/4bc0742))
|
||||||
|
|
||||||
|
### 💅 Refactors
|
||||||
|
|
||||||
|
- Update to DevTools v1 ([1bec7a7](https://github.com/arashsheyda/nuxt-mongoose/commit/1bec7a7))
|
||||||
|
|
||||||
|
### 📖 Documentation
|
||||||
|
|
||||||
|
- Update ui ([9296ae7](https://github.com/arashsheyda/nuxt-mongoose/commit/9296ae7))
|
||||||
|
- Fix playground path ([ea7c7b0](https://github.com/arashsheyda/nuxt-mongoose/commit/ea7c7b0))
|
||||||
|
- Fix install workflow ([4c5a034](https://github.com/arashsheyda/nuxt-mongoose/commit/4c5a034))
|
||||||
|
- Update link ([0b575fa](https://github.com/arashsheyda/nuxt-mongoose/commit/0b575fa))
|
||||||
|
|
||||||
|
### 🏡 Chore
|
||||||
|
|
||||||
|
- Remove comment ([549b2f3](https://github.com/arashsheyda/nuxt-mongoose/commit/549b2f3))
|
||||||
|
|
||||||
|
### ❤️ Contributors
|
||||||
|
|
||||||
|
- Arash
|
||||||
|
|
||||||
|
## v1.0.2
|
||||||
|
|
||||||
|
[compare changes](https://github.com/arashsheyda/nuxt-mongoose/compare/v1.0.1...v1.0.2)
|
||||||
|
|
||||||
|
### 🩹 Fixes
|
||||||
|
|
||||||
|
- Resolve build stuck issue with nitro pre-render enabled ([#26](https://github.com/arashsheyda/nuxt-mongoose/pull/26))
|
||||||
|
|
||||||
|
### 📖 Documentation
|
||||||
|
|
||||||
|
- Default connection ([e7c7beb](https://github.com/arashsheyda/nuxt-mongoose/commit/e7c7beb))
|
||||||
|
|
||||||
|
### 🏡 Chore
|
||||||
|
|
||||||
|
- **release:** V1.0.2 ([ba8459](https://github.com/arashsheyda/nuxt-mongoose/commit/ba8459))
|
||||||
|
- Lint ([3d7503e](https://github.com/arashsheyda/nuxt-mongoose/commit/3d7503e))
|
||||||
|
|
||||||
|
### ❤️ Contributors
|
||||||
|
|
||||||
|
- Arash Sheyda <sheidaeearash1999@gmail.com>
|
||||||
|
- Arash
|
||||||
|
|
||||||
|
## v1.0.1
|
||||||
|
|
||||||
|
### 🏡 Chore
|
||||||
|
|
||||||
|
- **release:** V1.0.0 ([b566196](https://github.com/arashsheyda/nuxt-mongoose/commit/b566196))
|
||||||
|
- **release:** V1.0.1 ([5bf554f](https://github.com/arashsheyda/nuxt-mongoose/commit/5bf554f))
|
||||||
|
- Update dependencies ([0f73464](https://github.com/arashsheyda/nuxt-mongoose/commit/0f73464))
|
||||||
|
|
||||||
|
### ❤️ Contributors
|
||||||
|
|
||||||
|
- Arash Sheyda <sheidaeearash1999@gmail.com>
|
||||||
|
|
||||||
## v1.0.0
|
## v1.0.0
|
||||||
|
|
||||||
[compare changes](https://github.com/arashsheyda/nuxt-mongoose/compare/v0.0.9...v1.0.0)
|
[compare changes](https://github.com/arashsheyda/nuxt-mongoose/compare/v0.0.9...v1.0.0)
|
||||||
|
|||||||
@ -1,11 +1,6 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import './styles/global.css'
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Html>
|
<Html>
|
||||||
<Body h-screen>
|
<Body h-screen>
|
||||||
<Notification />
|
|
||||||
<NuxtLayout>
|
<NuxtLayout>
|
||||||
<NuxtPage />
|
<NuxtPage />
|
||||||
</NuxtLayout>
|
</NuxtLayout>
|
||||||
|
|||||||
@ -249,8 +249,8 @@ const toggleSchema = computed({
|
|||||||
<NTextInput v-else v-model="column.default" n="orange" />
|
<NTextInput v-else v-model="column.default" n="orange" />
|
||||||
</div>
|
</div>
|
||||||
<div flex justify-center gap2>
|
<div flex justify-center gap2>
|
||||||
<NIconButton icon="carbon-add" n="cyan" @click="addField(index)" />
|
<NButton icon="carbon-add" n="cyan" @click="addField(index)" />
|
||||||
<NIconButton icon="carbon-trash-can" n="red" @click="removeField(index)" />
|
<NButton icon="carbon-trash-can" n="red" @click="removeField(index)" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -125,7 +125,7 @@ const copy = useCopy()
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div ref="dbContainer" :class="{ 'h-full': !documents?.length }">
|
<div ref="dbContainer" :class="{ 'h-full': !documents?.length }">
|
||||||
<Navbar v-model:search="search" sticky top-0 px4 py2 backdrop-blur z-10>
|
<NNavbar v-model:search="search" sticky top-0 px4 py2 backdrop-blur z-10>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<NButton icon="carbon:add" n="green" @click="addDocument">
|
<NButton icon="carbon:add" n="green" @click="addDocument">
|
||||||
Add Document
|
Add Document
|
||||||
@ -155,7 +155,7 @@ const copy = useCopy()
|
|||||||
</NSelect>
|
</NSelect>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Navbar>
|
</NNavbar>
|
||||||
<table v-if="documents?.length || selectedDocument" w-full mb10 :class="{ 'editing-mode': editing }">
|
<table v-if="documents?.length || selectedDocument" w-full mb10 :class="{ 'editing-mode': editing }">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@ -180,14 +180,14 @@ const copy = useCopy()
|
|||||||
<td>
|
<td>
|
||||||
<div flex justify-center gap2 class="group">
|
<div flex justify-center gap2 class="group">
|
||||||
<template v-if="editing && selectedDocument._id === document._id">
|
<template v-if="editing && selectedDocument._id === document._id">
|
||||||
<NIconButton title="Save" icon="carbon-save" @click="saveDocument(selectedDocument, false)" />
|
<NButton title="Save" icon="carbon-save" n="blue" @click="saveDocument(selectedDocument, false)" />
|
||||||
<NIconButton title="Cancel" icon="carbon-close" @click="discardEditing" />
|
<NButton title="Cancel" icon="carbon-close" n="red" @click="discardEditing" />
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<NIconButton title="Edit" icon="carbon-edit" @click="editDocument(document)" />
|
<NButton title="Edit" icon="carbon-edit" n="blue" @click="editDocument(document)" />
|
||||||
<NIconButton title="Delete" icon="carbon-trash-can" @click="deleteDocument(document)" />
|
<NButton title="Delete" icon="carbon-trash-can" n="red" @click="deleteDocument(document)" />
|
||||||
<NIconButton title="Duplicate" icon="carbon-document-multiple-02" @click="saveDocument(document)" />
|
<NButton title="Duplicate" icon="carbon-document-multiple-02" n="cyan" @click="saveDocument(document)" />
|
||||||
<NIconButton title="Copy" n="xs" absolute right-4 opacity-0 group-hover="opacity-100" transition-all icon="carbon-copy" @click="copy(JSON.stringify(document))" />
|
<NButton title="Copy" n="xs purple" absolute right-4 opacity-0 group-hover="opacity-100" transition-all icon="carbon-copy" @click="copy(JSON.stringify(document))" />
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -198,8 +198,8 @@ const copy = useCopy()
|
|||||||
<input v-else placeholder="ObjectId(_id)" disabled>
|
<input v-else placeholder="ObjectId(_id)" disabled>
|
||||||
</td>
|
</td>
|
||||||
<td flex="~ justify-center gap2">
|
<td flex="~ justify-center gap2">
|
||||||
<NIconButton title="Save" icon="carbon-save" @click="saveDocument(selectedDocument)" />
|
<NButton title="Save" icon="carbon-save" n="green" @click="saveDocument(selectedDocument)" />
|
||||||
<NIconButton title="Cancel" icon="carbon-close" @click="discardEditing" />
|
<NButton title="Cancel" icon="carbon-close" n="red" @click="discardEditing" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -1,57 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import { ref } from 'vue'
|
|
||||||
import { onClickOutside, useElementSize } from '@vueuse/core'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
modelValue?: boolean
|
|
||||||
navbar?: HTMLElement
|
|
||||||
autoClose?: boolean
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(e: 'close'): void
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const el = ref<HTMLElement>()
|
|
||||||
|
|
||||||
const { height: top } = useElementSize(() => props.navbar, undefined, { box: 'border-box' })
|
|
||||||
|
|
||||||
onClickOutside(el, () => {
|
|
||||||
if (props.modelValue && props.autoClose)
|
|
||||||
emit('close')
|
|
||||||
}, {
|
|
||||||
ignore: ['a', 'button', 'summary', '[role="dialog"]'],
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
inheritAttrs: false,
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Transition
|
|
||||||
enter-active-class="duration-200 ease-in"
|
|
||||||
enter-from-class="transform translate-x-1/1"
|
|
||||||
enter-to-class="opacity-100"
|
|
||||||
leave-active-class="duration-200 ease-out"
|
|
||||||
leave-from-class="opacity-100"
|
|
||||||
leave-to-class="transform translate-x-1/1"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
v-if="modelValue"
|
|
||||||
ref="el"
|
|
||||||
border="l base"
|
|
||||||
flex="~ col gap-1"
|
|
||||||
absolute bottom-0 right-0 z-10 z-20 of-auto text-sm glass-effect
|
|
||||||
:style="{ top: `${top}px` }"
|
|
||||||
v-bind="$attrs"
|
|
||||||
>
|
|
||||||
<NIconButton absolute right-2 top-2 z-20 text-xl icon="carbon-close" @click="$emit('close')" />
|
|
||||||
<div relative h-full w-full of-auto>
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Transition>
|
|
||||||
</template>
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
defineProps({
|
|
||||||
search: {
|
|
||||||
type: String,
|
|
||||||
default: undefined,
|
|
||||||
},
|
|
||||||
noPadding: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
placeholder: {
|
|
||||||
type: String,
|
|
||||||
default: 'Search...',
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
|
||||||
(event: 'update:search', value: string): void
|
|
||||||
}>()
|
|
||||||
|
|
||||||
function update(event: any) {
|
|
||||||
emit('update:search', event.target.value)
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div flex="~ col gap2" border="b base" flex-1 navbar-glass :class="[{ p4: !noPadding }]">
|
|
||||||
<div flex="~ gap4">
|
|
||||||
<slot name="search">
|
|
||||||
<NTextInput
|
|
||||||
:placeholder="placeholder"
|
|
||||||
icon="carbon-search"
|
|
||||||
n="primary" flex-auto
|
|
||||||
:class="{ 'px-5 py-2': !noPadding }"
|
|
||||||
:value="search"
|
|
||||||
@input="update"
|
|
||||||
/>
|
|
||||||
</slot>
|
|
||||||
<slot name="actions" />
|
|
||||||
</div>
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<script setup lang='ts'>
|
|
||||||
const show = ref(false)
|
|
||||||
const icon = ref<string | undefined>()
|
|
||||||
const text = ref<string | undefined>()
|
|
||||||
const classes = ref<string | undefined>()
|
|
||||||
|
|
||||||
provideNotificationFn((data) => {
|
|
||||||
text.value = data.message
|
|
||||||
icon.value = data.icon
|
|
||||||
classes.value = data.classes ?? 'text-green'
|
|
||||||
show.value = true
|
|
||||||
setTimeout(() => {
|
|
||||||
show.value = false
|
|
||||||
}, data.duration ?? 1500)
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div
|
|
||||||
fixed left-0 right-0 top-0 z-999 text-center
|
|
||||||
:class="show ? '' : 'pointer-events-none overflow-hidden'"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
border="~ base"
|
|
||||||
flex="~ inline gap2"
|
|
||||||
m-3 inline-block items-center rounded px-4 py-1 transition-all duration-300 bg-base
|
|
||||||
:style="show ? {} : { transform: 'translateY(-300%)' }"
|
|
||||||
:class="[show ? 'shadow' : 'shadow-none', classes]"
|
|
||||||
>
|
|
||||||
<div v-if="icon" :class="icon" />
|
|
||||||
<div>{{ text }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
<script lang="ts" setup>
|
|
||||||
import { computed, ref } from 'vue'
|
|
||||||
import { Pane, Splitpanes } from 'splitpanes'
|
|
||||||
import 'splitpanes/dist/splitpanes.css'
|
|
||||||
|
|
||||||
const props = defineProps<{
|
|
||||||
storageKey?: string
|
|
||||||
leftSize?: number
|
|
||||||
minSize?: number
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const DEFAULT = 30
|
|
||||||
|
|
||||||
const state = ref()
|
|
||||||
const key = props.storageKey
|
|
||||||
const size = key
|
|
||||||
? computed({
|
|
||||||
get: () => state.value[key] || props.leftSize || DEFAULT,
|
|
||||||
set: (v) => { state.value[key] = v },
|
|
||||||
})
|
|
||||||
: ref(props.leftSize || DEFAULT)
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<Splitpanes h-full of-hidden @resize="size = $event[0].size">
|
|
||||||
<Pane border="r base" h-full class="of-auto!" :size="size" :min-size="$slots.right ? (minSize || 10) : 100">
|
|
||||||
<slot name="left" />
|
|
||||||
</Pane>
|
|
||||||
<Pane v-if="$slots.right" relative h-full class="of-auto!" :min-size="minSize || 10">
|
|
||||||
<slot name="right" />
|
|
||||||
</Pane>
|
|
||||||
</Splitpanes>
|
|
||||||
</template>
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
let _showNotification: typeof showNotification
|
|
||||||
|
|
||||||
export function showNotification(data: {
|
|
||||||
message: string
|
|
||||||
icon?: string
|
|
||||||
classes?: string
|
|
||||||
duration?: number
|
|
||||||
}) {
|
|
||||||
_showNotification?.(data)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function provideNotificationFn(fn: typeof showNotification) {
|
|
||||||
_showNotification = fn
|
|
||||||
}
|
|
||||||
@ -1,14 +1,14 @@
|
|||||||
import { useClipboard } from '@vueuse/core'
|
import { useClipboard } from '@vueuse/core'
|
||||||
import { showNotification } from './dialog'
|
// import { } from '@nuxt/devtools-ui-kit'
|
||||||
|
|
||||||
export function useCopy() {
|
export function useCopy() {
|
||||||
const clipboard = useClipboard()
|
const clipboard = useClipboard()
|
||||||
|
|
||||||
return (text: string) => {
|
return (text: string) => {
|
||||||
clipboard.copy(text)
|
clipboard.copy(text)
|
||||||
showNotification({
|
// devtoolsUiShowNotification({
|
||||||
message: 'Copied to clipboard',
|
// message: 'Copied to clipboard',
|
||||||
icon: 'carbon-copy',
|
// icon: 'carbon-copy',
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,22 +36,22 @@ async function refresh() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<SplitPanel :min-left="13" :max-left="20">
|
<NSplitPane :min-left="13" :max-left="20">
|
||||||
<template #left>
|
<template #left>
|
||||||
<div px4>
|
<div px4>
|
||||||
<Navbar v-model:search="search" :placeholder="`${collections?.length ?? '-'} collection in total`" mt2>
|
<NNavbar v-model:search="search" :placeholder="`${collections?.length ?? '-'} collection in total`" mt2 no-padding>
|
||||||
<div flex items-center gap2>
|
<div flex items-center gap2>
|
||||||
<NIconButton w-full mb1.5 icon="carbon-reset" title="Refresh" @click="refresh" />
|
<NButton n="blue" w-full mb1.5 icon="carbon-reset" title="Refresh" @click="refresh" />
|
||||||
<NIconButton w-full mb1.5 icon="carbon-data-base" title="Default" text-green-5 />
|
<!-- <NButton w-full mb1.5 icon="carbon-data-base" title="Default" n="green" /> -->
|
||||||
<NIconButton id="open-drawer-right" w-full mb1.5 icon="carbon-add" title="Create Collection" @click="drawer = true" />
|
<NButton n="green" w-full mb1.5 icon="carbon-add" title="Create Collection" @click="drawer = true" />
|
||||||
</div>
|
</div>
|
||||||
</Navbar>
|
</NNavbar>
|
||||||
<div grid gird-cols-1 my2 mx1>
|
<div grid gird-cols-1 my2 mx1>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-for="table in filtered"
|
v-for="table in filtered"
|
||||||
:key="table.name"
|
:key="table.name"
|
||||||
:to="{ name: 'index', query: { table: table.name } }"
|
:to="{ name: 'index', query: { table: table.name } }"
|
||||||
flex justify-between p2 my1 hover-bg-green hover-bg-opacity-5 hover-text-green rounded-lg
|
flex items-center justify-between p2 my1 hover-bg-green hover-bg-opacity-5 hover-text-green rounded-lg
|
||||||
:class="{ 'bg-green bg-opacity-5 text-green': selectedCollection === table.name }"
|
:class="{ 'bg-green bg-opacity-5 text-green': selectedCollection === table.name }"
|
||||||
@click="selectedCollection = table.name"
|
@click="selectedCollection = table.name"
|
||||||
>
|
>
|
||||||
@ -59,9 +59,9 @@ async function refresh() {
|
|||||||
<NIcon icon="carbon-db2-database" />
|
<NIcon icon="carbon-db2-database" />
|
||||||
{{ table.name }}
|
{{ table.name }}
|
||||||
</span>
|
</span>
|
||||||
<div flex gap2>
|
<div flex="~ items-center gap-2">
|
||||||
<NIconButton block n="red" icon="carbon-trash-can" @click="dropCollection(table)" />
|
<NButton :border="false" n="red" icon="carbon-trash-can" @click="dropCollection(table)" />
|
||||||
<!-- <NIconButton icon="carbon-overflow-menu-horizontal" /> -->
|
<!-- <NButton :border="false" icon="carbon-overflow-menu-horizontal" /> -->
|
||||||
</div>
|
</div>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
@ -78,8 +78,8 @@ async function refresh() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</SplitPanel>
|
</NSplitPane>
|
||||||
<Drawer v-model="drawer" style="width: calc(80.5%);" auto-close @close="drawer = false">
|
<NDrawer v-model="drawer" style="width: calc(80.5%);" auto-close @close="drawer = false" z-20>
|
||||||
<CreateResource @refresh="refresh" />
|
<CreateResource @refresh="refresh" />
|
||||||
</Drawer>
|
</NDrawer>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
21
client/splitpanes.d.ts
vendored
21
client/splitpanes.d.ts
vendored
@ -1,21 +0,0 @@
|
|||||||
// TODO install @types/splitpanes once updated
|
|
||||||
declare module 'splitpanes' {
|
|
||||||
import { Component } from 'vue'
|
|
||||||
|
|
||||||
export interface SplitpaneProps {
|
|
||||||
horizontal: boolean
|
|
||||||
pushOtherPanes: boolean
|
|
||||||
dblClickSplitter: boolean
|
|
||||||
firstSplitter: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface PaneProps {
|
|
||||||
size: number | string
|
|
||||||
minSize: number | string
|
|
||||||
maxSize: number | string
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Pane = Component<PaneProps>
|
|
||||||
export const Pane: Pane
|
|
||||||
export const Splitpanes: Component<SplitpaneProps>
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
/* Splitpanes */
|
|
||||||
.splitpanes__splitter {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
.splitpanes__splitter:before {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
transition: .2s ease;
|
|
||||||
content: '';
|
|
||||||
transition: opacity 0.4s;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
.splitpanes__splitter:hover:before {
|
|
||||||
background: #8881;
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
.splitpanes--vertical>.splitpanes__splitter {
|
|
||||||
min-width: 0 !important;
|
|
||||||
width: 0 !important;
|
|
||||||
}
|
|
||||||
.splitpanes--horizontal>.splitpanes__splitter {
|
|
||||||
min-height: 0 !important;
|
|
||||||
height: 0 !important;
|
|
||||||
}
|
|
||||||
.splitpanes--vertical>.splitpanes__splitter:before {
|
|
||||||
left: -5px;
|
|
||||||
right: -4px;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
.splitpanes--horizontal>.splitpanes__splitter:before {
|
|
||||||
top: -5px;
|
|
||||||
bottom: -4px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
@ -15,22 +15,16 @@ export default defineAppConfig({
|
|||||||
edit: true,
|
edit: true,
|
||||||
},
|
},
|
||||||
aside: {
|
aside: {
|
||||||
level: 0,
|
level: 1,
|
||||||
collapsed: false,
|
collapsed: false,
|
||||||
exclude: [],
|
exclude: [],
|
||||||
},
|
},
|
||||||
main: {
|
|
||||||
padded: true,
|
|
||||||
fluid: true,
|
|
||||||
},
|
|
||||||
header: {
|
header: {
|
||||||
logo: true,
|
logo: true,
|
||||||
showLinkIcon: true,
|
showLinkIcon: true,
|
||||||
exclude: [],
|
exclude: [],
|
||||||
fluid: true,
|
|
||||||
},
|
},
|
||||||
footer: {
|
footer: {
|
||||||
fluid: true,
|
|
||||||
iconLinks: [
|
iconLinks: [
|
||||||
{
|
{
|
||||||
href: 'https://nuxt.com',
|
href: 'https://nuxt.com',
|
||||||
|
|||||||
295
docs/components/content/Illustration.vue
Normal file
295
docs/components/content/Illustration.vue
Normal file
@ -0,0 +1,295 @@
|
|||||||
|
<template>
|
||||||
|
<svg
|
||||||
|
width="403"
|
||||||
|
height="226"
|
||||||
|
viewBox="0 0 403 226"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<g clip-path="url(#clip0_1180_138)">
|
||||||
|
<g opacity="0.54">
|
||||||
|
<path
|
||||||
|
d="M0 12C0 5.37259 5.37258 0 12 0H391C397.627 0 403 5.37258 403 12V214C403 220.627 397.627 226 391 226H12C5.37259 226 0 220.627 0 214V12Z"
|
||||||
|
fill="url(#paint0_linear_1180_138)"
|
||||||
|
fill-opacity="0.3"
|
||||||
|
/>
|
||||||
|
<path
|
||||||
|
d="M12 0.5H391C397.351 0.5 402.5 5.64873 402.5 12V214C402.5 220.351 397.351 225.5 391 225.5H12C5.64873 225.5 0.5 220.351 0.5 214V12C0.5 5.64873 5.64873 0.5 12 0.5Z"
|
||||||
|
stroke="url(#paint1_linear_1180_138)"
|
||||||
|
stroke-opacity="0.4"
|
||||||
|
/>
|
||||||
|
</g>
|
||||||
|
<path
|
||||||
|
opacity="0.54"
|
||||||
|
d="M49.7811 28H57.5876C57.8356 28 58.0792 27.9354 58.2939 27.8125C58.5086 27.6896 58.6869 27.5128 58.8108 27.3C58.9347 27.0871 58.9999 26.8457 58.9998 26.5999C58.9997 26.3542 58.9343 26.1128 58.8102 25.9001L53.5676 16.9001C53.4437 16.6873 53.2654 16.5105 53.0507 16.3877C52.836 16.2648 52.5925 16.2001 52.3446 16.2001C52.0967 16.2001 51.8532 16.2648 51.6385 16.3877C51.4238 16.5105 51.2455 16.6873 51.1216 16.9001L49.7811 19.2028L47.1602 14.6998C47.0361 14.487 46.8578 14.3104 46.6431 14.1875C46.4283 14.0647 46.1847 14 45.9368 14C45.6889 14 45.4453 14.0647 45.2305 14.1875C45.0158 14.3104 44.8375 14.487 44.7134 14.6998L38.1896 25.9001C38.0655 26.1128 38.0001 26.3542 38 26.5999C37.9999 26.8457 38.0651 27.0871 38.189 27.3C38.3129 27.5128 38.4912 27.6896 38.7059 27.8125C38.9207 27.9354 39.1643 28 39.4122 28H44.3125C46.254 28 47.6859 27.1547 48.6711 25.5057L51.063 21.4001L52.3442 19.2028L56.1893 25.8028H51.063L49.7811 28ZM44.2326 25.8005L40.8128 25.7998L45.9391 17.0004L48.4969 21.4001L46.7843 24.3407C46.13 25.4107 45.3867 25.8005 44.2326 25.8005Z"
|
||||||
|
fill="white"
|
||||||
|
fill-opacity="0.1"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="43.5"
|
||||||
|
y1="75.5"
|
||||||
|
x2="84.5"
|
||||||
|
y2="75.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="43.5"
|
||||||
|
y1="147.5"
|
||||||
|
x2="63.5"
|
||||||
|
y2="147.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="172.5"
|
||||||
|
y1="147.5"
|
||||||
|
x2="192.899"
|
||||||
|
y2="147.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="301.5"
|
||||||
|
y1="147.5"
|
||||||
|
x2="321.5"
|
||||||
|
y2="147.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="143.5"
|
||||||
|
y1="20.5"
|
||||||
|
x2="167.5"
|
||||||
|
y2="20.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="184.5"
|
||||||
|
y1="20.5"
|
||||||
|
x2="208.5"
|
||||||
|
y2="20.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="225.5"
|
||||||
|
y1="20.5"
|
||||||
|
x2="249.5"
|
||||||
|
y2="20.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="43.5"
|
||||||
|
y1="93.5"
|
||||||
|
x2="178.5"
|
||||||
|
y2="93.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="43.5"
|
||||||
|
y1="162.5"
|
||||||
|
x2="115.544"
|
||||||
|
y2="162.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="172.5"
|
||||||
|
y1="162.5"
|
||||||
|
x2="244.5"
|
||||||
|
y2="162.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="301.5"
|
||||||
|
y1="162.5"
|
||||||
|
x2="373.5"
|
||||||
|
y2="162.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="43.5"
|
||||||
|
y1="111.5"
|
||||||
|
x2="178.5"
|
||||||
|
y2="111.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="43.5"
|
||||||
|
y1="177.5"
|
||||||
|
x2="115.5"
|
||||||
|
y2="177.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="172.5"
|
||||||
|
y1="177.5"
|
||||||
|
x2="244.5"
|
||||||
|
y2="177.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<line
|
||||||
|
opacity="0.54"
|
||||||
|
x1="301.5"
|
||||||
|
y1="177.5"
|
||||||
|
x2="373.5"
|
||||||
|
y2="177.5"
|
||||||
|
stroke="white"
|
||||||
|
stroke-opacity="0.1"
|
||||||
|
stroke-width="5"
|
||||||
|
stroke-linecap="round"
|
||||||
|
/>
|
||||||
|
<rect
|
||||||
|
opacity="0.54"
|
||||||
|
x="335.465"
|
||||||
|
y="17.619"
|
||||||
|
width="41.1089"
|
||||||
|
height="11.7454"
|
||||||
|
rx="2.93635"
|
||||||
|
fill="white"
|
||||||
|
fill-opacity="0.1"
|
||||||
|
/>
|
||||||
|
<rect
|
||||||
|
opacity="0.54"
|
||||||
|
x="212"
|
||||||
|
y="70"
|
||||||
|
width="164"
|
||||||
|
height="44"
|
||||||
|
rx="5"
|
||||||
|
fill="url(#paint2_linear_1180_138)"
|
||||||
|
fill-opacity="0.1"
|
||||||
|
/>
|
||||||
|
<!-- Mongo Logo -->
|
||||||
|
<g transform="translate(170, 80) scale(2)">
|
||||||
|
<rect width="32" height="32" rx="7.5" style="fill:#023430" />
|
||||||
|
<path d="M21.4,13.4C20.1,7.6,17.3,6.1,16.6,5a10.1,10.1,0,0,1-.7-1.5,1.6,1.6,0,0,1-.6,1.2,14.1,14.1,0,0,0-4.9,10.5c-.3,6.1,4.5,9.9,5.1,10.3a1.4,1.4,0,0,0,1.4-.2,12.1,12.1,0,0,0,4.5-11.9" style="fill:#10aa50" />
|
||||||
|
<path d="M16.1,22.2a17.8,17.8,0,0,1-.5,3.3s.2,1.5.3,3h.5a30.6,30.6,0,0,1,.5-3.2C16.3,25,16.1,23.6,16.1,22.2Z" style="fill:#b8c4c2" />
|
||||||
|
<path d="M16.9,25.3c-.6-.3-.8-1.7-.8-3.1s.2-4.3.1-6.5,0-10.7-.3-12.1L16.6,5c.7,1.1,3.5,2.6,4.8,8.4A12,12,0,0,1,16.9,25.3Z" style="fill:#12924f" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<filter
|
||||||
|
id="filter0_d_1180_138"
|
||||||
|
x="162.895"
|
||||||
|
y="74.8947"
|
||||||
|
width="76.2105"
|
||||||
|
height="76.2105"
|
||||||
|
filterUnits="userSpaceOnUse"
|
||||||
|
color-interpolation-filters="sRGB"
|
||||||
|
>
|
||||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix" />
|
||||||
|
<feColorMatrix
|
||||||
|
in="SourceAlpha"
|
||||||
|
type="matrix"
|
||||||
|
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
||||||
|
result="hardAlpha"
|
||||||
|
/>
|
||||||
|
<feOffset dy="4" />
|
||||||
|
<feGaussianBlur stdDeviation="2" />
|
||||||
|
<feComposite in2="hardAlpha" operator="out" />
|
||||||
|
<feColorMatrix
|
||||||
|
type="matrix"
|
||||||
|
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.44 0"
|
||||||
|
/>
|
||||||
|
<feBlend
|
||||||
|
mode="normal"
|
||||||
|
in2="BackgroundImageFix"
|
||||||
|
result="effect1_dropShadow_1180_138"
|
||||||
|
/>
|
||||||
|
<feBlend
|
||||||
|
mode="normal"
|
||||||
|
in="SourceGraphic"
|
||||||
|
in2="effect1_dropShadow_1180_138"
|
||||||
|
result="shape"
|
||||||
|
/>
|
||||||
|
</filter>
|
||||||
|
<linearGradient
|
||||||
|
id="paint0_linear_1180_138"
|
||||||
|
x1="201.5"
|
||||||
|
y1="0"
|
||||||
|
x2="201.5"
|
||||||
|
y2="102.822"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
>
|
||||||
|
<stop stop-color="white" />
|
||||||
|
<stop offset="1" stop-color="white" stop-opacity="0" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="paint1_linear_1180_138"
|
||||||
|
x1="201.5"
|
||||||
|
y1="-1.34109e-07"
|
||||||
|
x2="201.527"
|
||||||
|
y2="153.598"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
>
|
||||||
|
<stop stop-color="white" />
|
||||||
|
<stop offset="1" stop-color="white" stop-opacity="0" />
|
||||||
|
</linearGradient>
|
||||||
|
<linearGradient
|
||||||
|
id="paint2_linear_1180_138"
|
||||||
|
x1="294"
|
||||||
|
y1="70"
|
||||||
|
x2="294"
|
||||||
|
y2="114"
|
||||||
|
gradientUnits="userSpaceOnUse"
|
||||||
|
>
|
||||||
|
<stop stop-color="white" />
|
||||||
|
<stop offset="1" stop-color="white" stop-opacity="0" />
|
||||||
|
</linearGradient>
|
||||||
|
<clipPath id="clip0_1180_138">
|
||||||
|
<rect width="403" height="226" fill="white" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
</template>
|
||||||
@ -12,7 +12,7 @@ main:
|
|||||||
---
|
---
|
||||||
cta:
|
cta:
|
||||||
- Get started
|
- Get started
|
||||||
- /getting-started/setup
|
- /docs/getting-started/setup
|
||||||
secondary:
|
secondary:
|
||||||
- Open on GitHub →
|
- Open on GitHub →
|
||||||
- https://github.com/arashsheyda/nuxt-mongoose
|
- https://github.com/arashsheyda/nuxt-mongoose
|
||||||
@ -25,12 +25,54 @@ Nuxt [Mongoose]{style="color: var(--color-primary-500)"}
|
|||||||
A Nuxt module for simplifying the use of [Mongoose](https://mongoosejs.com/) in your project.
|
A Nuxt module for simplifying the use of [Mongoose](https://mongoosejs.com/) in your project.
|
||||||
|
|
||||||
#support
|
#support
|
||||||
::terminal
|
:illustration
|
||||||
---
|
|
||||||
content:
|
|
||||||
- npm i nuxt-mongoose -D
|
|
||||||
---
|
|
||||||
::
|
|
||||||
::
|
::
|
||||||
|
|
||||||
<!-- TODO: features -->
|
::card-grid
|
||||||
|
#title
|
||||||
|
<h1 class="center">Elevate Your <br/> <span class=highlight> Developer Experience</span></h1>
|
||||||
|
|
||||||
|
#root
|
||||||
|
:ellipsis{left=15rem width=40rem top=10rem blur=140px}
|
||||||
|
|
||||||
|
#default
|
||||||
|
::card{icon=tabler:code}
|
||||||
|
#title
|
||||||
|
Nuxt DevTools Support
|
||||||
|
#description
|
||||||
|
Dive into your database with confidence. Benefit from Nuxt Devtools support, allowing you to inspect and debug your DB operations seamlessly.
|
||||||
|
::
|
||||||
|
|
||||||
|
::card{icon=tabler:cloud-bolt}
|
||||||
|
#title
|
||||||
|
Auto Connection
|
||||||
|
#description
|
||||||
|
Forget about manual connection hassles. This module seamlessly handles the connection to your Mongoose database, making setup a breeze.
|
||||||
|
::
|
||||||
|
|
||||||
|
::card{icon=tabler:plug}
|
||||||
|
#title
|
||||||
|
Extendable & hackable
|
||||||
|
#description
|
||||||
|
This module grants you access to the full spectrum of Mongoose functionalities. Leverage the power of Mongoose in your project.
|
||||||
|
::
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.highlight {
|
||||||
|
color: var(--color-primary-500);
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.card svg {
|
||||||
|
height: 3rem!important;
|
||||||
|
width: 3rem!important;
|
||||||
|
}
|
||||||
|
.support {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|||||||
@ -40,7 +40,7 @@ export default defineNuxtConfig({
|
|||||||
## Options
|
## Options
|
||||||
|
|
||||||
You can configure the module by adding a `mongoose` section to your `nuxt.config` file.
|
You can configure the module by adding a `mongoose` section to your `nuxt.config` file.
|
||||||
read more about [Mongoose options](/getting-started/configuration).
|
read more about [Mongoose options](/docs/getting-started/configuration).
|
||||||
|
|
||||||
```ts [nuxt.config]
|
```ts [nuxt.config]
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
@ -54,7 +54,12 @@ This function creates a new Mongoose model with schema. Example usage:
|
|||||||
| `hooks` | [`(schema: Schema<T>) => void`](https://mongoosejs.com/docs/middleware.html) | false | Schema Hooks Function to customize Model |
|
| `hooks` | [`(schema: Schema<T>) => void`](https://mongoosejs.com/docs/middleware.html) | false | Schema Hooks Function to customize Model |
|
||||||
|
|
||||||
|
|
||||||
|
::alert
|
||||||
|
you can access the default connection with importing it from mongoose:
|
||||||
|
::
|
||||||
|
```
|
||||||
|
import { connection } from 'mongoose'
|
||||||
|
```
|
||||||
|
|
||||||
## `defineMongooseConnection`
|
## `defineMongooseConnection`
|
||||||
This function creates a new Mongoose connection.
|
This function creates a new Mongoose connection.
|
||||||
5
docs/content/1.docs/2.api/3.examples.md
Normal file
5
docs/content/1.docs/2.api/3.examples.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Examples
|
||||||
|
|
||||||
|
Here are a few examples:
|
||||||
|
|
||||||
|
- Nuxt Mongoose Minimal: [:icon{name="tabler:brand-github"} Github](https://github.com/arashsheyda/nuxt-mongoose-minimal) [:icon{name="tabler:world"} Website](https://nuxt-mongoose-minimal.vercel.app/)
|
||||||
1
docs/content/1.docs/_dir.yml
Normal file
1
docs/content/1.docs/_dir.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
icon: tabler:file-description
|
||||||
5
docs/content/2.playground/1.index.md
Normal file
5
docs/content/2.playground/1.index.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# Playground
|
||||||
|
|
||||||
|
:ellipsis{right=0px width=75% blur=150px}
|
||||||
|
|
||||||
|
:sandbox{src="https://stackblitz.com/github/arashsheyda/nuxt-mongoose-minimal"}
|
||||||
1
docs/content/2.playground/_dir.yml
Normal file
1
docs/content/2.playground/_dir.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
icon: tabler:play-volleyball
|
||||||
3
docs/content/3.releases/_dir.yml
Normal file
3
docs/content/3.releases/_dir.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
title: Releases
|
||||||
|
icon: tabler:clipboard-text
|
||||||
|
navigation.redirect: https://github.com/arashsheyda/nuxt-mongoose/releases
|
||||||
0
docs/content/3.releases/index.md
Normal file
0
docs/content/3.releases/index.md
Normal file
@ -10,8 +10,8 @@
|
|||||||
"lint": "eslint ."
|
"lint": "eslint ."
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxt-themes/docus": "^1.14.3",
|
"@nuxt-themes/docus": "^1.15.0",
|
||||||
"@nuxthq/studio": "^0.13.4",
|
"@nuxthq/studio": "^1.0.6",
|
||||||
"nuxt": "^3.6.3"
|
"nuxt": "^3.9.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
6847
docs/pnpm-lock.yaml
generated
6847
docs/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
34
package.json
34
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "nuxt-mongoose",
|
"name": "nuxt-mongoose",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "1.0.1",
|
"version": "1.0.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"packageManager": "pnpm@8.7.4",
|
"packageManager": "pnpm@8.7.4",
|
||||||
"description": "Nuxt 3 module for MongoDB with Mongoose",
|
"description": "Nuxt 3 module for MongoDB with Mongoose",
|
||||||
@ -49,28 +49,26 @@
|
|||||||
"lint": "eslint . --fix"
|
"lint": "eslint . --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/devtools-kit": "^0.8.4",
|
"@nuxt/devtools-kit": "1.0.0",
|
||||||
"@nuxt/devtools-ui-kit": "^0.8.4",
|
"@nuxt/devtools-ui-kit": "1.0.0",
|
||||||
"@nuxt/kit": "^3.7.3",
|
"@nuxt/kit": "^3.9.0",
|
||||||
"@vueuse/core": "^10.4.1",
|
"@vueuse/core": "^10.7.1",
|
||||||
"defu": "^6.1.2",
|
"defu": "^6.1.3",
|
||||||
"fs-extra": "^11.1.1",
|
"fs-extra": "^11.2.0",
|
||||||
"mongoose": "^7.5.2",
|
"mongoose": "^7.6.7",
|
||||||
"ofetch": "^1.3.3",
|
"ofetch": "^1.3.3",
|
||||||
"pathe": "^1.1.1",
|
"pathe": "^1.1.1",
|
||||||
"pluralize": "^8.0.0",
|
"pluralize": "^8.0.0",
|
||||||
"sirv": "^2.0.3"
|
"sirv": "^2.0.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^0.43.0",
|
"@antfu/eslint-config": "1.0.0-beta.29",
|
||||||
"@nuxt/module-builder": "^0.5.1",
|
"@nuxt/module-builder": "^0.5.5",
|
||||||
"@types/fs-extra": "^11.0.2",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/pluralize": "^0.0.30",
|
"@types/pluralize": "^0.0.32",
|
||||||
"changelogen": "^0.5.5",
|
"changelogen": "^0.5.5",
|
||||||
"eslint": "8.49.0",
|
"eslint": "8.52.0",
|
||||||
"nuxt": "^3.7.3",
|
"nuxt": "^3.9.0",
|
||||||
"sass": "^1.67.0",
|
"sass": "^1.69.7"
|
||||||
"sass-loader": "^13.3.2",
|
|
||||||
"splitpanes": "^3.1.5"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5570
pnpm-lock.yaml
generated
5570
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,7 @@ import {
|
|||||||
import type { ConnectOptions } from 'mongoose'
|
import type { ConnectOptions } from 'mongoose'
|
||||||
import defu from 'defu'
|
import defu from 'defu'
|
||||||
import { join } from 'pathe'
|
import { join } from 'pathe'
|
||||||
|
import mongoose from 'mongoose'
|
||||||
import { $fetch } from 'ofetch'
|
import { $fetch } from 'ofetch'
|
||||||
import { version } from '../package.json'
|
import { version } from '../package.json'
|
||||||
import { setupDevToolsUI } from './devtools'
|
import { setupDevToolsUI } from './devtools'
|
||||||
@ -18,27 +19,27 @@ export interface ModuleOptions {
|
|||||||
*
|
*
|
||||||
* @default process.env.MONGODB_URI
|
* @default process.env.MONGODB_URI
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
uri: string | undefined
|
uri: string | undefined
|
||||||
/**
|
/**
|
||||||
* Nuxt DevTools
|
* Nuxt DevTools
|
||||||
*
|
*
|
||||||
* @default true
|
* @default true
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
devtools: boolean
|
devtools: boolean
|
||||||
/**
|
/**
|
||||||
* Mongoose Connections
|
* Mongoose Connections
|
||||||
*
|
*
|
||||||
* @default {}
|
* @default {}
|
||||||
*/
|
*/
|
||||||
options?: ConnectOptions
|
options?: ConnectOptions
|
||||||
/**
|
/**
|
||||||
* Models Directory for auto-import
|
* Models Directory for auto-import
|
||||||
*
|
*
|
||||||
* @default 'models'
|
* @default 'models'
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
modelsDir?: string
|
modelsDir?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +55,11 @@ export default defineNuxtModule<ModuleOptions>({
|
|||||||
options: {},
|
options: {},
|
||||||
modelsDir: 'models',
|
modelsDir: 'models',
|
||||||
},
|
},
|
||||||
|
hooks: {
|
||||||
|
close: () => {
|
||||||
|
mongoose.disconnect()
|
||||||
|
},
|
||||||
|
},
|
||||||
async setup(options, nuxt) {
|
async setup(options, nuxt) {
|
||||||
if (nuxt.options.dev) {
|
if (nuxt.options.dev) {
|
||||||
$fetch('https://registry.npmjs.org/nuxt-mongoose/latest').then((release) => {
|
$fetch('https://registry.npmjs.org/nuxt-mongoose/latest').then((release) => {
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import type { ConnectOptions, Model, SchemaDefinition, SchemaOptions } from 'mon
|
|||||||
import { useRuntimeConfig } from '#imports'
|
import { useRuntimeConfig } from '#imports'
|
||||||
|
|
||||||
export async function defineMongooseConnection({ uri, options }: { uri?: string; options?: ConnectOptions } = {}): Promise<void> {
|
export async function defineMongooseConnection({ uri, options }: { uri?: string; options?: ConnectOptions } = {}): Promise<void> {
|
||||||
// TODO: types
|
|
||||||
const config = useRuntimeConfig().mongoose
|
const config = useRuntimeConfig().mongoose
|
||||||
const mongooseUri = uri || config.uri
|
const mongooseUri = uri || config.uri
|
||||||
const mongooseOptions = options || config.options
|
const mongooseOptions = options || config.options
|
||||||
@ -22,11 +21,11 @@ export async function defineMongooseConnection({ uri, options }: { uri?: string;
|
|||||||
export function defineMongooseModel<T>(
|
export function defineMongooseModel<T>(
|
||||||
nameOrOptions: string | {
|
nameOrOptions: string | {
|
||||||
name: string
|
name: string
|
||||||
schema: SchemaDefinition
|
schema: SchemaDefinition<T>
|
||||||
options?: SchemaOptions
|
options?: SchemaOptions
|
||||||
hooks?: (schema: mongoose.Schema<T>) => void
|
hooks?: (schema: mongoose.Schema<T>) => void
|
||||||
},
|
},
|
||||||
schema?: SchemaDefinition,
|
schema?: SchemaDefinition<T>,
|
||||||
options?: SchemaOptions,
|
options?: SchemaOptions,
|
||||||
hooks?: (schema: mongoose.Schema<T>) => void,
|
hooks?: (schema: mongoose.Schema<T>) => void,
|
||||||
): Model<T> {
|
): Model<T> {
|
||||||
|
|||||||
Reference in New Issue
Block a user