@qoder-ai/qmind-cli 3.0.0 → 3.1.1
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/CHANGELOG.md +20 -0
- package/CHANGELOG.zh-CN.md +20 -0
- package/README.md +25 -13
- package/README.zh-CN.md +25 -13
- package/dist/bot-gateway-CB6KrV15.js +373 -0
- package/dist/cards-JaeY0mah.js +132 -0
- package/dist/{imports-Da88W09Q.js → imports-CHEgKeR5.js} +3 -3
- package/dist/{management-xYuUDFtg.js → management-J4OEjnLA.js} +5 -4
- package/dist/notes-CxkxuWdP.js +128 -0
- package/dist/qmind.js +396 -395
- package/dist/{shared-DwycozMA.js → shared-9iPJsfjP.js} +15 -6
- package/dist/source-upload-mZ-N52xb.js +17 -0
- package/dist/transfers-BRx_Hrlz.js +254 -0
- package/package.json +5 -3
- package/dist/cards-2J6ebaI0.js +0 -75
|
@@ -565,7 +565,9 @@ const sourceListSchema = z.object({
|
|
|
565
565
|
totalSize: z.number().int().nonnegative().optional()
|
|
566
566
|
});
|
|
567
567
|
const sourceTreeNodeSchema = z.lazy(() => z.object({
|
|
568
|
+
externalBinding: sourceExternalBindingSchema.optional(),
|
|
568
569
|
files: z.array(sourceTreeNodeSchema).default([]),
|
|
570
|
+
hasChildren: z.boolean().optional(),
|
|
569
571
|
id: z.string().min(1),
|
|
570
572
|
name: z.string().default(""),
|
|
571
573
|
path: z.string().default(""),
|
|
@@ -666,11 +668,12 @@ const sourcePreviewSchema = z.preprocess((value) => isRecord(value) ? {
|
|
|
666
668
|
url: httpsUrlSchema
|
|
667
669
|
}));
|
|
668
670
|
/** proto3 JSON serializes the token timeout and version as int64, so both arrive either way. */
|
|
671
|
+
const officeTokenIntegerSchema = z.union([z.number(), z.string().regex(/^\d+$/).transform(Number)]).pipe(z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER));
|
|
669
672
|
const webOfficeTokenFields = {
|
|
670
673
|
accessToken: z.string().min(1),
|
|
671
674
|
accessTokenExpiresAt: timestampSchema.optional(),
|
|
672
|
-
tokenTimeoutMs:
|
|
673
|
-
tokenVersion:
|
|
675
|
+
tokenTimeoutMs: officeTokenIntegerSchema.refine((value) => value > 0),
|
|
676
|
+
tokenVersion: officeTokenIntegerSchema
|
|
674
677
|
};
|
|
675
678
|
function webOfficeTokenAliases(value) {
|
|
676
679
|
return isRecord(value) ? {
|
|
@@ -693,11 +696,11 @@ const sourceWebOfficeSessionSchema = z.preprocess((value) => {
|
|
|
693
696
|
} : aliased;
|
|
694
697
|
}, z.object({
|
|
695
698
|
...webOfficeTokenFields,
|
|
696
|
-
readOnly: z.
|
|
699
|
+
readOnly: z.literal(true),
|
|
697
700
|
reused: z.boolean().default(false),
|
|
698
701
|
sessionId: z.string().min(1),
|
|
699
|
-
sourceFormat: z.string().
|
|
700
|
-
sourceId: z.string().
|
|
702
|
+
sourceFormat: z.string().min(1).transform((value) => value.trim().toLowerCase().replace(/^\./, "")).pipe(z.string().min(1)),
|
|
703
|
+
sourceId: z.string().min(1),
|
|
701
704
|
webOfficeUrl: httpsUrlSchema
|
|
702
705
|
}));
|
|
703
706
|
const sourceWebOfficeTokenSchema = z.preprocess(webOfficeTokenAliases, z.object(webOfficeTokenFields));
|
|
@@ -1038,6 +1041,12 @@ function optionalString(value, field) {
|
|
|
1038
1041
|
if (typeof value !== "string") throw invalidArgument(`${field} must be a string`, field);
|
|
1039
1042
|
return value;
|
|
1040
1043
|
}
|
|
1044
|
+
/** Validate body text without trimming meaningful Markdown indentation or trailing newlines. */
|
|
1045
|
+
function requiredText(value, field) {
|
|
1046
|
+
const text = optionalString(value, field);
|
|
1047
|
+
if (text === void 0 || text.trim().length === 0) throw invalidArgument(`${field} must be a non-empty string`, field);
|
|
1048
|
+
return text;
|
|
1049
|
+
}
|
|
1041
1050
|
function optionalTrimmedString(value, field) {
|
|
1042
1051
|
const string = optionalString(value, field)?.trim();
|
|
1043
1052
|
return string === "" ? void 0 : string;
|
|
@@ -1144,4 +1153,4 @@ function call(context, options) {
|
|
|
1144
1153
|
});
|
|
1145
1154
|
}
|
|
1146
1155
|
//#endregion
|
|
1147
|
-
export {
|
|
1156
|
+
export { QMIND_SOURCE_UPLOAD_MAX_BYTES as $, notebookSchema as A, sourceSchema as B, chatMessageListSchema as C, imageUrlsSchema as D, imageUploadTicketSchema as E, sourceContentSchema as F, sourceWebOfficeTokenSchema as G, sourceUploadCapabilitiesSchema as H, sourceImportResultsSchema as I, taskRunSchema as J, streamWireEventSchema as K, sourceListSchema as L, sharedNotebookListSchema as M, sourceActionAccessSchema as N, importProvidersSchema as O, sourceChildrenCountsSchema as P, QMIND_MULTIPART_UPLOAD_MAX_BYTES as Q, sourcePreviewSchema as R, cardSchema as S, chatSessionSchema as T, sourceUploadTicketSchema as U, sourceTreeSchema as V, sourceWebOfficeSessionSchema as W, voidResponseSchema as X, timestampSchema as Y, wikiBranchListSchema as Z, aliDingImportRunItemListSchema as _, invalidArgument as a, cancelQuestionResultSchema as b, optionalRecord as c, pagination as d, assertCapability as et, positiveInteger as f, stringList as g, requiredText as h, httpUrl as i, retrieveResultSchema as j, notebookListSchema as k, optionalString as l, requiredString as m, call as n, executeUnary as nt, nonNegativeInteger as o, queryPath as p, taskRunListSchema as q, compactUndefined as r, QMindError as rt, optionalBoolean as s, assertNonEmptyPatch as t, executeStream as tt, optionalTrimmedString as u, aliDingImportRunSchema as v, chatSessionListSchema as w, cardListSchema as x, batchMutationResultSchema as y, sourceRawContentSchema as z };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { H as sourceUploadCapabilitiesSchema, m as requiredString, n as call } from "./shared-9iPJsfjP.js";
|
|
2
|
+
//#region ../sdk/src/operations/source-upload.ts
|
|
3
|
+
/** Notebook-scoped edit preflight, not the deployment-level capabilities lookup. */
|
|
4
|
+
async function preflightSourceUpload(context, notebookId, options) {
|
|
5
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
6
|
+
return call(context, {
|
|
7
|
+
callOptions: options,
|
|
8
|
+
capability: "transfers",
|
|
9
|
+
idempotent: true,
|
|
10
|
+
method: "GET",
|
|
11
|
+
operation: "sources.uploadPreflight",
|
|
12
|
+
path: context.profile.apiPath("notebooks", notebook, "sources", "upload", "capabilities"),
|
|
13
|
+
schema: sourceUploadCapabilitiesSchema
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { preflightSourceUpload as t };
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { $ as QMIND_SOURCE_UPLOAD_MAX_BYTES, B as sourceSchema, E as imageUploadTicketSchema, Q as QMIND_MULTIPART_UPLOAD_MAX_BYTES, U as sourceUploadTicketSchema, X as voidResponseSchema, a as invalidArgument, l as optionalString, m as requiredString, nt as executeUnary, p as queryPath, r as compactUndefined, rt as QMindError, u as optionalTrimmedString } from "./shared-9iPJsfjP.js";
|
|
2
|
+
import { t as preflightSourceUpload } from "./source-upload-mZ-N52xb.js";
|
|
3
|
+
//#region ../sdk/src/operations/transfers.ts
|
|
4
|
+
function isRecord(value) {
|
|
5
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
function binarySource(value) {
|
|
8
|
+
if (!isRecord(value)) throw invalidArgument("source must be a QMindBinarySource", "source");
|
|
9
|
+
const filename = requiredString(value.filename, "source.filename");
|
|
10
|
+
const mimeType = requiredString(value.mimeType, "source.mimeType");
|
|
11
|
+
const size = value.size;
|
|
12
|
+
if (typeof size !== "number" || !Number.isSafeInteger(size) || size <= 0) throw invalidArgument("source.size must be a positive safe integer", "source.size");
|
|
13
|
+
if (typeof value.open !== "function") throw invalidArgument("source.open must be a function", "source.open");
|
|
14
|
+
const source = value;
|
|
15
|
+
return {
|
|
16
|
+
filename,
|
|
17
|
+
mimeType,
|
|
18
|
+
open: () => source.open(),
|
|
19
|
+
size
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function transferOptions(options) {
|
|
23
|
+
if (options === void 0) return {};
|
|
24
|
+
if (!isRecord(options)) throw invalidArgument("options must be an object", "options");
|
|
25
|
+
if (options.onProgress !== void 0 && typeof options.onProgress !== "function") throw invalidArgument("onProgress must be a function", "onProgress");
|
|
26
|
+
return options;
|
|
27
|
+
}
|
|
28
|
+
function uploadMetadata(value) {
|
|
29
|
+
if (value === void 0) return {};
|
|
30
|
+
if (!isRecord(value)) throw invalidArgument("metadata must be an object", "metadata");
|
|
31
|
+
return {
|
|
32
|
+
parentSourceId: optionalString(value.parentSourceId, "parentSourceId"),
|
|
33
|
+
path: optionalString(value.path, "path"),
|
|
34
|
+
sha256: optionalTrimmedString(value.sha256, "sha256"),
|
|
35
|
+
sourceType: optionalTrimmedString(value.sourceType, "sourceType"),
|
|
36
|
+
title: optionalTrimmedString(value.title, "title")
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function progressReporter(context, operation, strategy, totalBytes, options) {
|
|
40
|
+
let lastUploadedBytes = 0;
|
|
41
|
+
const notify = (phase, uploadedBytes) => {
|
|
42
|
+
if (!Number.isSafeInteger(uploadedBytes) || uploadedBytes < lastUploadedBytes) throw new QMindError("HOST_POLICY_ERROR", "upload progress must be a monotonic integer", {
|
|
43
|
+
access: context.profile.access,
|
|
44
|
+
details: {
|
|
45
|
+
lastUploadedBytes,
|
|
46
|
+
totalBytes,
|
|
47
|
+
uploadedBytes
|
|
48
|
+
},
|
|
49
|
+
operation
|
|
50
|
+
});
|
|
51
|
+
if (uploadedBytes > totalBytes) throw new QMindError("HOST_POLICY_ERROR", "upload progress exceeds source size", {
|
|
52
|
+
access: context.profile.access,
|
|
53
|
+
details: {
|
|
54
|
+
totalBytes,
|
|
55
|
+
uploadedBytes
|
|
56
|
+
},
|
|
57
|
+
operation
|
|
58
|
+
});
|
|
59
|
+
lastUploadedBytes = uploadedBytes;
|
|
60
|
+
const progress = {
|
|
61
|
+
phase,
|
|
62
|
+
strategy,
|
|
63
|
+
totalBytes,
|
|
64
|
+
uploadedBytes
|
|
65
|
+
};
|
|
66
|
+
options.onProgress?.(progress);
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
complete: () => notify("uploading", totalBytes),
|
|
70
|
+
registering: () => notify("registering", totalBytes),
|
|
71
|
+
start: () => notify("uploading", 0),
|
|
72
|
+
update: (uploadedBytes) => notify("uploading", uploadedBytes)
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function transferRequestOptions(options) {
|
|
76
|
+
const timeoutMs = options.timeoutMs;
|
|
77
|
+
if (timeoutMs !== void 0 && (!Number.isFinite(timeoutMs) || timeoutMs <= 0)) throw invalidArgument("timeoutMs must be a positive finite number", "timeoutMs");
|
|
78
|
+
const deadlineAt = timeoutMs === void 0 ? void 0 : Date.now() + timeoutMs;
|
|
79
|
+
return (operation) => {
|
|
80
|
+
if (options.signal?.aborted === true) throw new QMindError("ABORTED", "QMind transfer was aborted", { operation });
|
|
81
|
+
if (deadlineAt === void 0) return options.signal === void 0 ? {} : { signal: options.signal };
|
|
82
|
+
const remainingMs = Math.ceil(deadlineAt - Date.now());
|
|
83
|
+
if (remainingMs <= 0) throw new QMindError("TIMEOUT", "QMind transfer timed out", {
|
|
84
|
+
details: { timeoutMs },
|
|
85
|
+
operation
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
...options.signal === void 0 ? {} : { signal: options.signal },
|
|
89
|
+
timeoutMs: remainingMs
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function transferCall(context, operation, request, schema) {
|
|
94
|
+
return executeUnary({
|
|
95
|
+
capability: operation.startsWith("images.") ? "images.presignUpload" : "transfers",
|
|
96
|
+
operation,
|
|
97
|
+
profile: context.profile,
|
|
98
|
+
request,
|
|
99
|
+
schema,
|
|
100
|
+
transport: context.transport
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function hostRequest(path, method, idempotent, options, requestOptions, operation, body) {
|
|
104
|
+
const authorization = options.authorization?.trim();
|
|
105
|
+
return {
|
|
106
|
+
body,
|
|
107
|
+
destination: {
|
|
108
|
+
kind: "host",
|
|
109
|
+
path
|
|
110
|
+
},
|
|
111
|
+
...authorization === void 0 || authorization.length === 0 ? {} : { headers: { authorization: `Bearer ${authorization}` } },
|
|
112
|
+
idempotent,
|
|
113
|
+
method,
|
|
114
|
+
...requestOptions(operation)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function signedUploadRequest(ticket, source, progress, requestOptions, operation) {
|
|
118
|
+
return {
|
|
119
|
+
body: {
|
|
120
|
+
kind: "binary",
|
|
121
|
+
onProgress: progress.update,
|
|
122
|
+
source
|
|
123
|
+
},
|
|
124
|
+
destination: {
|
|
125
|
+
kind: "signed",
|
|
126
|
+
url: ticket.uploadUrl
|
|
127
|
+
},
|
|
128
|
+
headers: ticket.headers,
|
|
129
|
+
idempotent: true,
|
|
130
|
+
method: "PUT",
|
|
131
|
+
...requestOptions(operation)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function selectSourceUploadStrategy(source, capabilities) {
|
|
135
|
+
const methods = capabilities.uploadMethods.filter(({ available, method, maxSizeBytes }) => available && maxSizeBytes > 0 && (method === "multipart" || method === "presign"));
|
|
136
|
+
if (methods.length === 0) throw new QMindError("UNSUPPORTED_OPERATION", "source upload is unavailable", {
|
|
137
|
+
details: { reason: "upload-unavailable" },
|
|
138
|
+
operation: "sources.uploadPreflight"
|
|
139
|
+
});
|
|
140
|
+
const filename = source.filename.toLowerCase();
|
|
141
|
+
const matching = methods.filter(({ supportedExtensions }) => supportedExtensions.some((extension) => filename.endsWith(extension.toLowerCase())));
|
|
142
|
+
if (matching.length === 0) throw new QMindError("INVALID_ARGUMENT", "file extension is not supported for upload", {
|
|
143
|
+
details: { reason: "unsupported-extension" },
|
|
144
|
+
operation: "sources.uploadPreflight"
|
|
145
|
+
});
|
|
146
|
+
const limit = (method) => Math.min(method.maxSizeBytes, method.method === "multipart" ? QMIND_MULTIPART_UPLOAD_MAX_BYTES : QMIND_SOURCE_UPLOAD_MAX_BYTES);
|
|
147
|
+
if (matching.find((method) => method.method === "multipart" && source.size <= limit(method))) return "multipart";
|
|
148
|
+
if (matching.some((method) => method.method === "presign" && source.size <= limit(method))) return "presigned";
|
|
149
|
+
throw new QMindError("FILE_TOO_LARGE", "file exceeds the available upload size limit", {
|
|
150
|
+
details: {
|
|
151
|
+
limitBytes: Math.max(...matching.map(limit)),
|
|
152
|
+
size: source.size
|
|
153
|
+
},
|
|
154
|
+
operation: "sources.uploadPreflight"
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function createTransferOperations(context) {
|
|
158
|
+
return {
|
|
159
|
+
async uploadImage(notebookId, sourceId, rawSource, rawOptions) {
|
|
160
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
161
|
+
const sourceIdValue = requiredString(sourceId, "sourceId");
|
|
162
|
+
const source = binarySource(rawSource);
|
|
163
|
+
const options = transferOptions(rawOptions);
|
|
164
|
+
const requestOptions = transferRequestOptions(options);
|
|
165
|
+
if (source.size > 52428800) throw new QMindError("FILE_TOO_LARGE", "image exceeds the 50 MiB upload limit", {
|
|
166
|
+
access: context.profile.access,
|
|
167
|
+
details: {
|
|
168
|
+
limitBytes: QMIND_MULTIPART_UPLOAD_MAX_BYTES,
|
|
169
|
+
size: source.size
|
|
170
|
+
},
|
|
171
|
+
operation: "images.upload"
|
|
172
|
+
});
|
|
173
|
+
const ticket = await transferCall(context, "images.presignUpload", hostRequest(context.profile.apiPath("notebooks", notebook, "sources", sourceIdValue, "images", "presign"), "POST", false, options, requestOptions, "images.presignUpload", {
|
|
174
|
+
kind: "json",
|
|
175
|
+
value: {
|
|
176
|
+
filename: source.filename,
|
|
177
|
+
mimeType: source.mimeType,
|
|
178
|
+
size: source.size
|
|
179
|
+
}
|
|
180
|
+
}), imageUploadTicketSchema);
|
|
181
|
+
const progress = progressReporter(context, "images.upload", "presigned", source.size, options);
|
|
182
|
+
progress.start();
|
|
183
|
+
await transferCall(context, "images.upload", signedUploadRequest(ticket, source, progress, requestOptions, "images.upload"), voidResponseSchema);
|
|
184
|
+
progress.complete();
|
|
185
|
+
return ticket;
|
|
186
|
+
},
|
|
187
|
+
async uploadSource(notebookId, rawSource, rawMetadata, rawOptions) {
|
|
188
|
+
const notebook = requiredString(notebookId, "notebookId");
|
|
189
|
+
const source = binarySource(rawSource);
|
|
190
|
+
const metadata = uploadMetadata(rawMetadata);
|
|
191
|
+
const options = transferOptions(rawOptions);
|
|
192
|
+
const requestOptions = transferRequestOptions(options);
|
|
193
|
+
if (source.size > 524288e3) throw new QMindError("FILE_TOO_LARGE", "file exceeds the 500 MiB upload limit", {
|
|
194
|
+
access: context.profile.access,
|
|
195
|
+
details: {
|
|
196
|
+
limitBytes: QMIND_SOURCE_UPLOAD_MAX_BYTES,
|
|
197
|
+
size: source.size
|
|
198
|
+
},
|
|
199
|
+
operation: "transfers.source.multipart"
|
|
200
|
+
});
|
|
201
|
+
if (selectSourceUploadStrategy(source, await preflightSourceUpload(context, notebook, {
|
|
202
|
+
...options,
|
|
203
|
+
...requestOptions("sources.uploadPreflight")
|
|
204
|
+
})) === "multipart") {
|
|
205
|
+
const progress = progressReporter(context, "transfers.source.multipart", "multipart", source.size, options);
|
|
206
|
+
progress.start();
|
|
207
|
+
const fields = compactUndefined({
|
|
208
|
+
parent_source_id: metadata.parentSourceId,
|
|
209
|
+
path: metadata.path,
|
|
210
|
+
retain_original_file: "true",
|
|
211
|
+
source_type: metadata.sourceType,
|
|
212
|
+
title: metadata.title
|
|
213
|
+
});
|
|
214
|
+
const result = await transferCall(context, "transfers.source.multipart", hostRequest(queryPath(context.profile.apiPath("notebooks", notebook, "sources", "upload"), [["client", context.client]]), "POST", false, options, requestOptions, "transfers.source.multipart", {
|
|
215
|
+
file: source,
|
|
216
|
+
fields,
|
|
217
|
+
kind: "multipart",
|
|
218
|
+
onProgress: progress.update
|
|
219
|
+
}), sourceSchema);
|
|
220
|
+
progress.complete();
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
const ticket = await transferCall(context, "transfers.source.presign", hostRequest(context.profile.apiPath("notebooks", notebook, "sources", "presign"), "POST", false, options, requestOptions, "transfers.source.presign", {
|
|
224
|
+
kind: "json",
|
|
225
|
+
value: {
|
|
226
|
+
filename: source.filename,
|
|
227
|
+
mimeType: source.mimeType,
|
|
228
|
+
size: source.size
|
|
229
|
+
}
|
|
230
|
+
}), sourceUploadTicketSchema);
|
|
231
|
+
const progress = progressReporter(context, "transfers.source.upload", "presigned", source.size, options);
|
|
232
|
+
progress.start();
|
|
233
|
+
await transferCall(context, "transfers.source.upload", signedUploadRequest(ticket, source, progress, requestOptions, "transfers.source.upload"), voidResponseSchema);
|
|
234
|
+
progress.complete();
|
|
235
|
+
progress.registering();
|
|
236
|
+
return transferCall(context, "transfers.source.register", hostRequest(context.profile.apiPath("notebooks", notebook, "sources", "register"), "POST", false, options, requestOptions, "transfers.source.register", {
|
|
237
|
+
kind: "json",
|
|
238
|
+
value: compactUndefined({
|
|
239
|
+
filename: source.filename,
|
|
240
|
+
mimeType: source.mimeType,
|
|
241
|
+
parentSourceId: metadata.parentSourceId,
|
|
242
|
+
path: metadata.path,
|
|
243
|
+
sha256: metadata.sha256,
|
|
244
|
+
size: source.size,
|
|
245
|
+
sourceType: metadata.sourceType,
|
|
246
|
+
title: metadata.title,
|
|
247
|
+
uri: ticket.uri
|
|
248
|
+
})
|
|
249
|
+
}), sourceSchema);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
//#endregion
|
|
254
|
+
export { createTransferOperations };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qoder-ai/qmind-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "QMind command line interface",
|
|
5
5
|
"bin": {
|
|
6
6
|
"qmind": "bin/cli.js"
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"p-limit": "7.3.1",
|
|
31
31
|
"picomatch": "4.0.5",
|
|
32
32
|
"proper-lockfile": "4.1.2",
|
|
33
|
+
"semver": "7.8.5",
|
|
33
34
|
"undici": "7.29.0",
|
|
34
35
|
"zod": "4.3.6"
|
|
35
36
|
},
|
|
@@ -37,8 +38,9 @@
|
|
|
37
38
|
"@types/node": "24.13.3",
|
|
38
39
|
"@types/picomatch": "4.0.3",
|
|
39
40
|
"@types/proper-lockfile": "4.1.4",
|
|
40
|
-
"@
|
|
41
|
-
"@ali/qmind-
|
|
41
|
+
"@types/semver": "7.8.0",
|
|
42
|
+
"@ali/qmind-node-host": "^2.2.34",
|
|
43
|
+
"@ali/qmind-sdk": "^0.15.24"
|
|
42
44
|
},
|
|
43
45
|
"license": "UNLICENSED"
|
|
44
46
|
}
|
package/dist/cards-2J6ebaI0.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { b as cardListSchema, d as pagination, h as stringList, m as requiredString, n as call, p as queryPath, u as optionalTrimmedString, v as batchMutationResultSchema, x as cardSchema } from "./shared-DwycozMA.js";
|
|
2
|
-
//#region ../sdk/src/operations/cards.ts
|
|
3
|
-
function createCardOperations(context) {
|
|
4
|
-
const listCards = async (notebookId, input = {}, options, featured = false) => {
|
|
5
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
6
|
-
const normalizedPage = pagination({
|
|
7
|
-
page: input.page ?? 1,
|
|
8
|
-
pageSize: input.pageSize ?? 20
|
|
9
|
-
});
|
|
10
|
-
const category = optionalTrimmedString(input.category, "category");
|
|
11
|
-
const query = optionalTrimmedString(input.query, "query");
|
|
12
|
-
const root = context.profile.apiPath(featured ? "featured-notebooks" : "notebooks", notebook, "cards");
|
|
13
|
-
const path = queryPath(root, [
|
|
14
|
-
["category", category],
|
|
15
|
-
["query", query],
|
|
16
|
-
["page", normalizedPage.page],
|
|
17
|
-
["page_size", normalizedPage.pageSize]
|
|
18
|
-
]);
|
|
19
|
-
return call(context, {
|
|
20
|
-
callOptions: options,
|
|
21
|
-
capability: featured ? "featuredNotebooks.read" : "cards.read",
|
|
22
|
-
idempotent: true,
|
|
23
|
-
method: "GET",
|
|
24
|
-
operation: featured ? "featuredCards.list" : "cards.list",
|
|
25
|
-
path,
|
|
26
|
-
schema: cardListSchema
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
async batchDeleteCards(notebookId, cardIds, options) {
|
|
31
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
32
|
-
const ids = stringList(cardIds, "cardIds", { min: 1 });
|
|
33
|
-
return call(context, {
|
|
34
|
-
body: { cardIds: ids },
|
|
35
|
-
callOptions: options,
|
|
36
|
-
capability: "cards.write",
|
|
37
|
-
idempotent: false,
|
|
38
|
-
method: "POST",
|
|
39
|
-
operation: "cards.batchDelete",
|
|
40
|
-
path: context.profile.apiPath("notebooks", notebook, "cards", "batch-delete"),
|
|
41
|
-
schema: batchMutationResultSchema
|
|
42
|
-
});
|
|
43
|
-
},
|
|
44
|
-
async deleteCard(notebookId, cardId, options) {
|
|
45
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
46
|
-
const card = requiredString(cardId, "cardId");
|
|
47
|
-
return call(context, {
|
|
48
|
-
callOptions: options,
|
|
49
|
-
capability: "cards.write",
|
|
50
|
-
idempotent: false,
|
|
51
|
-
method: "DELETE",
|
|
52
|
-
operation: "cards.delete",
|
|
53
|
-
path: context.profile.apiPath("notebooks", notebook, "cards", card),
|
|
54
|
-
schema: batchMutationResultSchema
|
|
55
|
-
});
|
|
56
|
-
},
|
|
57
|
-
async getCard(notebookId, cardId, options) {
|
|
58
|
-
const notebook = requiredString(notebookId, "notebookId");
|
|
59
|
-
const card = requiredString(cardId, "cardId");
|
|
60
|
-
return call(context, {
|
|
61
|
-
callOptions: options,
|
|
62
|
-
capability: "cards.read",
|
|
63
|
-
idempotent: true,
|
|
64
|
-
method: "GET",
|
|
65
|
-
operation: "cards.get",
|
|
66
|
-
path: context.profile.apiPath("notebooks", notebook, "cards", card),
|
|
67
|
-
schema: cardSchema
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
listCards: (notebookId, input, options) => listCards(notebookId, input, options),
|
|
71
|
-
listFeaturedCards: (notebookId, input, options) => listCards(notebookId, input, options, true)
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
//#endregion
|
|
75
|
-
export { createCardOperations };
|