update to new sdk
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"repository": {
|
||||
"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",
|
||||
"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) {
|
||||
const fileName = `${note.id}.json`
|
||||
const fileContent = JSON.stringify(note, null, 2)
|
||||
|
||||
@@ -6,7 +6,7 @@ export default definePlugin({
|
||||
name: 'Supabase',
|
||||
description: 'Store notes using Supabase storage',
|
||||
version: '0.1.0',
|
||||
apiVersion: '0.1.0',
|
||||
apiVersion: '0.3.1',
|
||||
configSchema: [
|
||||
{
|
||||
key: 'supabaseUrl',
|
||||
|
||||
@@ -1,42 +1,9 @@
|
||||
import { describe, it } from 'vitest'
|
||||
import { runPluginTests } from '@takerofnotes/plugin-sdk'
|
||||
import plugin from './src/index.js'
|
||||
import SupabaseAdapter from '../src/SupabaseAdapter.js'
|
||||
import { describePluginTests } from '@takerofnotes/plugin-sdk'
|
||||
import plugin from '../src/index.js'
|
||||
|
||||
const adapter = new SupabaseAdapter({
|
||||
const adapter = plugin.createAdapter({
|
||||
supabaseUrl: import.meta.env.VITE_SUPABASE_URL,
|
||||
supabaseKey: import.meta.env.VITE_SUPABASE_KEY,
|
||||
})
|
||||
const tests = runPluginTests({ plugin, adapter })
|
||||
|
||||
describe('Plugin Validation', () => {
|
||||
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,
|
||||
)
|
||||
describePluginTests({ plugin, adapter }, describe, it, expect)
|
||||
|
||||
@@ -3,5 +3,6 @@ import { defineConfig } from 'vitest/config'
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
testTimeout: 30000,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user