{"_id":"@asaidimu/remote-store-supabase","name":"@asaidimu/remote-store-supabase","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@asaidimu/remote-store-supabase","version":"1.0.0","description":"A Supabase adapter for the remote-store library that provides a consistent interface for working with Supabase tables and storage.","main":"index.js","types":"index.d.ts","keywords":["react-query","react","supabase","typescript"],"author":{"name":"Saidimu","email":"47994458+asaidimu@users.noreply.github.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/asaidimu/remote-store.git"},"bugs":{"url":"https://github.com/asaidimu/remote-store/issues"},"homepage":"https://github.com/asaidimu/remote-store#readme","publishConfig":{"registry":"https://registry.npmjs.org/","tag":"latest","access":"public"},"dependencies":{"@supabase/supabase-js":"^2.47.12","@tanstack/react-query":"^5.63.0"},"_id":"@asaidimu/remote-store-supabase@1.0.0","gitHead":"8263f8d8d4b9abeb523b03d0ffc3300d31fe513f","_nodeVersion":"20.8.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-frOZlhrobxRnOl5SPB4FzdferpswXu0VgY+tXaqi+vXA3woNb/PfLLwWy0cNimMsGme+zunUDp0HMQpf6pO9dg==","shasum":"72f4f745624a067df1fd113da77026c2036a6066","tarball":"https://registry.npmjs.org/@asaidimu/remote-store-supabase/-/remote-store-supabase-1.0.0.tgz","fileCount":5,"unpackedSize":9258,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC6ShlHnKpvsxa4EEd0Vx4cM8WqRe5MGcVYHx8J7zkAoQIgKybs5eNTXM+0IPAgSvO3B1A0wxbK1pAYpraIf4qf4dQ="}]},"_npmUser":{"name":"asaidimu","email":"lolokilesaidimu@gmail.com"},"directories":{},"maintainers":[{"name":"asaidimu","email":"lolokilesaidimu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/remote-store-supabase_1.0.0_1736589590866_0.6105987825128749"},"_hasShrinkwrap":false}},"time":{"created":"2025-01-11T09:59:50.769Z","1.0.0":"2025-01-11T09:59:51.034Z","modified":"2025-01-11T09:59:51.310Z"},"maintainers":[{"name":"asaidimu","email":"lolokilesaidimu@gmail.com"}],"description":"A Supabase adapter for the remote-store library that provides a consistent interface for working with Supabase tables and storage.","homepage":"https://github.com/asaidimu/remote-store#readme","keywords":["react-query","react","supabase","typescript"],"repository":{"type":"git","url":"git+https://github.com/asaidimu/remote-store.git"},"author":{"name":"Saidimu","email":"47994458+asaidimu@users.noreply.github.com"},"bugs":{"url":"https://github.com/asaidimu/remote-store/issues"},"license":"MIT","readme":"# @asaidimu/remote-store-supabase\n\nA Supabase adapter for the remote-store library that provides a consistent interface for working with Supabase tables and storage.\n\n## Installation\n\n```bash\nnpm install @asaidimu/remote-store-supabase @supabase/supabase-js\n```\n\n## Usage\n```typescript\nimport { createClient } from '@supabase/supabase-js';\nimport { createSupabaseStore } from '@asaidimu/remote-store-supabase';\n\n// Initialize Supabase client\nconst supabase = createClient(\n  'YOUR_SUPABASE_URL',\n  'YOUR_SUPABASE_ANON_KEY'\n);\n\n// Define your record type\ninterface User extends RemoteStoreRecord {\n  name: string;\n  email: string;\n  avatar_url?: string;\n}\n\n// Create a store instance\nconst userStore = createSupabaseStore<User>({\n  table: 'users',\n  supabase,\n  bucketName: 'avatars', // optional, defaults to 'uploads'\n});\n\n// Use the store\nasync function example() {\n  // Create a user\n  const user = await userStore.create({\n    data: {\n      name: 'John Doe',\n      email: 'john@example.com',\n    }\n  });\n\n  // Upload an avatar\n  const avatarFile = new File([''], 'avatar.png');\n  await userStore.upload({\n    id: user.id,\n    field: 'avatar_url',\n    file: avatarFile\n  });\n\n  // List users with pagination\n  const users = await userStore.list({\n    page: 1,\n    pageSize: 20,\n    filter: 'name=John Doe',\n    select: ['name', 'email'],\n    include: ['profile']\n  });\n}\n```\n\n## API\n\n### `createSupabaseStore(options)`\n\nCreates a new store instance for interacting with a Supabase table.\n\n#### Options\n\n- `table: string` - The name of the Supabase table\n- `supabase: SupabaseClient` - An initialized Supabase client instance\n- `bucketName?: string` - The name of the storage bucket (defaults to 'uploads')\n\n#### Returns\n\nReturns a `BaseStore<T>` instance with the following methods:\n\n- `find({ filter, options? })` - Find first record matching the filter\n- `read({ id, options? })` - Read a record by ID\n- `list({ filter?, page?, pageSize?, ...options })` - List records with pagination\n- `create({ data })` - Create a new record\n- `update({ id, data })` - Update an existing record\n- `delete({ id })` - Delete a record\n- `upload({ id, field, file })` - Upload a file to storage and update record with URL\n\n## License\n\nMIT\n","readmeFilename":"README.md"}