hazo_audit 2.0.1 → 2.1.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.
Files changed (58) hide show
  1. package/CHANGE_LOG.md +80 -0
  2. package/README.md +57 -1
  3. package/config/hazo_audit_config.ini.sample +28 -0
  4. package/db_setup_postgres.sql +76 -0
  5. package/db_setup_sqlite.sql +72 -0
  6. package/dist/client/AuditViewer.js +1 -1
  7. package/dist/client/FieldAuditIcon.d.ts.map +1 -1
  8. package/dist/client/FieldAuditIcon.js +3 -3
  9. package/dist/client/FieldAuditIcon.js.map +1 -1
  10. package/dist/client/FieldAuditTrail.d.ts.map +1 -1
  11. package/dist/client/FieldAuditTrail.js +72 -9
  12. package/dist/client/FieldAuditTrail.js.map +1 -1
  13. package/dist/client/RevertConfirmDialog.js +1 -1
  14. package/dist/index.d.ts +43 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +9 -0
  17. package/dist/index.js.map +1 -1
  18. package/dist/lib/config/hazo_audit_config.d.ts +99 -0
  19. package/dist/lib/config/hazo_audit_config.d.ts.map +1 -0
  20. package/dist/lib/config/hazo_audit_config.js +67 -0
  21. package/dist/lib/config/hazo_audit_config.js.map +1 -0
  22. package/dist/nextjs/index.d.ts +12 -0
  23. package/dist/nextjs/index.d.ts.map +1 -1
  24. package/dist/nextjs/index.js +307 -218
  25. package/dist/nextjs/index.js.map +1 -1
  26. package/dist/server/audited_crud.js +3 -3
  27. package/dist/server/audited_crud.js.map +1 -1
  28. package/dist/server/context.js +3 -3
  29. package/dist/server/context.js.map +1 -1
  30. package/dist/server/diff.js +11 -3
  31. package/dist/server/diff.js.map +1 -1
  32. package/dist/server/errors.d.ts +10 -1
  33. package/dist/server/errors.d.ts.map +1 -1
  34. package/dist/server/errors.js +16 -2
  35. package/dist/server/errors.js.map +1 -1
  36. package/dist/server/intent.js +3 -3
  37. package/dist/server/intent.js.map +1 -1
  38. package/dist/server/outbox.js +2 -2
  39. package/dist/server/outbox.js.map +1 -1
  40. package/dist/server/worker.d.ts +7 -7
  41. package/dist/server/worker.d.ts.map +1 -1
  42. package/dist/server/worker.js +60 -15
  43. package/dist/server/worker.js.map +1 -1
  44. package/dist/server/wrap.js +2 -2
  45. package/dist/server/wrap.js.map +1 -1
  46. package/dist/utils/logger.d.ts +25 -0
  47. package/dist/utils/logger.d.ts.map +1 -0
  48. package/dist/utils/logger.js +42 -0
  49. package/dist/utils/logger.js.map +1 -0
  50. package/dist/utils/uuid.d.ts +19 -0
  51. package/dist/utils/uuid.d.ts.map +1 -0
  52. package/dist/utils/uuid.js +22 -0
  53. package/dist/utils/uuid.js.map +1 -0
  54. package/package.json +36 -21
  55. package/dist/client/cn.d.ts +0 -3
  56. package/dist/client/cn.d.ts.map +0 -1
  57. package/dist/client/cn.js +0 -6
  58. package/dist/client/cn.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;GAIG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * UUID helper for hazo_audit.
3
+ *
4
+ * Uses hazo_core's `generateRequestId()` and strips the `req_` prefix so the
5
+ * resulting value fits a PostgreSQL UUID column. The `req_<uuid>` form is
6
+ * preserved for the correlation_id that flows through logs and HTTP headers
7
+ * via hazo_core's withContext / fetchWithRequestId.
8
+ *
9
+ * Per the workspace convention (Wave 2, D-015): never introduce new
10
+ * `node:crypto` randomUUID call sites — route everything through hazo_core
11
+ * so IDs stay traceable and tests can stub IDs deterministically.
12
+ */
13
+ import { generateRequestId } from 'hazo_core';
14
+ /**
15
+ * Generate a bare UUID suitable for a PostgreSQL UUID column or a SQLite
16
+ * TEXT primary key. Same shape as a v4 UUID, but routed through hazo_core
17
+ * so the generator stays consistent across the workspace.
18
+ */
19
+ export function generateUUID() {
20
+ return generateRequestId().slice(4);
21
+ }
22
+ //# sourceMappingURL=uuid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/utils/uuid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE9C;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,iBAAiB,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_audit",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "Field-level audit trail for hazo_connect-backed apps. Attach to any adapter via wrapWithAudit() to auto-capture writes; ships worker, Next.js routes, and React UI primitives.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -31,6 +31,8 @@
31
31
  "dist",
