hazo_notes 1.2.0 → 2.0.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 (59) hide show
  1. package/config/hazo_notes_config.ini +48 -0
  2. package/db_setup_postgres.sql +49 -0
  3. package/db_setup_sqlite.sql +22 -0
  4. package/dist/api/create_files_handler.d.ts +1 -1
  5. package/dist/api/create_files_handler.d.ts.map +1 -1
  6. package/dist/api/create_files_handler.js +196 -139
  7. package/dist/api/create_files_handler.js.map +1 -1
  8. package/dist/api/create_notes_handler.d.ts.map +1 -1
  9. package/dist/api/create_notes_handler.js +225 -162
  10. package/dist/api/create_notes_handler.js.map +1 -1
  11. package/dist/components/hazo_notes_entry.js +1 -1
  12. package/dist/components/hazo_notes_entry.js.map +1 -1
  13. package/dist/components/hazo_notes_file_preview.js +1 -1
  14. package/dist/components/hazo_notes_file_preview.js.map +1 -1
  15. package/dist/components/hazo_notes_icon.js +1 -1
  16. package/dist/components/hazo_notes_icon.js.map +1 -1
  17. package/dist/components/hazo_notes_panel.js +1 -1
  18. package/dist/components/hazo_notes_panel.js.map +1 -1
  19. package/dist/components/internal/sheet.js +1 -1
  20. package/dist/components/internal/sheet.js.map +1 -1
  21. package/dist/index.client.d.ts +0 -1
  22. package/dist/index.client.d.ts.map +1 -1
  23. package/dist/index.client.js +2 -2
  24. package/dist/index.client.js.map +1 -1
  25. package/dist/lib/config/hazo_notes_config.d.ts +125 -0
  26. package/dist/lib/config/hazo_notes_config.d.ts.map +1 -0
  27. package/dist/lib/config/hazo_notes_config.js +76 -0
  28. package/dist/lib/config/hazo_notes_config.js.map +1 -0
  29. package/dist/lib/config/index.d.ts +3 -0
  30. package/dist/lib/config/index.d.ts.map +1 -0
  31. package/dist/lib/config/index.js +2 -0
  32. package/dist/lib/config/index.js.map +1 -0
  33. package/dist/lib/config.d.ts +14 -15
  34. package/dist/lib/config.d.ts.map +1 -1
  35. package/dist/lib/config.js +45 -93
  36. package/dist/lib/config.js.map +1 -1
  37. package/dist/lib/index.d.ts +2 -0
  38. package/dist/lib/index.d.ts.map +1 -1
  39. package/dist/lib/index.js +1 -0
  40. package/dist/lib/index.js.map +1 -1
  41. package/dist/logger/server.d.ts +13 -9
  42. package/dist/logger/server.d.ts.map +1 -1
  43. package/dist/logger/server.js +21 -15
  44. package/dist/logger/server.js.map +1 -1
  45. package/dist/logger/types.d.ts +3 -2
  46. package/dist/logger/types.d.ts.map +1 -1
  47. package/dist/logger/types.js +2 -1
  48. package/dist/logger/types.js.map +1 -1
  49. package/dist/utils/index.d.ts +2 -1
  50. package/dist/utils/index.d.ts.map +1 -1
  51. package/dist/utils/index.js +2 -1
  52. package/dist/utils/index.js.map +1 -1
  53. package/package.json +26 -11
  54. package/dist/utils/cn.d.ts +0 -16
  55. package/dist/utils/cn.d.ts.map +0 -1
  56. package/dist/utils/cn.js +0 -19
  57. package/dist/utils/cn.js.map +0 -1
  58. package/migrations/001_create_hazo_notes_table.sql +0 -77
  59. package/migrations/002_grant_api_user_hazo_notes.sql +0 -24
@@ -1,27 +1,31 @@
1
1
  /**
2
2
  * Server-side logger management
3
- * Used for server-only code like config.ts
3
+ *
4
+ * Provides a default `hazo_notes` logger via hazo_core's createLogger
5
+ * with backward-compatible set_server_logger() / get_server_logger() API
6
+ * for consumers that wish to inject a custom logger.
4
7
  */
