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.
- package/config/hazo_notes_config.ini +48 -0
- package/db_setup_postgres.sql +49 -0
- package/db_setup_sqlite.sql +22 -0
- package/dist/api/create_files_handler.d.ts +1 -1
- package/dist/api/create_files_handler.d.ts.map +1 -1
- package/dist/api/create_files_handler.js +196 -139
- package/dist/api/create_files_handler.js.map +1 -1
- package/dist/api/create_notes_handler.d.ts.map +1 -1
- package/dist/api/create_notes_handler.js +225 -162
- package/dist/api/create_notes_handler.js.map +1 -1
- package/dist/components/hazo_notes_entry.js +1 -1
- package/dist/components/hazo_notes_entry.js.map +1 -1
- package/dist/components/hazo_notes_file_preview.js +1 -1
- package/dist/components/hazo_notes_file_preview.js.map +1 -1
- package/dist/components/hazo_notes_icon.js +1 -1
- package/dist/components/hazo_notes_icon.js.map +1 -1
- package/dist/components/hazo_notes_panel.js +1 -1
- package/dist/components/hazo_notes_panel.js.map +1 -1
- package/dist/components/internal/sheet.js +1 -1
- package/dist/components/internal/sheet.js.map +1 -1
- package/dist/index.client.d.ts +0 -1
- package/dist/index.client.d.ts.map +1 -1
- package/dist/index.client.js +2 -2
- package/dist/index.client.js.map +1 -1
- package/dist/lib/config/hazo_notes_config.d.ts +125 -0
- package/dist/lib/config/hazo_notes_config.d.ts.map +1 -0
- package/dist/lib/config/hazo_notes_config.js +76 -0
- package/dist/lib/config/hazo_notes_config.js.map +1 -0
- package/dist/lib/config/index.d.ts +3 -0
- package/dist/lib/config/index.d.ts.map +1 -0
- package/dist/lib/config/index.js +2 -0
- package/dist/lib/config/index.js.map +1 -0
- package/dist/lib/config.d.ts +14 -15
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +45 -93
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/logger/server.d.ts +13 -9
- package/dist/logger/server.d.ts.map +1 -1
- package/dist/logger/server.js +21 -15
- package/dist/logger/server.js.map +1 -1
- package/dist/logger/types.d.ts +3 -2
- package/dist/logger/types.d.ts.map +1 -1
- package/dist/logger/types.js +2 -1
- package/dist/logger/types.js.map +1 -1
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +26 -11
- package/dist/utils/cn.d.ts +0 -16
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/cn.js +0 -19
- package/dist/utils/cn.js.map +0 -1
- package/migrations/001_create_hazo_notes_table.sql +0 -77
- package/migrations/002_grant_api_user_hazo_notes.sql +0 -24
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# hazo_notes Configuration
|
|
2
|
+
# This file configures the notes system behavior and storage
|
|
3
|
+
#
|
|
4
|
+
# Env-var overrides follow the pattern HAZO_NOTES_<SECTION>_<KEY> (uppercase).
|
|
5
|
+
# Per-env overlays: place hazo_notes_config.<HAZO_ENV>.ini next to this file.
|
|
6
|
+
|
|
7
|
+
[general]
|
|
8
|
+
# Optional override for the deployment environment. Defaults to
|
|
9
|
+
# HAZO_ENV → NODE_ENV → 'development' (resolved by hazo_core).
|
|
10
|
+
# env = production
|
|
11
|
+
|
|
12
|
+
[log.overrides]
|
|
13
|
+
# Per-namespace log level overrides (per D-015). Format:
|
|
14
|
+
# <namespace> = <level>
|
|
15
|
+
# Examples:
|
|
16
|
+
# hazo_notes/poll = warn
|
|
17
|
+
# hazo_notes = debug
|
|
18
|
+
|
|
19
|
+
[ui]
|
|
20
|
+
# Background color for notes panel (Tailwind CSS class)
|
|
21
|
+
background_color = bg-yellow-100
|
|
22
|
+
|
|
23
|
+
# Panel presentation style: popover | slide_panel
|
|
24
|
+
panel_style = popover
|
|
25
|
+
|
|
26
|
+
# Save behavior: explicit (save/cancel buttons) | auto (save on blur)
|
|
27
|
+
save_mode = explicit
|
|
28
|
+
|
|
29
|
+
[storage]
|
|
30
|
+
# File storage mode: jsonb (in database) | filesystem (on server)
|
|
31
|
+
file_storage_mode = jsonb
|
|
32
|
+
|
|
33
|
+
# Path for filesystem storage (only used when file_storage_mode = filesystem)
|
|
34
|
+
file_storage_path = /uploads/notes
|
|
35
|
+
|
|
36
|
+
[files]
|
|
37
|
+
# Maximum file size in MB
|
|
38
|
+
max_file_size_mb = 10
|
|
39
|
+
|
|
40
|
+
# Allowed file types (comma-separated extensions)
|
|
41
|
+
allowed_file_types = pdf,png,jpg,jpeg,gif,doc,docx
|
|
42
|
+
|
|
43
|
+
# Maximum files per single note entry
|
|
44
|
+
max_files_per_note = 5
|
|
45
|
+
|
|
46
|
+
[logging]
|
|
47
|
+
# Log file path
|
|
48
|
+
logfile = logs/hazo_notes.log
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
-- hazo_notes database schema
|
|
2
|
+
-- PostgreSQL -- idempotent (safe to run multiple times)
|
|
3
|
+
-- Run this file to set up all tables required by hazo_notes
|
|
4
|
+
--
|
|
5
|
+
-- Tables: hazo_notes
|
|
6
|
+
|
|
7
|
+
-- ============================================================
|
|
8
|
+
-- hazo_notes
|
|
9
|
+
-- Database-backed notes linked to any entity via ref_id.
|
|
10
|
+
-- Notes are stored as a JSONB array with user attribution and
|
|
11
|
+
-- optional file attachments.
|
|
12
|
+
-- ============================================================
|
|
13
|
+
|
|
14
|
+
CREATE TABLE IF NOT EXISTS hazo_notes (
|
|
15
|
+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
16
|
+
ref_id UUID NOT NULL,
|
|
17
|
+
note JSONB NOT NULL DEFAULT '[]'::jsonb,
|
|
18
|
+
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
19
|
+
changed_at TIMESTAMPTZ NULL,
|
|
20
|
+
note_count INTEGER NOT NULL DEFAULT 0
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
CREATE INDEX IF NOT EXISTS idx_hazo_notes_ref_id ON hazo_notes(ref_id);
|
|
24
|
+
|
|
25
|
+
COMMENT ON TABLE hazo_notes IS 'Notes linked to any entity via ref_id. note column is a JSONB array of {userid, created_at, note_text, note_files}.';
|
|
26
|
+
COMMENT ON COLUMN hazo_notes.id IS 'Primary key UUID';
|
|
27
|
+
COMMENT ON COLUMN hazo_notes.ref_id IS 'UUID reference to the parent entity (e.g. form field, document, task)';
|
|
28
|
+
COMMENT ON COLUMN hazo_notes.note IS 'JSONB array of note entries';
|
|
29
|
+
COMMENT ON COLUMN hazo_notes.created_at IS 'Timestamp when the notes row was first created';
|
|
30
|
+
COMMENT ON COLUMN hazo_notes.changed_at IS 'Timestamp of the last modification to the notes';
|
|
31
|
+
COMMENT ON COLUMN hazo_notes.note_count IS 'Denormalised count of notes, kept in sync on write to avoid parsing JSONB on read';
|
|
32
|
+
|
|
33
|
+
-- ============================================================
|
|
34
|
+
-- PostgREST role grants
|
|
35
|
+
-- Required for the bundled API handlers, which talk to PostgREST.
|
|
36
|
+
-- The api_user role must exist beforehand (created by hazo_connect setup).
|
|
37
|
+
-- ============================================================
|
|
38
|
+
|
|
39
|
+
DO $$ BEGIN
|
|
40
|
+
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'api_user') THEN
|
|
41
|
+
GRANT SELECT, INSERT, UPDATE, DELETE ON hazo_notes TO api_user;
|
|
42
|
+
END IF;
|
|
43
|
+
END $$;
|
|
44
|
+
|
|
45
|
+
-- ============================================================
|
|
46
|
+
-- Notify PostgREST to reload the schema cache
|
|
47
|
+
-- ============================================================
|
|
48
|
+
|
|
49
|
+
SELECT pg_notify('pgrst', 'reload schema');
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- hazo_notes database schema
|
|
2
|
+
-- SQLite -- idempotent (safe to run multiple times)
|
|
3
|
+
-- Run this file to set up all tables required by hazo_notes
|
|
4
|
+
--
|
|
5
|
+
-- Tables: hazo_notes
|
|
6
|
+
|
|
7
|
+
-- ============================================================
|
|
8
|
+
-- hazo_notes
|
|
9
|
+
-- Notes linked to any entity via ref_id. The note column is a
|
|
10
|
+
-- JSON-encoded array stored as TEXT (SQLite has no native JSONB).
|
|
11
|
+
-- ============================================================
|
|
12
|
+
|
|
13
|
+
CREATE TABLE IF NOT EXISTS hazo_notes (
|
|
14
|
+
id TEXT PRIMARY KEY,
|
|
15
|
+
ref_id TEXT NOT NULL,
|
|
16
|
+
note TEXT NOT NULL DEFAULT '[]',
|
|
17
|
+
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
|
18
|
+
changed_at TEXT,
|
|
19
|
+
note_count INTEGER NOT NULL DEFAULT 0
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
CREATE INDEX IF NOT EXISTS idx_hazo_notes_ref_id ON hazo_notes(ref_id);
|
|
@@ -32,7 +32,7 @@ import type { CreateFilesHandlerOptions, FileUploadApiResponse } from '../types/
|
|
|
32
32
|
* @returns Object with POST (upload) and GET (download) handlers
|
|
33
33
|
*/
|
|
34
34
|
export declare function createFilesHandler(options: CreateFilesHandlerOptions): {
|
|
35
|
-
GET: (request: Request,
|
|
35
|
+
GET: (request: Request, _context: {
|
|
36
36
|
params: Promise<{
|
|
37
37
|
file_id?: string;
|
|
38
38
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_files_handler.d.ts","sourceRoot":"","sources":["../../src/api/create_files_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create_files_handler.d.ts","sourceRoot":"","sources":["../../src/api/create_files_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU3C,OAAO,KAAK,EACV,yBAAyB,EAEzB,qBAAqB,EAEtB,MAAM,mBAAmB,CAAC;AAqC3B;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB;mBAgKxD,OAAO,YACN;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,KAClD,OAAO,CAAC,YAAY,CAAC;oBA5IK,OAAO,KAAG,OAAO,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;EA0OpF"}
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
import { NextResponse } from 'next/server';
|
|
27
|
+
import { HazoError, HazoAuthError, HazoValidationError, HazoInternalError, HazoNotFoundError, withContext, createLogger, } from 'hazo_core';
|
|
27
28
|
import { get_mime_type, is_allowed_file_type, generate_file_no, } from '../utils/file_utils.js';
|
|
28
29
|
// ============================================================================
|
|
29
30
|
// Constants
|
|
@@ -33,17 +34,17 @@ const DEFAULT_ALLOWED_TYPES = ['pdf', 'png', 'jpg', 'jpeg', 'gif', 'doc', 'docx'
|
|
|
33
34
|
// ============================================================================
|
|
34
35
|
// Helper Functions
|
|
35
36
|
// ============================================================================
|
|
36
|
-
/** No-op logger */
|
|
37
|
-
const noopLogger = {
|
|
38
|
-
error: () => { },
|
|
39
|
-
warn: () => { },
|
|
40
|
-
info: () => { },
|
|
41
|
-
debug: () => { },
|
|
42
|
-
};
|
|
43
37
|
/** Create error response */
|
|
44
38
|
function createErrorResponse(error, status) {
|
|
45
39
|
return NextResponse.json({ success: false, error }, { status });
|
|
46
40
|
}
|
|
41
|
+
function errorResponseFromHazo(err) {
|
|
42
|
+
const status = err.httpStatus ?? 500;
|
|
43
|
+
return NextResponse.json({
|
|
44
|
+
success: false,
|
|
45
|
+
error: err.toUserMessage ? err.toUserMessage() : err.message,
|
|
46
|
+
}, { status });
|
|
47
|
+
}
|
|
47
48
|
/**
|
|
48
49
|
* Creates file upload and download handlers
|
|
49
50
|
*
|
|
@@ -52,7 +53,7 @@ function createErrorResponse(error, status) {
|
|
|
52
53
|
*/
|
|
53
54
|
export function createFilesHandler(options) {
|
|
54
55
|
const { getHazoConnect, getLogger, getUserIdFromRequest, file_storage_mode = 'jsonb', file_storage_path = '/uploads/notes', max_file_size_mb = DEFAULT_MAX_FILE_SIZE_MB, allowed_file_types = DEFAULT_ALLOWED_TYPES, } = options;
|
|
55
|
-
const logger = getLogger
|
|
56
|
+
const logger = getLogger ? getLogger() : createLogger('hazo_notes');
|
|
56
57
|
const max_bytes = max_file_size_mb * 1024 * 1024;
|
|
57
58
|
/**
|
|
58
59
|
* POST handler - Upload a file
|
|
@@ -63,150 +64,206 @@ export function createFilesHandler(options) {
|
|
|
63
64
|
* - embed_type: 'embed' or 'attachment'
|
|
64
65
|
*/
|
|
65
66
|
async function POST(request) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
// Validate file size
|
|
90
|
-
if (file.size > max_bytes) {
|
|
91
|
-
return createErrorResponse(`File size exceeds maximum of ${max_file_size_mb} MB`, 400);
|
|
92
|
-
}
|
|
93
|
-
logger.debug('[hazo_notes/files] Upload request', {
|
|
94
|
-
filename: file.name,
|
|
95
|
-
size: file.size,
|
|
96
|
-
ref_id,
|
|
97
|
-
embed_type,
|
|
98
|
-
storage_mode: file_storage_mode,
|
|
99
|
-
});
|
|
100
|
-
// Generate file number
|
|
101
|
-
const file_no = generate_file_no([]);
|
|
102
|
-
let filedata;
|
|
103
|
-
if (file_storage_mode === 'filesystem') {
|
|
104
|
-
// Filesystem storage - save to disk and store path
|
|
105
|
-
try {
|
|
106
|
-
const fs = await import('fs/promises');
|
|
107
|
-
const path = await import('path');
|
|
108
|
-
// Create directory if it doesn't exist
|
|
109
|
-
const upload_dir = path.join(process.cwd(), file_storage_path, ref_id);
|
|
110
|
-
await fs.mkdir(upload_dir, { recursive: true });
|
|
111
|
-
// Save file
|
|
112
|
-
const safe_filename = `${file_no}_${file.name.replace(/[^a-zA-Z0-9._-]/g, '_')}`;
|
|
113
|
-
const file_path = path.join(upload_dir, safe_filename);
|
|
114
|
-
const buffer = Buffer.from(await file.arrayBuffer());
|
|
115
|
-
await fs.writeFile(file_path, buffer);
|
|
116
|
-
// Store relative path
|
|
117
|
-
filedata = `${file_storage_path}/${ref_id}/${safe_filename}`;
|
|
118
|
-
logger.debug('[hazo_notes/files] File saved to filesystem', { path: filedata });
|
|
67
|
+
return withContext({}, async () => {
|
|
68
|
+
try {
|
|
69
|
+
const userId = getUserIdFromRequest
|
|
70
|
+
? await getUserIdFromRequest(request)
|
|
71
|
+
: null;
|
|
72
|
+
if (!userId) {
|
|
73
|
+
throw new HazoAuthError({
|
|
74
|
+
pkg: 'hazo_notes',
|
|
75
|
+
code: 'HAZO_NOTES_UNAUTHORIZED',
|
|
76
|
+
message: 'Unauthorized',
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
const formData = await request.formData();
|
|
80
|
+
const file = formData.get('file');
|
|
81
|
+
const ref_id = formData.get('ref_id');
|
|
82
|
+
const embed_type = formData.get('embed_type') || 'attachment';
|
|
83
|
+
if (!file) {
|
|
84
|
+
throw new HazoValidationError({
|
|
85
|
+
pkg: 'hazo_notes',
|
|
86
|
+
code: 'HAZO_NOTES_VALIDATION_ERROR',
|
|
87
|
+
message: 'No file provided',
|
|
88
|
+
context: { field: 'file' },
|
|
89
|
+
});
|
|
119
90
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
91
|
+
if (!ref_id) {
|
|
92
|
+
throw new HazoValidationError({
|
|
93
|
+
pkg: 'hazo_notes',
|
|
94
|
+
code: 'HAZO_NOTES_VALIDATION_ERROR',
|
|
95
|
+
message: 'ref_id is required',
|
|
96
|
+
context: { field: 'ref_id' },
|
|
123
97
|
});
|
|
124
|
-
return createErrorResponse('Failed to save file', 500);
|
|
125
98
|
}
|
|
99
|
+
if (!is_allowed_file_type(file.name, allowed_file_types)) {
|
|
100
|
+
throw new HazoValidationError({
|
|
101
|
+
pkg: 'hazo_notes',
|
|
102
|
+
code: 'HAZO_NOTES_UNSUPPORTED_TYPE',
|
|
103
|
+
message: `File type not allowed. Allowed types: ${allowed_file_types.join(', ')}`,
|
|
104
|
+
context: { filename: file.name, allowed: allowed_file_types },
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
if (file.size > max_bytes) {
|
|
108
|
+
throw new HazoValidationError({
|
|
109
|
+
pkg: 'hazo_notes',
|
|
110
|
+
code: 'HAZO_NOTES_FILE_TOO_LARGE',
|
|
111
|
+
message: `File size exceeds maximum of ${max_file_size_mb} MB`,
|
|
112
|
+
context: { size: file.size, max_bytes },
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
logger.debug('notes.files.upload.request', {
|
|
116
|
+
filename: file.name,
|
|
117
|
+
size: file.size,
|
|
118
|
+
ref_id,
|
|
119
|
+
embed_type,
|
|
120
|
+
storage_mode: file_storage_mode,
|
|
121
|
+
});
|
|
122
|
+
const file_no = generate_file_no([]);
|
|
123
|
+
let filedata;
|
|
124
|
+
if (file_storage_mode === 'filesystem') {
|
|
125
|
+
try {
|
|
126
|
+
const fs = await import('fs/promises');
|
|
127
|
+
const path = await import('path');
|
|
128
|
+
const upload_dir = path.join(process.cwd(), file_storage_path, ref_id);
|
|
129
|
+
await fs.mkdir(upload_dir, { recursive: true });
|
|
130
|
+
const safe_filename = `${file_no}_${file.name.replace(/[^a-zA-Z0-9._-]/g, '_')}`;
|
|
131
|
+
const file_path = path.join(upload_dir, safe_filename);
|
|
132
|
+
const buffer = Buffer.from(await file.arrayBuffer());
|
|
133
|
+
await fs.writeFile(file_path, buffer);
|
|
134
|
+
filedata = `${file_storage_path}/${ref_id}/${safe_filename}`;
|
|
135
|
+
logger.debug('notes.files.saved', { path: filedata });
|
|
136
|
+
}
|
|
137
|
+
catch (cause) {
|
|
138
|
+
throw new HazoInternalError({
|
|
139
|
+
pkg: 'hazo_notes',
|
|
140
|
+
code: 'HAZO_NOTES_STORAGE_FAILED',
|
|
141
|
+
message: 'Failed to save file',
|
|
142
|
+
cause: cause instanceof Error ? cause : new Error(String(cause)),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
const buffer = await file.arrayBuffer();
|
|
148
|
+
filedata = Buffer.from(buffer).toString('base64');
|
|
149
|
+
}
|
|
150
|
+
const note_file = {
|
|
151
|
+
file_no,
|
|
152
|
+
embed_type,
|
|
153
|
+
filename: file.name,
|
|
154
|
+
filedata,
|
|
155
|
+
mime_type: get_mime_type(file.name),
|
|
156
|
+
file_size: file.size,
|
|
157
|
+
};
|
|
158
|
+
logger.info('notes.files.uploaded', {
|
|
159
|
+
ref_id,
|
|
160
|
+
file_no,
|
|
161
|
+
storage_mode: file_storage_mode,
|
|
162
|
+
});
|
|
163
|
+
return NextResponse.json({
|
|
164
|
+
success: true,
|
|
165
|
+
file: note_file,
|
|
166
|
+
});
|
|
126
167
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
168
|
+
catch (error) {
|
|
169
|
+
if (HazoError.is(error)) {
|
|
170
|
+
const hazo = error;
|
|
171
|
+
if (hazo.httpStatus && hazo.httpStatus < 500) {
|
|
172
|
+
logger.warn('notes.files.upload.client_error', { code: hazo.code, message: hazo.message });
|
|
173
|
+
}
|
|
174
|
+
else {
|
|
175
|
+
logger.error('notes.files.upload.error', { code: hazo.code, message: hazo.message });
|
|
176
|
+
}
|
|
177
|
+
return errorResponseFromHazo(hazo);
|
|
178
|
+
}
|
|
179
|
+
logger.error('notes.files.upload.error', {
|
|
180
|
+
error: error instanceof Error ? error.message : String(error),
|
|
181
|
+
});
|
|
182
|
+
return createErrorResponse('Failed to upload file', 500);
|
|
131
183
|
}
|
|
132
|
-
|
|
133
|
-
file_no,
|
|
134
|
-
embed_type,
|
|
135
|
-
filename: file.name,
|
|
136
|
-
filedata,
|
|
137
|
-
mime_type: get_mime_type(file.name),
|
|
138
|
-
file_size: file.size,
|
|
139
|
-
};
|
|
140
|
-
return NextResponse.json({
|
|
141
|
-
success: true,
|
|
142
|
-
file: note_file,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
catch (error) {
|
|
146
|
-
logger.error('[hazo_notes/files] Upload error', {
|
|
147
|
-
error: error instanceof Error ? error.message : String(error),
|
|
148
|
-
});
|
|
149
|
-
return createErrorResponse('Failed to upload file', 500);
|
|
150
|
-
}
|
|
184
|
+
});
|
|
151
185
|
}
|
|
152
186
|
/**
|
|
153
187
|
* GET handler - Download a file (for filesystem storage mode)
|
|
154
|
-
*
|
|
155
|
-
* Query params:
|
|
156
|
-
* - ref_id: Reference ID
|
|
157
|
-
* - file_no: File number
|
|
158
188
|
*/
|
|
159
|
-
async function GET(request,
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
189
|
+
async function GET(request, _context) {
|
|
190
|
+
return withContext({}, async () => {
|
|
191
|
+
try {
|
|
192
|
+
if (file_storage_mode !== 'filesystem') {
|
|
193
|
+
throw new HazoValidationError({
|
|
194
|
+
pkg: 'hazo_notes',
|
|
195
|
+
code: 'HAZO_NOTES_VALIDATION_ERROR',
|
|
196
|
+
message: 'File download only available for filesystem storage mode',
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
const url = new URL(request.url);
|
|
200
|
+
const ref_id = url.searchParams.get('ref_id');
|
|
201
|
+
const file_no = url.searchParams.get('file_no');
|
|
202
|
+
if (!ref_id || !file_no) {
|
|
203
|
+
throw new HazoValidationError({
|
|
204
|
+
pkg: 'hazo_notes',
|
|
205
|
+
code: 'HAZO_NOTES_VALIDATION_ERROR',
|
|
206
|
+
message: 'ref_id and file_no are required',
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
const hazoConnect = await getHazoConnect();
|
|
210
|
+
const result = await hazoConnect.rawQuery(`/hazo_notes?ref_id=eq.${ref_id}`);
|
|
211
|
+
if (!result || result.length === 0) {
|
|
212
|
+
throw new HazoNotFoundError({
|
|
213
|
+
pkg: 'hazo_notes',
|
|
214
|
+
code: 'HAZO_NOTES_NOTE_NOT_FOUND',
|
|
215
|
+
message: 'Notes not found',
|
|
216
|
+
context: { ref_id },
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
const notes = result[0].note || [];
|
|
220
|
+
let file_info = null;
|
|
221
|
+
for (const note of notes) {
|
|
222
|
+
if (note.note_files) {
|
|
223
|
+
const found = note.note_files.find((f) => f.file_no === file_no);
|
|
224
|
+
if (found) {
|
|
225
|
+
file_info = found;
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
185
228
|
}
|
|
186
229
|
}
|
|
230
|
+
if (!file_info) {
|
|
231
|
+
throw new HazoNotFoundError({
|
|
232
|
+
pkg: 'hazo_notes',
|
|
233
|
+
code: 'HAZO_NOTES_FILE_NOT_FOUND',
|
|
234
|
+
message: 'File not found',
|
|
235
|
+
context: { ref_id, file_no },
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
const fs = await import('fs/promises');
|
|
239
|
+
const path = await import('path');
|
|
240
|
+
const file_path = path.join(process.cwd(), file_info.filedata);
|
|
241
|
+
const buffer = await fs.readFile(file_path);
|
|
242
|
+
return new NextResponse(buffer, {
|
|
243
|
+
headers: {
|
|
244
|
+
'Content-Type': file_info.mime_type || 'application/octet-stream',
|
|
245
|
+
'Content-Disposition': `attachment; filename="${file_info.filename}"`,
|
|
246
|
+
'Content-Length': String(buffer.length),
|
|
247
|
+
},
|
|
248
|
+
});
|
|
187
249
|
}
|
|
188
|
-
|
|
189
|
-
|
|
250
|
+
catch (error) {
|
|
251
|
+
if (HazoError.is(error)) {
|
|
252
|
+
const hazo = error;
|
|
253
|
+
if (hazo.httpStatus && hazo.httpStatus < 500) {
|
|
254
|
+
logger.warn('notes.files.download.client_error', { code: hazo.code, message: hazo.message });
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
logger.error('notes.files.download.error', { code: hazo.code, message: hazo.message });
|
|
258
|
+
}
|
|
259
|
+
return NextResponse.json({ success: false, error: hazo.toUserMessage ? hazo.toUserMessage() : hazo.message }, { status: hazo.httpStatus ?? 500 });
|
|
260
|
+
}
|
|
261
|
+
logger.error('notes.files.download.error', {
|
|
262
|
+
error: error instanceof Error ? error.message : String(error),
|
|
263
|
+
});
|
|
264
|
+
return createErrorResponse('Failed to download file', 500);
|
|
190
265
|
}
|
|
191
|
-
|
|
192
|
-
const fs = await import('fs/promises');
|
|
193
|
-
const path = await import('path');
|
|
194
|
-
const file_path = path.join(process.cwd(), file_info.filedata);
|
|
195
|
-
const buffer = await fs.readFile(file_path);
|
|
196
|
-
return new NextResponse(buffer, {
|
|
197
|
-
headers: {
|
|
198
|
-
'Content-Type': file_info.mime_type || 'application/octet-stream',
|
|
199
|
-
'Content-Disposition': `attachment; filename="${file_info.filename}"`,
|
|
200
|
-
'Content-Length': String(buffer.length),
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
catch (error) {
|
|
205
|
-
logger.error('[hazo_notes/files] Download error', {
|
|
206
|
-
error: error instanceof Error ? error.message : String(error),
|
|
207
|
-
});
|
|
208
|
-
return createErrorResponse('Failed to download file', 500);
|
|
209
|
-
}
|
|
266
|
+
});
|
|
210
267
|
}
|
|
211
268
|
return { GET, POST };
|
|
212
269
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_files_handler.js","sourceRoot":"","sources":["../../src/api/create_files_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create_files_handler.js","sourceRoot":"","sources":["../../src/api/create_files_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EACL,SAAS,EACT,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,WAAW,EACX,YAAY,GACb,MAAM,WAAW,CAAC;AAOnB,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAEhC,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAElF,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E,4BAA4B;AAC5B,SAAS,mBAAmB,CAC1B,KAAa,EACb,MAAc;IAEd,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,qBAAqB,CAAC,GAAc;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,IAAI,GAAG,CAAC;IACrC,OAAO,YAAY,CAAC,IAAI,CACtB;QACE,OA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,CAAC;gBACJ,CAAC;gBACD,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE;oBACzC,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;iBAC9D,CAAC,CAAC;gBACH,OAAO,mBAAmB,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_notes_handler.d.ts","sourceRoot":"","sources":["../../src/api/create_notes_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create_notes_handler.d.ts","sourceRoot":"","sources":["../../src/api/create_notes_handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU3C,OAAO,KAAK,EACV,yBAAyB,EAKzB,gBAAgB,EAChB,kBAAkB,EAEnB,MAAM,mBAAmB,CAAC;AA2D3B;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB;mBAgCxD,OAAO,WACP;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,KAC/C,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC;oBAmG/B,OAAO,WACP;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,KAC/C,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;EAsK7C"}
|