graphile-test 2.7.1 → 2.8.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/README.md CHANGED
@@ -20,6 +20,8 @@
20
20
 
21
21
  It provides a seamless setup for isolated, seeded, role-aware Postgres databases and injects GraphQL helpers for snapshot testing, role context, and mutation/query assertions.
22
22
 
23
+ **Note:** This is a bare-bones package with no defaults or settings applied. For a batteries-included version with all LaunchQL plugins pre-configured, use [`launchql-test`](https://github.com/launchql/launchql/tree/main/packages/launchql-test) instead.
24
+
23
25
  ## 🚀 Features
24
26
 
25
27
  * 🔁 **Per-test rollback** via savepoints for isolation
@@ -192,6 +194,26 @@ expect(result.data.createUser.username).toBe('alice');
192
194
  * Start with `getConnections()` for most use cases.
193
195
  * Consider `getConnectionsUnwrapped()` for cleaner test assertions.
194
196
 
197
+ ## Education and Tutorials
198
+
199
+ 1. 🚀 [Quickstart: Getting Up and Running](https://launchql.com/learn/quickstart)
200
+ Get started with modular databases in minutes. Install prerequisites and deploy your first module.
201
+
202
+ 2. 📦 [Modular PostgreSQL Development with Database Packages](https://launchql.com/learn/modular-postgres)
203
+ Learn to organize PostgreSQL projects with pgpm workspaces and reusable database modules.
204
+
205
+ 3. ✏️ [Authoring Database Changes](https://launchql.com/learn/authoring-database-changes)
206
+ Master the workflow for adding, organizing, and managing database changes with pgpm.
207
+
208
+ 4. 🧪 [End-to-End PostgreSQL Testing with TypeScript](https://launchql.com/learn/e2e-postgres-testing)
209
+ Master end-to-end PostgreSQL testing with ephemeral databases, RLS testing, and CI/CD automation.
210
+
211
+ 5. ⚡ [Supabase Testing](https://launchql.com/learn/supabase)
212
+ TypeScript-native testing for Supabase with modern workflows.
213
+
214
+ 6. 🔧 [Troubleshooting](https://launchql.com/learn/troubleshooting)
215
+ Common issues and solutions for pgpm, PostgreSQL, and testing.
216
+
195
217
  ## Related LaunchQL Tooling
196
218
 
197
219
  ### 🧪 Testing
@@ -233,6 +255,11 @@ expect(result.data.createUser.username).toBe('alice');
233
255
  * [@launchql/query-builder](https://github.com/launchql/launchql/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.
234
256
  * [@launchql/query](https://github.com/launchql/launchql/tree/main/packages/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
235
257
 
258
+ ## Credits
259
+
260
+ 🛠 Built by LaunchQL — if you like our tools, please checkout and contribute to [our github ⚛️](https://github.com/launchql)
261
+
262
+
236
263
  ## Disclaimer
237
264
 
238
265
  AS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED "AS IS", AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.
@@ -1,13 +1,25 @@
1
- import { getGraphileSettings } from 'graphile-settings';
2
1
  import { createPostGraphileSchema } from 'postgraphile';
3
2
  import { runGraphQLInContext } from './context';
4
3
  export const GraphQLTest = (input, conn) => {
5
- const { schemas, authRole } = input;
4
+ const { schemas, authRole, graphile } = input;
6
5
  let schema;
7
6
  let options;
8
7
  const pgPool = conn.manager.getPool(conn.pg.config);
9
8
  const setup = async () => {
10
- options = getGraphileSettings({ graphile: { schema: schemas } });
9
+ // Bare-bones configuration - no defaults, only use what's explicitly provided
10
+ // This gives full control over PostGraphile configuration
11
+ options = {
12
+ schema: schemas,
13
+ // Only apply graphile options if explicitly provided
14
+ ...(graphile?.appendPlugins && {
15
+ appendPlugins: graphile.appendPlugins
16
+ }),
17
+ ...(graphile?.graphileBuildOptions && {
18
+ graphileBuildOptions: graphile.graphileBuildOptions
19
+ }),
20
+ // Apply any overrideSettings if provided
21
+ ...(graphile?.overrideSettings || {})
22
+ };
11
23
  schema = await createPostGraphileSchema(pgPool, schemas, options);
12
24
  };
13
25
  const teardown = async () => { };
package/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './clean';
2
+ export * from './context';
2
3
  export * from './get-connections';
3
4
  export * from './graphile-test';
4
5
  export * from './types';
package/graphile-test.js CHANGED
@@ -1,16 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GraphQLTest = void 0;
4
- const graphile_settings_1 = require("graphile-settings");
5
4
  const postgraphile_1 = require("postgraphile");
6
5
  const context_1 = require("./context");
7
6
  const GraphQLTest = (input, conn) => {
8
- const { schemas, authRole } = input;
7
+ const { schemas, authRole, graphile } = input;
9
8
  let schema;
10
9
  let options;
11
10
  const pgPool = conn.manager.getPool(conn.pg.config);
12
11
  const setup = async () => {
13
- options = (0, graphile_settings_1.getGraphileSettings)({ graphile: { schema: schemas } });
12
+ // Bare-bones configuration - no defaults, only use what's explicitly provided
13
+ // This gives full control over PostGraphile configuration
14
+ options = {
15
+ schema: schemas,
16
+ // Only apply graphile options if explicitly provided
17
+ ...(graphile?.appendPlugins && {
18
+ appendPlugins: graphile.appendPlugins
19
+ }),
20
+ ...(graphile?.graphileBuildOptions && {
21
+ graphileBuildOptions: graphile.graphileBuildOptions
22
+ }),
23
+ // Apply any overrideSettings if provided
24
+ ...(graphile?.overrideSettings || {})
25
+ };
14
26
  schema = await (0, postgraphile_1.createPostGraphileSchema)(pgPool, schemas, options);
15
27
  };
16
28
  const teardown = async () => { };
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './clean';
2
+ export * from './context';
2
3
  export * from './get-connections';
3
4
  export * from './graphile-test';
4
5
  export * from './types';
package/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.seed = void 0;
18
18
  __exportStar(require("./clean"), exports);
19
+ __exportStar(require("./context"), exports);
19
20
  __exportStar(require("./get-connections"), exports);
20
21
  __exportStar(require("./graphile-test"), exports);
21
22
  __exportStar(require("./types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graphile-test",
3
- "version": "2.7.1",
3
+ "version": "2.8.0",
4
4
  "author": "Dan Lynch <pyramation@gmail.com>",
5
5
  "description": "PostGraphile Testing",
6
6
  "main": "index.js",
@@ -34,12 +34,11 @@
34
34
  "graphql-tag": "2.12.6"
35
35
  },
36
36
  "dependencies": {
37
- "@launchql/types": "^2.8.0",
38
- "graphile-settings": "^2.6.1",
37
+ "@launchql/types": "^2.8.1",
39
38
  "graphql": "15.10.1",
40
39
  "mock-req": "^0.2.0",
41
40
  "pg": "^8.16.0",
42
- "pgsql-test": "^2.14.1",
41
+ "pgsql-test": "^2.14.3",
43
42
  "postgraphile": "^4.14.1"
44
43
  },
45
44
  "keywords": [
@@ -49,5 +48,5 @@
49
48
  "launchql",
50
49
  "test"
51
50
  ],
52
- "gitHead": "2bc45c48444fc9c2cce9f082cf33d533915bb048"
51
+ "gitHead": "da2bd9606bd5e1d4e63b7d74f08920975980e541"
53
52
  }
package/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { GraphileOptions } from '@launchql/types';
1
2
  import { DocumentNode, GraphQLError } from 'graphql';
2
3
  export interface GraphQLQueryOptions<TVariables = Record<string, any>> {
3
4
  query: string | DocumentNode;
@@ -14,6 +15,7 @@ export interface GetConnectionsInput {
14
15
  useRoot?: boolean;
15
16
  schemas: string[];
16
17
  authRole?: string;
18
+ graphile?: GraphileOptions;
17
19
  }
18
20
  export interface GraphQLQueryOptions<TVariables = Record<string, any>> {
19
21
  query: string | DocumentNode;