noverload-mcp 0.9.2 → 0.9.3
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/dist/client.d.ts +141 -30
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +142 -115
- package/dist/client.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/resources/index.d.ts +6 -1
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/tools/implementations/explore-topic.d.ts.map +1 -1
- package/dist/tools/implementations/explore-topic.js +41 -22
- package/dist/tools/implementations/explore-topic.js.map +1 -1
- package/dist/tools/implementations/extract-frameworks.d.ts.map +1 -1
- package/dist/tools/implementations/extract-frameworks.js +91 -29
- package/dist/tools/implementations/extract-frameworks.js.map +1 -1
- package/dist/tools/implementations/get-content.d.ts.map +1 -1
- package/dist/tools/implementations/get-content.js +3 -1
- package/dist/tools/implementations/get-content.js.map +1 -1
- package/dist/tools/implementations/list-content.d.ts.map +1 -1
- package/dist/tools/implementations/list-content.js +3 -1
- package/dist/tools/implementations/list-content.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -4,83 +4,183 @@ export interface ClientConfig {
|
|
|
4
4
|
apiUrl: string;
|
|
5
5
|
readOnly: boolean;
|
|
6
6
|
}
|
|
7
|
+
export declare const ContentTypeEnum: z.ZodEnum<["youtube", "x_twitter", "reddit", "article", "pdf"]>;
|
|
8
|
+
export declare const ContentStatusEnum: z.ZodEnum<["pending", "processing", "completed", "failed"]>;
|
|
9
|
+
export declare const SummaryObjectSchema: z.ZodObject<{
|
|
10
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
11
|
+
text: z.ZodOptional<z.ZodString>;
|
|
12
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
13
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
14
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
15
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
16
|
+
text: z.ZodOptional<z.ZodString>;
|
|
17
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
18
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
19
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
20
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
21
|
+
text: z.ZodOptional<z.ZodString>;
|
|
22
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
23
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
24
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
25
|
+
export declare const SummarySchema: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
26
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
27
|
+
text: z.ZodOptional<z.ZodString>;
|
|
28
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
29
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
30
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
31
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
32
|
+
text: z.ZodOptional<z.ZodString>;
|
|
33
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
34
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
35
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
36
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
37
|
+
text: z.ZodOptional<z.ZodString>;
|
|
38
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
39
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
40
|
+
}, z.ZodTypeAny, "passthrough">>]>>>;
|
|
41
|
+
export declare const ProcessingMetadataSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
42
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
43
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
model: z.ZodOptional<z.ZodString>;
|
|
45
|
+
version: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
47
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
48
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
model: z.ZodOptional<z.ZodString>;
|
|
50
|
+
version: z.ZodOptional<z.ZodString>;
|
|
51
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
52
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
53
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
model: z.ZodOptional<z.ZodString>;
|
|
55
|
+
version: z.ZodOptional<z.ZodString>;
|
|
56
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
7
57
|
export declare const ContentSchema: z.ZodObject<{
|
|
8
58
|
id: z.ZodString;
|
|
9
|
-
userId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
10
59
|
url: z.ZodString;
|
|
60
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
11
61
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
62
|
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
13
63
|
contentType: z.ZodDefault<z.ZodOptional<z.ZodEnum<["youtube", "x_twitter", "reddit", "article", "pdf"]>>>;
|
|
14
64
|
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["pending", "processing", "completed", "failed"]>>>;
|
|
15
|
-
summary: z.ZodOptional<z.ZodNullable<z.
|
|
16
|
-
|
|
65
|
+
summary: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
66
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
67
|
+
text: z.ZodOptional<z.ZodString>;
|
|
68
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
69
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
70
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
71
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
72
|
+
text: z.ZodOptional<z.ZodString>;
|
|
73
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
74
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
75
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
76
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
77
|
+
text: z.ZodOptional<z.ZodString>;
|
|
78
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
79
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
80
|
+
}, z.ZodTypeAny, "passthrough">>]>>>;
|
|
81
|
+
keyInsights: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
|
|
17
82
|
rawText: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
18
83
|
tokenCount: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
19
84
|
ogImage: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
20
|
-
processingMetadata: z.ZodOptional<z.ZodNullable<z.
|
|
85
|
+
processingMetadata: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
86
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
87
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
model: z.ZodOptional<z.ZodString>;
|
|
89
|
+
version: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
91
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
92
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
93
|
+
model: z.ZodOptional<z.ZodString>;
|
|
94
|
+
version: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
96
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
97
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
model: z.ZodOptional<z.ZodString>;
|
|
99
|
+
version: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.ZodTypeAny, "passthrough">>>>;
|
|
21
101
|
tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
22
|
-
createdAt: z.
|
|
23
|
-
updatedAt: z.
|
|
102
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
103
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
24
104
|
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
status: "pending" | "processing" | "completed" | "failed";
|
|
25
106
|
id: string;
|
|
26
|
-
userId: string;
|
|
27
107
|
url: string;
|
|
28
108
|
contentType: "youtube" | "x_twitter" | "reddit" | "article" | "pdf";
|
|
29
|
-
status: "pending" | "processing" | "completed" | "failed";
|
|
30
|
-
keyInsights: string[] | null;
|
|
31
109
|
tags: string[];
|
|
32
|
-
|
|
33
|
-
updatedAt: string;
|
|
110
|
+
userId?: string | undefined;
|
|
34
111
|
title?: string | null | undefined;
|
|
35
112
|
description?: string | null | undefined;
|
|
36
|
-
summary?:
|
|
113
|
+
summary?: string | z.objectOutputType<{
|
|
114
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
115
|
+
text: z.ZodOptional<z.ZodString>;
|
|
116
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
117
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
118
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
119
|
+
keyInsights?: string[] | null | undefined;
|
|
37
120
|
rawText?: string | null | undefined;
|
|
38
121
|
tokenCount?: number | null | undefined;
|
|
39
122
|
ogImage?: string | null | undefined;
|
|
40
|
-
processingMetadata?:
|
|
123
|
+
processingMetadata?: z.objectOutputType<{
|
|
124
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
125
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
model: z.ZodOptional<z.ZodString>;
|
|
127
|
+
version: z.ZodOptional<z.ZodString>;
|
|
128
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
129
|
+
createdAt?: string | undefined;
|
|
130
|
+
updatedAt?: string | undefined;
|
|
41
131
|
}, {
|
|
42
132
|
id: string;
|
|
43
133
|
url: string;
|
|
134
|
+
status?: "pending" | "processing" | "completed" | "failed" | undefined;
|
|
44
135
|
userId?: string | undefined;
|
|
45
136
|
title?: string | null | undefined;
|
|
46
137
|
description?: string | null | undefined;
|
|
47
138
|
contentType?: "youtube" | "x_twitter" | "reddit" | "article" | "pdf" | undefined;
|
|
48
|
-
|
|
49
|
-
|
|
139
|
+
summary?: string | z.objectInputType<{
|
|
140
|
+
one_sentence: z.ZodOptional<z.ZodString>;
|
|
141
|
+
text: z.ZodOptional<z.ZodString>;
|
|
142
|
+
key_points: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
143
|
+
actionable_takeaways: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
144
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
50
145
|
keyInsights?: string[] | null | undefined;
|
|
51
146
|
rawText?: string | null | undefined;
|
|
52
147
|
tokenCount?: number | null | undefined;
|
|
53
148
|
ogImage?: string | null | undefined;
|
|
54
|
-
processingMetadata?:
|
|
149
|
+
processingMetadata?: z.objectInputType<{
|
|
150
|
+
processedAt: z.ZodOptional<z.ZodString>;
|
|
151
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
model: z.ZodOptional<z.ZodString>;
|
|
153
|
+
version: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.ZodTypeAny, "passthrough"> | null | undefined;
|
|
55
155
|
tags?: string[] | undefined;
|
|
56
156
|
createdAt?: string | undefined;
|
|
57
157
|
updatedAt?: string | undefined;
|
|
58
158
|
}>;
|
|
59
159
|
export declare const ActionSchema: z.ZodObject<{
|
|
60
160
|
id: z.ZodString;
|
|
61
|
-
contentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
62
|
-
goalId: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
63
161
|
title: z.ZodString;
|
|
64
|
-
|
|
65
|
-
|
|
162
|
+
contentId: z.ZodOptional<z.ZodString>;
|
|
163
|
+
goalId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
164
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
165
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodEnum<["high", "medium", "low"]>>>;
|
|
66
166
|
completed: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
67
|
-
completedAt: z.
|
|
68
|
-
createdAt: z.
|
|
167
|
+
completedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
168
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
69
169
|
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
completed: boolean;
|
|
70
171
|
id: string;
|
|
71
172
|
title: string;
|
|
72
|
-
description
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
completedAt: string | null;
|
|
173
|
+
description?: string | null | undefined;
|
|
174
|
+
createdAt?: string | undefined;
|
|
175
|
+
contentId?: string | undefined;
|
|
176
|
+
goalId?: string | null | undefined;
|
|
177
|
+
priority?: "high" | "medium" | "low" | null | undefined;
|
|
178
|
+
completedAt?: string | null | undefined;
|
|
79
179
|
}, {
|
|
80
180
|
id: string;
|
|
81
181
|
title: string;
|
|
82
|
-
description?: string | null | undefined;
|
|
83
182
|
completed?: boolean | undefined;
|
|
183
|
+
description?: string | null | undefined;
|
|
84
184
|
createdAt?: string | undefined;
|
|
85
185
|
contentId?: string | undefined;
|
|
86
186
|
goalId?: string | null | undefined;
|
|
@@ -561,6 +661,12 @@ export declare class NoverloadClient {
|
|
|
561
661
|
initialize(): Promise<void>;
|
|
562
662
|
validateToken(): Promise<boolean>;
|
|
563
663
|
private request;
|
|
664
|
+
/**
|
|
665
|
+
* Transform raw API content to schema format
|
|
666
|
+
* Handles both camelCase and snake_case field names from API
|
|
667
|
+
* Required fields (id, url) are passed through - Zod validates them
|
|
668
|
+
*/
|
|
669
|
+
private transformRawContent;
|
|
564
670
|
listContent(filters?: {
|
|
565
671
|
status?: string;
|
|
566
672
|
contentType?: string;
|
|
@@ -568,6 +674,11 @@ export declare class NoverloadClient {
|
|
|
568
674
|
}): Promise<Content[]>;
|
|
569
675
|
getContent(id: string): Promise<Content>;
|
|
570
676
|
saveContent(url: string): Promise<Content>;
|
|
677
|
+
/**
|
|
678
|
+
* Transform raw API action to schema format
|
|
679
|
+
* Handles both camelCase and snake_case field names from API
|
|
680
|
+
*/
|
|
681
|
+
private transformRawAction;
|
|
571
682
|
listActions(filters?: {
|
|
572
683
|
contentId?: string;
|
|
573
684
|
goalId?: string;
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;CACnB;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,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E,MAAM,EAAE,EAAE,kBAAkB,GAAE,OAAe,GAAG,OAAO,CAAC,GAAG,CAAC;IAyCpF,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC;IAmBjC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA0BnD,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,eAAe,CAAC;IA0B7E,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA0BrF,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAoBjD,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAyBlE,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAyBtE,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;CAkB9E"}
|
package/dist/client.js
CHANGED
|
@@ -1,34 +1,65 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//
|
|
3
|
-
|
|
2
|
+
// Content types enum for reuse
|
|
3
|
+
export const ContentTypeEnum = z.enum(["youtube", "x_twitter", "reddit", "article", "pdf"]);
|
|
4
|
+
export const ContentStatusEnum = z.enum(["pending", "processing", "completed", "failed"]);
|
|
5
|
+
// Summary can be either a string or a structured object
|
|
6
|
+
// The API returns different formats depending on processing stage
|
|
7
|
+
export const SummaryObjectSchema = z.object({
|
|
8
|
+
one_sentence: z.string().optional(),
|
|
9
|
+
text: z.string().optional(),
|
|
10
|
+
key_points: z.array(z.string()).optional(),
|
|
11
|
+
actionable_takeaways: z.array(z.string()).optional(),
|
|
12
|
+
}).passthrough(); // Allow additional fields from API
|
|
13
|
+
export const SummarySchema = z.union([
|
|
14
|
+
z.string(),
|
|
15
|
+
SummaryObjectSchema,
|
|
16
|
+
]).nullable().optional();
|
|
17
|
+
// Processing metadata schema (flexible for API variations)
|
|
18
|
+
export const ProcessingMetadataSchema = z.object({
|
|
19
|
+
processedAt: z.string().optional(),
|
|
20
|
+
duration: z.number().optional(),
|
|
21
|
+
model: z.string().optional(),
|
|
22
|
+
version: z.string().optional(),
|
|
23
|
+
}).passthrough().nullable().optional();
|
|
24
|
+
// Schema definitions matching Noverload database
|
|
25
|
+
// Required fields will throw if missing - no silent defaults for critical data
|
|
4
26
|
export const ContentSchema = z.object({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
url: z.string(),
|
|
27
|
+
// Required fields - will throw if missing
|
|
28
|
+
id: z.string().min(1, "Content ID is required"),
|
|
29
|
+
url: z.string().min(1, "Content URL is required"),
|
|
30
|
+
// Optional metadata - may not be present in API response
|
|
31
|
+
userId: z.string().optional(),
|
|
8
32
|
title: z.string().nullable().optional(),
|
|
9
33
|
description: z.string().nullable().optional(),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
34
|
+
// Fields with API-behavior defaults (API typically provides these)
|
|
35
|
+
contentType: ContentTypeEnum.optional().default("article"),
|
|
36
|
+
status: ContentStatusEnum.optional().default("pending"),
|
|
37
|
+
// Properly typed summary field
|
|
38
|
+
summary: SummarySchema,
|
|
39
|
+
keyInsights: z.array(z.string()).nullable().optional(),
|
|
40
|
+
// Content data
|
|
41
|
+
rawText: z.string().nullable().optional(),
|
|
42
|
+
tokenCount: z.number().nullable().optional(),
|
|
16
43
|
ogImage: z.string().nullable().optional(),
|
|
17
|
-
processingMetadata:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
44
|
+
processingMetadata: ProcessingMetadataSchema,
|
|
45
|
+
// Tags default to empty array (API convention)
|
|
46
|
+
tags: z.array(z.string()).optional().default([]),
|
|
47
|
+
// Timestamps - optional, no fabrication if missing
|
|
48
|
+
createdAt: z.string().optional(),
|
|
49
|
+
updatedAt: z.string().optional(),
|
|
21
50
|
});
|
|
22
51
|
export const ActionSchema = z.object({
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
52
|
+
// Required fields
|
|
53
|
+
id: z.string().min(1, "Action ID is required"),
|
|
54
|
+
title: z.string().min(1, "Action title is required"),
|
|
55
|
+
// Optional fields - no data fabrication
|
|
56
|
+
contentId: z.string().optional(),
|
|
57
|
+
goalId: z.string().nullable().optional(),
|
|
58
|
+
description: z.string().nullable().optional(),
|
|
59
|
+
priority: z.enum(["high", "medium", "low"]).nullable().optional(),
|
|
29
60
|
completed: z.boolean().optional().default(false),
|
|
30
|
-
completedAt: z.string().nullable().optional()
|
|
31
|
-
createdAt: z.string().optional()
|
|
61
|
+
completedAt: z.string().nullable().optional(),
|
|
62
|
+
createdAt: z.string().optional(),
|
|
32
63
|
});
|
|
33
64
|
export const GoalSchema = z.object({
|
|
34
65
|
id: z.string(),
|
|
@@ -163,6 +194,43 @@ export class NoverloadClient {
|
|
|
163
194
|
},
|
|
164
195
|
});
|
|
165
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* Transform raw API content to schema format
|
|
199
|
+
* Handles both camelCase and snake_case field names from API
|
|
200
|
+
* Required fields (id, url) are passed through - Zod validates them
|
|
201
|
+
*/
|
|
202
|
+
transformRawContent(item) {
|
|
203
|
+
// Get required fields - let Zod validate they exist
|
|
204
|
+
const id = item.id ?? item._id;
|
|
205
|
+
const url = item.url;
|
|
206
|
+
if (!id || !url) {
|
|
207
|
+
throw new Error(`Invalid content from API: missing ${!id ? 'id' : 'url'}`);
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
// Required fields
|
|
211
|
+
id,
|
|
212
|
+
url,
|
|
213
|
+
// Optional metadata - use undefined if missing, not empty string
|
|
214
|
+
userId: item.userId ?? item.user_id ?? undefined,
|
|
215
|
+
title: item.title ?? null,
|
|
216
|
+
description: item.description ?? null,
|
|
217
|
+
// Fields with defaults handled by schema
|
|
218
|
+
contentType: item.contentType ?? item.content_type ?? undefined,
|
|
219
|
+
status: item.status ?? undefined,
|
|
220
|
+
// Content fields
|
|
221
|
+
summary: item.summary ?? null,
|
|
222
|
+
keyInsights: item.keyInsights ?? item.key_insights ?? null,
|
|
223
|
+
rawText: item.rawText ?? item.raw_text ?? null,
|
|
224
|
+
tokenCount: item.tokenCount ?? item.token_count ?? null,
|
|
225
|
+
ogImage: item.ogImage ?? item.og_image ?? null,
|
|
226
|
+
processingMetadata: item.processingMetadata ?? item.processing_metadata ?? null,
|
|
227
|
+
// Tags
|
|
228
|
+
tags: item.tags ?? undefined,
|
|
229
|
+
// Timestamps - pass through as-is, no fabrication
|
|
230
|
+
createdAt: item.createdAt ?? item.created_at ?? undefined,
|
|
231
|
+
updatedAt: item.updatedAt ?? item.updated_at ?? undefined,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
166
234
|
// Content methods
|
|
167
235
|
async listContent(filters) {
|
|
168
236
|
const params = new URLSearchParams();
|
|
@@ -194,26 +262,12 @@ export class NoverloadClient {
|
|
|
194
262
|
}
|
|
195
263
|
const data = await response.json();
|
|
196
264
|
// v2 returns { success, contents, pagination }
|
|
197
|
-
const rawContents = data.contents
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
title: item.title || null,
|
|
204
|
-
description: item.description || null,
|
|
205
|
-
contentType: item.contentType || item.content_type || "article",
|
|
206
|
-
status: item.status || "completed",
|
|
207
|
-
summary: item.summary || null,
|
|
208
|
-
keyInsights: item.keyInsights || item.key_insights || null,
|
|
209
|
-
rawText: item.rawText || item.raw_text || null,
|
|
210
|
-
tokenCount: item.tokenCount || item.token_count || null,
|
|
211
|
-
ogImage: item.ogImage || item.og_image || null,
|
|
212
|
-
processingMetadata: item.processingMetadata || item.processing_metadata || null,
|
|
213
|
-
tags: item.tags || [],
|
|
214
|
-
createdAt: item.createdAt || item.created_at || new Date().toISOString(),
|
|
215
|
-
updatedAt: item.updatedAt || item.updated_at || new Date().toISOString(),
|
|
216
|
-
})) : [];
|
|
265
|
+
const rawContents = (data.contents ?? data);
|
|
266
|
+
if (!Array.isArray(rawContents)) {
|
|
267
|
+
throw new Error("Invalid API response: expected array of contents");
|
|
268
|
+
}
|
|
269
|
+
// Transform and validate each item
|
|
270
|
+
const transformedContents = rawContents.map((item) => this.transformRawContent(item));
|
|
217
271
|
return z.array(ContentSchema).parse(transformedContents);
|
|
218
272
|
}
|
|
219
273
|
async getContent(id) {
|
|
@@ -233,33 +287,18 @@ export class NoverloadClient {
|
|
|
233
287
|
}
|
|
234
288
|
}
|
|
235
289
|
catch {
|
|
236
|
-
// If JSON parsing fails, use status text
|
|
237
290
|
errorMessage = `${errorMessage} (HTTP ${response.status})`;
|
|
238
291
|
}
|
|
239
292
|
throw new Error(errorMessage);
|
|
240
293
|
}
|
|
241
294
|
const data = await response.json();
|
|
242
295
|
// v2 returns { success, content }
|
|
243
|
-
const rawContent = data.content
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
title: rawContent.title || null,
|
|
250
|
-
description: rawContent.description || null,
|
|
251
|
-
contentType: rawContent.contentType || rawContent.content_type || "article",
|
|
252
|
-
status: rawContent.status || "completed",
|
|
253
|
-
summary: rawContent.summary || null,
|
|
254
|
-
keyInsights: rawContent.keyInsights || rawContent.key_insights || null,
|
|
255
|
-
rawText: rawContent.rawText || rawContent.raw_text || null,
|
|
256
|
-
tokenCount: rawContent.tokenCount || rawContent.token_count || null,
|
|
257
|
-
ogImage: rawContent.ogImage || rawContent.og_image || null,
|
|
258
|
-
processingMetadata: rawContent.processingMetadata || rawContent.processing_metadata || null,
|
|
259
|
-
tags: rawContent.tags || [],
|
|
260
|
-
createdAt: rawContent.createdAt || rawContent.created_at || new Date().toISOString(),
|
|
261
|
-
updatedAt: rawContent.updatedAt || rawContent.updated_at || new Date().toISOString(),
|
|
262
|
-
};
|
|
296
|
+
const rawContent = (data.content ?? data);
|
|
297
|
+
if (!rawContent || typeof rawContent !== 'object') {
|
|
298
|
+
throw new Error(`Invalid API response for content ID: ${id}`);
|
|
299
|
+
}
|
|
300
|
+
// Transform and validate
|
|
301
|
+
const transformedContent = this.transformRawContent(rawContent);
|
|
263
302
|
return ContentSchema.parse(transformedContent);
|
|
264
303
|
}
|
|
265
304
|
async saveContent(url) {
|
|
@@ -293,6 +332,28 @@ export class NoverloadClient {
|
|
|
293
332
|
const data = await response.json();
|
|
294
333
|
return ContentSchema.parse(data);
|
|
295
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Transform raw API action to schema format
|
|
337
|
+
* Handles both camelCase and snake_case field names from API
|
|
338
|
+
*/
|
|
339
|
+
transformRawAction(item) {
|
|
340
|
+
const id = item.id;
|
|
341
|
+
const title = item.title;
|
|
342
|
+
if (!id || !title) {
|
|
343
|
+
throw new Error(`Invalid action from API: missing ${!id ? 'id' : 'title'}`);
|
|
344
|
+
}
|
|
345
|
+
return {
|
|
346
|
+
id,
|
|
347
|
+
title,
|
|
348
|
+
contentId: item.contentId ?? item.content_id ?? undefined,
|
|
349
|
+
goalId: item.goalId ?? item.goal_id ?? null,
|
|
350
|
+
description: item.description ?? null,
|
|
351
|
+
priority: item.priority ?? undefined,
|
|
352
|
+
completed: item.completed ?? item.is_completed ?? false,
|
|
353
|
+
completedAt: item.completedAt ?? item.completed_at ?? null,
|
|
354
|
+
createdAt: item.createdAt ?? item.created_at ?? undefined,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
296
357
|
// Action methods
|
|
297
358
|
async listActions(filters) {
|
|
298
359
|
const params = new URLSearchParams();
|
|
@@ -308,19 +369,12 @@ export class NoverloadClient {
|
|
|
308
369
|
throw new Error("Failed to fetch actions");
|
|
309
370
|
const data = await response.json();
|
|
310
371
|
// v2 returns { success, actions, pagination, statistics }
|
|
311
|
-
const rawActions = data.actions
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
title: item.title || "Untitled Action",
|
|
318
|
-
description: item.description || null,
|
|
319
|
-
priority: item.priority || "medium",
|
|
320
|
-
completed: item.completed ?? item.is_completed ?? false,
|
|
321
|
-
completedAt: item.completedAt || item.completed_at || null,
|
|
322
|
-
createdAt: item.createdAt || item.created_at || new Date().toISOString(),
|
|
323
|
-
})) : [];
|
|
372
|
+
const rawActions = (data.actions ?? data);
|
|
373
|
+
if (!Array.isArray(rawActions)) {
|
|
374
|
+
throw new Error("Invalid API response: expected array of actions");
|
|
375
|
+
}
|
|
376
|
+
// Transform and validate each item
|
|
377
|
+
const transformedActions = rawActions.map((item) => this.transformRawAction(item));
|
|
324
378
|
return z.array(ActionSchema).parse(transformedActions);
|
|
325
379
|
}
|
|
326
380
|
async completeAction(id) {
|
|
@@ -403,25 +457,15 @@ export class NoverloadClient {
|
|
|
403
457
|
// v2 returns { success, query, results, pagination, metadata }
|
|
404
458
|
const results = data?.results || [];
|
|
405
459
|
if (Array.isArray(results) && results.length > 0) {
|
|
406
|
-
return results.map((item) =>
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
keyInsights: item.keyInsights || item.key_insights || [],
|
|
416
|
-
rawText: item.rawText || item.raw_text || item.fullContent || null,
|
|
417
|
-
tokenCount: item.tokenCount || item.token_count || null,
|
|
418
|
-
ogImage: item.ogImage || item.og_image || null,
|
|
419
|
-
processingMetadata: item.processingMetadata || item.processing_metadata || null,
|
|
420
|
-
tags: item.tags || [],
|
|
421
|
-
createdAt: item.createdAt || item.created_at || item.metadata?.createdAt || new Date().toISOString(),
|
|
422
|
-
updatedAt: item.updatedAt || item.updated_at || item.metadata?.updatedAt || new Date().toISOString(),
|
|
423
|
-
relevanceScore: item.relevanceScore || item.score || 0,
|
|
424
|
-
}));
|
|
460
|
+
return results.map((item) => {
|
|
461
|
+
// Transform content fields using helper, but preserve search-specific fields
|
|
462
|
+
const baseContent = this.transformRawContent(item);
|
|
463
|
+
return {
|
|
464
|
+
...baseContent,
|
|
465
|
+
// Search-specific fields
|
|
466
|
+
relevanceScore: (item.relevanceScore ?? item.score ?? 0),
|
|
467
|
+
};
|
|
468
|
+
});
|
|
425
469
|
}
|
|
426
470
|
// If no results, try a fallback search with looser parameters
|
|
427
471
|
if (results.length === 0 && !options?.includeFullContent) {
|
|
@@ -455,25 +499,8 @@ export class NoverloadClient {
|
|
|
455
499
|
return [];
|
|
456
500
|
}
|
|
457
501
|
const data = await response.json();
|
|
458
|
-
const results = Array.isArray(data) ? data : (data.results
|
|
459
|
-
return results.map((item) => (
|
|
460
|
-
id: item.id || item._id || "",
|
|
461
|
-
userId: item.userId || item.user_id || "",
|
|
462
|
-
url: item.url || "",
|
|
463
|
-
title: item.title || "Untitled",
|
|
464
|
-
description: item.description || "",
|
|
465
|
-
contentType: item.contentType || item.content_type || "article",
|
|
466
|
-
status: item.status || "completed",
|
|
467
|
-
summary: item.summary || null,
|
|
468
|
-
keyInsights: item.keyInsights || item.key_insights || [],
|
|
469
|
-
rawText: item.rawText || item.raw_text || null,
|
|
470
|
-
tokenCount: item.tokenCount || item.token_count || null,
|
|
471
|
-
ogImage: item.ogImage || item.og_image || null,
|
|
472
|
-
processingMetadata: item.processingMetadata || item.processing_metadata || null,
|
|
473
|
-
tags: item.tags || [],
|
|
474
|
-
createdAt: item.createdAt || item.created_at || new Date().toISOString(),
|
|
475
|
-
updatedAt: item.updatedAt || item.updated_at || new Date().toISOString(),
|
|
476
|
-
}));
|
|
502
|
+
const results = Array.isArray(data) ? data : (data.results ?? []);
|
|
503
|
+
return results.map((item) => this.transformRawContent(item));
|
|
477
504
|
}
|
|
478
505
|
catch (error) {
|
|
479
506
|
console.error("v1 search error:", error);
|