32
32
  "bin",
33
33
  "config",
34
+ "db_setup_postgres.sql",
35
+ "db_setup_sqlite.sql",
34
36
  "migrations",
35
37
  "README.md",
36
38
  "SETUP_CHECKLIST.md",
@@ -44,7 +46,7 @@
44
46
  "clean": "rm -rf dist",
45
47
  "prebuild": "npm run clean",
46
48
  "prepublishOnly": "npm run build",
47
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
49
+ "test": "node --experimental-vm-modules ../node_modules/jest/bin/jest.js"
48
50
  },
49
51
  "keywords": [
50
52
  "audit",
@@ -57,9 +59,6 @@
57
59
  "nextjs"
58
60
  ],
59
61
  "author": "Pubs Abayasiri",
60
- "engines": {
61
- "node": ">=18.0.0"
62
- },
63
62
  "dependencies": {
64
63
  "clsx": "^2.1.1",
65
64
  "ini": "^4.1.0",
@@ -68,22 +67,35 @@
68
67
  "tailwind-merge": "^3.5.0"
69
68
  },
70
69
  "peerDependencies": {
71
- "hazo_auth": "^6.0.0",
72
- "hazo_config": "^2.1.0",
73
- "hazo_connect": "^2.6.0",
74
- "hazo_logs": "^1.0.13",
75
- "hazo_ui": "^2.8.0",
70
+ "hazo_auth": "^9.0.0",
71
+ "hazo_config": "^2.1.5",
72
+ "hazo_connect": "^3.0.0",
73
+ "hazo_core": "^1.0.0",
74
+ "hazo_logs": "^2.0.0",
75
+ "hazo_ui": "^3.1.0",
76
76
  "next": "^14.0.0 || ^16.0.0",
77
77
  "react": "^18.0.0 || ^19.0.0",
78
78
  "react-dom": "^18.0.0 || ^19.0.0"
79
79
  },
80
80
  "peerDependenciesMeta": {
81
- "hazo_auth": { "optional": true },
82
- "hazo_logs": { "optional": true },
83
- "hazo_ui": { "optional": true },
84
- "next": { "optional": true },
85
- "react": { "optional": true },
86
- "react-dom": { "optional": true }
81
+ "hazo_auth": {
82
+ "optional": true
83
+ },
84
+ "hazo_logs": {
85
+ "optional": true
86
+ },
87
+ "hazo_ui": {
88
+ "optional": true
89
+ },
90
+ "next": {
91
+ "optional": true
92
+ },
93
+ "react": {
94
+ "optional": true
95
+ },
96
+ "react-dom": {
97
+ "optional": true
98
+ }
87
99
  },
88
100
  "devDependencies": {
89
101
  "@types/ini": "^4.1.1",
@@ -91,16 +103,19 @@
91
103
  "@types/node": "^20.14.10",
92
104
  "@types/react": "^18.3.3",
93
105
  "@types/react-dom": "^18.3.0",
94
- "hazo_auth": "^6.0.0",
95
- "hazo_config": "^2.1.0",
96
- "hazo_connect": "^2.7.0",
97
- "hazo_logs": "^1.0.13",
106
+ "hazo_auth": "^9.0.0",
107
+ "hazo_config": "^2.1.6",
108
+ "hazo_connect": "^3.0.0",
109
+ "hazo_core": "^1.0.0",
110
+ "hazo_logs": "^2.0.1",
111
+ "hazo_ui": "^3.1.0",
98
112
  "jest": "^30.2.0",
99
113
  "jest-environment-node": "^30.2.0",
100
114
  "next": "^14.2.33",
101
115
  "react": "^18.3.1",
102
116
  "react-dom": "^18.3.1",
103
117
  "ts-jest": "^29.4.5",
104
- "typescript": "^5.7.2"
118
+ "typescript": "^5.7.2",
119
+ "zod": "^3.23.8"
105
120
  }
106
121
  }
@@ -1,3 +0,0 @@
1
- import { type ClassValue } from 'clsx';
2
- export declare function cn(...inputs: ClassValue[]): string;
3
- //# sourceMappingURL=cn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/client/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
package/dist/client/cn.js DELETED
@@ -1,6 +0,0 @@
1
- import { clsx } from 'clsx';
2
- import { twMerge } from 'tailwind-merge';
3
- export function cn(...inputs) {
4
- return twMerge(clsx(inputs));
5
- }
6
- //# sourceMappingURL=cn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/client/cn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}