{"_id":"@bnjmnt4n/supabase-client","_rev":"1-724d737403db522fb4a37e58937877ec","name":"@bnjmnt4n/supabase-client","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"@bnjmnt4n/supabase-client","version":"0.0.1","description":"An alternative Supabase client.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepare":"npm run build","test":"tsc","build":"tsc"},"repository":{"type":"git","url":"git+https://github.com/bnjmnt4n/supabase-client.git"},"keywords":["supabase"],"author":{"name":"Benjamin Tan","email":"benjamin@dev.ofcr.se","url":"https://ofcr.se/"},"license":"MIT","bugs":{"url":"https://github.com/bnjmnt4n/supabase-client/issues"},"homepage":"https://github.com/bnjmnt4n/supabase-client#readme","devDependencies":{"@supabase/postgrest-js":"^0.35.0","@supabase/supabase-js":"^1.28.2","@typescript-eslint/eslint-plugin":"^5.4.0","@typescript-eslint/parser":"^5.4.0","eslint":"^8.3.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","postgrest-query":"^0.0.2","prettier":"^2.4.1","typescript":"^4.5.2"},"gitHead":"49996a6de2e643bde876007e953b450fc158975b","_id":"@bnjmnt4n/supabase-client@0.0.1","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-nAm82vUYuhWoEr3DAFwooehnK9vJ516b9K0YZ6fnqiYmKGJq5LEb/R9SWYQzfC9T2RkSoKwmUfBQWtqMGAqgSw==","shasum":"8bc9751be53e1087e8f2e13cc12049073d56b243","tarball":"https://registry.npmjs.org/@bnjmnt4n/supabase-client/-/supabase-client-0.0.1.tgz","fileCount":29,"unpackedSize":51966,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhpOTLCRA9TVsSAnZWagAAs3kP/1DHo+x+TIIXN4Scg2To\nIj3lfnVFxELfrd8c8Mp341V6NsGwMxC4jp9FaMo4HWnhfPyRThrdrmo6qv9/\n0RR/dd+j1dzN8Kk0yhJZeBOuPf7JpO+T/90O84g1bDLO6ULdv0AhPXonxOEF\nJW/iP6WssLpuDoY/ZaYq3CMp6/0XS1H2BNflzOsf65DRIu4JGA9XC6e9w/C8\nIqijMSRz79Grl3iV8hzUIm2z40Om/Q1HYLA1pZ3zsTa0hCSB9Ysrk6jKmdb4\n8VlN1IqLlNg2G49755ffhNqldBtD1Hy6B9fdsANA2XUJQIK22TV7vJ59djE3\nh9hilsIOP4WHugmJJ4ssLTZevs6bqiajTyT9TRQoiONjxplm8DsS+7w+xaMz\nwcEpjyTLbSW4vl2DzVXKG3TO+EqZq2alChre7mMVjfv6kgDDKS+EtjOwTetE\n5fIu/9M6/IrvupTWSiZWGhLOnt+H6031ecF0KdA5oO/nB/1ju8Y1EvyFH5Bk\nkkap+7tdjH6r7OLQNKnSnvQSGeWu0u02TYoK1e0QbijIvfRNtNEy71KdHZon\nkzSrmQzTEF+la3BenxNgeyJO/4F6jPlNMCF0p8JEzPNMr+bo4qp6duL+UC5Y\n1oreeJ5utEZx8iWkrFRk1siayWtJ+hzeQ6IbK2VMBG4U4+SiFSNCOm2Ob/RU\nsNko\r\n=mrij\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDYJAZcZVmLFLClh+ZKauGLF//zeB1WNgktVNxLr1BdagIgPhD8HyCkDQBRxWp3ayTMsAUeJ+JzUbt/PuE4Fm5K8Cw="}]},"_npmUser":{"name":"bnjmnt4n","email":"benjamin@dev.ofcr.se"},"directories":{},"maintainers":[{"name":"bnjmnt4n","email":"benjamin@dev.ofcr.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/supabase-client_0.0.1_1638196427544_0.3866573864492415"},"_hasShrinkwrap":false}},"time":{"created":"2021-11-29T14:33:47.466Z","0.0.1":"2021-11-29T14:33:47.732Z","modified":"2022-04-04T19:53:40.187Z"},"maintainers":[{"name":"bnjmnt4n","email":"benjamin@dev.ofcr.se"}],"description":"An alternative Supabase client.","homepage":"https://github.com/bnjmnt4n/supabase-client#readme","keywords":["supabase"],"repository":{"type":"git","url":"git+https://github.com/bnjmnt4n/supabase-client.git"},"author":{"name":"Benjamin Tan","email":"benjamin@dev.ofcr.se","url":"https://ofcr.se/"},"bugs":{"url":"https://github.com/bnjmnt4n/supabase-client/issues"},"license":"MIT","readme":"# supabase-client\n\nAn alternative TypeScript-based Supabase client.\n\nThis package is an alternative to the official [`@supabase/supabase-js`](https://github.com/supabase/supabase-js) client, with the intention of experiment with better TypeScript type definitions. In the future, this package might also contain other experiments such as a more tree-shaking-friendly API, and other UX/DX improvements, with the hope that they might eventually be upstreamed into [`@supabase/supabase-js` v2](https://github.com/supabase/supabase-js/issues/170).\n\n## Features\n\n- Use of template literals types to construct return type definitions of your queries, without having to manually specify them:\n\n    ```ts\n    // Before:\n    // Instead of having to specify the query and the definition:\n\n    type WorkspaceWithTeam =\n      definition[\"workspaces\"] & {\n        team: {\n          user: Pick<definition[\"users\"], \"id\" | \"email\">;\n        };\n      };\n\n    supabase\n      .from<WorkspaceWithTeam>(\"workspaces\")\n      .select(`\n        *,\n        team:members(\n          user:users(\n            id,\n            email\n          )\n        )\n      `);\n\n    // After:\n    // Just specify the query once!\n    supabase\n      .from(\"workspaces\")\n      .select(`\n        *,\n        team:members(\n          user:users(\n            id,\n            email\n          )\n        )\n      `);\n    ```\n- Type-checking of your `select(query)` format\n- IntelliSense suggestions of fields in filter conditions:\n\n    ```ts\n    supabase\n      .from(\"workspaces\")\n      .select(`\n        name,\n        id,\n        team:members(\n          user:users(\n            id,\n            email\n          )\n        )\n      `)\n      .filter(\"|\", \"eq\", X);\n      // Provides auto-complete suggestions of \"name\" | \"id\" | \"team.user.id\" | \"team.user.email\"\n    ```\n\n## Usage\n\nInstall using npm or yarn:\n\n```sh\nnpm i @supabase/supabase-js \nnpm i --D @bnjmnt4n/supbase-client\n```\n\nFor now, this package only provides alternative types for the `@supabase/supabase-js` client. TypeScript v4.5.0+ is required.\n\n```ts\nimport { createClient } from \"@supabase/supabase-js\";\nimport { type SupabaseClient } from \"@bnjmnt4n/supabase-client\";\n\n// Type-definitions for each table in your schema. See \nimport { definitions } from \"lib/__generated__/supabase.ts\";\n\nconst supabase = createClient(SUPABASE_URL, SUPABASE_KEY, OPTIONS)\n  as unknown as SupabaseClient<definitions>;\n\nconst { data, error } = await supabase\n  .from(\"users\")\n  .select(`\n    email,\n    name,\n    products(\n      id,\n      name\n    )\n  `)\n  .maybeSingle();\n\nif (data) {\n  data.name;\n  data.email;\n\n  if (\"length\" in data.products) {\n    // Array of products.\n    data.products[0].id;\n  } else {\n    // Single products.\n    data.products.id;\n  }\n}\n```\n\n## Bugs/Issues?\n\nIf there are any issues with the types, you can simply cast the client back to the original type definitions:\n\n```ts\nimport { type SupabaseClient } from \"@supabase/supabase-js\";\n\n(supabase as unknown as SupabaseClient).from(\"\").select();\n```\n\nDo report any bugs though!\n","readmeFilename":"README.md"}