5
8
  import 'server-only';
6
9
  import type { Logger } from './types.js';
7
10
  /**
8
- * Set the logger instance for server-side code
9
- * Call this once during app initialization
11
+ * Set the logger instance for server-side code.
12
+ *
13
+ * Optional — by default hazo_notes uses createLogger('hazo_notes') from
14
+ * hazo_core, which auto-injects correlationId and env. Call this only if
15
+ * you need a custom logger implementation.
10
16
  *
11
17
  * @example
12
18
  * ```ts
13
- * // In your app initialization (e.g., instrumentation.ts)
14
- * import { createLogger } from 'hazo_logs';
19
+ * import { createLogger } from 'hazo_core';
15
20
  * import { set_server_logger } from 'hazo_notes/lib';
16
21
  *
17
- * const logger = createLogger('hazo_notes');
18
- * set_server_logger(logger);
22
+ * set_server_logger(createLogger('my_app'));
19
23
  * ```
20
24
  */
21
25
  export declare function set_server_logger(logger: Logger): void;
22
26
  /**
23
- * Get the current server logger instance
24
- * Returns no-op logger if none has been set
27
+ * Get the current server logger instance.
28
+ * Falls back to hazo_core's createLogger('hazo_notes') if none has been set.
25
29
  */
26
30
  export declare function get_server_logger(): Logger;
27
31
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/logger/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AASzC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/logger/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAQzC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C"}
@@ -1,36 +1,42 @@
1
1
  /**
2
2
  * Server-side logger management
3
- * Used for server-only code like config.ts
3
+ *
4
+ * Provides a default `hazo_notes` logger via hazo_core's createLogger
5
+ * with backward-compatible set_server_logger() / get_server_logger() API
6
+ * for consumers that wish to inject a custom logger.
4
7
  */
5
8
  import 'server-only';
6
- import { noop_logger } from './types.js';
7
- /**
8
- * Module-level logger instance for server-side code
9
- * Defaults to no-op logger
10
- */
11
- let server_logger = noop_logger;
9
+ import { createLogger } from 'hazo_core';
10
+ let server_logger = null;
11
+ function default_logger() {
12
+ return createLogger('hazo_notes');
13
+ }
12
14
  /**
13
- * Set the logger instance for server-side code
14
- * Call this once during app initialization
15
+ * Set the logger instance for server-side code.
16
+ *
17
+ * Optional — by default hazo_notes uses createLogger('hazo_notes') from
18
+ * hazo_core, which auto-injects correlationId and env. Call this only if
19
+ * you need a custom logger implementation.
15
20
  *
16
21
  * @example
17
22
  * ```ts
18
- * // In your app initialization (e.g., instrumentation.ts)
19
- * import { createLogger } from 'hazo_logs';
23
+ * import { createLogger } from 'hazo_core';
20
24
  * import { set_server_logger } from 'hazo_notes/lib';
21
25
  *
22
- * const logger = createLogger('hazo_notes');
23
- * set_server_logger(logger);
26
+ * set_server_logger(createLogger('my_app'));
24
27
  * ```
25
28
  */
26
29
  export function set_server_logger(logger) {
27
30
  server_logger = logger;
28
31
  }
29
32
  /**
30
- * Get the current server logger instance
31
- * Returns no-op logger if none has been set
33
+ * Get the current server logger instance.
34
+ * Falls back to hazo_core's createLogger('hazo_notes') if none has been set.
32
35
  */
33
36
  export function get_server_logger() {
37
+ if (!server_logger) {
38
+ server_logger = default_logger();
39
+ }
34
40
  return server_logger;
35
41
  }
36
42
  //# sourceMappingURL=server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/logger/server.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;;GAGG;AACH,IAAI,aAAa,GAAW,WAAW,CAAC;AAExC;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,aAAa,GAAG,MAAM,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,aAAa,CAAC;AACvB,CAAC"}
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/logger/server.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAGzC,IAAI,aAAa,GAAkB,IAAI,CAAC;AAExC,SAAS,cAAc;IACrB,OAAO,YAAY,CAAC,YAAY,CAAsB,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,aAAa,GAAG,MAAM,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,aAAa,GAAG,cAAc,EAAE,CAAC;IACnC,CAAC;IACD,OAAO,aAAa,CAAC;AACvB,CAAC"}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Logger type definitions for hazo_notes
3
- * Compatible with hazo_logs but does not require it as a dependency
3
+ * Compatible with hazo_logs and hazo_core logger
4
4
  */
