@nexusm/sdk 2.0.0 → 3.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/dist/index.d.mts +102 -92
- package/dist/index.d.ts +102 -92
- package/dist/index.js +18 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1130,12 +1130,6 @@ var ConversationService = class extends BaseService {
|
|
|
1130
1130
|
|
|
1131
1131
|
// src/schemas/knowledge.ts
|
|
1132
1132
|
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
1133
|
var graphQueryRequestSchema = z4.object({
|
|
1140
1134
|
entity_name: z4.string().min(1),
|
|
1141
1135
|
depth: z4.number().int().min(1).max(3).optional(),
|
|
@@ -1150,22 +1144,9 @@ var extractionRequestSchema = z4.object({
|
|
|
1150
1144
|
// src/services/knowledge.ts
|
|
1151
1145
|
var KnowledgeService = class extends BaseService {
|
|
1152
1146
|
/**
|
|
1153
|
-
*
|
|
1147
|
+
* List knowledge entities for a user with optional filtering.
|
|
1154
1148
|
*
|
|
1155
|
-
* @param
|
|
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.
|
|
1167
|
-
*
|
|
1168
|
-
* @param params - Optional filters for user_id, entity_type, and pagination controls.
|
|
1149
|
+
* @param params - Filters: required user_id (backend-enforced), optional entity_type and pagination controls.
|
|
1169
1150
|
* @returns Paginated list of knowledge entities.
|
|
1170
1151
|
*/
|
|
1171
1152
|
async listEntities(params, options) {
|
|
@@ -1252,15 +1233,22 @@ var TenantService = class extends BaseService {
|
|
|
1252
1233
|
return this.http.get("/tenants/me", void 0, options?.signal);
|
|
1253
1234
|
}
|
|
1254
1235
|
/**
|
|
1255
|
-
* Retrieve the current tenant's
|
|
1236
|
+
* Retrieve the current tenant's usage statistics.
|
|
1256
1237
|
*
|
|
1257
|
-
* Returns counts
|
|
1258
|
-
*
|
|
1238
|
+
* Returns API-call counts, success rate, latency percentiles, resource
|
|
1239
|
+
* counts, and storage usage for the requested period — the backend
|
|
1240
|
+
* `UsageStatsResponse` shape (v3.0.0: previously mistyped as a 3-field
|
|
1241
|
+
* `TenantUsage` that never matched the wire).
|
|
1259
1242
|
*
|
|
1260
|
-
* @
|
|
1243
|
+
* @param period - Statistics window: `'day'` (default) | `'week'` | `'month'`.
|
|
1244
|
+
* @returns Usage statistics for the authenticated tenant.
|
|
1261
1245
|
*/
|
|
1262
|
-
async usage(options) {
|
|
1263
|
-
return this.http.get(
|
|
1246
|
+
async usage(period, options) {
|
|
1247
|
+
return this.http.get(
|
|
1248
|
+
"/tenants/me/usage",
|
|
1249
|
+
period ? { period } : void 0,
|
|
1250
|
+
options?.signal
|
|
1251
|
+
);
|
|
1264
1252
|
}
|
|
1265
1253
|
/**
|
|
1266
1254
|
* List all API keys for the current tenant.
|
|
@@ -1400,11 +1388,10 @@ var NexusClient = class {
|
|
|
1400
1388
|
|
|
1401
1389
|
// src/schemas/tenant.ts
|
|
1402
1390
|
import { z as z5 } from "zod";
|
|
1403
|
-
var apiKeyScopeSchema = z5.enum(["read", "write", "admin"]);
|
|
1404
1391
|
var apiKeyCreateSchema = z5.object({
|
|
1405
|
-
name: z5.string().min(1).max(
|
|
1406
|
-
scopes: z5.array(
|
|
1407
|
-
|
|
1392
|
+
name: z5.string().min(1).max(255),
|
|
1393
|
+
scopes: z5.array(z5.string()).optional(),
|
|
1394
|
+
expires_in_days: z5.number().int().min(1).max(365).optional()
|
|
1408
1395
|
});
|
|
1409
1396
|
export {
|
|
1410
1397
|
ActivityService,
|
|
@@ -1432,7 +1419,6 @@ export {
|
|
|
1432
1419
|
apiKeyCreateSchema,
|
|
1433
1420
|
contextRequestSchema,
|
|
1434
1421
|
conversationCreateSchema,
|
|
1435
|
-
entityCreateSchema,
|
|
1436
1422
|
extractionRequestSchema,
|
|
1437
1423
|
graphQueryRequestSchema,
|
|
1438
1424
|
memoryCreateSchema,
|