diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2fd7fc0c..f5adacb6 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -88,4 +88,4 @@ jobs: pgpm admin-users bootstrap --client --yes - name: Run Integration Tests - run: pgpm test-packages --full-cycle + run: pgpm test-packages --full-cycle --exclude pgpm-supabase diff --git a/.github/workflows/supabase.yml b/.github/workflows/supabase.yml new file mode 100644 index 00000000..198272ce --- /dev/null +++ b/.github/workflows/supabase.yml @@ -0,0 +1,87 @@ +name: Supabase integration +on: + push: + branches: + - main + paths: + - 'packages/supabase/**' + - '.github/workflows/supabase.yml' + pull_request: + paths: + - 'packages/supabase/**' + - '.github/workflows/supabase.yml' + workflow_dispatch: + +jobs: + supabase: + runs-on: ubuntu-latest + + env: + PGHOST: localhost + PGPORT: 5432 + PGUSER: postgres + PGPASSWORD: password + PGPM_VERSION: 5.18.0 + + services: + pg_db: + image: constructiveio/postgres-plus:18 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + options: >- + --health-cmd "pg_isready -U postgres" + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + + steps: + - name: Configure Git (for tests) + run: | + git config --global user.name "CI Test User" + git config --global user.email "ci@example.com" + + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v2 + with: + version: 9 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + + - name: Install + run: pnpm install + + - name: Cache pgpm CLI + uses: actions/cache@v4 + with: + path: ~/.npm + key: pgpm-${{ env.PGPM_VERSION }} + + - name: Install pgpm CLI globally + run: npm install -g pgpm@${{ env.PGPM_VERSION }} + + - name: Tune Postgres for CI (disable durability) + run: pgpm tune --yes + + - name: Seed Supabase users + run: | + pgpm admin-users bootstrap --client --yes + pgpm admin-users add --test --yes + psql -v ON_ERROR_STOP=1 -c 'CREATE ROLE anon NOINHERIT NOLOGIN;' + + - name: Test Supabase + run: pnpm --dir packages/supabase test + + - name: Full cycle for Supabase only + run: | + excludes=$(find packages -name '*.control' ! -path 'packages/supabase/*' -printf '%f\n' | sed 's/\.control$//' | paste -sd, -) + pgpm test-packages --full-cycle --exclude "$excludes" diff --git a/MODULES.md b/MODULES.md index aae4464a..f388161c 100644 --- a/MODULES.md +++ b/MODULES.md @@ -46,6 +46,7 @@ ## Security & Authentication ### Core Security +- [ ] `packages/supabase` - Supabase PostgREST role and identity claim bridge - [ ] `packages/security/defaults` - Security defaults - [ ] `packages/security/jwt-claims` - JWT claim handling - [ ] `packages/security/totp` - Time-based One-Time Password (TOTP) diff --git a/packages/supabase/.npmignore b/packages/supabase/.npmignore new file mode 100644 index 00000000..cf8a4554 --- /dev/null +++ b/packages/supabase/.npmignore @@ -0,0 +1,2 @@ +__tests__ +jest.config.js diff --git a/packages/supabase/LICENSE b/packages/supabase/LICENSE new file mode 100644 index 00000000..7b18c918 --- /dev/null +++ b/packages/supabase/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2025 Dan Lynch +Copyright (c) 2025 Constructive + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/supabase/Makefile b/packages/supabase/Makefile new file mode 100644 index 00000000..e19c333a --- /dev/null +++ b/packages/supabase/Makefile @@ -0,0 +1,6 @@ +EXTENSION = pgpm-supabase +DATA = sql/pgpm-supabase--1.0.0.sql + +PG_CONFIG = pg_config +PGXS := $(shell $(PG_CONFIG) --pgxs) +include $(PGXS) diff --git a/packages/supabase/README.md b/packages/supabase/README.md new file mode 100644 index 00000000..9a42a0cd --- /dev/null +++ b/packages/supabase/README.md @@ -0,0 +1,50 @@ +# @pgpm/supabase + +Bridge Supabase PostgREST requests to Constructive's transaction-local RLS claims. + +## Supabase setup + +1. Run `pgpm admin-users bootstrap --yes` against the Supabase database to create + Constructive's `anonymous` role (and the other base roles). +2. Ensure Supabase's `anon` and `authenticated` roles already exist. Outside + Supabase, create `anon` with `CREATE ROLE anon NOINHERIT NOLOGIN;` before deployment. +3. Install `@pgpm/supabase` and deploy `pgpm-supabase` with `pgpm deploy`. +4. As the database administrator, configure PostgREST: + + ```sql + ALTER ROLE authenticator SET pgrst.db_pre_request = 'supabase_integration.pre_request'; + NOTIFY pgrst, 'reload config'; + ``` + +Schema USAGE and hook EXECUTE are available to PUBLIC so PostgREST can also +invoke the hook as `service_role` without requiring that role at deploy time. +The hook is a no-op for roles other than `anon` and `authenticated`. + +The security-invoker hook switches `anon` to `anonymous`. It does not grant +automatic inheritance: `anon` cannot use `anonymous` grants without switching. +On PostgreSQL 16+ the membership explicitly disables inheritance and allows SET; +on PostgreSQL 15 it relies on Supabase's `anon` being NOINHERIT. + +For `authenticated`, the hook copies the verified `request.jwt.claims` JSON `sub` +to both `jwt.claims.user_id` and `jwt.claims.principal_id`, transaction-locally. +The subject must correspond to Constructive's `users.id`. Missing/empty claims +or subjects leave the claims unset; malformed JSON raises an error. Other roles +are unchanged. Only use this hook behind PostgREST's verified JWT boundary; +it does not verify JWTs or provision users. Each request must use a fresh transaction. + +RLS policies must treat empty claim strings as absent, for example +`nullif(current_setting('jwt.claims.user_id', true), '')::uuid`. PostgreSQL can +return an empty string for a custom GUC after its transaction-local value is +rolled back; a direct UUID cast would then raise on a later unauthenticated request. + +## Development + +```sh +eval "$(pgpm env)" +pnpm test +pgpm package +``` + +The tests create a missing `anon` role before deploying the module. Reverting +revokes the membership and drops the hook and schema, but does not drop roles +or change PostgREST configuration. Remove the pre-request setting before reverting. diff --git a/packages/supabase/__tests__/supabase.test.ts b/packages/supabase/__tests__/supabase.test.ts new file mode 100644 index 00000000..d1e19dd8 --- /dev/null +++ b/packages/supabase/__tests__/supabase.test.ts @@ -0,0 +1,90 @@ +import { getConnections, PgTestClient } from 'pgsql-test'; +import { seed } from 'pgsql-test/seed'; + +let pg: PgTestClient; +let teardown: () => Promise; +const userId = '00000000-0000-0000-0000-000000000001'; +const otherId = '00000000-0000-0000-0000-000000000002'; + +beforeAll(async () => { + ({ pg, teardown } = await getConnections({}, [ + seed.fn(async ({ pg }) => { + await pg.query(` + DO $$ BEGIN + IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'anon') THEN + CREATE ROLE anon NOINHERIT NOLOGIN; + END IF; + END $$; + `); + }), + seed.pgpm() + ])); + await pg.query(` + CREATE TABLE public.anonymous_read (value text); + INSERT INTO public.anonymous_read VALUES ('public content'); + GRANT SELECT ON public.anonymous_read TO anonymous; + CREATE TABLE public.owned_rows (user_id uuid PRIMARY KEY); + INSERT INTO public.owned_rows VALUES ('${userId}'), ('${otherId}'); + ALTER TABLE public.owned_rows ENABLE ROW LEVEL SECURITY; + GRANT SELECT ON public.owned_rows TO authenticated; + CREATE POLICY own_rows ON public.owned_rows TO authenticated + USING (user_id = nullif(current_setting('jwt.claims.user_id', true), '')::uuid); + `); +}); + +afterAll(async () => { await teardown?.(); }); +beforeEach(async () => { + pg.setContext({ role: null, 'request.jwt.claims': null }); + await pg.beforeEach(); +}); +afterEach(async () => { await pg.afterEach(); }); + +async function preRequestThen(sql: string) { + const results: any = await pg.query(`SELECT supabase_integration.pre_request(); ${sql}`); + return results[1].rows; +} + +it('does not inherit anonymous grants before pre_request', async () => { + pg.setContext({ role: 'anon' }); + await pg.expectError(() => pg.query('SELECT * FROM public.anonymous_read'), /permission denied/); +}); + +it('switches anon to anonymous and reads anonymous grants', async () => { + pg.setContext({ role: 'anon' }); + expect(await preRequestThen('SELECT current_user, value FROM public.anonymous_read')) + .toEqual([{ current_user: 'anonymous', value: 'public content' }]); +}); + +it('bridges both identity claims and restricts rows to the subject', async () => { + pg.setContext({ role: 'authenticated', 'request.jwt.claims': JSON.stringify({ sub: userId }) }); + expect(await preRequestThen(`SELECT user_id, + current_setting('jwt.claims.user_id', true) AS claim, + current_setting('jwt.claims.principal_id', true) AS principal + FROM public.owned_rows`)).toEqual([{ user_id: userId, claim: userId, principal: userId }]); +}); + +it.each([null, '', '{}', '{"sub":""}'])('handles absent subject in claims %p', async claims => { + pg.setContext({ role: 'authenticated', 'request.jwt.claims': claims }); + expect(await preRequestThen('SELECT * FROM public.owned_rows')).toEqual([]); +}); + +it('does nothing for other roles', async () => { + pg.setContext({ role: null, 'request.jwt.claims': JSON.stringify({ sub: userId }) }); + expect(await preRequestThen(`SELECT current_user = session_user AS unchanged, + nullif(current_setting('jwt.claims.user_id', true), '') AS claim`)) + .toEqual([{ unchanged: true, claim: null }]); +}); + +it('allows a role with no grants to call the hook as a no-op', async () => { + await pg.query('CREATE ROLE supabase_test_service NOINHERIT NOLOGIN'); + pg.setContext({ role: 'supabase_test_service', 'request.jwt.claims': JSON.stringify({ sub: userId }) }); + expect(await preRequestThen(`SELECT current_user, + nullif(current_setting('jwt.claims.user_id', true), '') AS claim, + nullif(current_setting('jwt.claims.principal_id', true), '') AS principal`)) + .toEqual([{ current_user: 'supabase_test_service', claim: null, principal: null }]); +}); + +it('rejects malformed JWT JSON', async () => { + pg.setContext({ role: 'authenticated', 'request.jwt.claims': 'invalid' }); + await pg.expectError(() => pg.query('SELECT supabase_integration.pre_request()'), /invalid input syntax for type json/); +}); diff --git a/packages/supabase/deploy/roles/anon.sql b/packages/supabase/deploy/roles/anon.sql new file mode 100644 index 00000000..e924f7b9 --- /dev/null +++ b/packages/supabase/deploy/roles/anon.sql @@ -0,0 +1,15 @@ +-- Deploy roles/anon to pg + +BEGIN; + +DO $$ +BEGIN + IF current_setting('server_version_num')::integer >= 160000 THEN + GRANT anonymous TO anon WITH INHERIT FALSE, SET TRUE; + ELSE + GRANT anonymous TO anon; + END IF; +END; +$$; + +COMMIT; diff --git a/packages/supabase/deploy/schemas/supabase_integration/procedures/pre_request.sql b/packages/supabase/deploy/schemas/supabase_integration/procedures/pre_request.sql new file mode 100644 index 00000000..dddd4764 --- /dev/null +++ b/packages/supabase/deploy/schemas/supabase_integration/procedures/pre_request.sql @@ -0,0 +1,26 @@ +-- Deploy schemas/supabase_integration/procedures/pre_request to pg + +BEGIN; + +CREATE FUNCTION supabase_integration.pre_request() +RETURNS void +LANGUAGE plpgsql +AS $$ +DECLARE + subject text; +BEGIN + IF current_user = 'anon' THEN + PERFORM set_config('role', 'anonymous', true); + ELSIF current_user = 'authenticated' THEN + subject := nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'sub'; + IF subject IS NOT NULL AND subject <> '' THEN + PERFORM set_config('jwt.claims.user_id', subject, true); + PERFORM set_config('jwt.claims.principal_id', subject, true); + END IF; + END IF; +END; +$$; + +GRANT EXECUTE ON FUNCTION supabase_integration.pre_request() TO PUBLIC; + +COMMIT; diff --git a/packages/supabase/deploy/schemas/supabase_integration/schema.sql b/packages/supabase/deploy/schemas/supabase_integration/schema.sql new file mode 100644 index 00000000..3d6aeaff --- /dev/null +++ b/packages/supabase/deploy/schemas/supabase_integration/schema.sql @@ -0,0 +1,9 @@ +-- Deploy schemas/supabase_integration/schema to pg + +BEGIN; + +CREATE SCHEMA supabase_integration; + +GRANT USAGE ON SCHEMA supabase_integration TO PUBLIC; + +COMMIT; diff --git a/packages/supabase/jest.config.js b/packages/supabase/jest.config.js new file mode 100644 index 00000000..4108cf46 --- /dev/null +++ b/packages/supabase/jest.config.js @@ -0,0 +1,16 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + forceExit: true, + preset: 'ts-jest', + testEnvironment: 'node', + + // Match both __tests__ and colocated test files + testMatch: ['**/?(*.)+(test|spec).{ts,tsx,js,jsx}'], + + // Ignore build artifacts and type declarations + testPathIgnorePatterns: ['/dist/', '\\.d\\.ts$'], + modulePathIgnorePatterns: ['/dist/'], + watchPathIgnorePatterns: ['/dist/'], + + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], +}; diff --git a/packages/supabase/package.json b/packages/supabase/package.json new file mode 100644 index 00000000..d8172460 --- /dev/null +++ b/packages/supabase/package.json @@ -0,0 +1,38 @@ +{ + "name": "@pgpm/supabase", + "version": "1.0.0", + "description": "Bridge Supabase PostgREST requests to Constructive RLS claims", + "author": "Dan Lynch ", + "contributors": [ + "Constructive " + ], + "keywords": [ + "postgresql", + "pgpm", + "supabase", + "authentication" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "bundle": "pgpm package", + "test": "jest", + "test:watch": "jest --watch" + }, + "devDependencies": { + "pgpm": "^5", + "pgsql-test": "^5.20.13" + }, + "dependencies": { + "@pgpm/verify": "workspace:*" + }, + "repository": { + "type": "git", + "url": "https://github.com/constructive-io/pgpm-modules" + }, + "homepage": "https://github.com/constructive-io/pgpm-modules", + "bugs": { + "url": "https://github.com/constructive-io/pgpm-modules/issues" + } +} diff --git a/packages/supabase/pgpm-supabase.control b/packages/supabase/pgpm-supabase.control new file mode 100644 index 00000000..5ca95dd9 --- /dev/null +++ b/packages/supabase/pgpm-supabase.control @@ -0,0 +1,7 @@ +# pgpm-supabase extension +comment = 'Supabase PostgREST integration for Constructive' +default_version = '1.0.0' +module_pathname = '$libdir/pgpm-supabase' +requires = 'plpgsql,pgpm-verify' +relocatable = false +superuser = false diff --git a/packages/supabase/pgpm.plan b/packages/supabase/pgpm.plan new file mode 100644 index 00000000..efda0e70 --- /dev/null +++ b/packages/supabase/pgpm.plan @@ -0,0 +1,7 @@ +%syntax-version=1.0.0 +%project=pgpm-supabase +%uri=pgpm-supabase + +schemas/supabase_integration/schema [pgpm-verify:procedures/assert_schema pgpm-verify:procedures/assert_function] 2026-08-27T00:00:00Z Constructive # add schemas/supabase_integration/schema +roles/anon [schemas/supabase_integration/schema] 2026-08-27T00:00:00Z Constructive # add roles/anon +schemas/supabase_integration/procedures/pre_request [schemas/supabase_integration/schema roles/anon] 2026-08-27T00:00:00Z Constructive # add schemas/supabase_integration/procedures/pre_request diff --git a/packages/supabase/revert/roles/anon.sql b/packages/supabase/revert/roles/anon.sql new file mode 100644 index 00000000..791ebb0a --- /dev/null +++ b/packages/supabase/revert/roles/anon.sql @@ -0,0 +1,7 @@ +-- Revert roles/anon from pg + +BEGIN; + +REVOKE anonymous FROM anon; + +COMMIT; diff --git a/packages/supabase/revert/schemas/supabase_integration/procedures/pre_request.sql b/packages/supabase/revert/schemas/supabase_integration/procedures/pre_request.sql new file mode 100644 index 00000000..fb3ac066 --- /dev/null +++ b/packages/supabase/revert/schemas/supabase_integration/procedures/pre_request.sql @@ -0,0 +1,7 @@ +-- Revert schemas/supabase_integration/procedures/pre_request from pg + +BEGIN; + +DROP FUNCTION supabase_integration.pre_request(); + +COMMIT; diff --git a/packages/supabase/revert/schemas/supabase_integration/schema.sql b/packages/supabase/revert/schemas/supabase_integration/schema.sql new file mode 100644 index 00000000..e1089ad6 --- /dev/null +++ b/packages/supabase/revert/schemas/supabase_integration/schema.sql @@ -0,0 +1,7 @@ +-- Revert schemas/supabase_integration/schema from pg + +BEGIN; + +DROP SCHEMA supabase_integration; + +COMMIT; diff --git a/packages/supabase/sql/pgpm-supabase--1.0.0.bundle.tar.gz b/packages/supabase/sql/pgpm-supabase--1.0.0.bundle.tar.gz new file mode 100644 index 00000000..8bee249b Binary files /dev/null and b/packages/supabase/sql/pgpm-supabase--1.0.0.bundle.tar.gz differ diff --git a/packages/supabase/sql/pgpm-supabase--1.0.0.sql b/packages/supabase/sql/pgpm-supabase--1.0.0.sql new file mode 100644 index 00000000..bc75b1e3 --- /dev/null +++ b/packages/supabase/sql/pgpm-supabase--1.0.0.sql @@ -0,0 +1,32 @@ +\echo Use "CREATE EXTENSION pgpm-supabase" to load this file. \quit +CREATE SCHEMA supabase_integration; + +GRANT USAGE ON SCHEMA supabase_integration TO PUBLIC; + +DO $EOFCODE$ +BEGIN + IF current_setting('server_version_num')::integer >= 160000 THEN + GRANT anonymous TO anon WITH INHERIT FALSE, SET TRUE; + ELSE + GRANT anonymous TO anon; + END IF; +END; +$EOFCODE$; + +CREATE FUNCTION supabase_integration.pre_request() RETURNS void LANGUAGE plpgsql AS $EOFCODE$ +DECLARE + subject text; +BEGIN + IF current_user = 'anon' THEN + PERFORM set_config('role', 'anonymous', true); + ELSIF current_user = 'authenticated' THEN + subject := nullif(current_setting('request.jwt.claims', true), '')::jsonb ->> 'sub'; + IF subject IS NOT NULL AND subject <> '' THEN + PERFORM set_config('jwt.claims.user_id', subject, true); + PERFORM set_config('jwt.claims.principal_id', subject, true); + END IF; + END IF; +END; +$EOFCODE$; + +GRANT EXECUTE ON FUNCTION supabase_integration.pre_request() TO PUBLIC; \ No newline at end of file diff --git a/packages/supabase/verify/roles/anon.sql b/packages/supabase/verify/roles/anon.sql new file mode 100644 index 00000000..4fefd7cd --- /dev/null +++ b/packages/supabase/verify/roles/anon.sql @@ -0,0 +1,12 @@ +-- Verify roles/anon from pg + +BEGIN; + +DO $$ +BEGIN + ASSERT pg_has_role('anon', 'anonymous', 'MEMBER'); + ASSERT NOT pg_has_role('anon', 'anonymous', 'USAGE'); +END; +$$; + +ROLLBACK; diff --git a/packages/supabase/verify/schemas/supabase_integration/procedures/pre_request.sql b/packages/supabase/verify/schemas/supabase_integration/procedures/pre_request.sql new file mode 100644 index 00000000..769d9d7b --- /dev/null +++ b/packages/supabase/verify/schemas/supabase_integration/procedures/pre_request.sql @@ -0,0 +1,19 @@ +-- Verify schemas/supabase_integration/procedures/pre_request from pg + +BEGIN; + +SELECT assert_function('supabase_integration.pre_request()'::regprocedure); + +DO $$ +BEGIN + ASSERT EXISTS ( + SELECT FROM pg_proc, + LATERAL aclexplode(coalesce(proacl, acldefault('f', proowner))) AS privilege + WHERE oid = 'supabase_integration.pre_request()'::regprocedure + AND privilege.grantee = 0 AND privilege.privilege_type = 'EXECUTE' + ); + ASSERT NOT (SELECT prosecdef FROM pg_proc WHERE oid = 'supabase_integration.pre_request()'::regprocedure); +END; +$$; + +ROLLBACK; diff --git a/packages/supabase/verify/schemas/supabase_integration/schema.sql b/packages/supabase/verify/schemas/supabase_integration/schema.sql new file mode 100644 index 00000000..55e21ee3 --- /dev/null +++ b/packages/supabase/verify/schemas/supabase_integration/schema.sql @@ -0,0 +1,18 @@ +-- Verify schemas/supabase_integration/schema from pg + +BEGIN; + +SELECT assert_schema('supabase_integration'::regnamespace); + +DO $$ +BEGIN + ASSERT EXISTS ( + SELECT FROM pg_namespace, + LATERAL aclexplode(nspacl) AS privilege + WHERE nspname = 'supabase_integration' + AND privilege.grantee = 0 AND privilege.privilege_type = 'USAGE' + ); +END; +$$; + +ROLLBACK; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 92051e6a..ce6b4b7c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -404,6 +404,19 @@ importers: specifier: ^5 version: 5.8.0(@dataplan/json@1.0.0(grafast@1.0.2(graphql@16.13.0)))(@dataplan/pg@1.0.3(@dataplan/json@1.0.0(grafast@1.0.2(graphql@16.13.0)))(grafast@1.0.2(graphql@16.13.0))(graphile-config@1.0.1)(graphql@16.13.0)(pg-sql2@5.0.1)(pg@8.22.0))(@types/node@22.19.17)(grafserv@1.0.0(@types/node@22.19.17)(grafast@1.0.2(graphql@16.13.0))(graphile-config@1.0.1)(graphql@16.13.0)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(use-sync-external-store@1.6.0(react@19.2.5))(ws@8.20.0))(graphile-build@5.0.2(grafast@1.0.2(graphql@16.13.0))(graphile-config@1.0.1)(graphql@16.13.0))(pg-sql2@5.0.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(tamedevil@0.1.1)(use-sync-external-store@1.6.0(react@19.2.5))(ws@8.20.0) + packages/supabase: + dependencies: + "@pgpm/verify": + specifier: workspace:* + version: link:../verify + devDependencies: + pgpm: + specifier: ^5 + version: 5.8.0(@dataplan/json@1.0.0(grafast@1.0.2(graphql@16.13.0)))(@dataplan/pg@1.0.3(@dataplan/json@1.0.0(grafast@1.0.2(graphql@16.13.0)))(grafast@1.0.2(graphql@16.13.0))(graphile-config@1.0.1)(graphql@16.13.0)(pg-sql2@5.0.1)(pg@8.22.0))(@types/node@22.19.17)(grafserv@1.0.0(@types/node@22.19.17)(grafast@1.0.2(graphql@16.13.0))(graphile-config@1.0.1)(graphql@16.13.0)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(use-sync-external-store@1.6.0(react@19.2.5))(ws@8.20.0))(graphile-build@5.0.2(grafast@1.0.2(graphql@16.13.0))(graphile-config@1.0.1)(graphql@16.13.0))(pg-sql2@5.0.1)(react-dom@19.2.5(react@19.2.5))(react@19.2.5)(tamedevil@0.1.1)(use-sync-external-store@1.6.0(react@19.2.5))(ws@8.20.0) + pgsql-test: + specifier: ^5.20.13 + version: 5.20.13 + packages: 12factor-env@1.27.1: resolution: @@ -9294,6 +9307,110 @@ packages: use-sync-external-store: optional: true + 12factor-env@1.34.0: + resolution: + integrity: sha512-jyeOuen3cbNn2EKmRkbayXsNKxqeeHGnL84to4RiLoOAOa7IG98z8kJXLKO70+0yE8wrsRGIlR2UVf7xKbr21g== + "@constructive-io/coerce@0.6.0": + resolution: + integrity: sha512-1R3colAQqLmEZ5AyMoX2nO3Lv8Sjp76JoJcmOcWphpKqmpHOraUDLOluBXTHCHY2+ERywICwkkm4oJozoybSMw== + "@constructive-io/errors@0.26.0": + resolution: + integrity: sha512-2Qo08JZQOVu/dn0A7pEUniIicTQdwM0Zbp1Z0d80jxO47J7evH6r59sb4p4+ZnXlbo5jdv/9RGiSt7xJ7khfDw== + "@pgpmjs/ast@0.16.3": + resolution: + integrity: sha512-x8Ov6iQJWzhc9vIqb3wpxSxZkI1ktesscgPD3zLMJY1OdG+BGGRSSMWn4ndT1HLaFiCGOMFbsO3RPyEu3tAA0g== + "@pgpmjs/bundle@0.19.3": + resolution: + integrity: sha512-bxsibsN9lALyiB5uIuchhjiM9sayQL4/ImezJ2K7fmeDB8BuWOogFp+l9mGaxHriVuUWD4m39S9xS+V9TsxkPw== + "@pgpmjs/core@7.35.13": + resolution: + integrity: sha512-RQuWcJG9rDGQXMtsX137l3CALDVgQ9inVxU7rT7dxdvJzkYabvKFL7Po4JgfJHyg/5ZR8yVH65va4gK59YsE4g== + "@pgpmjs/diff@0.10.12": + resolution: + integrity: sha512-GKzR7CDNUjRwwuz3Sgqov+26CT0xMbV8PZJaMkk6zz2KNDCSHCyGVEiTSzajgMdaNBlZkr5XcT2vW7Ar/QF+pA== + "@pgpmjs/env@2.48.3": + resolution: + integrity: sha512-4IEDMUiDtYBi5arOlCukW01D3Y51jfztZr+zXrtvCwKrHwfGmNic30z/Oai3VqqZsP2n30AohkIcUuJytu+syA== + "@pgpmjs/logger@2.27.0": + resolution: + integrity: sha512-Jx6arlQdICAtPFbKy9Zmo8U48gAJkwQEnzDqFRTN7Pgbd5ty5m9lGN1BbYm23UJMT8Ap6z3p80P16voffBOs6w== + "@pgpmjs/naming-spec@0.6.2": + resolution: + integrity: sha512-J5t4rpGESP92vjGiY/B97Pu4heOAZ+t+RbMq6mRRWa5pgoLYRtLNoGbFu1yhbeELtjCe9nXX1kU/1Ztg+5qDvw== + "@pgpmjs/server-utils@3.30.3": + resolution: + integrity: sha512-nMT0nA/tbhSi6yOjVIJfDl8KL91QkJ/GP98hgPOMWCLNG6c/TRDk+VmHA/et9Raw2iiL9pHotpc3uPzDozTP0Q== + "@pgpmjs/slice@0.21.12": + resolution: + integrity: sha512-8f2mpH1/0C2kPkGEHpo4CPazg/IjmWG7+vx2z0KF45cmlW8LEiFJINHzPZAjQCjPxaccwyeEPmonLtUR4ey5ZQ== + "@pgpmjs/transform@0.32.8": + resolution: + integrity: sha512-2NxWSGNZemLRBRUHvNRLuWsfCAHK2qQFvo4Abv4ZhnFFmr5Q+RaAkmsUGqDr9v/fWw0QHqV1qzVOzJEeWD+Q9A== + "@pgpmjs/traverse@0.16.3": + resolution: + integrity: sha512-e/Skd3xoGjHj7Z6ZFldLQpGANNBbOzlInzRuLC5NfIUY3O65W1UwtV/DxbTcDLyMqza2UC2TT+0QQygIKS/WaQ== + "@pgpmjs/types@2.58.3": + resolution: + integrity: sha512-LLvrloG2iv90y3CH2Q7G0HdUzCF/R3AawmUDXRHdXvZgsJrNFjMaoj8Lvin06gQSvSosb+elhyZKvhoO/vU06Q== + "@pgsql/scripts@18.5.9": + resolution: + integrity: sha512-GP+QSrgZWkB4lgkDCCoYTRwmBwJjwQw6NlXeAm80k+iymjwlGkMaRt8DzBaa69tYFzoq2LyHaYPs8j3StP8qOg== + "@pgsql/semantics@18.2.9": + resolution: + integrity: sha512-SvMjcYyv5HKVTYCcZT2u+SqBjIevaQd9Mh4PQkd4HVm3nm//SHgTbzFXhr+GxPxxbe/vHhUCmglYCnsSg4xfZQ== + "@pgsql/transform@18.18.9": + resolution: + integrity: sha512-uxc+4dptLDM+UcsApeGToqCk9wLiCJML2cVT7MfHw1EP0i3M/cUbRQWls88i9ukQVCiP7D53bdYoK3K7Ym8H0g== + "@pgsql/traverse@18.8.9": + resolution: + integrity: sha512-SxkP0sSrOTCRbyeV9c8qw3pOaimr9SBJi5eyBPXWaA4OlpxyA4cviGynOBQBUqlLm7bHoowjiEYLsN3cR2ALiQ== + "@pgsql/utils@18.3.9": + resolution: + integrity: sha512-+3B46FmyN76JPAFbMWdFC+arZq8MmcQuAvdPIjJX4xCLUdzHKEwe3ybVGa1bE72Vc6IVMOMk31JAY9OUuAqPgQ== + csv-to-pg@4.16.6: + resolution: + integrity: sha512-Dnlhn4H1/dEP4FOfvnxoUDED7d4ilWJ84Ek9eFC52czasbSRZar23v14poMXQUU0xDGDJeW92BUHnZLxOxHmIA== + hasBin: true + genomic@5.6.6: + resolution: + integrity: sha512-Rcw2Q8U4c9GfoAPS5lkpY4Dtm2rvRTtS8AK4awCejlWfe6m0P0dtp2gusixsoOuPWL9VAWm616/skbPkKFeBbw== + inquirerer@4.9.4: + resolution: + integrity: sha512-ALS4QpTbm9geTdRelvU1Cg4gaFEWBf2rc/5Qqd6cUZcaTqTXLGyfE4/g3Os2wm6f4H+4RNuZyZ94n+7OHr7D7A== + libpg-query@18.2.4: + resolution: + integrity: sha512-7nqWUm+39v/fYgWP0qR+sYC7tyhmW8lctqAzx7bdKG6V0ySr9G1lcY43BdZM5+lxVSzL0Y5Yy6eM9e+uL7T79w== + pg-cache@3.30.3: + resolution: + integrity: sha512-SDW3pYrK2udVElcdoIqgXf76bKFkG1I8R+MPmWrR40H6jeUe8sn6D36KGC6NqtLB9kH1RmtqXnhYBUuKaon9gQ== + pg-env@1.33.0: + resolution: + integrity: sha512-OslZMDKoqoIv0sy+omJ8Jy6Vlc5CnHpboPwUL4nUV7usydff7bSRMsZNLOwN4c89/ZT4nyaHG1/58ujQvErVnA== + pg-seed@0.30.0: + resolution: + integrity: sha512-/xDOFqgNl6yZV/osCAUW6dbucOq8X6g+VuN59M1N1AnU2r135nj9THI2dYoctB2fIQXlRptt9jwNdxjWMONgfA== + pgsql-client@4.18.13: + resolution: + integrity: sha512-LyOJOWamIl4B/8Pr++p+x/SFK6kt5nzTLoDPx/bUu22CkP9kNKiJm+rNZssNSjcoyaiTIceDJSNJ0i0SIWWjkw== + pgsql-deparser@18.5.2: + resolution: + integrity: sha512-vR+qGJf6eU8Qbs06AGjTklAAucE+oz1NEAH3RlGwGGSBTpFpD7q4GYsriDB+24Y7FZxi8C00kFnsAtvJPP90ug== + pgsql-parser@18.4.2: + resolution: + integrity: sha512-Gjm85k5ZTt8rlXDIzviF9I3C7oGvkZD/4KEb7v0EjjjRvXnOP0hAG217UbebstyTFjD13QWk9jtEan9siL2Icw== + pgsql-seed@3.17.13: + resolution: + integrity: sha512-XfReTj/2YEK40/CaXXRblvXNjWBo657+ja4XZKB1pedB3jwr4AgPqD1nGtRN7V0iyK5/Mg1LpNLxvuriXdQ7TA== + pgsql-test@5.20.13: + resolution: + integrity: sha512-u8UulmHfUziKW6eXusp4hzkvUoHn8pqv4sd04tNuKE+z8C34ri8PBo9uuK4DAK0RgGvrn33UFNvoTbnjPoMpeQ== + plpgsql-deparser@18.3.8: + resolution: + integrity: sha512-DBnv+lXcitiXrd9hZmL68biiey1zB7KGvHHyZVR00+gXuA4ZYc3ryOCKtFLqEo7wTek1S5nOxtYJJoQhIIJFfg== + plpgsql-parser@18.6.9: + resolution: + integrity: sha512-Q2I/bu8V9San2HA9rVCqFhG+/lykT5B4eSq11+QIa0gZNTEhuWrqLrYQMKp68q9h1ooUXWq/XAkQFvMnC9esxQ== + snapshots: 12factor-env@1.27.1: dependencies: @@ -15750,3 +15867,209 @@ snapshots: optionalDependencies: react: 19.2.5 use-sync-external-store: 1.6.0(react@19.2.5) + + 12factor-env@1.34.0: + dependencies: + "@constructive-io/coerce": 0.6.0 + envalid: 8.2.0 + "@constructive-io/coerce@0.6.0": {} + "@constructive-io/errors@0.26.0": {} + "@pgpmjs/ast@0.16.3": + dependencies: + "@pgpmjs/env": 2.48.3 + "@pgpmjs/types": 2.58.3 + "@pgpmjs/bundle@0.19.3": + dependencies: + "@pgpmjs/ast": 0.16.3 + "@pgpmjs/traverse": 0.16.3 + "@pgpmjs/core@7.35.13": + dependencies: + "@pgpmjs/ast": 0.16.3 + "@pgpmjs/bundle": 0.19.3 + "@pgpmjs/diff": 0.10.12 + "@pgpmjs/env": 2.48.3 + "@pgpmjs/logger": 2.27.0 + "@pgpmjs/server-utils": 3.30.3 + "@pgpmjs/slice": 0.21.12 + "@pgpmjs/transform": 0.32.8 + "@pgpmjs/types": 2.58.3 + cross-spawn: 7.0.6 + csv-to-pg: 4.16.6 + genomic: 5.6.6 + git-changed: 0.4.0 + glob: 13.0.6 + parse-package-name: 1.0.0 + pg: 8.22.0 + pg-cache: 3.30.3 + pg-env: 1.33.0 + pgsql-deparser: 18.5.2 + pgsql-parser: 18.4.2 + semver: 7.8.5 + yaml: 2.9.0 + yanse: 0.2.2 + transitivePeerDependencies: + - pg-native + - supports-color + "@pgpmjs/diff@0.10.12": + dependencies: + "@pgpmjs/ast": 0.16.3 + "@pgpmjs/naming-spec": 0.6.2 + "@pgpmjs/transform": 0.32.8 + "@pgpmjs/env@2.48.3": + dependencies: + 12factor-env: 1.34.0 + "@pgpmjs/types": 2.58.3 + deepmerge: 4.3.1 + "@pgpmjs/logger@2.27.0": + dependencies: + yanse: 0.2.2 + "@pgpmjs/naming-spec@0.6.2": {} + "@pgpmjs/server-utils@3.30.3": + dependencies: + "@pgpmjs/logger": 2.27.0 + "@pgpmjs/types": 2.58.3 + cors: 2.8.6 + express: 5.2.1 + lru-cache: 11.3.5 + transitivePeerDependencies: + - supports-color + "@pgpmjs/slice@0.21.12": + dependencies: + "@pgpmjs/ast": 0.16.3 + "@pgpmjs/transform": 0.32.8 + minimatch: 10.2.6 + plpgsql-parser: 18.6.9 + "@pgpmjs/transform@0.32.8": + dependencies: + "@pgpmjs/ast": 0.16.3 + "@pgpmjs/naming-spec": 0.6.2 + "@pgsql/scripts": 18.5.9 + "@pgsql/semantics": 18.2.9 + "@pgsql/transform": 18.18.9 + plpgsql-parser: 18.6.9 + "@pgpmjs/traverse@0.16.3": + dependencies: + "@pgpmjs/ast": 0.16.3 + "@pgpmjs/types@2.58.3": + dependencies: + "@constructive-io/errors": 0.26.0 + pg-env: 1.33.0 + "@pgsql/scripts@18.5.9": + dependencies: + "@pgsql/quotes": 18.2.4 + "@pgsql/transform": 18.18.9 + plpgsql-parser: 18.6.9 + "@pgsql/semantics@18.2.9": + dependencies: + "@pgsql/traverse": 18.8.9 + plpgsql-parser: 18.6.9 + "@pgsql/transform@18.18.9": + dependencies: + "@pgsql/quotes": 18.2.4 + "@pgsql/semantics": 18.2.9 + "@pgsql/traverse": 18.8.9 + plpgsql-parser: 18.6.9 + "@pgsql/traverse@18.8.9": + dependencies: + "@pgsql/types": 18.0.0 + plpgsql-deparser: 18.3.8 + "@pgsql/utils@18.3.9": + dependencies: + "@pgsql/types": 18.0.0 + nested-obj: 0.2.3 + csv-to-pg@4.16.6: + dependencies: + "@pgsql/types": 18.0.0 + "@pgsql/utils": 18.3.9 + csv-parser: 3.2.1 + inquirerer: 4.9.4 + js-yaml: 4.1.1 + pgsql-deparser: 18.5.2 + genomic@5.6.6: + dependencies: + appstash: 0.8.0 + inquirerer: 4.9.4 + inquirerer@4.9.4: + dependencies: + deepmerge: 4.3.1 + find-and-require-package-json: 0.9.1 + minimist: 1.2.8 + yanse: 0.2.2 + libpg-query@18.2.4: + dependencies: + "@pgsql/types": 18.0.0 + pg-cache@3.30.3: + dependencies: + 12factor-env: 1.34.0 + "@pgpmjs/logger": 2.27.0 + "@pgpmjs/types": 2.58.3 + lru-cache: 11.3.5 + pg: 8.22.0 + pg-env: 1.33.0 + transitivePeerDependencies: + - pg-native + pg-env@1.33.0: + dependencies: + 12factor-env: 1.34.0 + pg-seed@0.30.0: + dependencies: + csv-parse: 6.2.1 + pg: 8.22.0 + pg-copy-streams: 7.0.0 + transitivePeerDependencies: + - pg-native + pgsql-client@4.18.13: + dependencies: + "@pgpmjs/core": 7.35.13 + "@pgpmjs/logger": 2.27.0 + "@pgpmjs/types": 2.58.3 + pg: 8.22.0 + pg-env: 1.33.0 + transitivePeerDependencies: + - pg-native + - supports-color + pgsql-deparser@18.5.2: + dependencies: + "@pgsql/quotes": 18.2.4 + "@pgsql/types": 18.0.0 + pgsql-parser@18.4.2: + dependencies: + "@pgsql/types": 18.0.0 + libpg-query: 18.2.4 + pgsql-deparser: 18.5.2 + pgsql-seed@3.17.13: + dependencies: + "@pgpmjs/core": 7.35.13 + "@pgpmjs/env": 2.48.3 + pg: 8.22.0 + pg-env: 1.33.0 + pg-seed: 0.30.0 + transitivePeerDependencies: + - pg-native + - supports-color + pgsql-test@5.20.13: + dependencies: + "@pgpmjs/env": 2.48.3 + "@pgpmjs/logger": 2.27.0 + "@pgpmjs/server-utils": 3.30.3 + "@pgpmjs/types": 2.58.3 + pg: 8.22.0 + pg-cache: 3.30.3 + pg-env: 1.33.0 + pgsql-client: 4.18.13 + pgsql-seed: 3.17.13 + transitivePeerDependencies: + - pg-native + - supports-color + plpgsql-deparser@18.3.8: + dependencies: + "@pgsql/types": 18.0.0 + libpg-query: 18.2.4 + pgsql-deparser: 18.5.2 + plpgsql-parser@18.6.9: + dependencies: + "@pgsql/traverse": 18.8.9 + "@pgsql/types": 18.0.0 + libpg-query: 18.2.4 + pgsql-deparser: 18.5.2 + plpgsql-deparser: 18.3.8