@memnexus-ai/typescript-sdk 1.36.1 → 1.38.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.cjs +287 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +167 -1
- package/dist/index.d.ts +167 -1
- package/dist/index.js +285 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AdminService: () => AdminService,
|
|
23
24
|
ApiKeysService: () => ApiKeysService,
|
|
24
25
|
ArtifactsService: () => ArtifactsService,
|
|
25
26
|
BehaviorService: () => BehaviorService,
|
|
@@ -31,6 +32,7 @@ __export(index_exports, {
|
|
|
31
32
|
FactsService: () => FactsService,
|
|
32
33
|
GraphragService: () => GraphragService,
|
|
33
34
|
HealthService: () => HealthService,
|
|
35
|
+
InvitesService: () => InvitesService,
|
|
34
36
|
Memnexus: () => Memnexus,
|
|
35
37
|
MemoriesService: () => MemoriesService,
|
|
36
38
|
MonitoringService: () => MonitoringService,
|
|
@@ -537,6 +539,221 @@ function serializeQueryParam(key, param) {
|
|
|
537
539
|
return `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`;
|
|
538
540
|
}
|
|
539
541
|
|
|
542
|
+
// src/services/admin-service.ts
|
|
543
|
+
var AdminService = class extends BaseService {
|
|
544
|
+
/**
|
|
545
|
+
* List invite codes
|
|
546
|
+
* List all invite codes with optional status filter
|
|
547
|
+
* @param status - Filter by status
|
|
548
|
+
* @param limit -
|
|
549
|
+
* @param offset -
|
|
550
|
+
*/
|
|
551
|
+
async adminListInviteCodes(options) {
|
|
552
|
+
const request = new Request({
|
|
553
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
554
|
+
method: "GET",
|
|
555
|
+
path: "/api/admin/invites",
|
|
556
|
+
config: this.config,
|
|
557
|
+
retry: {
|
|
558
|
+
attempts: 3,
|
|
559
|
+
delayMs: 150,
|
|
560
|
+
maxDelayMs: 5e3,
|
|
561
|
+
jitterMs: 50,
|
|
562
|
+
backoffFactor: 2
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
if (options?.status !== void 0) {
|
|
566
|
+
request.addQueryParam("status", {
|
|
567
|
+
key: "status",
|
|
568
|
+
value: options.status,
|
|
569
|
+
explode: false,
|
|
570
|
+
encode: true,
|
|
571
|
+
style: "form",
|
|
572
|
+
isLimit: false,
|
|
573
|
+
isOffset: false,
|
|
574
|
+
isCursor: false
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
if (options?.limit !== void 0) {
|
|
578
|
+
request.addQueryParam("limit", {
|
|
579
|
+
key: "limit",
|
|
580
|
+
value: options.limit,
|
|
581
|
+
explode: false,
|
|
582
|
+
encode: true,
|
|
583
|
+
style: "form",
|
|
584
|
+
isLimit: true,
|
|
585
|
+
isOffset: false,
|
|
586
|
+
isCursor: false
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
if (options?.offset !== void 0) {
|
|
590
|
+
request.addQueryParam("offset", {
|
|
591
|
+
key: "offset",
|
|
592
|
+
value: options.offset,
|
|
593
|
+
explode: false,
|
|
594
|
+
encode: true,
|
|
595
|
+
style: "form",
|
|
596
|
+
isLimit: false,
|
|
597
|
+
isOffset: true,
|
|
598
|
+
isCursor: false
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
return this.client.call(request);
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Create invite code
|
|
605
|
+
* Create a new invite code for the gated preview
|
|
606
|
+
* @param body - Request body
|
|
607
|
+
*/
|
|
608
|
+
async adminCreateInviteCode(body) {
|
|
609
|
+
const request = new Request({
|
|
610
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
611
|
+
method: "POST",
|
|
612
|
+
path: "/api/admin/invites",
|
|
613
|
+
config: this.config,
|
|
614
|
+
retry: {
|
|
615
|
+
attempts: 3,
|
|
616
|
+
delayMs: 150,
|
|
617
|
+
maxDelayMs: 5e3,
|
|
618
|
+
jitterMs: 50,
|
|
619
|
+
backoffFactor: 2
|
|
620
|
+
}
|
|
621
|
+
});
|
|
622
|
+
if (body !== void 0) {
|
|
623
|
+
request.addBody(body);
|
|
624
|
+
}
|
|
625
|
+
return this.client.call(request);
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Get invite system statistics
|
|
629
|
+
* Aggregate statistics for the invite system
|
|
630
|
+
*/
|
|
631
|
+
async adminGetInviteStats() {
|
|
632
|
+
const request = new Request({
|
|
633
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
634
|
+
method: "GET",
|
|
635
|
+
path: "/api/admin/invites/stats",
|
|
636
|
+
config: this.config,
|
|
637
|
+
retry: {
|
|
638
|
+
attempts: 3,
|
|
639
|
+
delayMs: 150,
|
|
640
|
+
maxDelayMs: 5e3,
|
|
641
|
+
jitterMs: 50,
|
|
642
|
+
backoffFactor: 2
|
|
643
|
+
}
|
|
644
|
+
});
|
|
645
|
+
return this.client.call(request);
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Get invite code details
|
|
649
|
+
* Get details for a single invite code including redemptions
|
|
650
|
+
* @param code - The invite code
|
|
651
|
+
*/
|
|
652
|
+
async adminGetInviteCode(code) {
|
|
653
|
+
const request = new Request({
|
|
654
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
655
|
+
method: "GET",
|
|
656
|
+
path: "/api/admin/invites/{code}",
|
|
657
|
+
config: this.config,
|
|
658
|
+
retry: {
|
|
659
|
+
attempts: 3,
|
|
660
|
+
delayMs: 150,
|
|
661
|
+
maxDelayMs: 5e3,
|
|
662
|
+
jitterMs: 50,
|
|
663
|
+
backoffFactor: 2
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
request.addPathParam("code", {
|
|
667
|
+
key: "code",
|
|
668
|
+
value: code,
|
|
669
|
+
explode: false,
|
|
670
|
+
encode: true,
|
|
671
|
+
style: "simple",
|
|
672
|
+
isLimit: false,
|
|
673
|
+
isOffset: false,
|
|
674
|
+
isCursor: false
|
|
675
|
+
});
|
|
676
|
+
return this.client.call(request);
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Revoke an invite code
|
|
680
|
+
* Revoke an invite code. Existing accounts created with this code are unaffected.
|
|
681
|
+
* @param code -
|
|
682
|
+
*/
|
|
683
|
+
async adminRevokeInviteCode(code) {
|
|
684
|
+
const request = new Request({
|
|
685
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
686
|
+
method: "DELETE",
|
|
687
|
+
path: "/api/admin/invites/{code}",
|
|
688
|
+
config: this.config,
|
|
689
|
+
retry: {
|
|
690
|
+
attempts: 3,
|
|
691
|
+
delayMs: 150,
|
|
692
|
+
maxDelayMs: 5e3,
|
|
693
|
+
jitterMs: 50,
|
|
694
|
+
backoffFactor: 2
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
request.addPathParam("code", {
|
|
698
|
+
key: "code",
|
|
699
|
+
value: code,
|
|
700
|
+
explode: false,
|
|
701
|
+
encode: true,
|
|
702
|
+
style: "simple",
|
|
703
|
+
isLimit: false,
|
|
704
|
+
isOffset: false,
|
|
705
|
+
isCursor: false
|
|
706
|
+
});
|
|
707
|
+
return this.client.call(request);
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Get gate status with audit info
|
|
711
|
+
* Get current invite gate state with audit information
|
|
712
|
+
*/
|
|
713
|
+
async adminGetGateStatus() {
|
|
714
|
+
const request = new Request({
|
|
715
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
716
|
+
method: "GET",
|
|
717
|
+
path: "/api/admin/gate",
|
|
718
|
+
config: this.config,
|
|
719
|
+
retry: {
|
|
720
|
+
attempts: 3,
|
|
721
|
+
delayMs: 150,
|
|
722
|
+
maxDelayMs: 5e3,
|
|
723
|
+
jitterMs: 50,
|
|
724
|
+
backoffFactor: 2
|
|
725
|
+
}
|
|
726
|
+
});
|
|
727
|
+
return this.client.call(request);
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Toggle invite gate
|
|
731
|
+
* Toggle the invite gate. When enabled (true), new signups require a valid invite code.
|
|
732
|
+
When disabled (false), registration is open. Takes effect immediately.
|
|
733
|
+
|
|
734
|
+
* @param body - Request body
|
|
735
|
+
*/
|
|
736
|
+
async adminSetGateStatus(body) {
|
|
737
|
+
const request = new Request({
|
|
738
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
739
|
+
method: "POST",
|
|
740
|
+
path: "/api/admin/gate",
|
|
741
|
+
config: this.config,
|
|
742
|
+
retry: {
|
|
743
|
+
attempts: 3,
|
|
744
|
+
delayMs: 150,
|
|
745
|
+
maxDelayMs: 5e3,
|
|
746
|
+
jitterMs: 50,
|
|
747
|
+
backoffFactor: 2
|
|
748
|
+
}
|
|
749
|
+
});
|
|
750
|
+
if (body !== void 0) {
|
|
751
|
+
request.addBody(body);
|
|
752
|
+
}
|
|
753
|
+
return this.client.call(request);
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
|
|
540
757
|
// src/services/api-keys-service.ts
|
|
541
758
|
var ApiKeysService = class extends BaseService {
|
|
542
759
|
/**
|
|
@@ -1816,6 +2033,60 @@ var HealthService = class extends BaseService {
|
|
|
1816
2033
|
}
|
|
1817
2034
|
};
|
|
1818
2035
|
|
|
2036
|
+
// src/services/invites-service.ts
|
|
2037
|
+
var InvitesService = class extends BaseService {
|
|
2038
|
+
/**
|
|
2039
|
+
* Check invite gate status
|
|
2040
|
+
* Check whether the invite gate is currently open or closed.
|
|
2041
|
+
When gated is true, new signups require a valid invite code.
|
|
2042
|
+
Response is cached server-side (30-second TTL).
|
|
2043
|
+
|
|
2044
|
+
*/
|
|
2045
|
+
async getGateStatus() {
|
|
2046
|
+
const request = new Request({
|
|
2047
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2048
|
+
method: "GET",
|
|
2049
|
+
path: "/api/invites/gate-status",
|
|
2050
|
+
config: this.config,
|
|
2051
|
+
retry: {
|
|
2052
|
+
attempts: 3,
|
|
2053
|
+
delayMs: 150,
|
|
2054
|
+
maxDelayMs: 5e3,
|
|
2055
|
+
jitterMs: 50,
|
|
2056
|
+
backoffFactor: 2
|
|
2057
|
+
}
|
|
2058
|
+
});
|
|
2059
|
+
return this.client.call(request);
|
|
2060
|
+
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Validate an invite code
|
|
2063
|
+
* Validate an invite code without redeeming it.
|
|
2064
|
+
Rate limited to 10 requests per minute per IP to prevent enumeration.
|
|
2065
|
+
Error messages are intentionally generic.
|
|
2066
|
+
|
|
2067
|
+
* @param body - Request body
|
|
2068
|
+
*/
|
|
2069
|
+
async validateInviteCode(body) {
|
|
2070
|
+
const request = new Request({
|
|
2071
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2072
|
+
method: "POST",
|
|
2073
|
+
path: "/api/invites/validate",
|
|
2074
|
+
config: this.config,
|
|
2075
|
+
retry: {
|
|
2076
|
+
attempts: 3,
|
|
2077
|
+
delayMs: 150,
|
|
2078
|
+
maxDelayMs: 5e3,
|
|
2079
|
+
jitterMs: 50,
|
|
2080
|
+
backoffFactor: 2
|
|
2081
|
+
}
|
|
2082
|
+
});
|
|
2083
|
+
if (body !== void 0) {
|
|
2084
|
+
request.addBody(body);
|
|
2085
|
+
}
|
|
2086
|
+
return this.client.call(request);
|
|
2087
|
+
}
|
|
2088
|
+
};
|
|
2089
|
+
|
|
1819
2090
|
// src/services/memories-service.ts
|
|
1820
2091
|
var MemoriesService = class extends BaseService {
|
|
1821
2092
|
/**
|
|
@@ -4008,6 +4279,8 @@ var UsersService = class extends BaseService {
|
|
|
4008
4279
|
* Called by the customer portal after WorkOS authentication.
|
|
4009
4280
|
Creates a new user if they don't exist, or updates their profile if they do.
|
|
4010
4281
|
This is the main entry point for user provisioning.
|
|
4282
|
+
When the invite gate is closed and a new user is created, the inviteCode
|
|
4283
|
+
is redeemed atomically to track which code was used for registration.
|
|
4011
4284
|
|
|
4012
4285
|
* @param body - Request body
|
|
4013
4286
|
*/
|
|
@@ -5307,6 +5580,8 @@ var digestResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
|
5307
5580
|
// src/index.ts
|
|
5308
5581
|
var Memnexus = class {
|
|
5309
5582
|
config;
|
|
5583
|
+
/** Admin management endpoints for invite codes and platform configuration operations */
|
|
5584
|
+
admin;
|
|
5310
5585
|
/** API key management endpoints operations */
|
|
5311
5586
|
apiKeys;
|
|
5312
5587
|
/** Artifact storage and retrieval endpoints operations */
|
|
@@ -5323,6 +5598,8 @@ var Memnexus = class {
|
|
|
5323
5598
|
graphrag;
|
|
5324
5599
|
/** Health check endpoints operations */
|
|
5325
5600
|
health;
|
|
5601
|
+
/** Invite code validation and gate status endpoints operations */
|
|
5602
|
+
invites;
|
|
5326
5603
|
/** Memory management and retrieval endpoints operations */
|
|
5327
5604
|
memories;
|
|
5328
5605
|
/** Observability and metrics endpoints for production monitoring operations */
|
|
@@ -5348,6 +5625,7 @@ var Memnexus = class {
|
|
|
5348
5625
|
baseUrl: config.baseUrl || "http://localhost:3000",
|
|
5349
5626
|
...config
|
|
5350
5627
|
};
|
|
5628
|
+
this.admin = new AdminService(this.config);
|
|
5351
5629
|
this.apiKeys = new ApiKeysService(this.config);
|
|
5352
5630
|
this.artifacts = new ArtifactsService(this.config);
|
|
5353
5631
|
this.billing = new BillingService(this.config);
|
|
@@ -5356,6 +5634,7 @@ var Memnexus = class {
|
|
|
5356
5634
|
this.facts = new FactsService(this.config);
|
|
5357
5635
|
this.graphrag = new GraphragService(this.config);
|
|
5358
5636
|
this.health = new HealthService(this.config);
|
|
5637
|
+
this.invites = new InvitesService(this.config);
|
|
5359
5638
|
this.memories = new MemoriesService(this.config);
|
|
5360
5639
|
this.monitoring = new MonitoringService(this.config);
|
|
5361
5640
|
this.narratives = new NarrativesService(this.config);
|
|
@@ -5371,6 +5650,7 @@ var Memnexus = class {
|
|
|
5371
5650
|
*/
|
|
5372
5651
|
setToken(token) {
|
|
5373
5652
|
this.config.token = token;
|
|
5653
|
+
this.admin.token = token;
|
|
5374
5654
|
this.apiKeys.token = token;
|
|
5375
5655
|
this.artifacts.token = token;
|
|
5376
5656
|
this.billing.token = token;
|
|
@@ -5379,6 +5659,7 @@ var Memnexus = class {
|
|
|
5379
5659
|
this.facts.token = token;
|
|
5380
5660
|
this.graphrag.token = token;
|
|
5381
5661
|
this.health.token = token;
|
|
5662
|
+
this.invites.token = token;
|
|
5382
5663
|
this.memories.token = token;
|
|
5383
5664
|
this.monitoring.token = token;
|
|
5384
5665
|
this.narratives.token = token;
|
|
@@ -5394,6 +5675,7 @@ var Memnexus = class {
|
|
|
5394
5675
|
*/
|
|
5395
5676
|
setBaseUrl(baseUrl) {
|
|
5396
5677
|
this.config.baseUrl = baseUrl;
|
|
5678
|
+
this.admin.baseUrl = baseUrl;
|
|
5397
5679
|
this.apiKeys.baseUrl = baseUrl;
|
|
5398
5680
|
this.artifacts.baseUrl = baseUrl;
|
|
5399
5681
|
this.billing.baseUrl = baseUrl;
|
|
@@ -5402,6 +5684,7 @@ var Memnexus = class {
|
|
|
5402
5684
|
this.facts.baseUrl = baseUrl;
|
|
5403
5685
|
this.graphrag.baseUrl = baseUrl;
|
|
5404
5686
|
this.health.baseUrl = baseUrl;
|
|
5687
|
+
this.invites.baseUrl = baseUrl;
|
|
5405
5688
|
this.memories.baseUrl = baseUrl;
|
|
5406
5689
|
this.monitoring.baseUrl = baseUrl;
|
|
5407
5690
|
this.narratives.baseUrl = baseUrl;
|
|
@@ -5417,6 +5700,7 @@ var Memnexus = class {
|
|
|
5417
5700
|
*/
|
|
5418
5701
|
setEnvironment(environment) {
|
|
5419
5702
|
this.config.environment = environment;
|
|
5703
|
+
this.admin.environment = environment;
|
|
5420
5704
|
this.apiKeys.environment = environment;
|
|
5421
5705
|
this.artifacts.environment = environment;
|
|
5422
5706
|
this.billing.environment = environment;
|
|
@@ -5425,6 +5709,7 @@ var Memnexus = class {
|
|
|
5425
5709
|
this.facts.environment = environment;
|
|
5426
5710
|
this.graphrag.environment = environment;
|
|
5427
5711
|
this.health.environment = environment;
|
|
5712
|
+
this.invites.environment = environment;
|
|
5428
5713
|
this.memories.environment = environment;
|
|
5429
5714
|
this.monitoring.environment = environment;
|
|
5430
5715
|
this.narratives.environment = environment;
|
|
@@ -5438,6 +5723,7 @@ var Memnexus = class {
|
|
|
5438
5723
|
var index_default = Memnexus;
|
|
5439
5724
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5440
5725
|
0 && (module.exports = {
|
|
5726
|
+
AdminService,
|
|
5441
5727
|
ApiKeysService,
|
|
5442
5728
|
ArtifactsService,
|
|
5443
5729
|
BehaviorService,
|
|
@@ -5449,6 +5735,7 @@ var index_default = Memnexus;
|
|
|
5449
5735
|
FactsService,
|
|
5450
5736
|
GraphragService,
|
|
5451
5737
|
HealthService,
|
|
5738
|
+
InvitesService,
|
|
5452
5739
|
Memnexus,
|
|
5453
5740
|
MemoriesService,
|
|
5454
5741
|
MonitoringService,
|