@pgpm/stamps 0.15.2 → 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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpm/stamps",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.4",
|
|
4
4
|
"description": "Timestamp utilities and audit trail functions for PostgreSQL",
|
|
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
|
"dependencies": {
|
|
24
|
-
"@pgpm/jwt-claims": "0.15.
|
|
25
|
-
"@pgpm/verify": "0.15.
|
|
24
|
+
"@pgpm/jwt-claims": "0.15.4",
|
|
25
|
+
"@pgpm/verify": "0.15.4"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"pgpm": "^1.
|
|
28
|
+
"pgpm": "^1.2.2"
|
|
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": "
|
|
38
|
+
"gitHead": "aad0dbef0336d6c18d027120ef9addc418822edd"
|
|
39
39
|
}
|
package/pgpm-stamps.control
CHANGED
package/__tests__/stamps.test.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { getConnections, PgTestClient } from 'pgsql-test';
|
|
2
|
-
|
|
3
|
-
let pg: PgTestClient;
|
|
4
|
-
let teardown: () => Promise<void>;
|
|
5
|
-
|
|
6
|
-
beforeAll(async () => {
|
|
7
|
-
({ pg, teardown } = await getConnections());
|
|
8
|
-
|
|
9
|
-
await pg.any(`
|
|
10
|
-
CREATE TABLE public.test_stamps (
|
|
11
|
-
id serial PRIMARY KEY,
|
|
12
|
-
name text,
|
|
13
|
-
created_at timestamptz,
|
|
14
|
-
updated_at timestamptz,
|
|
15
|
-
created_by uuid,
|
|
16
|
-
updated_by uuid
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
CREATE TRIGGER set_stamps
|
|
20
|
-
BEFORE INSERT OR UPDATE ON public.test_stamps
|
|
21
|
-
FOR EACH ROW
|
|
22
|
-
EXECUTE FUNCTION stamps.timestamps();
|
|
23
|
-
|
|
24
|
-
CREATE TRIGGER set_peoplestamps
|
|
25
|
-
BEFORE INSERT OR UPDATE ON public.test_stamps
|
|
26
|
-
FOR EACH ROW
|
|
27
|
-
EXECUTE FUNCTION stamps.peoplestamps();
|
|
28
|
-
`);
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
afterAll(async () => {
|
|
32
|
-
try {
|
|
33
|
-
await teardown();
|
|
34
|
-
} catch (e) {
|
|
35
|
-
console.error('Teardown failed:', e);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
beforeEach(() => pg.beforeEach());
|
|
40
|
-
afterEach(() => pg.afterEach());
|
|
41
|
-
|
|
42
|
-
it('applies timestamps and peoplestamps', async () => {
|
|
43
|
-
await pg.setContext({ 'jwt.claims.user_id': '00000000-0000-0000-0000-000000000001' });
|
|
44
|
-
|
|
45
|
-
const insertRes = await pg.one(
|
|
46
|
-
`INSERT INTO public.test_stamps (name) VALUES ($1) RETURNING *`,
|
|
47
|
-
['Alice']
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
expect(insertRes.created_at).toBeTruthy();
|
|
51
|
-
expect(insertRes.updated_at).toBeTruthy();
|
|
52
|
-
expect(insertRes.created_by).toBe('00000000-0000-0000-0000-000000000001');
|
|
53
|
-
expect(insertRes.updated_by).toBe('00000000-0000-0000-0000-000000000001');
|
|
54
|
-
});
|
|
File without changes
|