@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.js
CHANGED
|
@@ -55,7 +55,6 @@ __export(index_exports, {
|
|
|
55
55
|
apiKeyCreateSchema: () => apiKeyCreateSchema,
|
|
56
56
|
contextRequestSchema: () => contextRequestSchema,
|
|
57
57
|
conversationCreateSchema: () => conversationCreateSchema,
|
|
58
|
-
entityCreateSchema: () => entityCreateSchema,
|
|
59
58
|
extractionRequestSchema: () => extractionRequestSchema,
|
|
60
59
|
graphQueryRequestSchema: () => graphQueryRequestSchema,
|
|
61
60
|
memoryCreateSchema: () => memoryCreateSchema,
|
|
@@ -1124,10 +1123,14 @@ var ConversationService = class extends BaseService {
|
|
|
1124
1123
|
return this.http.get("/conversations", params, options?.signal);
|
|
1125
1124
|
}
|
|
1126
1125
|
/**
|
|
1127
|
-
* Retrieve a conversation
|
|
1126
|
+
* Retrieve a conversation.
|
|
1128
1127
|
*
|
|
1129
|
-
*
|
|
1130
|
-
*
|
|
1128
|
+
* v4.0.0 BREAKING: returns `Conversation` — the backend response has no
|
|
1129
|
+
* `messages` array (the previous `ConversationDetail` shape was a
|
|
1130
|
+
* phantom). Fetch messages via {@link getMessages}.
|
|
1131
|
+
*
|
|
1132
|
+
* @param conversationId - Compound conversation ID to retrieve.
|
|
1133
|
+
* @returns The conversation record.
|
|
1131
1134
|
* @throws {ApiError} 404 if the conversation does not exist.
|
|
1132
1135
|
*/
|
|
1133
1136
|
async get(conversationId, options) {
|
|
@@ -1198,12 +1201,6 @@ var ConversationService = class extends BaseService {
|
|
|
1198
1201
|
|
|
1199
1202
|
// src/schemas/knowledge.ts
|
|
1200
1203
|
var import_zod4 = require("zod");
|
|
1201
|
-
var entityCreateSchema = import_zod4.z.object({
|
|
1202
|
-
name: import_zod4.z.string().min(1),
|
|
1203
|
-
entity_type: import_zod4.z.string().min(1),
|
|
1204
|
-
description: import_zod4.z.string().optional(),
|
|
1205
|
-
properties: import_zod4.z.record(import_zod4.z.unknown()).optional()
|
|
1206
|
-
});
|
|
1207
1204
|
var graphQueryRequestSchema = import_zod4.z.object({
|
|
1208
1205
|
entity_name: import_zod4.z.string().min(1),
|
|
1209
1206
|
depth: import_zod4.z.number().int().min(1).max(3).optional(),
|
|
@@ -1218,22 +1215,9 @@ var extractionRequestSchema = import_zod4.z.object({
|
|
|
1218
1215
|
// src/services/knowledge.ts
|
|
1219
1216
|
var KnowledgeService = class extends BaseService {
|
|
1220
1217
|
/**
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
* @param data - Entity creation payload including name, type, and optional description/properties.
|
|
1224
|
-
* @returns The newly created entity with generated entity_id.
|
|
1225
|
-
*/
|
|
1226
|
-
async createEntity(data, options) {
|
|
1227
|
-
const parsed = entityCreateSchema.safeParse(data);
|
|
1228
|
-
if (!parsed.success) {
|
|
1229
|
-
throw new InputValidationError(parsed.error);
|
|
1230
|
-
}
|
|
1231
|
-
return this.http.post("/knowledge/entities", data, options?.signal);
|
|
1232
|
-
}
|
|
1233
|
-
/**
|
|
1234
|
-
* List knowledge entities with optional filtering.
|
|
1218
|
+
* List knowledge entities for a user with optional filtering.
|
|
1235
1219
|
*
|
|
1236
|
-
* @param params -
|
|
1220
|
+
* @param params - Filters: required user_id (backend-enforced), optional entity_type and pagination controls.
|
|
1237
1221
|
* @returns Paginated list of knowledge entities.
|
|
1238
1222
|
*/
|
|
1239
1223
|
async listEntities(params, options) {
|
|
@@ -1320,15 +1304,22 @@ var TenantService = class extends BaseService {
|
|
|
1320
1304
|
return this.http.get("/tenants/me", void 0, options?.signal);
|
|
1321
1305
|
}
|
|
1322
1306
|
/**
|
|
1323
|
-
* Retrieve the current tenant's
|
|
1307
|
+
* Retrieve the current tenant's usage statistics.
|
|
1324
1308
|
*
|
|
1325
|
-
* Returns counts
|
|
1326
|
-
*
|
|
1309
|
+
* Returns API-call counts, success rate, latency percentiles, resource
|
|
1310
|
+
* counts, and storage usage for the requested period — the backend
|
|
1311
|
+
* `UsageStatsResponse` shape (v3.0.0: previously mistyped as a 3-field
|
|
1312
|
+
* `TenantUsage` that never matched the wire).
|
|
1327
1313
|
*
|
|
1328
|
-
* @
|
|
1314
|
+
* @param period - Statistics window: `'day'` (default) | `'week'` | `'month'`.
|
|
1315
|
+
* @returns Usage statistics for the authenticated tenant.
|
|
1329
1316
|
*/
|
|
1330
|
-
async usage(options) {
|
|
1331
|
-
return this.http.get(
|
|
1317
|
+
async usage(period, options) {
|
|
1318
|
+
return this.http.get(
|
|
1319
|
+
"/tenants/me/usage",
|
|
1320
|
+
period ? { period } : void 0,
|
|
1321
|
+
options?.signal
|
|
1322
|
+
);
|
|
1332
1323
|
}
|
|
1333
1324
|
/**
|
|
1334
1325
|
* List all API keys for the current tenant.
|
|
@@ -1468,11 +1459,10 @@ var NexusClient = class {
|
|
|
1468
1459
|
|
|
1469
1460
|
// src/schemas/tenant.ts
|
|
1470
1461
|
var import_zod5 = require("zod");
|
|
1471
|
-
var apiKeyScopeSchema = import_zod5.z.enum(["read", "write", "admin"]);
|
|
1472
1462
|
var apiKeyCreateSchema = import_zod5.z.object({
|
|
1473
|
-
name: import_zod5.z.string().min(1).max(
|
|
1474
|
-
scopes: import_zod5.z.array(
|
|
1475
|
-
|
|
1463
|
+
name: import_zod5.z.string().min(1).max(255),
|
|
1464
|
+
scopes: import_zod5.z.array(import_zod5.z.string()).optional(),
|
|
1465
|
+
expires_in_days: import_zod5.z.number().int().min(1).max(365).optional()
|
|
1476
1466
|
});
|
|
1477
1467
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1478
1468
|
0 && (module.exports = {
|
|
@@ -1501,7 +1491,6 @@ var apiKeyCreateSchema = import_zod5.z.object({
|
|
|
1501
1491
|
apiKeyCreateSchema,
|
|
1502
1492
|
contextRequestSchema,
|
|
1503
1493
|
conversationCreateSchema,
|
|
1504
|
-
entityCreateSchema,
|
|
1505
1494
|
extractionRequestSchema,
|
|
1506
1495
|
graphQueryRequestSchema,
|
|
1507
1496
|
memoryCreateSchema,
|