5
5
  /**
6
- * Logger interface compatible with hazo_logs
6
+ * Logger interface compatible with hazo_logs and hazo_core
7
7
  * Consumers can provide any logger matching this interface
8
8
  */
9
9
  export interface Logger {
@@ -11,6 +11,7 @@ export interface Logger {
11
11
  warn(message: string, data?: Record<string, unknown>): void;
12
12
  info(message: string, data?: Record<string, unknown>): void;
13
13
  debug(message: string, data?: Record<string, unknown>): void;
14
+ trace?(message: string, data?: Record<string, unknown>): void;
14
15
  }
15
16
  /**
16
17
  * No-op logger that silently discards all log calls
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/logger/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC9D;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAKzB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/logger/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC5D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,KAAK,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC/D;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,MAMzB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Logger type definitions for hazo_notes
3
- * Compatible with hazo_logs but does not require it as a dependency
3
+ * Compatible with hazo_logs and hazo_core logger
4
4
  */
5
5
  /**
6
6
  * No-op logger that silently discards all log calls
@@ -11,5 +11,6 @@ export const noop_logger = {
11
11
  warn: () => { },
12
12
  info: () => { },
13
13
  debug: () => { },
14
+ trace: () => { },
14
15
  };
15
16
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/logger/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/logger/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAcH;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Utility functions for hazo_notes
3
+ *
4
+ * Note: `cn()` is provided by hazo_ui — import directly from there.
3
5
  */
4
- export { cn } from './cn.js';
5
6
  export { generate_file_no, file_to_base64, get_mime_type, is_allowed_file_type, is_image_file, format_file_size, parse_file_references, create_file_reference, validate_file, } from './file_utils.js';
6
7
  export { get_initials, get_avatar_color } from './avatar_utils.js';
7
8
  export { get_theme_classes } from './theme_utils.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Utility functions for hazo_notes
3
+ *
4
+ * Note: `cn()` is provided by hazo_ui — import directly from there.
3
5
  */
4
- export { cn } from './cn.js';
5
6
  export { generate_file_no, file_to_base64, get_mime_type, is_allowed_file_type, is_image_file, format_file_size, parse_file_references, create_file_reference, validate_file, } from './file_utils.js';
6
7
  export { get_initials, get_avatar_color } from './avatar_utils.js';
7
8
  export { get_theme_classes } from './theme_utils.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hazo_notes",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "Database-backed notes system with file attachment support for the hazo ecosystem",
5
5
  "type": "module",
6
6
  "main": "./dist/index.client.js",
@@ -35,7 +35,9 @@
35
35
  "files": [
36
36
  "dist",
37
37
  "templates",
38
- "migrations",
38
+ "db_setup_postgres.sql",
39
+ "db_setup_sqlite.sql",
40
+ "config",
39
41
  "README.md",
40
42
  "SETUP_CHECKLIST.md"
41
43
  ],
@@ -71,27 +73,30 @@
71
73
  "@radix-ui/react-dialog": "^1.0.5",
72
74
  "@radix-ui/react-popover": "^1.0.7",
73
75
  "clsx": "^2.1.1",
74
- "hazo_config": "^2.1.0",
75
76
  "server-only": "^0.0.1",
76
- "tailwind-merge": "^3.5.0"
77
+ "tailwind-merge": "^3.5.0",
78
+ "zod": "^3.23.8"
77
79
  },
78
80
  "devDependencies": {
79
81
  "@types/node": "^20.14.10",
80
82
  "@types/react": "^18.3.3",
81
83
  "@types/react-dom": "^18.3.0",
82
- "hazo_logs": "^1.0.13",
83
- "next": "^14.2.33",
84
+ "hazo_core": "^1.0.0",
85
+ "hazo_logs": "^2.0.1",
86
+ "next": "^16.0.10",
84
87
  "typescript": "^5.7.2"
85
88
  },
