@qoder-ai/qmind-cli 4.2.0 → 5.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/CHANGELOG.md +16 -0
- package/CHANGELOG.zh-CN.md +16 -0
- package/README.md +9 -5
- package/README.zh-CN.md +11 -7
- package/dist/data-sources-DItXSL_s.js +129 -0
- package/dist/{imports-BZyUf1pq.js → imports-CSg7ebnN.js} +15 -15
- package/dist/management-iTQ9-Osc.js +206 -0
- package/dist/nezha-B_SP8BvK.js +13 -0
- package/dist/{notes-BRnv_Z10.js → notes-BUq1ciGO.js} +7 -7
- package/dist/qmind.js +5456 -5605
- package/dist/{shared-53S5tNf6.js → shared-evTnu_EB.js} +523 -265
- package/dist/{source-upload-DlOLtECT.js → source-upload-DckYHoRo.js} +2 -2
- package/dist/{transfers-cf1MXHdB.js → transfers-C0pXH5Qe.js} +94 -18
- package/dist/wiki-_a2EAozi.js +100 -0
- package/dist/{wiki-branches-DmgHlIxc.js → wiki-branches-DViaqEOy.js} +3 -3
- package/package.json +5 -5
- package/dist/bot-gateway-B5cW3ErV.js +0 -373
- package/dist/management-DQVj17Hn.js +0 -386
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
import { Z as timestampSchema, a as invalidArgument, c as optionalRecord, d as pagination, h as requiredText, l as optionalString, m as requiredString, n as call, p as queryPath, r as compactUndefined, s as optionalBoolean, t as assertNonEmptyPatch, u as optionalTrimmedString } from "./shared-53S5tNf6.js";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
//#region ../sdk/src/operations/bot-gateway-codecs.ts
|
|
4
|
-
const botTimestamp = z.preprocess((value) => typeof value === "object" && value !== null && !Array.isArray(value) && !("seconds" in value) ? {
|
|
5
|
-
...value,
|
|
6
|
-
seconds: 0
|
|
7
|
-
} : value, timestampSchema).optional();
|
|
8
|
-
const jsonObject = z.record(z.string(), z.json());
|
|
9
|
-
const fields = {
|
|
10
|
-
id: z.string().min(1),
|
|
11
|
-
org_id: z.string().default(""),
|
|
12
|
-
platform: z.string().default(""),
|
|
13
|
-
is_active: z.boolean().default(false),
|
|
14
|
-
created_at: botTimestamp,
|
|
15
|
-
updated_at: botTimestamp
|
|
16
|
-
};
|
|
17
|
-
function base(value) {
|
|
18
|
-
return {
|
|
19
|
-
id: value.id,
|
|
20
|
-
orgId: value.org_id,
|
|
21
|
-
platform: value.platform,
|
|
22
|
-
isActive: value.is_active,
|
|
23
|
-
...value.created_at === void 0 ? {} : { createdAt: value.created_at },
|
|
24
|
-
...value.updated_at === void 0 ? {} : { updatedAt: value.updated_at }
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
const platformAppSchema = z.object({
|
|
28
|
-
...fields,
|
|
29
|
-
app_name: z.string().default(""),
|
|
30
|
-
client_id: z.string().default("")
|
|
31
|
-
}).transform((value) => ({
|
|
32
|
-
...base(value),
|
|
33
|
-
appName: value.app_name,
|
|
34
|
-
clientId: value.client_id
|
|
35
|
-
}));
|
|
36
|
-
const expertBindingSchema = z.object({
|
|
37
|
-
...fields,
|
|
38
|
-
user_id: z.string().default(""),
|
|
39
|
-
platform_app_id: z.string().default(""),
|
|
40
|
-
external_union_id: z.string().default(""),
|
|
41
|
-
external_nickname: z.string().default("")
|
|
42
|
-
}).transform((value) => ({
|
|
43
|
-
...base(value),
|
|
44
|
-
userId: value.user_id,
|
|
45
|
-
platformAppId: value.platform_app_id,
|
|
46
|
-
externalUnionId: value.external_union_id,
|
|
47
|
-
externalNickname: value.external_nickname
|
|
48
|
-
}));
|
|
49
|
-
const groupBindingSchema = z.object({
|
|
50
|
-
...fields,
|
|
51
|
-
platform_app_id: z.string().default(""),
|
|
52
|
-
conversation_id: z.string().default(""),
|
|
53
|
-
conversation_name: z.string().default(""),
|
|
54
|
-
notebook_id: z.string().default(""),
|
|
55
|
-
context_window: z.int32().default(0),
|
|
56
|
-
writer_user_id: z.string().default(""),
|
|
57
|
-
instructions: jsonObject.nullish()
|
|
58
|
-
}).transform((value) => ({
|
|
59
|
-
...base(value),
|
|
60
|
-
platformAppId: value.platform_app_id,
|
|
61
|
-
conversationId: value.conversation_id,
|
|
62
|
-
conversationName: value.conversation_name,
|
|
63
|
-
notebookId: value.notebook_id,
|
|
64
|
-
contextWindow: value.context_window,
|
|
65
|
-
writerUserId: value.writer_user_id,
|
|
66
|
-
...value.instructions == null ? {} : { instructions: value.instructions }
|
|
67
|
-
}));
|
|
68
|
-
const pageInfoSchema = z.object({
|
|
69
|
-
current_page: z.int32().nonnegative().default(0),
|
|
70
|
-
last_page: z.int32().nonnegative().default(0),
|
|
71
|
-
next_page: z.int32().nonnegative().default(0),
|
|
72
|
-
prev_page: z.int32().nonnegative().default(0),
|
|
73
|
-
page_size: z.int32().nonnegative().default(0),
|
|
74
|
-
total_size: z.int32().nonnegative().default(0),
|
|
75
|
-
next_token: z.string().default("")
|
|
76
|
-
}).transform((value) => ({
|
|
77
|
-
currentPage: value.current_page,
|
|
78
|
-
lastPage: value.last_page,
|
|
79
|
-
nextPage: value.next_page,
|
|
80
|
-
previousPage: value.prev_page,
|
|
81
|
-
pageSize: value.page_size,
|
|
82
|
-
totalSize: value.total_size,
|
|
83
|
-
nextToken: value.next_token
|
|
84
|
-
}));
|
|
85
|
-
const platformAppListSchema = z.object({
|
|
86
|
-
apps: z.array(platformAppSchema).nullish(),
|
|
87
|
-
pages: pageInfoSchema.nullish()
|
|
88
|
-
}).transform((value) => ({
|
|
89
|
-
apps: value.apps ?? [],
|
|
90
|
-
...value.pages == null ? {} : { pages: value.pages }
|
|
91
|
-
}));
|
|
92
|
-
const expertBindingListSchema = z.object({
|
|
93
|
-
bindings: z.array(expertBindingSchema).nullish(),
|
|
94
|
-
pages: pageInfoSchema.nullish()
|
|
95
|
-
}).transform((value) => ({
|
|
96
|
-
bindings: value.bindings ?? [],
|
|
97
|
-
...value.pages == null ? {} : { pages: value.pages }
|
|
98
|
-
}));
|
|
99
|
-
const groupBindingListSchema = z.object({
|
|
100
|
-
bindings: z.array(groupBindingSchema).nullish(),
|
|
101
|
-
pages: pageInfoSchema.nullish()
|
|
102
|
-
}).transform((value) => ({
|
|
103
|
-
bindings: value.bindings ?? [],
|
|
104
|
-
...value.pages == null ? {} : { pages: value.pages }
|
|
105
|
-
}));
|
|
106
|
-
const publishDingTalkSchema = z.object({
|
|
107
|
-
binding_code: z.string().min(1),
|
|
108
|
-
bind_command: z.string().min(1),
|
|
109
|
-
group_binding: groupBindingSchema
|
|
110
|
-
}).transform((value) => ({
|
|
111
|
-
bindingCode: value.binding_code,
|
|
112
|
-
bindCommand: value.bind_command,
|
|
113
|
-
groupBinding: value.group_binding
|
|
114
|
-
}));
|
|
115
|
-
const inviteDingTalkSchema = z.object({
|
|
116
|
-
binding_code: z.string().min(1),
|
|
117
|
-
bind_command: z.string().min(1),
|
|
118
|
-
expert_binding: expertBindingSchema
|
|
119
|
-
}).transform((value) => ({
|
|
120
|
-
bindingCode: value.binding_code,
|
|
121
|
-
bindCommand: value.bind_command,
|
|
122
|
-
expertBinding: value.expert_binding
|
|
123
|
-
}));
|
|
124
|
-
const botDeleteSchema = z.object({}).transform(() => void 0);
|
|
125
|
-
function optionalInt32(value, field) {
|
|
126
|
-
if (value === void 0) return void 0;
|
|
127
|
-
if (typeof value !== "number" || !Number.isInteger(value) || value < -2147483648 || value > 2147483647) throw invalidArgument(`${field} must be an int32`, field);
|
|
128
|
-
return value;
|
|
129
|
-
}
|
|
130
|
-
function isJson(value, ancestors) {
|
|
131
|
-
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
132
|
-
if (typeof value === "number") return Number.isFinite(value);
|
|
133
|
-
if (typeof value !== "object" || ancestors.has(value)) return false;
|
|
134
|
-
if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return false;
|
|
135
|
-
if (Object.getOwnPropertySymbols(value).length > 0) return false;
|
|
136
|
-
ancestors.add(value);
|
|
137
|
-
const valid = (Array.isArray(value) ? Array.from(value) : Object.values(value)).every((child) => isJson(child, ancestors));
|
|
138
|
-
ancestors.delete(value);
|
|
139
|
-
return valid;
|
|
140
|
-
}
|
|
141
|
-
function optionalInstructions(value) {
|
|
142
|
-
const object = optionalRecord(value, "instructions");
|
|
143
|
-
if (object === void 0) return void 0;
|
|
144
|
-
try {
|
|
145
|
-
if (isJson(object, /* @__PURE__ */ new Set())) return object;
|
|
146
|
-
} catch {}
|
|
147
|
-
throw invalidArgument("instructions must contain only JSON values", "instructions");
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region ../sdk/src/operations/bot-gateway.ts
|
|
151
|
-
function groupFields(input) {
|
|
152
|
-
return compactUndefined({
|
|
153
|
-
conversation_name: optionalString(input?.conversationName, "conversationName"),
|
|
154
|
-
context_window: optionalInt32(input?.contextWindow, "contextWindow"),
|
|
155
|
-
writer_user_id: optionalString(input?.writerUserId, "writerUserId"),
|
|
156
|
-
is_active: optionalBoolean(input?.isActive, "isActive"),
|
|
157
|
-
instructions: optionalInstructions(input?.instructions)
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
function patch(body) {
|
|
161
|
-
assertNonEmptyPatch(body, "input");
|
|
162
|
-
return body;
|
|
163
|
-
}
|
|
164
|
-
function createBotGatewayOperations(context) {
|
|
165
|
-
const path = (notebookId, ...segments) => context.profile.apiPath("notebooks", requiredString(notebookId, "notebookId"), "botgw", ...segments);
|
|
166
|
-
const listPath = (notebookId, resource, input = {}) => {
|
|
167
|
-
const page = pagination({
|
|
168
|
-
page: input.page ?? 1,
|
|
169
|
-
pageSize: input.pageSize ?? 20
|
|
170
|
-
});
|
|
171
|
-
const onlyActive = optionalBoolean(input.onlyActive, "onlyActive");
|
|
172
|
-
return queryPath(path(notebookId, resource), [
|
|
173
|
-
["page", optionalInt32(page.page, "page")],
|
|
174
|
-
["page_size", optionalInt32(page.pageSize, "pageSize")],
|
|
175
|
-
["platform", optionalTrimmedString(input.platform, "platform")],
|
|
176
|
-
["only_active", onlyActive === void 0 ? void 0 : String(onlyActive)],
|
|
177
|
-
["platform_app_id", resource === "platform-apps" ? void 0 : optionalTrimmedString(input.platformAppId, "platformAppId")],
|
|
178
|
-
["user_id", resource === "expert-bindings" ? optionalTrimmedString(input.userId, "userId") : void 0]
|
|
179
|
-
]);
|
|
180
|
-
};
|
|
181
|
-
return {
|
|
182
|
-
async listPlatformApps(notebookId, input, options) {
|
|
183
|
-
return call(context, {
|
|
184
|
-
callOptions: options,
|
|
185
|
-
capability: "botGateway",
|
|
186
|
-
method: "GET",
|
|
187
|
-
idempotent: true,
|
|
188
|
-
operation: "botGateway.platformApps.list",
|
|
189
|
-
path: listPath(notebookId, "platform-apps", input),
|
|
190
|
-
schema: platformAppListSchema
|
|
191
|
-
});
|
|
192
|
-
},
|
|
193
|
-
async createPlatformApp(notebookId, input, options) {
|
|
194
|
-
const body = compactUndefined({
|
|
195
|
-
platform: requiredString(input?.platform, "platform"),
|
|
196
|
-
app_name: requiredString(input?.appName, "appName"),
|
|
197
|
-
client_id: requiredString(input?.clientId, "clientId"),
|
|
198
|
-
client_secret: requiredText(input?.clientSecret, "clientSecret"),
|
|
199
|
-
is_active: optionalBoolean(input?.isActive, "isActive")
|
|
200
|
-
});
|
|
201
|
-
return call(context, {
|
|
202
|
-
body,
|
|
203
|
-
callOptions: options,
|
|
204
|
-
capability: "botGateway",
|
|
205
|
-
method: "POST",
|
|
206
|
-
idempotent: false,
|
|
207
|
-
operation: "botGateway.platformApps.create",
|
|
208
|
-
path: path(notebookId, "platform-apps"),
|
|
209
|
-
schema: platformAppSchema
|
|
210
|
-
});
|
|
211
|
-
},
|
|
212
|
-
async updatePlatformApp(notebookId, appId, input, options) {
|
|
213
|
-
const body = patch(compactUndefined({
|
|
214
|
-
app_name: optionalString(input?.appName, "appName"),
|
|
215
|
-
client_secret: optionalString(input?.clientSecret, "clientSecret"),
|
|
216
|
-
is_active: optionalBoolean(input?.isActive, "isActive")
|
|
217
|
-
}));
|
|
218
|
-
return call(context, {
|
|
219
|
-
body,
|
|
220
|
-
callOptions: options,
|
|
221
|
-
capability: "botGateway",
|
|
222
|
-
method: "PATCH",
|
|
223
|
-
idempotent: false,
|
|
224
|
-
operation: "botGateway.platformApps.update",
|
|
225
|
-
path: path(notebookId, "platform-apps", requiredString(appId, "appId")),
|
|
226
|
-
schema: platformAppSchema
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
async deletePlatformApp(notebookId, appId, options) {
|
|
230
|
-
return call(context, {
|
|
231
|
-
callOptions: options,
|
|
232
|
-
capability: "botGateway",
|
|
233
|
-
method: "DELETE",
|
|
234
|
-
idempotent: false,
|
|
235
|
-
operation: "botGateway.platformApps.delete",
|
|
236
|
-
path: path(notebookId, "platform-apps", requiredString(appId, "appId")),
|
|
237
|
-
schema: botDeleteSchema
|
|
238
|
-
});
|
|
239
|
-
},
|
|
240
|
-
async listExpertBindings(notebookId, input, options) {
|
|
241
|
-
return call(context, {
|
|
242
|
-
callOptions: options,
|
|
243
|
-
capability: "botGateway",
|
|
244
|
-
method: "GET",
|
|
245
|
-
idempotent: true,
|
|
246
|
-
operation: "botGateway.expertBindings.list",
|
|
247
|
-
path: listPath(notebookId, "expert-bindings", input),
|
|
248
|
-
schema: expertBindingListSchema
|
|
249
|
-
});
|
|
250
|
-
},
|
|
251
|
-
async updateExpertBinding(notebookId, bindingId, input, options) {
|
|
252
|
-
const body = patch(compactUndefined({
|
|
253
|
-
external_nickname: optionalString(input?.externalNickname, "externalNickname"),
|
|
254
|
-
is_active: optionalBoolean(input?.isActive, "isActive")
|
|
255
|
-
}));
|
|
256
|
-
return call(context, {
|
|
257
|
-
body,
|
|
258
|
-
callOptions: options,
|
|
259
|
-
capability: "botGateway",
|
|
260
|
-
method: "PATCH",
|
|
261
|
-
idempotent: false,
|
|
262
|
-
operation: "botGateway.expertBindings.update",
|
|
263
|
-
path: path(notebookId, "expert-bindings", requiredString(bindingId, "bindingId")),
|
|
264
|
-
schema: expertBindingSchema
|
|
265
|
-
});
|
|
266
|
-
},
|
|
267
|
-
async deleteExpertBinding(notebookId, bindingId, options) {
|
|
268
|
-
return call(context, {
|
|
269
|
-
callOptions: options,
|
|
270
|
-
capability: "botGateway",
|
|
271
|
-
method: "DELETE",
|
|
272
|
-
idempotent: false,
|
|
273
|
-
operation: "botGateway.expertBindings.delete",
|
|
274
|
-
path: path(notebookId, "expert-bindings", requiredString(bindingId, "bindingId")),
|
|
275
|
-
schema: botDeleteSchema
|
|
276
|
-
});
|
|
277
|
-
},
|
|
278
|
-
async listGroupBindings(notebookId, input, options) {
|
|
279
|
-
return call(context, {
|
|
280
|
-
callOptions: options,
|
|
281
|
-
capability: "botGateway",
|
|
282
|
-
method: "GET",
|
|
283
|
-
idempotent: true,
|
|
284
|
-
operation: "botGateway.groupBindings.list",
|
|
285
|
-
path: listPath(notebookId, "group-bindings", input),
|
|
286
|
-
schema: groupBindingListSchema
|
|
287
|
-
});
|
|
288
|
-
},
|
|
289
|
-
async createGroupBinding(notebookId, input, options) {
|
|
290
|
-
const body = {
|
|
291
|
-
...groupFields(input),
|
|
292
|
-
platform_app_id: requiredString(input?.platformAppId, "platformAppId"),
|
|
293
|
-
conversation_id: requiredString(input?.conversationId, "conversationId")
|
|
294
|
-
};
|
|
295
|
-
return call(context, {
|
|
296
|
-
body,
|
|
297
|
-
callOptions: options,
|
|
298
|
-
capability: "botGateway",
|
|
299
|
-
method: "POST",
|
|
300
|
-
idempotent: false,
|
|
301
|
-
operation: "botGateway.groupBindings.create",
|
|
302
|
-
path: path(notebookId, "group-bindings"),
|
|
303
|
-
schema: groupBindingSchema
|
|
304
|
-
});
|
|
305
|
-
},
|
|
306
|
-
async updateGroupBinding(notebookId, bindingId, input, options) {
|
|
307
|
-
const body = patch(compactUndefined({
|
|
308
|
-
...groupFields(input),
|
|
309
|
-
notebook_id: optionalString(input?.notebookId, "notebookId")
|
|
310
|
-
}));
|
|
311
|
-
return call(context, {
|
|
312
|
-
body,
|
|
313
|
-
callOptions: options,
|
|
314
|
-
capability: "botGateway",
|
|
315
|
-
method: "PATCH",
|
|
316
|
-
idempotent: false,
|
|
317
|
-
operation: "botGateway.groupBindings.update",
|
|
318
|
-
path: path(notebookId, "group-bindings", requiredString(bindingId, "bindingId")),
|
|
319
|
-
schema: groupBindingSchema
|
|
320
|
-
});
|
|
321
|
-
},
|
|
322
|
-
async deleteGroupBinding(notebookId, bindingId, options) {
|
|
323
|
-
return call(context, {
|
|
324
|
-
callOptions: options,
|
|
325
|
-
capability: "botGateway",
|
|
326
|
-
method: "DELETE",
|
|
327
|
-
idempotent: false,
|
|
328
|
-
operation: "botGateway.groupBindings.delete",
|
|
329
|
-
path: path(notebookId, "group-bindings", requiredString(bindingId, "bindingId")),
|
|
330
|
-
schema: botDeleteSchema
|
|
331
|
-
});
|
|
332
|
-
},
|
|
333
|
-
async publishDingTalk(notebookId, input, options) {
|
|
334
|
-
const body = compactUndefined({
|
|
335
|
-
platform_app_id: requiredString(input?.platformAppId, "platformAppId"),
|
|
336
|
-
context_window: optionalInt32(input?.contextWindow, "contextWindow"),
|
|
337
|
-
instructions: optionalInstructions(input?.instructions)
|
|
338
|
-
});
|
|
339
|
-
return call(context, {
|
|
340
|
-
body,
|
|
341
|
-
callOptions: options,
|
|
342
|
-
capability: "botGateway",
|
|
343
|
-
method: "POST",
|
|
344
|
-
idempotent: false,
|
|
345
|
-
operation: "botGateway.dingTalk.publish",
|
|
346
|
-
path: path(notebookId, "dingtalk", "publish"),
|
|
347
|
-
schema: publishDingTalkSchema
|
|
348
|
-
});
|
|
349
|
-
},
|
|
350
|
-
async inviteDingTalkExpert(notebookId, input, options) {
|
|
351
|
-
const userId = optionalTrimmedString(input?.userId, "userId");
|
|
352
|
-
const email = optionalTrimmedString(input?.email, "email");
|
|
353
|
-
if (userId === void 0 && email === void 0) throw invalidArgument("provide userId or email", "input");
|
|
354
|
-
const body = compactUndefined({
|
|
355
|
-
platform_app_id: requiredString(input?.platformAppId, "platformAppId"),
|
|
356
|
-
user_id: userId,
|
|
357
|
-
email
|
|
358
|
-
});
|
|
359
|
-
return call(context, {
|
|
360
|
-
body,
|
|
361
|
-
callOptions: options,
|
|
362
|
-
capability: "botGateway",
|
|
363
|
-
method: "POST",
|
|
364
|
-
idempotent: false,
|
|
365
|
-
operation: "botGateway.dingTalk.inviteExpert",
|
|
366
|
-
path: path(notebookId, "dingtalk", "experts", "invite"),
|
|
367
|
-
schema: inviteDingTalkSchema
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
//#endregion
|
|
373
|
-
export { createBotGatewayOperations };
|