graphile-i18n 0.1.5 โ†’ 0.1.7

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.
Files changed (2) hide show
  1. package/README.md +28 -11
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -8,19 +8,30 @@
8
8
  <a href="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml">
9
9
  <img height="20" src="https://github.com/launchql/launchql/actions/workflows/run-tests.yaml/badge.svg" />
10
10
  </a>
11
- <a href="https://github.com/launchql/launchql/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
12
- <a href="https://www.npmjs.com/package/graphile-i18n"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/launchql?filename=graphile%2Fgraphile-i18n%2Fpackage.json"/></a>
11
+ <a href="https://github.com/launchql/launchql/blob/main/LICENSE">
12
+ <img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/>
13
+ </a>
14
+ <a href="https://www.npmjs.com/package/graphile-i18n">
15
+ <img height="20" src="https://img.shields.io/github/package-json/v/launchql/launchql?filename=graphile%2Fgraphile-i18n%2Fpackage.json"/>
16
+ </a>
13
17
  </p>
14
18
 
15
- TypeScript rewrite of the Graphile/PostGraphile i18n plugin. Adds language-aware fields sourced from translation tables declared via smart comments.
19
+ **`graphile-i18n`** is a TypeScript rewrite of the Graphile/PostGraphile i18n plugin. It adds language-aware fields sourced from translation tables declared via smart comments and respects `Accept-Language` with sensible fallbacks.
16
20
 
17
- ## Install
21
+ ## ๐Ÿš€ Installation
18
22
 
19
23
  ```bash
20
24
  pnpm add graphile-i18n
21
25
  ```
22
26
 
23
- ## Usage
27
+ ## โœจ Features
28
+
29
+ - Smart comments (`@i18n`) to wire translation tables
30
+ - `Accept-Language` detection with graceful fallback to base values
31
+ - Works with PostGraphile context via `additionalGraphQLContextFromRequest`
32
+ - TypeScript-first implementation
33
+
34
+ ## ๐Ÿ“ฆ Usage
24
35
 
25
36
  1. Add a translation table and tag the base table with `@i18n`:
26
37
 
@@ -66,15 +77,21 @@ app.use(
66
77
 
67
78
  Requests with `Accept-Language` headers receive the closest translation; fields fall back to the base table values when a translation is missing.
68
79
 
69
- ## Tests
80
+ ## ๐Ÿงฐ Configuration Options
70
81
 
71
- Tests run against a real Postgres instance using `graphile-test`:
82
+ All options are provided through `graphileBuildOptions`:
72
83
 
73
- ```bash
74
- pnpm test
75
- ```
84
+ - `langPluginLanguageCodeColumn` โ€” translation table column name, default `lang_code`
85
+ - `langPluginLanguageCodeGqlField` โ€” exposed GraphQL field name, default `langCode`
86
+ - `langPluginAllowedTypes` โ€” allowed base column types for translation, default `['citext', 'text']`
87
+ - `langPluginDefaultLanguages` โ€” fallback language order, default `['en']`
76
88
 
77
- Ensure Postgres is available at `postgres://postgres:password@localhost:5432`.
89
+ ## ๐Ÿงช Testing
90
+
91
+ ```sh
92
+ # requires a local Postgres available (defaults to postgres/password@localhost:5432)
93
+ pnpm --filter graphile-i18n test
94
+ ```
78
95
 
79
96
  ---
80
97
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-i18n",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Graphile i18n plugin",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "homepage": "https://github.com/launchql/launchql",
@@ -40,9 +40,9 @@
40
40
  "devDependencies": {
41
41
  "@types/accept-language-parser": "^1.5.4",
42
42
  "@types/pg": "^8.15.2",
43
- "graphile-test": "^2.8.9",
43
+ "graphile-test": "^2.8.11",
44
44
  "makage": "^0.1.8",
45
- "pgsql-test": "^2.14.12"
45
+ "pgsql-test": "^2.14.14"
46
46
  },
47
47
  "dependencies": {
48
48
  "accept-language-parser": "^1.5.0",
@@ -55,5 +55,5 @@
55
55
  "graphql-tag": "2.12.6",
56
56
  "pg": "^8.16.0"
57
57
  },
58
- "gitHead": "3812f24a480b2035b3413ec7fecfe492f294e590"
58
+ "gitHead": "00c90828cab8d3e306ebb2bc6053aab4aa9ae807"
59
59
  }