86
89
  "peerDependencies": {
87
- "hazo_auth": "^6.0.0",
88
- "hazo_connect": "^2.6.0",
89
- "hazo_logs": "^1.0.13",
90
- "next": ">=14.0.0",
90
+ "hazo_auth": "^9.0.0",
91
+ "hazo_connect": "^3.0.0",
92
+ "hazo_core": "^1.0.0",
93
+ "hazo_logs": "^2.0.0",
94
+ "hazo_ui": "^3.0.1",
95
+ "next": "^14.0.0 || ^16.0.0",
91
96
  "react": "^18.0.0 || ^19.0.0",
92
97
  "react-dom": "^18.0.0 || ^19.0.0",
93
98
  "react-icons": "^5.0.0",
94
- "tailwindcss": "^3.0.0 || ^4.0.0"
99
+ "tailwindcss": "^4.2.4"
95
100
  },
96
101
  "peerDependenciesMeta": {
97
102
  "hazo_auth": {
@@ -100,11 +105,21 @@
100
105
  "hazo_connect": {
101
106
  "optional": true
102
107
  },
108
+ "hazo_core": {
109
+ "optional": false
110
+ },
103
111
  "hazo_logs": {
104
112
  "optional": true
105
113
  },
114
+ "hazo_ui": {
115
+ "optional": true
116
+ },
106
117
  "react-icons": {
107
118
  "optional": true
108
119
  }
120
+ },
121
+ "engines": {
122
+ "node": ">=18.0.0",
123
+ "npm": ">=9.0.0"
109
124
  }
110
125
  }
