@constructive-io/graphql-test 4.24.0 → 4.26.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.
@@ -14,6 +14,15 @@ const unwrap = (res) => {
14
14
  const createConnectionsBase = async (input, seedAdapters) => {
15
15
  const conn = await getPgConnections(input, seedAdapters);
16
16
  const { pg, db, teardown: dbTeardown } = conn;
17
+ // Auto-derive principal_id from user_id on every setContext call
18
+ // (same behavior as constructive-test for pgsql-test clients).
19
+ const origSetContext = db.setContext.bind(db);
20
+ db.setContext = (ctx) => {
21
+ if (ctx['jwt.claims.user_id'] && !('jwt.claims.principal_id' in ctx)) {
22
+ ctx = { ...ctx, 'jwt.claims.principal_id': ctx['jwt.claims.user_id'] };
23
+ }
24
+ origSetContext(ctx);
25
+ };
17
26
  const gqlContext = GraphQLTest(input, conn);
18
27
  await gqlContext.setup();
19
28
  const teardown = async () => {
@@ -17,6 +17,15 @@ const unwrap = (res) => {
17
17
  const createConnectionsBase = async (input, seedAdapters) => {
18
18
  const conn = await (0, pgsql_test_1.getConnections)(input, seedAdapters);
19
19
  const { pg, db, teardown: dbTeardown } = conn;
20
+ // Auto-derive principal_id from user_id on every setContext call
21
+ // (same behavior as constructive-test for pgsql-test clients).
22
+ const origSetContext = db.setContext.bind(db);
23
+ db.setContext = (ctx) => {
24
+ if (ctx['jwt.claims.user_id'] && !('jwt.claims.principal_id' in ctx)) {
25
+ ctx = { ...ctx, 'jwt.claims.principal_id': ctx['jwt.claims.user_id'] };
26
+ }
27
+ origSetContext(ctx);
28
+ };
20
29
  const gqlContext = (0, graphile_test_1.GraphQLTest)(input, conn);
21
30
  await gqlContext.setup();
22
31
  const teardown = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-test",
3
- "version": "4.24.0",
3
+ "version": "4.26.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "Constructive GraphQL Testing with all plugins loaded",
6
6
  "main": "index.js",
@@ -34,21 +34,21 @@
34
34
  "makage": "^0.3.0"
35
35
  },
36
36
  "dependencies": {
37
- "@constructive-io/graphql-codegen": "^4.49.0",
38
- "@constructive-io/graphql-env": "^3.13.1",
39
- "@constructive-io/graphql-query": "^3.29.0",
40
- "@constructive-io/graphql-types": "^3.12.1",
41
- "@pgpmjs/types": "^2.29.1",
37
+ "@constructive-io/graphql-codegen": "^4.50.0",
38
+ "@constructive-io/graphql-env": "^3.14.0",
39
+ "@constructive-io/graphql-query": "^3.30.0",
40
+ "@constructive-io/graphql-types": "^3.13.0",
41
+ "@pgpmjs/types": "^2.30.0",
42
42
  "grafast": "1.0.2",
43
43
  "graphile-build": "5.0.2",
44
44
  "graphile-build-pg": "5.0.2",
45
45
  "graphile-config": "1.0.1",
46
- "graphile-settings": "^5.10.0",
47
- "graphile-test": "^4.18.0",
46
+ "graphile-settings": "^5.11.0",
47
+ "graphile-test": "^4.19.0",
48
48
  "graphql": "16.13.0",
49
49
  "mock-req": "^0.2.0",
50
50
  "pg": "^8.21.0",
51
- "pgsql-test": "^4.17.0",
51
+ "pgsql-test": "^4.18.0",
52
52
  "postgraphile": "5.0.3",
53
53
  "typescript": "^5.0.0"
54
54
  },
@@ -59,5 +59,5 @@
59
59
  "constructive",
60
60
  "test"
61
61
  ],
62
- "gitHead": "8f3ad107babeed3220d680d7ee4be53738e6440d"
62
+ "gitHead": "958154492690368ffffef974122ea243c68055e2"
63
63
  }