n8n-nodes-puter-ai
Version:
Advanced n8n node for Puter.js AI with RAG agentic capabilities, document processing, audio transcription, Supabase integration, and cost-optimized model priorities
143 lines (142 loc) • 4.98 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SupabaseApi = void 0;
class SupabaseApi {
constructor() {
this.name = 'supabaseApi';
this.displayName = 'Supabase API';
this.documentationUrl = 'https://supabase.com/docs';
this.properties = [
{
displayName: 'Supabase URL',
name: 'supabaseUrl',
type: 'string',
default: '',
required: true,
placeholder: 'https://your-project.supabase.co',
description: 'Your Supabase project URL',
},
{
displayName: 'Anon Key',
name: 'anonKey',
type: 'string',
typeOptions: {
password: true,
},
default: '',
required: true,
placeholder: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
description: 'Your Supabase anon/public key for client-side operations',
},
{
displayName: 'Service Role Key',
name: 'serviceRoleKey',
type: 'string',
typeOptions: {
password: true,
},
default: '',
placeholder: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
description: 'Your Supabase service role key for server-side operations (optional, for admin operations)',
},
{
displayName: 'Enable Vector Storage',
name: 'enableVectorStorage',
type: 'boolean',
default: true,
description: 'Enable vector embeddings storage for RAG functionality',
},
{
displayName: 'Documents Table Name',
name: 'documentsTable',
type: 'string',
default: 'documents',
description: 'Table name for storing document metadata',
displayOptions: {
show: {
enableVectorStorage: [true],
},
},
},
{
displayName: 'Embeddings Table Name',
name: 'embeddingsTable',
type: 'string',
default: 'document_embeddings',
description: 'Table name for storing vector embeddings',
displayOptions: {
show: {
enableVectorStorage: [true],
},
},
},
{
displayName: 'Vector Dimension',
name: 'vectorDimension',
type: 'number',
default: 1536,
description: 'Vector dimension for embeddings (1536 for OpenAI, 768 for others)',
typeOptions: {
minValue: 384,
maxValue: 3072,
},
displayOptions: {
show: {
enableVectorStorage: [true],
},
},
},
{
displayName: 'Similarity Threshold',
name: 'similarityThreshold',
type: 'number',
default: 0.7,
description: 'Minimum similarity score for document retrieval (0.0 to 1.0)',
typeOptions: {
minValue: 0.0,
maxValue: 1.0,
numberPrecision: 2,
},
displayOptions: {
show: {
enableVectorStorage: [true],
},
},
},
{
displayName: 'Max Documents Retrieved',
name: 'maxDocuments',
type: 'number',
default: 5,
description: 'Maximum number of similar documents to retrieve for RAG context',
typeOptions: {
minValue: 1,
maxValue: 20,
},
displayOptions: {
show: {
enableVectorStorage: [true],
},
},
},
];
this.authenticate = {
type: 'generic',
properties: {
headers: {
'apikey': '={{$credentials.anonKey}}',
'Authorization': '=Bearer {{$credentials.anonKey}}',
'Content-Type': 'application/json',
},
},
};
this.test = {
request: {
baseURL: '={{$credentials.supabaseUrl}}',
url: '/rest/v1/',
method: 'GET',
},
};
}
}
exports.SupabaseApi = SupabaseApi;