Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ postgres/pgsql-test/output/
.env.local
graphql/server/logs/
graphql/server/*.heapsnapshot
packages/perf-harness/artifacts/

# Ephemeral pgpm modules installed by `pnpm fixtures:install` (pgpm install)
/extensions/
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default [
'**/*.generated.ts',
'postgres/pg-ast/src/asts.ts',
'postgres/pg-ast/src/wrapped.ts',
// upstream-derived source; preserve Crystal formatting for reviewability
'graphile/graphile-scoped-introspection/src/upstream/**',
// read verbatim at codegen time and written into generated clients
'graphql/codegen/src/core/codegen/templates/**',
// codegen output snapshots and standalone sqitch/pgpm fixture projects
Expand Down
21 changes: 21 additions & 0 deletions graphile/graphile-scoped-introspection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# graphile-scoped-introspection

CNC-owned, upstream-shaped PostgreSQL introspection plugin. The package starts
from the published Graphile implementations that own the two relevant seams:

- `pg-introspection@1.0.1` query generation and result augmentation;
- `graphile-build-pg@5.1.3` `PgIntrospectionPlugin` orchestration.

The copied source is kept together so scoped changes remain reviewable against
the upstream package boundaries. See `UPSTREAM.md` and `UPSTREAM_LICENSE.md` for
provenance and licensing.

`ScopedIntrospectionPreset` atomically disables the stock
`PgIntrospectionPlugin` and installs `PgScopedIntrospectionPlugin`. The
replacement preserves the stock query unless `gather.pgScopedIntrospection`
contains an entry for the PG service name. Scoped services use a parameterized
catalog query, validate required and allowed namespaces after parsing, and can
apply dependency-closure validation to retained PostgreSQL types.

Installing this package alone does not change Graphile's default preset or any
PG service. CNC owns the configuration that selects and installs the preset.
31 changes: 31 additions & 0 deletions graphile/graphile-scoped-introspection/UPSTREAM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Upstream provenance

The files under `src/upstream/pg-introspection` and
`src/upstream/graphile-build-pg` are derived from the MIT-licensed Graphile
Crystal repository at commit:

`fb9792dd4e64601530026d1ec4079652a4f33c1c`

That commit publishes `pg-introspection@1.0.1` and
`graphile-build-pg@5.1.3`, matching the versions pinned by CNC.

Copied paths:

- `utils/pg-introspection/src/*.ts`
- `graphile-build/graphile-build-pg/src/plugins/PgIntrospectionPlugin.ts`
- `graphile-build/graphile-build-pg/src/version.ts`
- `graphile-build/graphile-build-pg/src/watchFixtures.ts`

The baseline copy has only the integration adaptations needed to compile the
published sources as an isolated CNC package:

- relative imports and TypeScript extension syntax match the CNC package layout;
- the published `graphile-build-pg` declarations are loaded for registry and
service types that the original monorepo supplied through its compilation
unit (including the standard PG adaptor), and its public
`pg-introspection` types remain the plugin contract;
- Crystal's `useUnknownInCatchVariables: false` setting is retained; and
- one otherwise-contextual `description` value has an explicit type annotation.

Functional changes are layered in separate commits. The copied source keeps its
upstream formatting so future comparisons remain useful.
21 changes: 21 additions & 0 deletions graphile/graphile-scoped-introspection/UPSTREAM_LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
## The MIT License (MIT)

Copyright © `2025` Benjie Gillam

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.
Loading