graphile-pg-type-mappings 0.2.0 → 0.2.2
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/LICENSE +1 -1
- package/README.md +61 -47
- package/package.json +8 -8
package/LICENSE
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
The MIT License (MIT)
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2025 Dan Lynch <pyramation@gmail.com>
|
|
4
|
-
Copyright (c) 2025
|
|
4
|
+
Copyright (c) 2025 Constructive <developers@constructive.io>
|
|
5
5
|
Copyright (c) 2020-present, Interweb, Inc.
|
|
6
6
|
|
|
7
7
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# graphile-pg-type-mappings
|
|
2
2
|
|
|
3
3
|
<p align="center" width="100%">
|
|
4
|
-
<img height="250" src="https://raw.githubusercontent.com/
|
|
4
|
+
<img height="250" src="https://raw.githubusercontent.com/constructive-io/constructive/refs/heads/main/assets/outline-logo.svg" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
7
|
<p align="center" width="100%">
|
|
8
|
-
<a href="https://github.com/
|
|
9
|
-
<img height="20" src="https://github.com/
|
|
8
|
+
<a href="https://github.com/constructive-io/constructive/actions/workflows/run-tests.yaml">
|
|
9
|
+
<img height="20" src="https://github.com/constructive-io/constructive/actions/workflows/run-tests.yaml/badge.svg" />
|
|
10
10
|
</a>
|
|
11
|
-
<a href="https://github.com/
|
|
11
|
+
<a href="https://github.com/constructive-io/constructive/blob/main/LICENSE">
|
|
12
12
|
<img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/>
|
|
13
13
|
</a>
|
|
14
14
|
<a href="https://www.npmjs.com/package/graphile-pg-type-mappings">
|
|
@@ -16,9 +16,22 @@
|
|
|
16
16
|
</a>
|
|
17
17
|
</p>
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**`graphile-pg-type-mappings`** is a Graphile/PostGraphile plugin that maps custom PostgreSQL types to GraphQL scalars.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## 🚀 Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install graphile-pg-type-mappings
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## ✨ Features
|
|
28
|
+
|
|
29
|
+
- Sensible defaults for common custom Postgres types (`email`, `origin`, `multiple_select`, etc.)
|
|
30
|
+
- Override or extend mappings via `customTypeMappings`
|
|
31
|
+
- Works with PostGraphile v4 as a standard plugin
|
|
32
|
+
- TypeScript definitions for mapping configuration
|
|
33
|
+
|
|
34
|
+
### Default mappings
|
|
22
35
|
|
|
23
36
|
- `email` → `String`
|
|
24
37
|
- `hostname` → `String`
|
|
@@ -29,13 +42,7 @@ This plugin provides custom type mappings for PostgreSQL types to GraphQL types,
|
|
|
29
42
|
|
|
30
43
|
> **Note:** If you need PostGIS types (like `geolocation` or `geopolygon` → `GeoJSON`), you can add them via `customTypeMappings` when using the PostGIS plugin.
|
|
31
44
|
|
|
32
|
-
##
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npm install graphile-pg-type-mappings
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Usage
|
|
45
|
+
## 📦 Usage
|
|
39
46
|
|
|
40
47
|
### Basic Usage (Default Mappings)
|
|
41
48
|
|
|
@@ -132,7 +139,7 @@ const postgraphileOptions = {
|
|
|
132
139
|
};
|
|
133
140
|
```
|
|
134
141
|
|
|
135
|
-
## API
|
|
142
|
+
## 📘 API
|
|
136
143
|
|
|
137
144
|
### `CustomPgTypeMappingsPlugin`
|
|
138
145
|
|
|
@@ -156,75 +163,82 @@ interface CustomPgTypeMappingsPluginOptions {
|
|
|
156
163
|
}
|
|
157
164
|
```
|
|
158
165
|
|
|
166
|
+
## 🧪 Testing
|
|
167
|
+
|
|
168
|
+
```sh
|
|
169
|
+
# requires a local Postgres available (defaults to postgres/password@localhost:5432)
|
|
170
|
+
pnpm --filter graphile-pg-type-mappings test
|
|
171
|
+
```
|
|
172
|
+
|
|
159
173
|
---
|
|
160
174
|
|
|
161
175
|
## Education and Tutorials
|
|
162
176
|
|
|
163
|
-
1. 🚀 [Quickstart: Getting Up and Running](https://
|
|
177
|
+
1. 🚀 [Quickstart: Getting Up and Running](https://constructive.io/learn/quickstart)
|
|
164
178
|
Get started with modular databases in minutes. Install prerequisites and deploy your first module.
|
|
165
179
|
|
|
166
|
-
2. 📦 [Modular PostgreSQL Development with Database Packages](https://
|
|
180
|
+
2. 📦 [Modular PostgreSQL Development with Database Packages](https://constructive.io/learn/modular-postgres)
|
|
167
181
|
Learn to organize PostgreSQL projects with pgpm workspaces and reusable database modules.
|
|
168
182
|
|
|
169
|
-
3. ✏️ [Authoring Database Changes](https://
|
|
183
|
+
3. ✏️ [Authoring Database Changes](https://constructive.io/learn/authoring-database-changes)
|
|
170
184
|
Master the workflow for adding, organizing, and managing database changes with pgpm.
|
|
171
185
|
|
|
172
|
-
4. 🧪 [End-to-End PostgreSQL Testing with TypeScript](https://
|
|
186
|
+
4. 🧪 [End-to-End PostgreSQL Testing with TypeScript](https://constructive.io/learn/e2e-postgres-testing)
|
|
173
187
|
Master end-to-end PostgreSQL testing with ephemeral databases, RLS testing, and CI/CD automation.
|
|
174
188
|
|
|
175
|
-
5. ⚡ [Supabase Testing](https://
|
|
189
|
+
5. ⚡ [Supabase Testing](https://constructive.io/learn/supabase)
|
|
176
190
|
Use TypeScript-first tools to test Supabase projects with realistic RLS, policies, and auth contexts.
|
|
177
191
|
|
|
178
|
-
6. 💧 [Drizzle ORM Testing](https://
|
|
192
|
+
6. 💧 [Drizzle ORM Testing](https://constructive.io/learn/drizzle-testing)
|
|
179
193
|
Run full-stack tests with Drizzle ORM, including database setup, teardown, and RLS enforcement.
|
|
180
194
|
|
|
181
|
-
7. 🔧 [Troubleshooting](https://
|
|
195
|
+
7. 🔧 [Troubleshooting](https://constructive.io/learn/troubleshooting)
|
|
182
196
|
Common issues and solutions for pgpm, PostgreSQL, and testing.
|
|
183
197
|
|
|
184
|
-
## Related
|
|
198
|
+
## Related Constructive Tooling
|
|
185
199
|
|
|
186
200
|
### 🧪 Testing
|
|
187
201
|
|
|
188
|
-
* [
|
|
189
|
-
* [
|
|
190
|
-
* [
|
|
191
|
-
* [
|
|
202
|
+
* [pgsql-test](https://github.com/constructive-io/constructive/tree/main/packages/pgsql-test): **📊 Isolated testing environments** with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
|
|
203
|
+
* [supabase-test](https://github.com/constructive-io/constructive/tree/main/packages/supabase-test): **🧪 Supabase-native test harness** preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
|
|
204
|
+
* [graphile-test](https://github.com/constructive-io/constructive/tree/main/packages/graphile-test): **🔐 Authentication mocking** for Graphile-focused test helpers and emulating row-level security contexts.
|
|
205
|
+
* [pg-query-context](https://github.com/constructive-io/constructive/tree/main/packages/pg-query-context): **🔒 Session context injection** to add session-local context (e.g., `SET LOCAL`) into queries—ideal for setting `role`, `jwt.claims`, and other session settings.
|
|
192
206
|
|
|
193
207
|
### 🧠 Parsing & AST
|
|
194
208
|
|
|
195
|
-
* [
|
|
196
|
-
* [
|
|
197
|
-
* [
|
|
198
|
-
* [@pgsql/enums](https://
|
|
199
|
-
* [@pgsql/types](https://
|
|
200
|
-
* [@pgsql/utils](https://
|
|
201
|
-
* [
|
|
209
|
+
* [pgsql-parser](https://www.npmjs.com/package/pgsql-parser): **🔄 SQL conversion engine** that interprets and converts PostgreSQL syntax.
|
|
210
|
+
* [libpg-query-node](https://www.npmjs.com/package/libpg-query): **🌉 Node.js bindings** for `libpg_query`, converting SQL into parse trees.
|
|
211
|
+
* [pg-proto-parser](https://www.npmjs.com/package/pg-proto-parser): **📦 Protobuf parser** for parsing PostgreSQL Protocol Buffers definitions to generate TypeScript interfaces, utility functions, and JSON mappings for enums.
|
|
212
|
+
* [@pgsql/enums](https://www.npmjs.com/package/@pgsql/enums): **🏷️ TypeScript enums** for PostgreSQL AST for safe and ergonomic parsing logic.
|
|
213
|
+
* [@pgsql/types](https://www.npmjs.com/package/@pgsql/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
|
|
214
|
+
* [@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
|
|
215
|
+
* [pg-ast](https://www.npmjs.com/package/pg-ast): **🔍 Low-level AST tools** and transformations for Postgres query structures.
|
|
202
216
|
|
|
203
217
|
### 🚀 API & Dev Tools
|
|
204
218
|
|
|
205
|
-
* [launchql/server](https://github.com/
|
|
206
|
-
* [launchql/explorer](https://github.com/
|
|
219
|
+
* [launchql/server](https://github.com/constructive-io/constructive/tree/main/packages/server): **⚡ Express-based API server** powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
|
|
220
|
+
* [launchql/explorer](https://github.com/constructive-io/constructive/tree/main/packages/explorer): **🔎 Visual API explorer** with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.
|
|
207
221
|
|
|
208
222
|
### 🔁 Streaming & Uploads
|
|
209
223
|
|
|
210
|
-
* [launchql/s3-streamer](https://github.com/
|
|
211
|
-
* [launchql/etag-hash](https://github.com/
|
|
212
|
-
* [launchql/etag-stream](https://github.com/
|
|
213
|
-
* [launchql/uuid-hash](https://github.com/
|
|
214
|
-
* [launchql/uuid-stream](https://github.com/
|
|
215
|
-
* [launchql/upload-names](https://github.com/
|
|
224
|
+
* [launchql/s3-streamer](https://github.com/constructive-io/constructive/tree/main/packages/s3-streamer): **📤 Direct S3 streaming** for large files with support for metadata injection and content validation.
|
|
225
|
+
* [launchql/etag-hash](https://github.com/constructive-io/constructive/tree/main/packages/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
|
|
226
|
+
* [launchql/etag-stream](https://github.com/constructive-io/constructive/tree/main/packages/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
|
|
227
|
+
* [launchql/uuid-hash](https://github.com/constructive-io/constructive/tree/main/packages/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
|
|
228
|
+
* [launchql/uuid-stream](https://github.com/constructive-io/constructive/tree/main/packages/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
|
|
229
|
+
* [launchql/upload-names](https://github.com/constructive-io/constructive/tree/main/packages/upload-names): **📂 Collision-resistant filenames** utility for structured and unique file names for uploads.
|
|
216
230
|
|
|
217
231
|
### 🧰 CLI & Codegen
|
|
218
232
|
|
|
219
|
-
* [pgpm](https://github.com/
|
|
220
|
-
* [@launchql/cli](https://github.com/
|
|
221
|
-
* [launchql/launchql-gen](https://github.com/
|
|
222
|
-
* [@launchql/query-builder](https://github.com/
|
|
223
|
-
* [@launchql/query](https://github.com/
|
|
233
|
+
* [pgpm](https://github.com/constructive-io/constructive/tree/main/packages/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
|
|
234
|
+
* [@launchql/cli](https://github.com/constructive-io/constructive/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing LaunchQL projects—supports database scaffolding, migrations, seeding, code generation, and automation.
|
|
235
|
+
* [launchql/launchql-gen](https://github.com/constructive-io/constructive/tree/main/packages/launchql-gen): **✨ Auto-generated GraphQL** mutations and queries dynamically built from introspected schema data.
|
|
236
|
+
* [@launchql/query-builder](https://github.com/constructive-io/constructive/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
|
|
237
|
+
* [@launchql/query](https://github.com/constructive-io/constructive/tree/main/packages/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
|
|
224
238
|
|
|
225
239
|
## Credits
|
|
226
240
|
|
|
227
|
-
🛠 Built by
|
|
241
|
+
🛠 Built by Constructive — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/constructive-io)
|
|
228
242
|
|
|
229
243
|
|
|
230
244
|
## Disclaimer
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-pg-type-mappings",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Custom PostgreSQL type mappings plugin for Graphile/PostGraphile",
|
|
5
5
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
|
-
"homepage": "https://github.com/
|
|
6
|
+
"homepage": "https://github.com/constructive-io/constructive",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"module": "esm/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "https://github.com/
|
|
27
|
+
"url": "https://github.com/constructive-io/constructive"
|
|
28
28
|
},
|
|
29
29
|
"keywords": [
|
|
30
30
|
"graphile",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"launchql"
|
|
37
37
|
],
|
|
38
38
|
"bugs": {
|
|
39
|
-
"url": "https://github.com/
|
|
39
|
+
"url": "https://github.com/constructive-io/constructive/issues"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"graphile-postgis": "^0.1.
|
|
43
|
-
"graphile-test": "^2.8.
|
|
42
|
+
"graphile-postgis": "^0.1.4",
|
|
43
|
+
"graphile-test": "^2.8.12",
|
|
44
44
|
"graphql-tag": "2.12.6",
|
|
45
45
|
"makage": "^0.1.6",
|
|
46
|
-
"pgsql-test": "^2.14.
|
|
46
|
+
"pgsql-test": "^2.14.15"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
49
|
"graphile-build": "^4.14.1"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "5a0d7c7502624bd42a214f983fd7ab957e1fb3e3"
|
|
52
52
|
}
|