@pgpm/jwt-claims 0.15.3 → 0.15.4

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/Makefile CHANGED
@@ -1,5 +1,5 @@
1
1
  EXTENSION = pgpm-jwt-claims
2
- DATA = sql/pgpm-jwt-claims--0.15.2.sql
2
+ DATA = sql/pgpm-jwt-claims--0.15.3.sql
3
3
 
4
4
  PG_CONFIG = pg_config
5
5
  PGXS := $(shell $(PG_CONFIG) --pgxs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpm/jwt-claims",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "description": "JWT claim handling and validation functions",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "contributors": [
@@ -21,11 +21,11 @@
21
21
  "test:watch": "jest --watch"
22
22
  },
23
23
  "devDependencies": {
24
- "pgpm": "^1.0.0"
24
+ "pgpm": "^1.2.2"
25
25
  },
26
26
  "dependencies": {
27
- "@pgpm/types": "0.15.3",
28
- "@pgpm/verify": "0.15.3"
27
+ "@pgpm/types": "0.15.4",
28
+ "@pgpm/verify": "0.15.4"
29
29
  },
30
30
  "repository": {
31
31
  "type": "git",
@@ -35,5 +35,5 @@
35
35
  "bugs": {
36
36
  "url": "https://github.com/constructive-io/pgpm-modules/issues"
37
37
  },
38
- "gitHead": "187ed37f6b731132fe930acf5b5996b1e63ecca0"
38
+ "gitHead": "aad0dbef0336d6c18d027120ef9addc418822edd"
39
39
  }
@@ -1,6 +1,6 @@
1
1
  # pgpm-jwt-claims extension
2
2
  comment = 'pgpm-jwt-claims extension'
3
- default_version = '0.15.2'
3
+ default_version = '0.15.3'
4
4
  module_pathname = '$libdir/pgpm-jwt-claims'
5
5
  requires = 'plpgsql,uuid-ossp,pgpm-types,pgpm-verify'
6
6
  relocatable = false
@@ -1,25 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`get values 1`] = `
4
- {
5
- "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36",
6
- }
7
- `;
8
-
9
- exports[`get values 2`] = `
10
- {
11
- "ip_address": "127.0.0.1",
12
- }
13
- `;
14
-
15
- exports[`get values 3`] = `
16
- {
17
- "database_id": "44744c94-93cf-425a-b524-ce6f1466e327",
18
- }
19
- `;
20
-
21
- exports[`get values 4`] = `
22
- {
23
- "user_id": "b9d22af1-62c7-43a5-b8c4-50630bbd4962",
24
- }
25
- `;
@@ -1,54 +0,0 @@
1
- import { getConnections, PgTestClient } from 'pgsql-test';
2
-
3
- let pg: PgTestClient;
4
- let teardown: () => Promise<void>;
5
-
6
- const jwt = {
7
- user_id: 'b9d22af1-62c7-43a5-b8c4-50630bbd4962',
8
- database_id: '44744c94-93cf-425a-b524-ce6f1466e327'
9
- };
10
-
11
- beforeAll(async () => {
12
- ({ pg, teardown } = await getConnections());
13
- });
14
-
15
- afterAll(async () => {
16
- await teardown?.();
17
- });
18
-
19
- it('get values', async () => {
20
- await pg.any(`BEGIN`);
21
- await pg.any(
22
- `SELECT
23
- set_config('jwt.claims.user_agent', $1, true),
24
- set_config('jwt.claims.ip_address', $2, true),
25
- set_config('jwt.claims.database_id', $3, true),
26
- set_config('jwt.claims.user_id', $4, true)
27
- `,
28
- [
29
- 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36',
30
- '127.0.0.1',
31
- jwt.database_id,
32
- jwt.user_id
33
- ]
34
- );
35
-
36
- const { user_agent } = await pg.one(
37
- `select jwt_public.current_user_agent() as user_agent`
38
- );
39
- const { ip_address } = await pg.one(
40
- `select jwt_public.current_ip_address() as ip_address`
41
- );
42
- const { database_id } = await pg.one(
43
- `select jwt_private.current_database_id() as database_id`
44
- );
45
- const { user_id } = await pg.one(
46
- `select jwt_public.current_user_id() as user_id`
47
- );
48
- await pg.any(`ROLLBACK`);
49
-
50
- expect({ user_agent }).toMatchSnapshot();
51
- expect({ ip_address }).toMatchSnapshot();
52
- expect({ database_id }).toMatchSnapshot();
53
- expect({ user_id }).toMatchSnapshot();
54
- });