@exposify/supabase 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@exposify/supabase",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "bin": {
10
+ "agentify-supabase": "./dist/cli.js"
11
+ },
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js",
16
+ "require": "./dist/index.cjs"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "sql"
22
+ ],
23
+ "scripts": {
24
+ "build": "tsup src/index.ts --format esm,cjs --dts --clean && tsup bin/cli.ts --format esm --outDir dist --shims --no-clean",
25
+ "test": "vitest run",
26
+ "typecheck": "tsc --noEmit",
27
+ "prepack": "yarn build"
28
+ },
29
+ "dependencies": {
30
+ "@exposify/core": "0.0.0",
31
+ "@modelcontextprotocol/sdk": "^1.12.0",
32
+ "zod": "^3.24.0"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^22.0.0",
36
+ "tsup": "^8.3.0",
37
+ "typescript": "^5.6.0",
38
+ "vitest": "^3.0.0"
39
+ },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ }
43
+ }
@@ -0,0 +1,46 @@
1
+ -- agentify-supabase: schema introspection function.
2
+ --
3
+ -- Exposes, per PostgREST's RPC convention (POST /rpc/agentify_meta), one row
4
+ -- per column of every ordinary table in the `public` schema: whether Row
5
+ -- Level Security is enabled on its table, and the table/column comments an
6
+ -- owner wrote via `COMMENT ON TABLE` / `COMMENT ON COLUMN`.
7
+ --
8
+ -- This is the runtime source of truth for the DB exposure policy (RLS-gated,
9
+ -- reads auto) and for tool/param descriptions -- see the design spec's "DB
10
+ -- tool surface" section. It is SECURITY DEFINER because reading
11
+ -- `pg_catalog`'s RLS flag and comments for tables the calling role can't
12
+ -- necessarily SELECT from would otherwise be blocked; the function only ever
13
+ -- returns catalog metadata, never row data, so this does not leak anything
14
+ -- RLS would otherwise protect.
15
+ create or replace function public.agentify_meta()
16
+ returns table (
17
+ table_name text,
18
+ rls_enabled boolean,
19
+ table_comment text,
20
+ column_name text,
21
+ column_comment text
22
+ )
23
+ language sql
24
+ security definer
25
+ set search_path = public, pg_catalog
26
+ as $$
27
+ select
28
+ c.relname as table_name,
29
+ c.relrowsecurity as rls_enabled,
30
+ obj_description(c.oid, 'pg_class') as table_comment,
31
+ a.attname as column_name,
32
+ col_description(c.oid, a.attnum) as column_comment
33
+ from pg_catalog.pg_class c
34
+ join pg_catalog.pg_namespace n on n.oid = c.relnamespace
35
+ join pg_catalog.pg_attribute a on a.attrelid = c.oid
36
+ where n.nspname = 'public'
37
+ and c.relkind = 'r' -- ordinary tables only (no views, no partitions' children complexity)
38
+ and a.attnum > 0 -- skip system columns
39
+ and not a.attisdropped
40
+ order by c.relname, a.attnum;
41
+ $$;
42
+
43
+ -- PostgREST's `anon`/`authenticated` roles must be able to call this RPC;
44
+ -- the SECURITY DEFINER body above is what makes that safe (catalog metadata
45
+ -- only, never row data).
46
+ grant execute on function public.agentify_meta() to anon, authenticated;