hazo_notes 1.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.
- package/README.md +661 -0
- package/SETUP_CHECKLIST.md +453 -0
- package/dist/api/create_files_handler.d.ts +42 -0
- package/dist/api/create_files_handler.d.ts.map +1 -0
- package/dist/api/create_files_handler.js +213 -0
- package/dist/api/create_files_handler.js.map +1 -0
- package/dist/api/create_notes_handler.d.ts +50 -0
- package/dist/api/create_notes_handler.d.ts.map +1 -0
- package/dist/api/create_notes_handler.js +242 -0
- package/dist/api/create_notes_handler.js.map +1 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- package/dist/components/hazo_notes_entry.d.ts +6 -0
- package/dist/components/hazo_notes_entry.d.ts.map +1 -0
- package/dist/components/hazo_notes_entry.js +69 -0
- package/dist/components/hazo_notes_entry.js.map +1 -0
- package/dist/components/hazo_notes_file_preview.d.ts +16 -0
- package/dist/components/hazo_notes_file_preview.d.ts.map +1 -0
- package/dist/components/hazo_notes_file_preview.js +77 -0
- package/dist/components/hazo_notes_file_preview.js.map +1 -0
- package/dist/components/hazo_notes_icon.d.ts +6 -0
- package/dist/components/hazo_notes_icon.d.ts.map +1 -0
- package/dist/components/hazo_notes_icon.js +208 -0
- package/dist/components/hazo_notes_icon.js.map +1 -0
- package/dist/components/hazo_notes_panel.d.ts +6 -0
- package/dist/components/hazo_notes_panel.d.ts.map +1 -0
- package/dist/components/hazo_notes_panel.js +197 -0
- package/dist/components/hazo_notes_panel.js.map +1 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +8 -0
- package/dist/components/index.js.map +1 -0
- package/dist/hooks/index.d.ts +8 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +6 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use_notes.d.ts +46 -0
- package/dist/hooks/use_notes.d.ts.map +1 -0
- package/dist/hooks/use_notes.js +146 -0
- package/dist/hooks/use_notes.js.map +1 -0
- package/dist/hooks/use_notes_file_upload.d.ts +52 -0
- package/dist/hooks/use_notes_file_upload.d.ts.map +1 -0
- package/dist/hooks/use_notes_file_upload.js +125 -0
- package/dist/hooks/use_notes_file_upload.js.map +1 -0
- package/dist/index.client.d.ts +16 -0
- package/dist/index.client.d.ts.map +1 -0
- package/dist/index.client.js +18 -0
- package/dist/index.client.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/config.d.ts +31 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +123 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/index.d.ts +6 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +6 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/logger/context.d.ts +49 -0
- package/dist/logger/context.d.ts.map +1 -0
- package/dist/logger/context.js +45 -0
- package/dist/logger/context.js.map +1 -0
- package/dist/logger/index.d.ts +9 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +7 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/server.d.ts +27 -0
- package/dist/logger/server.d.ts.map +1 -0
- package/dist/logger/server.js +36 -0
- package/dist/logger/server.js.map +1 -0
- package/dist/logger/types.d.ts +20 -0
- package/dist/logger/types.d.ts.map +1 -0
- package/dist/logger/types.js +15 -0
- package/dist/logger/types.js.map +1 -0
- package/dist/types/index.d.ts +267 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/cn.d.ts +16 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +19 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/file_utils.d.ts +51 -0
- package/dist/utils/file_utils.d.ts.map +1 -0
- package/dist/utils/file_utils.js +128 -0
- package/dist/utils/file_utils.js.map +1 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +6 -0
- package/dist/utils/index.js.map +1 -0
- package/migrations/001_create_hazo_notes_table.sql +77 -0
- package/package.json +119 -0
- package/templates/config/hazo_notes_config.ini +43 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React Context for client-side logger injection
|
|
3
|
+
* Allows consuming apps to provide their own logger instance
|
|
4
|
+
*/
|
|
5
|
+
import { type ReactNode } from 'react';
|
|
6
|
+
import type { Logger } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Props for LoggerProvider
|
|
9
|
+
*/
|
|
10
|
+
export interface LoggerProviderProps {
|
|
11
|
+
/**
|
|
12
|
+
* Logger instance to provide to child components
|
|
13
|
+
* If not provided, a no-op logger is used
|
|
14
|
+
*/
|
|
15
|
+
logger?: Logger;
|
|
16
|
+
/**
|
|
17
|
+
* Child components
|
|
18
|
+
*/
|
|
19
|
+
children: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Provider component for injecting logger into client components
|
|
23
|
+
* Wrap your app or component tree with this provider to enable logging
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* import { createClientLogger } from 'hazo_logs/ui';
|
|
28
|
+
* import { LoggerProvider } from 'hazo_notes';
|
|
29
|
+
*
|
|
30
|
+
* const logger = createClientLogger({ packageName: 'my_app' });
|
|
31
|
+
*
|
|
32
|
+
* <LoggerProvider logger={logger}>
|
|
33
|
+
* <MyApp />
|
|
34
|
+
* </LoggerProvider>
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare function LoggerProvider({ logger, children }: LoggerProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* Hook to access the logger from context
|
|
40
|
+
* Returns no-op logger if no provider is found
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```tsx
|
|
44
|
+
* const logger = use_logger();
|
|
45
|
+
* logger.debug('Component mounted', { ref_id: 'my_note_ref' });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare function use_logger(): Logger;
|
|
49
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/logger/context.tsx"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,OAAc,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAQzC;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAMvE;AAED;;;;;;;;;GASG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* React Context for client-side logger injection
|
|
5
|
+
* Allows consuming apps to provide their own logger instance
|
|
6
|
+
*/
|
|
7
|
+
import { createContext, useContext } from 'react';
|
|
8
|
+
import { noop_logger } from './types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Context for providing logger to client components
|
|
11
|
+
*/
|
|
12
|
+
const LoggerContext = createContext(noop_logger);
|
|
13
|
+
/**
|
|
14
|
+
* Provider component for injecting logger into client components
|
|
15
|
+
* Wrap your app or component tree with this provider to enable logging
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { createClientLogger } from 'hazo_logs/ui';
|
|
20
|
+
* import { LoggerProvider } from 'hazo_notes';
|
|
21
|
+
*
|
|
22
|
+
* const logger = createClientLogger({ packageName: 'my_app' });
|
|
23
|
+
*
|
|
24
|
+
* <LoggerProvider logger={logger}>
|
|
25
|
+
* <MyApp />
|
|
26
|
+
* </LoggerProvider>
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export function LoggerProvider({ logger, children }) {
|
|
30
|
+
return (_jsx(LoggerContext.Provider, { value: logger || noop_logger, children: children }));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Hook to access the logger from context
|
|
34
|
+
* Returns no-op logger if no provider is found
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```tsx
|
|
38
|
+
* const logger = use_logger();
|
|
39
|
+
* logger.debug('Component mounted', { ref_id: 'my_note_ref' });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function use_logger() {
|
|
43
|
+
return useContext(LoggerContext);
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/logger/context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;GAGG;AAEH,OAAc,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,MAAM,aAAa,GAAG,aAAa,CAAS,WAAW,CAAC,CAAC;AAkBzD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAuB;IACtE,OAAO,CACL,KAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,IAAI,WAAW,YACjD,QAAQ,GACc,CAC1B,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,UAAU;IACxB,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger utilities for hazo_notes
|
|
3
|
+
* Provides injectable logging for client components
|
|
4
|
+
*/
|
|
5
|
+
export type { Logger } from './types.js';
|
|
6
|
+
export { noop_logger } from './types.js';
|
|
7
|
+
export { LoggerProvider, use_logger } from './context.js';
|
|
8
|
+
export type { LoggerProviderProps } from './context.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1D,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side logger management
|
|
3
|
+
* Used for server-only code like config.ts
|
|
4
|
+
*/
|
|
5
|
+
import 'server-only';
|
|
6
|
+
import type { Logger } from './types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Set the logger instance for server-side code
|
|
9
|
+
* Call this once during app initialization
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* // In your app initialization (e.g., instrumentation.ts)
|
|
14
|
+
* import { createLogger } from 'hazo_logs';
|
|
15
|
+
* import { set_server_logger } from 'hazo_notes/lib';
|
|
16
|
+
*
|
|
17
|
+
* const logger = createLogger('hazo_notes');
|
|
18
|
+
* set_server_logger(logger);
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function set_server_logger(logger: Logger): void;
|
|
22
|
+
/**
|
|
23
|
+
* Get the current server logger instance
|
|
24
|
+
* Returns no-op logger if none has been set
|
|
25
|
+
*/
|
|
26
|
+
export declare function get_server_logger(): Logger;
|
|
27
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side logger management
|
|
3
|
+
* Used for server-only code like config.ts
|
|
4
|
+
*/
|
|
5
|
+
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;
|
|
12
|
+
/**
|
|
13
|
+
* Set the logger instance for server-side code
|
|
14
|
+
* Call this once during app initialization
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* // In your app initialization (e.g., instrumentation.ts)
|
|
19
|
+
* import { createLogger } from 'hazo_logs';
|
|
20
|
+
* import { set_server_logger } from 'hazo_notes/lib';
|
|
21
|
+
*
|
|
22
|
+
* const logger = createLogger('hazo_notes');
|
|
23
|
+
* set_server_logger(logger);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export function set_server_logger(logger) {
|
|
27
|
+
server_logger = logger;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Get the current server logger instance
|
|
31
|
+
* Returns no-op logger if none has been set
|
|
32
|
+
*/
|
|
33
|
+
export function get_server_logger() {
|
|
34
|
+
return server_logger;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger type definitions for hazo_notes
|
|
3
|
+
* Compatible with hazo_logs but does not require it as a dependency
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Logger interface compatible with hazo_logs
|
|
7
|
+
* Consumers can provide any logger matching this interface
|
|
8
|
+
*/
|
|
9
|
+
export interface Logger {
|
|
10
|
+
error(message: string, data?: Record<string, unknown>): void;
|
|
11
|
+
warn(message: string, data?: Record<string, unknown>): void;
|
|
12
|
+
info(message: string, data?: Record<string, unknown>): void;
|
|
13
|
+
debug(message: string, data?: Record<string, unknown>): void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* No-op logger that silently discards all log calls
|
|
17
|
+
* Used as default when no logger is provided
|
|
18
|
+
*/
|
|
19
|
+
export declare const noop_logger: Logger;
|
|
20
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger type definitions for hazo_notes
|
|
3
|
+
* Compatible with hazo_logs but does not require it as a dependency
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* No-op logger that silently discards all log calls
|
|
7
|
+
* Used as default when no logger is provided
|
|
8
|
+
*/
|
|
9
|
+
export const noop_logger = {
|
|
10
|
+
error: () => { },
|
|
11
|
+
warn: () => { },
|
|
12
|
+
info: () => { },
|
|
13
|
+
debug: () => { },
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for hazo_notes package
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* File attachment stored with a note
|
|
6
|
+
*/
|
|
7
|
+
export interface NoteFile {
|
|
8
|
+
/** Reference ID used in note_text (e.g., "0001") */
|
|
9
|
+
file_no: string;
|
|
10
|
+
/** How to display: embed inline or as downloadable attachment */
|
|
11
|
+
embed_type: 'embed' | 'attachment';
|
|
12
|
+
/** Original filename */
|
|
13
|
+
filename: string;
|
|
14
|
+
/** Base64 data OR file path (based on storage mode) */
|
|
15
|
+
filedata: string;
|
|
16
|
+
/** MIME type for rendering */
|
|
17
|
+
mime_type?: string;
|
|
18
|
+
/** Size in bytes */
|
|
19
|
+
file_size?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Note entry as stored in database JSONB
|
|
23
|
+
*/
|
|
24
|
+
export interface NoteEntryDB {
|
|
25
|
+
/** UUID of user who created the note */
|
|
26
|
+
userid: string;
|
|
27
|
+
/** ISO timestamp when the note was created */
|
|
28
|
+
created_at: string;
|
|
29
|
+
/** Note content with optional embed/attach references */
|
|
30
|
+
note_text: string;
|
|
31
|
+
/** Optional array of attached files */
|
|
32
|
+
note_files?: NoteFile[];
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Note entry enriched with user profile data (for display)
|
|
36
|
+
*/
|
|
37
|
+
export interface NoteEntry extends NoteEntryDB {
|
|
38
|
+
/** User's display name */
|
|
39
|
+
user_name: string;
|
|
40
|
+
/** User's email address */
|
|
41
|
+
user_email: string;
|
|
42
|
+
/** User's avatar URL */
|
|
43
|
+
user_avatar?: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Database row structure for hazo_notes table
|
|
47
|
+
*/
|
|
48
|
+
export interface HazoNotesRow {
|
|
49
|
+
/** UUID primary key */
|
|
50
|
+
id: string;
|
|
51
|
+
/** Reference to parent entity (e.g., form field, document) */
|
|
52
|
+
ref_id: string;
|
|
53
|
+
/** JSONB array of note entries */
|
|
54
|
+
note: NoteEntryDB[];
|
|
55
|
+
/** Row creation timestamp */
|
|
56
|
+
created_at: string;
|
|
57
|
+
/** Last modification timestamp */
|
|
58
|
+
changed_at?: string;
|
|
59
|
+
/** Denormalized count of notes */
|
|
60
|
+
note_count: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Input for creating a new note via API
|
|
64
|
+
*/
|
|
65
|
+
export interface NewNoteInput {
|
|
66
|
+
/** Note text content */
|
|
67
|
+
note_text: string;
|
|
68
|
+
/** Optional file attachments */
|
|
69
|
+
note_files?: NoteFile[];
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* User information for note attribution
|
|
73
|
+
*/
|
|
74
|
+
export interface NoteUserInfo {
|
|
75
|
+
/** User ID (UUID) */
|
|
76
|
+
id: string;
|
|
77
|
+
/** User's display name */
|
|
78
|
+
name: string;
|
|
79
|
+
/** User's email address */
|
|
80
|
+
email: string;
|
|
81
|
+
/** User's profile image URL */
|
|
82
|
+
profile_image?: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Configuration structure from INI file
|
|
86
|
+
*/
|
|
87
|
+
export interface HazoNotesConfig {
|
|
88
|
+
ui: {
|
|
89
|
+
/** Background color for notes panel (Tailwind class) */
|
|
90
|
+
background_color: string;
|
|
91
|
+
/** Panel presentation style */
|
|
92
|
+
panel_style: 'popover' | 'slide_panel';
|
|
93
|
+
/** Save behavior: explicit (save/cancel buttons) | auto (save on blur) */
|
|
94
|
+
save_mode: 'explicit' | 'auto';
|
|
95
|
+
};
|
|
96
|
+
storage: {
|
|
97
|
+
/** File storage mode: jsonb (in database) | filesystem (on server) */
|
|
98
|
+
file_storage_mode: 'jsonb' | 'filesystem';
|
|
99
|
+
/** Path for filesystem storage */
|
|
100
|
+
file_storage_path: string;
|
|
101
|
+
};
|
|
102
|
+
files: {
|
|
103
|
+
/** Maximum file size in MB */
|
|
104
|
+
max_file_size_mb: number;
|
|
105
|
+
/** Allowed file types (extensions) */
|
|
106
|
+
allowed_file_types: string[];
|
|
107
|
+
/** Maximum files per single note entry */
|
|
108
|
+
max_files_per_note: number;
|
|
109
|
+
};
|
|
110
|
+
logging: {
|
|
111
|
+
/** Log file path */
|
|
112
|
+
logfile: string;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Props for HazoNotesIcon component
|
|
117
|
+
*/
|
|
118
|
+
export interface HazoNotesIconProps {
|
|
119
|
+
/** UUID reference to parent entity */
|
|
120
|
+
ref_id: string;
|
|
121
|
+
/** Label shown in panel header */
|
|
122
|
+
label?: string;
|
|
123
|
+
/** Show indicator when notes exist */
|
|
124
|
+
has_notes?: boolean;
|
|
125
|
+
/** Display count badge */
|
|
126
|
+
note_count?: number;
|
|
127
|
+
/** Controlled notes array */
|
|
128
|
+
notes?: NoteEntry[];
|
|
129
|
+
/** Callback when notes change */
|
|
130
|
+
on_notes_change?: (notes: NoteEntry[]) => void;
|
|
131
|
+
/** User context (auto-fetched if not provided) */
|
|
132
|
+
current_user?: NoteUserInfo;
|
|
133
|
+
/** UI presentation style */
|
|
134
|
+
panel_style?: 'popover' | 'slide_panel';
|
|
135
|
+
/** Save behavior */
|
|
136
|
+
save_mode?: 'explicit' | 'auto';
|
|
137
|
+
/** Notes panel background color (Tailwind class) */
|
|
138
|
+
background_color?: string;
|
|
139
|
+
/** Enable file attachments */
|
|
140
|
+
enable_files?: boolean;
|
|
141
|
+
/** Maximum files per note */
|
|
142
|
+
max_files_per_note?: number;
|
|
143
|
+
/** Allowed file types */
|
|
144
|
+
allowed_file_types?: string[];
|
|
145
|
+
/** Maximum file size in MB */
|
|
146
|
+
max_file_size_mb?: number;
|
|
147
|
+
/** Called when panel opens */
|
|
148
|
+
on_open?: () => void;
|
|
149
|
+
/** Called when panel closes */
|
|
150
|
+
on_close?: () => void;
|
|
151
|
+
/** Disable the notes icon */
|
|
152
|
+
disabled?: boolean;
|
|
153
|
+
/** Additional CSS class names */
|
|
154
|
+
className?: string;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Props for HazoNotesPanel component
|
|
158
|
+
*/
|
|
159
|
+
export interface HazoNotesPanelProps {
|
|
160
|
+
/** UUID reference to parent entity */
|
|
161
|
+
ref_id: string;
|
|
162
|
+
/** Label shown in panel header */
|
|
163
|
+
label?: string;
|
|
164
|
+
/** Array of notes to display */
|
|
165
|
+
notes: NoteEntry[];
|
|
166
|
+
/** Callback to add a new note */
|
|
167
|
+
on_add_note: (note: NewNoteInput) => Promise<void>;
|
|
168
|
+
/** Callback when panel closes */
|
|
169
|
+
on_close?: () => void;
|
|
170
|
+
/** Current user info (null if not logged in) */
|
|
171
|
+
current_user: NoteUserInfo | null;
|
|
172
|
+
/** Save behavior */
|
|
173
|
+
save_mode: 'explicit' | 'auto';
|
|
174
|
+
/** Background color (Tailwind class) */
|
|
175
|
+
background_color: string;
|
|
176
|
+
/** Loading state */
|
|
177
|
+
loading?: boolean;
|
|
178
|
+
/** Error message */
|
|
179
|
+
error?: string;
|
|
180
|
+
/** Enable file attachments */
|
|
181
|
+
enable_files?: boolean;
|
|
182
|
+
/** Maximum files per note */
|
|
183
|
+
max_files_per_note?: number;
|
|
184
|
+
/** Allowed file types */
|
|
185
|
+
allowed_file_types?: string[];
|
|
186
|
+
/** Maximum file size in MB */
|
|
187
|
+
max_file_size_mb?: number;
|
|
188
|
+
/** ProfileStamp component (dynamically loaded) */
|
|
189
|
+
ProfileStampComponent?: React.ComponentType<any> | null;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Props for HazoNotesEntry component
|
|
193
|
+
*/
|
|
194
|
+
export interface HazoNotesEntryProps {
|
|
195
|
+
/** The note entry to display */
|
|
196
|
+
note: NoteEntry;
|
|
197
|
+
/** ProfileStamp component for avatar */
|
|
198
|
+
ProfileStampComponent?: React.ComponentType<any> | null;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Props for HazoNotesFilePreview component
|
|
202
|
+
*/
|
|
203
|
+
export interface HazoNotesFilePreviewProps {
|
|
204
|
+
/** The file to preview */
|
|
205
|
+
file: NoteFile;
|
|
206
|
+
/** Whether to render inline (embed) or as download link */
|
|
207
|
+
display_mode: 'embed' | 'attachment';
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* API handler factory options
|
|
211
|
+
*/
|
|
212
|
+
export interface CreateNotesHandlerOptions {
|
|
213
|
+
/** Function to get hazo_connect adapter */
|
|
214
|
+
getHazoConnect: () => Promise<any> | any;
|
|
215
|
+
/** Function to get logger instance */
|
|
216
|
+
getLogger?: () => any;
|
|
217
|
+
/** Function to extract user ID from request */
|
|
218
|
+
getUserIdFromRequest?: (req: Request) => Promise<string | null>;
|
|
219
|
+
/** Function to get user profile by ID */
|
|
220
|
+
getUserProfile?: (userId: string) => Promise<NoteUserInfo | null>;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* API handler factory options for file operations
|
|
224
|
+
*/
|
|
225
|
+
export interface CreateFilesHandlerOptions {
|
|
226
|
+
/** Function to get hazo_connect adapter */
|
|
227
|
+
getHazoConnect: () => Promise<any> | any;
|
|
228
|
+
/** Function to get logger instance */
|
|
229
|
+
getLogger?: () => any;
|
|
230
|
+
/** Function to extract user ID from request */
|
|
231
|
+
getUserIdFromRequest?: (req: Request) => Promise<string | null>;
|
|
232
|
+
/** File storage mode */
|
|
233
|
+
file_storage_mode?: 'jsonb' | 'filesystem';
|
|
234
|
+
/** Path for filesystem storage */
|
|
235
|
+
file_storage_path?: string;
|
|
236
|
+
/** Maximum file size in MB */
|
|
237
|
+
max_file_size_mb?: number;
|
|
238
|
+
/** Allowed file types */
|
|
239
|
+
allowed_file_types?: string[];
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* API response for fetching notes
|
|
243
|
+
*/
|
|
244
|
+
export interface NotesApiResponse {
|
|
245
|
+
success: boolean;
|
|
246
|
+
notes?: NoteEntry[];
|
|
247
|
+
note_count?: number;
|
|
248
|
+
error?: string;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* API response for adding a note
|
|
252
|
+
*/
|
|
253
|
+
export interface AddNoteApiResponse {
|
|
254
|
+
success: boolean;
|
|
255
|
+
note?: NoteEntry;
|
|
256
|
+
note_count?: number;
|
|
257
|
+
error?: string;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* API response for file upload
|
|
261
|
+
*/
|
|
262
|
+
export interface FileUploadApiResponse {
|
|
263
|
+
success: boolean;
|
|
264
|
+
file?: NoteFile;
|
|
265
|
+
error?: string;
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,UAAU,EAAE,OAAO,GAAG,YAAY,CAAC;IACnC,wBAAwB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,8BAA8B;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,WAAW;IAC5C,0BAA0B;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,2BAA2B;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC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 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File utility functions for hazo_notes
|
|
3
|
+
*/
|
|
4
|
+
import type { NoteFile } from '../types/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Generate a sequential file number (e.g., "0001", "0002")
|
|
7
|
+
*/
|
|
8
|
+
export declare function generate_file_no(existing_files: NoteFile[]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Convert File object to base64 string
|
|
11
|
+
*/
|
|
12
|
+
export declare function file_to_base64(file: File): Promise<string>;
|
|
13
|
+
/**
|
|
14
|
+
* Get MIME type from filename extension
|
|
15
|
+
*/
|
|
16
|
+
export declare function get_mime_type(filename: string): string;
|
|
17
|
+
/**
|
|
18
|
+
* Check if file type is allowed
|
|
19
|
+
*/
|
|
20
|
+
export declare function is_allowed_file_type(filename: string, allowed_types: string[]): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Check if file is an image (can be embedded)
|
|
23
|
+
*/
|
|
24
|
+
export declare function is_image_file(filename: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Format file size for display
|
|
27
|
+
*/
|
|
28
|
+
export declare function format_file_size(bytes: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Parse note text and extract file references
|
|
31
|
+
* Returns array of { type: 'embed' | 'attach', file_no: string }
|
|
32
|
+
*/
|
|
33
|
+
export declare function parse_file_references(note_text: string): Array<{
|
|
34
|
+
type: 'embed' | 'attachment';
|
|
35
|
+
file_no: string;
|
|
36
|
+
}>;
|
|
37
|
+
/**
|
|
38
|
+
* Create file reference syntax for inserting into note text
|
|
39
|
+
*/
|
|
40
|
+
export declare function create_file_reference(file_no: string, embed_type: 'embed' | 'attachment'): string;
|
|
41
|
+
/**
|
|
42
|
+
* Validate file before upload
|
|
43
|
+
*/
|
|
44
|
+
export declare function validate_file(file: File, options: {
|
|
45
|
+
max_size_mb: number;
|
|
46
|
+
allowed_types: string[];
|
|
47
|
+
}): {
|
|
48
|
+
valid: boolean;
|
|
49
|
+
error?: string;
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=file_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file_utils.d.ts","sourceRoot":"","sources":["../../src/utils/file_utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,cAAc,EAAE,QAAQ,EAAE,GAAG,MAAM,CAMnE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAYhE;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAuBtD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,OAAO,CAGvF;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAMtD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SA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