update to new sdk
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/nicwands/takerofnotes-plugin-supabase.git"
|
"url": "git+https://git.alt-tuning.co/takerofnotes/takerofnotes-plugin-supabase"
|
||||||
},
|
},
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -70,6 +70,15 @@ export default class SupabaseAdapter extends BaseNotesAdapter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async testConnection() {
|
||||||
|
const { error } = await this.supabase.storage
|
||||||
|
.from(this.bucket)
|
||||||
|
.list('', { limit: 1 })
|
||||||
|
|
||||||
|
if (error) return false
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
async _write(note) {
|
async _write(note) {
|
||||||
const fileName = `${note.id}.json`
|
const fileName = `${note.id}.json`
|
||||||
const fileContent = JSON.stringify(note, null, 2)
|
const fileContent = JSON.stringify(note, null, 2)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export default definePlugin({
|
|||||||
name: 'Supabase',
|
name: 'Supabase',
|
||||||
description: 'Store notes using Supabase storage',
|
description: 'Store notes using Supabase storage',
|
||||||
version: '0.1.0',
|
version: '0.1.0',
|
||||||
apiVersion: '0.1.0',
|
apiVersion: '0.3.1',
|
||||||
configSchema: [
|
configSchema: [
|
||||||
{
|
{
|
||||||
key: 'supabaseUrl',
|
key: 'supabaseUrl',
|
||||||
|
|||||||
@@ -1,42 +1,9 @@
|
|||||||
import { describe, it } from 'vitest'
|
import { describePluginTests } from '@takerofnotes/plugin-sdk'
|
||||||
import { runPluginTests } from '@takerofnotes/plugin-sdk'
|
import plugin from '../src/index.js'
|
||||||
import plugin from './src/index.js'
|
|
||||||
import SupabaseAdapter from '../src/SupabaseAdapter.js'
|
|
||||||
|
|
||||||
const adapter = new SupabaseAdapter({
|
const adapter = plugin.createAdapter({
|
||||||
supabaseUrl: import.meta.env.VITE_SUPABASE_URL,
|
supabaseUrl: import.meta.env.VITE_SUPABASE_URL,
|
||||||
supabaseKey: import.meta.env.VITE_SUPABASE_KEY,
|
supabaseKey: import.meta.env.VITE_SUPABASE_KEY,
|
||||||
})
|
})
|
||||||
const tests = runPluginTests({ plugin, adapter })
|
|
||||||
|
|
||||||
describe('Plugin Validation', () => {
|
describePluginTests({ plugin, adapter }, describe, it, expect)
|
||||||
tests.validatePlugin(it, (a, b) => expect(a).toBe(b))
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Adapter: init()', () => {
|
|
||||||
tests.init(it)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Adapter: getAll()', () => {
|
|
||||||
tests.getAll(it)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Adapter: create()', () => {
|
|
||||||
tests.create(it)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Adapter: update()', () => {
|
|
||||||
tests.update(it)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe('Adapter: delete()', () => {
|
|
||||||
tests.delete(it)
|
|
||||||
})
|
|
||||||
|
|
||||||
describe(
|
|
||||||
'Full CRUD Cycle',
|
|
||||||
() => {
|
|
||||||
tests.crudCycle(it)
|
|
||||||
},
|
|
||||||
10 * 1000,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -3,5 +3,6 @@ import { defineConfig } from 'vitest/config'
|
|||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
test: {
|
test: {
|
||||||
globals: true,
|
globals: true,
|
||||||
|
testTimeout: 30000,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user