@@ -1,16 +0,0 @@
1
- /**
2
- * Utility for merging Tailwind CSS classes
3
- */
4
- import { type ClassValue } from 'clsx';
5
- /**
6
- * Combines class names with Tailwind CSS merge support
7
- * Handles conditional classes and resolves Tailwind conflicts
8
- *
9
- * @example
10
- * ```tsx
11
- * cn('px-2 py-1', isActive && 'bg-blue-500', 'px-4')
12
- * // Result: 'py-1 bg-blue-500 px-4' (px-4 overrides px-2)
13
- * ```
14
- */
15
- export declare function cn(...inputs: ClassValue[]): string;
16
- //# sourceMappingURL=cn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.d.ts","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAG7C;;;;;;;;;GASG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
package/dist/utils/cn.js DELETED
@@ -1,19 +0,0 @@
1
- /**
2
- * Utility for merging Tailwind CSS classes
3
- */
4
- import { clsx } from 'clsx';
5
- import { twMerge } from 'tailwind-merge';
6
- /**
7
- * Combines class names with Tailwind CSS merge support
8
- * Handles conditional classes and resolves Tailwind conflicts
9
- *
10
- * @example
11
- * ```tsx
12
- * cn('px-2 py-1', isActive && 'bg-blue-500', 'px-4')
13
- * // Result: 'py-1 bg-blue-500 px-4' (px-4 overrides px-2)
14
- * ```
15
- */
16
- export function cn(...inputs) {
17
- return twMerge(clsx(inputs));
18
- }
19
- //# sourceMappingURL=cn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/utils/cn.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;GASG;AACH,MAAM,UAAU,EAAE,CAAC,GAAG,MAAoB;IACxC,OAAO,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/B,CAAC"}
@@ -1,77 +0,0 @@
1
- -- Migration: Create hazo_notes table
2
- -- Version: 001
3
- -- Description: Initial table creation for notes system with JSONB storage
4
- -- Compatible with: PostgreSQL 13+, SQLite 3.38+ (with JSON1 extension)
5
-
6
- -- ============================================================================
7
- -- PostgreSQL Version
8
- -- ============================================================================
9
-
10
- -- Create the hazo_notes table
11
- CREATE TABLE IF NOT EXISTS hazo_notes (
12
- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
13
- ref_id UUID NOT NULL,
14
- note JSONB NOT NULL DEFAULT '[]'::jsonb,
15
- created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
16
- changed_at TIMESTAMPTZ,
17
- note_count INTEGER NOT NULL DEFAULT 0
18
- );
19
-
20
- -- Create index on ref_id for efficient lookups
21
- CREATE INDEX IF NOT EXISTS idx_hazo_notes_ref_id ON hazo_notes(ref_id);
22
-
23
- -- Add comments for documentation
24
- COMMENT ON TABLE hazo_notes IS 'Stores notes linked to any entity via ref_id. Notes are stored as JSONB array with user attribution and optional file attachments.';
25
- COMMENT ON COLUMN hazo_notes.id IS 'Primary key UUID';
26
- COMMENT ON COLUMN hazo_notes.ref_id IS 'UUID reference to the parent entity (e.g., form field, document, task)';
27
- COMMENT ON COLUMN hazo_notes.note IS 'JSONB array of note entries: [{userid, created_at, note_text, note_files}]';
28
- COMMENT ON COLUMN hazo_notes.created_at IS 'Timestamp when the notes row was first created';
29
- COMMENT ON COLUMN hazo_notes.changed_at IS 'Timestamp of the last modification to the notes';
30
- COMMENT ON COLUMN hazo_notes.note_count IS 'Denormalized count of notes for quick access without parsing JSONB';
31
-
32
- -- ============================================================================
33
- -- SQLite Version (for test-app)
34
- -- Run this in SQLite instead of the PostgreSQL version above
35
- -- ============================================================================
36
-
37
- /*
38
- -- SQLite version (uncomment to use):
39
-
40
- CREATE TABLE IF NOT EXISTS hazo_notes (
41
- id TEXT PRIMARY KEY,
42
- ref_id TEXT NOT NULL,
43
- note TEXT NOT NULL DEFAULT '[]',
44
- created_at TEXT NOT NULL DEFAULT (datetime('now')),
45
- changed_at TEXT,
46
- note_count INTEGER NOT NULL DEFAULT 0
47
- );
48
-
49
- CREATE INDEX IF NOT EXISTS idx_hazo_notes_ref_id ON hazo_notes(ref_id);
50
- */
51
-
52
- -- ============================================================================
53
- -- Note Entry JSONB Schema Reference
54
- -- ============================================================================
55
- /*
56
- Each element in the `note` JSONB array follows this structure:
57
-
58
- {
59
- "userid": "550e8400-e29b-41d4-a716-446655440000",
60
- "created_at": "2026-01-07T12:30:00.000Z",
61
- "note_text": "This is the note content. See attachment: <<attach:0001>>",
62
- "note_files": [
63
- {
64
- "file_no": "0001",
65
- "embed_type": "attachment",
66
- "filename": "document.pdf",
67
- "filedata": "base64_encoded_content_or_file_path",
68
- "mime_type": "application/pdf",
69
- "file_size": 12345
70
- }
71
- ]
72
- }
73
-
74
- File references in note_text:
75
- - <<embed:0001>> - Renders file inline (images displayed directly)
76
- - <<attach:0001>> - Renders as downloadable link
77
- */
@@ -1,24 +0,0 @@
1
- -- Migration: Grant api_user privileges on hazo_notes
2
- -- Version: 002
3
- -- Description: Allow the PostgREST role (api_user) to read/write hazo_notes.
4
- -- Without this grant, PostgREST returns 42501 / "permission denied
5
- -- for table hazo_notes" and the API surfaces a generic 500.
6
- -- Compatible with: PostgreSQL only. SQLite has no role system, skip there.
7
-
8
- -- ============================================================================
9
- -- PostgreSQL Version
10
- -- ============================================================================
11
-
12
- GRANT SELECT, INSERT, UPDATE, DELETE ON hazo_notes TO api_user;
13
-
14
- -- Idempotent re-runs are safe: GRANT on an already-granted privilege is a no-op.
15
-
16
- -- ============================================================================
17
- -- Verification
18
- -- ============================================================================
19
- --
20
- -- After applying, this should return [] (not 401 / permission denied):
21
- --
22
- -- curl -H "Authorization: Bearer <api_user JWT>" \
23
- -- "$POSTGREST_URL/hazo_notes?limit=1"
24
- --