@qodercn-ai/qmind-cli 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,128 @@
1
+ import { X as voidResponseSchema, Y as timestampSchema, c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, t as assertNonEmptyPatch } from "./shared-BkQJzIZF.js";
2
+ import { z } from "zod";
3
+ //#region ../sdk/src/operations/note-schemas.ts
4
+ const noteSchema = z.object({
5
+ content: z.string().default(""),
6
+ createdAt: timestampSchema.optional(),
7
+ id: z.string().min(1),
8
+ metadata: z.record(z.string(), z.unknown()).nullish(),
9
+ notebookId: z.string().default(""),
10
+ noteType: z.string().default(""),
11
+ orgId: z.string().default(""),
12
+ title: z.string().default(""),
13
+ updatedAt: timestampSchema.optional(),
14
+ userId: z.string().default("")
15
+ });
16
+ const noteListSchema = z.object({
17
+ currentPage: z.number().int().nonnegative().optional(),
18
+ notes: z.array(noteSchema).nullish().transform((notes) => notes ?? []),
19
+ pageSize: z.number().int().nonnegative().optional(),
20
+ totalSize: z.number().int().nonnegative().default(0)
21
+ });
22
+ //#endregion
23
+ //#region ../sdk/src/operations/notes.ts
24
+ function createNoteOperations(context) {
25
+ return {
26
+ async createNote(notebookId, input, options) {
27
+ const notebook = requiredString(notebookId, "notebookId");
28
+ const body = compactUndefined({
29
+ content: requiredText(input?.content, "content"),
30
+ metadata: optionalRecord(input?.metadata, "metadata"),
31
+ noteType: optionalString(input?.noteType, "noteType"),
32
+ title: requiredString(input?.title, "title")
33
+ });
34
+ return call(context, {
35
+ body,
36
+ callOptions: options,
37
+ capability: "notes.write",
38
+ idempotent: false,
39
+ method: "POST",
40
+ operation: "notes.create",
41
+ path: context.profile.apiPath("notebooks", notebook, "notes"),
42
+ schema: noteSchema
43
+ });
44
+ },
45
+ async deleteNote(notebookId, noteId, options) {
46
+ const notebook = requiredString(notebookId, "notebookId");
47
+ const note = requiredString(noteId, "noteId");
48
+ return call(context, {
49
+ callOptions: options,
50
+ capability: "notes.write",
51
+ idempotent: false,
52
+ method: "DELETE",
53
+ operation: "notes.delete",
54
+ path: context.profile.apiPath("notebooks", notebook, "notes", note),
55
+ schema: voidResponseSchema
56
+ });
57
+ },
58
+ async getNote(notebookId, noteId, options) {
59
+ const notebook = requiredString(notebookId, "notebookId");
60
+ const note = requiredString(noteId, "noteId");
61
+ return call(context, {
62
+ callOptions: options,
63
+ capability: "notes.read",
64
+ idempotent: true,
65
+ method: "GET",
66
+ operation: "notes.get",
67
+ path: context.profile.apiPath("notebooks", notebook, "notes", note),
68
+ schema: noteSchema
69
+ });
70
+ },
71
+ async listNotes(notebookId, input = {}, options) {
72
+ const notebook = requiredString(notebookId, "notebookId");
73
+ const page = pagination({
74
+ page: input.page ?? 1,
75
+ pageSize: input.pageSize ?? 20
76
+ });
77
+ return call(context, {
78
+ callOptions: options,
79
+ capability: "notes.read",
80
+ idempotent: true,
81
+ method: "GET",
82
+ operation: "notes.list",
83
+ path: queryPath(context.profile.apiPath("notebooks", notebook, "notes"), [["page", page.page], ["page_size", page.pageSize]]),
84
+ schema: noteListSchema
85
+ });
86
+ },
87
+ async saveCondensationResult(notebookId, input, options) {
88
+ const notebook = requiredString(notebookId, "notebookId");
89
+ const body = {
90
+ content: requiredText(input?.content, "content"),
91
+ title: requiredString(input?.title, "title")
92
+ };
93
+ return call(context, {
94
+ body,
95
+ callOptions: options,
96
+ capability: "notes.saveCondensation",
97
+ idempotent: false,
98
+ method: "POST",
99
+ operation: "notes.saveCondensationResult",
100
+ path: context.profile.apiPath("notebooks", notebook, "condensation-results", "save"),
101
+ schema: noteSchema
102
+ });
103
+ },
104
+ async updateNote(notebookId, noteId, input, options) {
105
+ const notebook = requiredString(notebookId, "notebookId");
106
+ const note = requiredString(noteId, "noteId");
107
+ const body = compactUndefined({
108
+ content: optionalString(input?.content, "content"),
109
+ metadata: optionalRecord(input?.metadata, "metadata"),
110
+ noteType: optionalString(input?.noteType, "noteType"),
111
+ title: input?.title === void 0 ? void 0 : requiredString(input.title, "title")
112
+ });
113
+ assertNonEmptyPatch(body, "input");
114
+ return call(context, {
115
+ body,
116
+ callOptions: options,
117
+ capability: "notes.write",
118
+ idempotent: false,
119
+ method: "PUT",
120
+ operation: "notes.update",
121
+ path: context.profile.apiPath("notebooks", notebook, "notes", note),
122
+ schema: noteSchema
123
+ });
124
+ }
125
+ };
126
+ }
127
+ //#endregion
128
+ export { createNoteOperations };