Files
semprini-data-product-templ…/canonical_data_product/example/ods/030_api.sql
T
paulandClaude Opus 5 62a3714562 Add the canonical data product template
Moves the data product template from semprini-blog-dataproducts, as adapted to
the semprini-data domain platform, into canonical_data_product/. Its worked
example passed 9 of 9 checks on the domain platform on 2026-09-17.

Adds agent-canonical-product, the blog's agent-product adapted to generate a
product into a domain repository from a declaration in the domain's model
repository, and README/CLAUDE.md describing the template catalogue, the
product contract with the domain platform, and team ownership. Source-aligned
and experience templates are planned.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-17 22:55:11 +12:00

27 lines
1.0 KiB
PL/PgSQL

-- Example Address: API surface (runs on the postgres service).
GRANT USAGE ON SCHEMA example_address TO anon;
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA example_address TO anon;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA example_address TO anon;
ALTER DEFAULT PRIVILEGES IN SCHEMA example_address GRANT SELECT, INSERT, UPDATE, DELETE ON TABLES TO anon;
-- The product's GraphQL endpoint: POST /rpc/example_address_graphql through PostgREST.
-- pg_graphql reflects the schemas on the search_path, so the SET clause scopes the
-- endpoint to this product's tables.
CREATE FUNCTION api.example_address_graphql(
query text,
variables jsonb DEFAULT '{}'::jsonb,
"operationName" text DEFAULT NULL,
extensions jsonb DEFAULT NULL
) RETURNS jsonb
LANGUAGE sql
SECURITY INVOKER
SET search_path = example_address, graphql
AS $$
SELECT graphql.resolve(query, variables, "operationName", extensions);
$$;
GRANT EXECUTE ON FUNCTION api.example_address_graphql(text, jsonb, text, jsonb) TO anon;
NOTIFY pgrst, 'reload schema';