@nexusm/sdk 2.0.0 → 4.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/README.md +10 -7
- package/dist/index.d.mts +219 -139
- package/dist/index.d.ts +219 -139
- package/dist/index.js +25 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1056,10 +1056,14 @@ var ConversationService = class extends BaseService {
|
|
|
1056
1056
|
return this.http.get("/conversations", params, options?.signal);
|
|
1057
1057
|
}
|
|
1058
1058
|
/**
|
|
1059
|
-
* Retrieve a conversation
|
|
1059
|
+
* Retrieve a conversation.
|
|
1060
1060
|
*
|
|
1061
|
-
*
|
|
1062
|
-
*
|
|
1061
|
+
* v4.0.0 BREAKING: returns `Conversation` — the backend response has no
|
|
1062
|
+
* `messages` array (the previous `ConversationDetail` shape was a
|
|
1063
|
+
* phantom). Fetch messages via {@link getMessages}.
|
|
1064
|
+
*
|
|
1065
|
+
* @param conversationId - Compound conversation ID to retrieve.
|
|
1066
|
+
* @returns The conversation record.
|
|
1063
1067
|
* @throws {ApiError} 404 if the conversation does not exist.
|
|
1064
1068
|
*/
|
|
1065
1069
|
async get(conversationId, options) {
|
|
@@ -1130,12 +1134,6 @@ var ConversationService = class extends BaseService {
|
|
|
1130
1134
|
|
|
1131
1135
|
// src/schemas/knowledge.ts
|
|
1132
1136
|
import { z as z4 } from "zod";
|
|
1133
|
-
var entityCreateSchema = z4.object({
|
|
1134
|
-
name: z4.string().min(1),
|
|
1135
|
-
entity_type: z4.string().min(1),
|
|
1136
|
-
description: z4.string().optional(),
|
|
1137
|
-
properties: z4.record(z4.unknown()).optional()
|
|
1138
|
-
});
|
|
1139
1137
|
var graphQueryRequestSchema = z4.object({
|
|
1140
1138
|
entity_name: z4.string().min(1),
|
|
1141
1139
|
depth: z4.number().int().min(1).max(3).optional(),
|
|
@@ -1150,22 +1148,9 @@ var extractionRequestSchema = z4.object({
|
|
|
1150
1148
|
// src/services/knowledge.ts
|
|
1151
1149
|
var KnowledgeService = class extends BaseService {
|
|
1152
1150
|
/**
|
|
1153
|
-
*
|
|
1154
|
-
*
|
|
1155
|
-
* @param data - Entity creation payload including name, type, and optional description/properties.
|
|
1156
|
-
* @returns The newly created entity with generated entity_id.
|
|
1157
|
-
*/
|
|
1158
|
-
async createEntity(data, options) {
|
|
1159
|
-
const parsed = entityCreateSchema.safeParse(data);
|
|
1160
|
-
if (!parsed.success) {
|
|
1161
|
-
throw new InputValidationError(parsed.error);
|
|
1162
|
-
}
|
|
1163
|
-
return this.http.post("/knowledge/entities", data, options?.signal);
|
|
1164
|
-
}
|
|
1165
|
-
/**
|
|
1166
|
-
* List knowledge entities with optional filtering.
|
|
1151
|
+
* List knowledge entities for a user with optional filtering.
|
|
1167
1152
|
*
|
|
1168
|
-
* @param params -
|
|
1153
|
+
* @param params - Filters: required user_id (backend-enforced), optional entity_type and pagination controls.
|
|
1169
1154
|
* @returns Paginated list of knowledge entities.
|
|
1170
1155
|
*/
|
|
1171
1156
|
async listEntities(params, options) {
|
|
@@ -1252,15 +1237,22 @@ var TenantService = class extends BaseService {
|
|
|
1252
1237
|
return this.http.get("/tenants/me", void 0, options?.signal);
|
|
1253
1238
|
}
|
|
1254
1239
|
/**
|
|
1255
|
-
* Retrieve the current tenant's
|
|
1240
|
+
* Retrieve the current tenant's usage statistics.
|
|
1256
1241
|
*
|
|
1257
|
-
* Returns counts
|
|
1258
|
-
*
|
|
1242
|
+
* Returns API-call counts, success rate, latency percentiles, resource
|
|
1243
|
+
* counts, and storage usage for the requested period — the backend
|
|
1244
|
+
* `UsageStatsResponse` shape (v3.0.0: previously mistyped as a 3-field
|
|
1245
|
+
* `TenantUsage` that never matched the wire).
|
|
1259
1246
|
*
|
|
1260
|
-
* @
|
|
1247
|
+
* @param period - Statistics window: `'day'` (default) | `'week'` | `'month'`.
|
|
1248
|
+
* @returns Usage statistics for the authenticated tenant.
|
|
1261
1249
|
*/
|
|
1262
|
-
async usage(options) {
|
|
1263
|
-
return this.http.get(
|
|
1250
|
+
async usage(period, options) {
|
|
1251
|
+
return this.http.get(
|
|
1252
|
+
"/tenants/me/usage",
|
|
1253
|
+
period ? { period } : void 0,
|
|
1254
|
+
options?.signal
|
|
1255
|
+
);
|
|
1264
1256
|
}
|
|
1265
1257
|
/**
|
|
1266
1258
|
* List all API keys for the current tenant.
|
|
@@ -1400,11 +1392,10 @@ var NexusClient = class {
|
|
|
1400
1392
|
|
|
1401
1393
|
// src/schemas/tenant.ts
|
|
1402
1394
|
import { z as z5 } from "zod";
|
|
1403
|
-
var apiKeyScopeSchema = z5.enum(["read", "write", "admin"]);
|
|
1404
1395
|
var apiKeyCreateSchema = z5.object({
|
|
1405
|
-
name: z5.string().min(1).max(
|
|
1406
|
-
scopes: z5.array(
|
|
1407
|
-
|
|
1396
|
+
name: z5.string().min(1).max(255),
|
|
1397
|
+
scopes: z5.array(z5.string()).optional(),
|
|
1398
|
+
expires_in_days: z5.number().int().min(1).max(365).optional()
|
|
1408
1399
|
});
|
|
1409
1400
|
export {
|
|
1410
1401
|
ActivityService,
|
|
@@ -1432,7 +1423,6 @@ export {
|
|
|
1432
1423
|
apiKeyCreateSchema,
|
|
1433
1424
|
contextRequestSchema,
|
|
1434
1425
|
conversationCreateSchema,
|
|
1435
|
-
entityCreateSchema,
|
|
1436
1426
|
extractionRequestSchema,
|
|
1437
1427
|
graphQueryRequestSchema,
|
|
1438
1428
|
memoryCreateSchema,
|