mindgraph 0.1.9 → 0.2.1

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 CHANGED
@@ -52,7 +52,27 @@ new MindGraph({ baseUrl: string, apiKey?: string, jwt?: string })
52
52
  |--------|-------------|
53
53
  | `capture(req)` | Capture a source, snippet, or observation |
54
54
  | `entity(req)` | Create, alias, resolve, or merge entities |
55
- | `findOrCreateEntity(label, entityType?, agentId?)` | Convenience: create or find an entity by label |
55
+ | `findOrCreateEntity(label, entityType?, agentId?)` | Convenience: create or find an entity by label (generic fallback) |
56
+ | `findOrCreatePerson(label, props?, agentId?)` | Find or create a Person entity |
57
+ | `findOrCreateOrganization(label, props?, agentId?)` | Find or create an Organization entity |
58
+ | `findOrCreateNation(label, props?, agentId?)` | Find or create a Nation entity |
59
+ | `findOrCreateEvent(label, props?, agentId?)` | Find or create an Event entity |
60
+ | `findOrCreatePlace(label, props?, agentId?)` | Find or create a Place entity |
61
+ | `findOrCreateConcept(label, props?, agentId?)` | Find or create a Concept entity |
62
+ | `addClaim(label, props?, agentId?)` | Add a Claim node |
63
+ | `addEvidence(label, props?, agentId?)` | Add an Evidence node |
64
+ | `addObservation(label, props?, agentId?)` | Add an Observation node |
65
+
66
+ **Typed entity example:**
67
+
68
+ ```typescript
69
+ const person = await graph.findOrCreatePerson("Marie Curie", { nationality: "Polish" });
70
+ const org = await graph.findOrCreateOrganization("CERN", { org_type: "intergovernmental" });
71
+ const concept = await graph.findOrCreateConcept("Nuclear Physics");
72
+
73
+ // findOrCreateEntity() still works as a generic fallback for any entity type
74
+ const entity = await graph.findOrCreateEntity("Some Entity");
75
+ ```
56
76
 
57
77
  ### Epistemic Layer
58
78
 
package/dist/index.d.mts CHANGED
@@ -38,6 +38,59 @@ interface PathStep {
38
38
  depth: number;
39
39
  parent_uid: string | null;
40
40
  }
41
+ interface PersonProps {
42
+ canonical_name: string;
43
+ description?: string;
44
+ birth_date?: string;
45
+ death_date?: string;
46
+ nationality?: string;
47
+ occupation?: string;
48
+ identifiers?: Record<string, string>;
49
+ attributes?: Record<string, unknown>;
50
+ }
51
+ interface OrganizationProps {
52
+ canonical_name: string;
53
+ description?: string;
54
+ org_type: string;
55
+ founded_date?: string;
56
+ dissolved_date?: string;
57
+ headquarters?: string;
58
+ sector?: string;
59
+ identifiers?: Record<string, string>;
60
+ attributes?: Record<string, unknown>;
61
+ }
62
+ interface NationProps {
63
+ canonical_name: string;
64
+ description?: string;
65
+ iso_code?: string;
66
+ capital?: string;
67
+ government_type?: string;
68
+ region?: string;
69
+ identifiers?: Record<string, string>;
70
+ attributes?: Record<string, unknown>;
71
+ }
72
+ interface EventProps {
73
+ canonical_name: string;
74
+ description?: string;
75
+ event_type: string;
76
+ event_date?: string;
77
+ end_date?: string;
78
+ location?: string;
79
+ identifiers?: Record<string, string>;
80
+ attributes?: Record<string, unknown>;
81
+ }
82
+ interface PlaceProps {
83
+ canonical_name: string;
84
+ description?: string;
85
+ place_type: string;
86
+ coordinates?: {
87
+ lat: number;
88
+ lon: number;
89
+ };
90
+ parent_location?: string;
91
+ identifiers?: Record<string, string>;
92
+ attributes?: Record<string, unknown>;
93
+ }
41
94
  interface CaptureRequest {
42
95
  action: "source" | "snippet" | "observation";
43
96
  label: string;
@@ -445,6 +498,30 @@ declare class MindGraph {
445
498
  findOrCreateEntity(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
446
499
  created: boolean;
447
500
  }>;
501
+ /** Convenience: create or find a Person entity by label. */
502
+ findOrCreatePerson(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
503
+ created: boolean;
504
+ }>;
505
+ /** Convenience: create or find an Organization entity by label. */
506
+ findOrCreateOrganization(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
507
+ created: boolean;
508
+ }>;
509
+ /** Convenience: create or find a Nation entity by label. */
510
+ findOrCreateNation(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
511
+ created: boolean;
512
+ }>;
513
+ /** Convenience: create or find an Event entity by label. */
514
+ findOrCreateEvent(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
515
+ created: boolean;
516
+ }>;
517
+ /** Convenience: create or find a Place entity by label. */
518
+ findOrCreatePlace(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
519
+ created: boolean;
520
+ }>;
521
+ /** Convenience: create or find a Concept entity by label. */
522
+ findOrCreateConcept(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
523
+ created: boolean;
524
+ }>;
448
525
  /**
449
526
  * Resolve text to an existing entity via alias matching.
450
527
  * Returns `{ uid: string | null }`.
@@ -466,6 +543,18 @@ declare class MindGraph {
466
543
  argue(req: ArgumentRequest): Promise<unknown>;
467
544
  inquire(req: InquiryRequest): Promise<unknown>;
468
545
  structure(req: StructureRequest): Promise<unknown>;
546
+ /**
547
+ * Convenience: create a Claim node via the argument endpoint.
548
+ * Returns the full argument response including `claim_uid`.
549
+ */
550
+ addClaim(label: string, content: string, confidence?: number, agentId?: string): Promise<unknown>;
551
+ /**
552
+ * Convenience: create an Evidence node attached to a claim via the argument endpoint.
553
+ * If `claimLabel` and `claimConfidence` are provided, also creates the claim.
554
+ */
555
+ addEvidence(label: string, description: string, agentId?: string): Promise<unknown>;
556
+ /** Convenience: create an Observation node via the reality capture endpoint. */
557
+ addObservation(label: string, description: string, agentId?: string): Promise<unknown>;
469
558
  commit(req: CommitmentRequest): Promise<unknown>;
470
559
  deliberate(req: DeliberationRequest): Promise<unknown>;
471
560
  /** Open a new decision for deliberation. Returns the Decision node. */
@@ -530,6 +619,25 @@ declare class MindGraph {
530
619
  agent_id?: string;
531
620
  }): Promise<GraphNode>;
532
621
  deleteNode(uid: string): Promise<void>;
622
+ batchDeleteNodes(params: {
623
+ uids?: string[];
624
+ agentId?: string;
625
+ filter?: {
626
+ nodeType?: string;
627
+ nodeTypes?: string[];
628
+ layer?: string;
629
+ labelContains?: string;
630
+ propEquals?: [string, string];
631
+ };
632
+ reason?: string;
633
+ by?: string;
634
+ hardPurge?: boolean;
635
+ }): Promise<{
636
+ nodes_tombstoned: number;
637
+ edges_tombstoned: number;
638
+ nodes_purged: number;
639
+ edges_purged: number;
640
+ }>;
533
641
  getNodeHistory(uid: string): Promise<unknown[]>;
534
642
  getNodeAtVersion(uid: string, version: number): Promise<GraphNode>;
535
643
  addLink(body: {
@@ -675,4 +783,4 @@ declare class MindGraph {
675
783
  clearGraph(): Promise<ClearResponse>;
676
784
  }
677
785
 
678
- export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EntityRequest, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type PathStep, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
786
+ export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EntityRequest, type EventProps, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
package/dist/index.d.ts CHANGED
@@ -38,6 +38,59 @@ interface PathStep {
38
38
  depth: number;
39
39
  parent_uid: string | null;
40
40
  }
41
+ interface PersonProps {
42
+ canonical_name: string;
43
+ description?: string;
44
+ birth_date?: string;
45
+ death_date?: string;
46
+ nationality?: string;
47
+ occupation?: string;
48
+ identifiers?: Record<string, string>;
49
+ attributes?: Record<string, unknown>;
50
+ }
51
+ interface OrganizationProps {
52
+ canonical_name: string;
53
+ description?: string;
54
+ org_type: string;
55
+ founded_date?: string;
56
+ dissolved_date?: string;
57
+ headquarters?: string;
58
+ sector?: string;
59
+ identifiers?: Record<string, string>;
60
+ attributes?: Record<string, unknown>;
61
+ }
62
+ interface NationProps {
63
+ canonical_name: string;
64
+ description?: string;
65
+ iso_code?: string;
66
+ capital?: string;
67
+ government_type?: string;
68
+ region?: string;
69
+ identifiers?: Record<string, string>;
70
+ attributes?: Record<string, unknown>;
71
+ }
72
+ interface EventProps {
73
+ canonical_name: string;
74
+ description?: string;
75
+ event_type: string;
76
+ event_date?: string;
77
+ end_date?: string;
78
+ location?: string;
79
+ identifiers?: Record<string, string>;
80
+ attributes?: Record<string, unknown>;
81
+ }
82
+ interface PlaceProps {
83
+ canonical_name: string;
84
+ description?: string;
85
+ place_type: string;
86
+ coordinates?: {
87
+ lat: number;
88
+ lon: number;
89
+ };
90
+ parent_location?: string;
91
+ identifiers?: Record<string, string>;
92
+ attributes?: Record<string, unknown>;
93
+ }
41
94
  interface CaptureRequest {
42
95
  action: "source" | "snippet" | "observation";
43
96
  label: string;
@@ -445,6 +498,30 @@ declare class MindGraph {
445
498
  findOrCreateEntity(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
446
499
  created: boolean;
447
500
  }>;
501
+ /** Convenience: create or find a Person entity by label. */
502
+ findOrCreatePerson(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
503
+ created: boolean;
504
+ }>;
505
+ /** Convenience: create or find an Organization entity by label. */
506
+ findOrCreateOrganization(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
507
+ created: boolean;
508
+ }>;
509
+ /** Convenience: create or find a Nation entity by label. */
510
+ findOrCreateNation(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
511
+ created: boolean;
512
+ }>;
513
+ /** Convenience: create or find an Event entity by label. */
514
+ findOrCreateEvent(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
515
+ created: boolean;
516
+ }>;
517
+ /** Convenience: create or find a Place entity by label. */
518
+ findOrCreatePlace(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
519
+ created: boolean;
520
+ }>;
521
+ /** Convenience: create or find a Concept entity by label. */
522
+ findOrCreateConcept(label: string, props?: Record<string, unknown>, agentId?: string): Promise<GraphNode & {
523
+ created: boolean;
524
+ }>;
448
525
  /**
449
526
  * Resolve text to an existing entity via alias matching.
450
527
  * Returns `{ uid: string | null }`.
@@ -466,6 +543,18 @@ declare class MindGraph {
466
543
  argue(req: ArgumentRequest): Promise<unknown>;
467
544
  inquire(req: InquiryRequest): Promise<unknown>;
468
545
  structure(req: StructureRequest): Promise<unknown>;
546
+ /**
547
+ * Convenience: create a Claim node via the argument endpoint.
548
+ * Returns the full argument response including `claim_uid`.
549
+ */
550
+ addClaim(label: string, content: string, confidence?: number, agentId?: string): Promise<unknown>;
551
+ /**
552
+ * Convenience: create an Evidence node attached to a claim via the argument endpoint.
553
+ * If `claimLabel` and `claimConfidence` are provided, also creates the claim.
554
+ */
555
+ addEvidence(label: string, description: string, agentId?: string): Promise<unknown>;
556
+ /** Convenience: create an Observation node via the reality capture endpoint. */
557
+ addObservation(label: string, description: string, agentId?: string): Promise<unknown>;
469
558
  commit(req: CommitmentRequest): Promise<unknown>;
470
559
  deliberate(req: DeliberationRequest): Promise<unknown>;
471
560
  /** Open a new decision for deliberation. Returns the Decision node. */
@@ -530,6 +619,25 @@ declare class MindGraph {
530
619
  agent_id?: string;
531
620
  }): Promise<GraphNode>;
532
621
  deleteNode(uid: string): Promise<void>;
622
+ batchDeleteNodes(params: {
623
+ uids?: string[];
624
+ agentId?: string;
625
+ filter?: {
626
+ nodeType?: string;
627
+ nodeTypes?: string[];
628
+ layer?: string;
629
+ labelContains?: string;
630
+ propEquals?: [string, string];
631
+ };
632
+ reason?: string;
633
+ by?: string;
634
+ hardPurge?: boolean;
635
+ }): Promise<{
636
+ nodes_tombstoned: number;
637
+ edges_tombstoned: number;
638
+ nodes_purged: number;
639
+ edges_purged: number;
640
+ }>;
533
641
  getNodeHistory(uid: string): Promise<unknown[]>;
534
642
  getNodeAtVersion(uid: string, version: number): Promise<GraphNode>;
535
643
  addLink(body: {
@@ -675,4 +783,4 @@ declare class MindGraph {
675
783
  clearGraph(): Promise<ClearResponse>;
676
784
  }
677
785
 
678
- export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EntityRequest, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type PathStep, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
786
+ export { type ArgumentRequest, type BatchRequest, type CaptureRequest, type ClearResponse, type CommitmentRequest, type DecayRequest, type DeliberationRequest, type DistillRequest, type EntityRequest, type EventProps, type EvolveRequest, type ExecutionRequest, type GovernanceRequest, type GraphEdge, type GraphNode, type IngestChunkRequest, type IngestChunkResponse, type IngestDocumentRequest, type IngestDocumentResponse, type IngestSessionRequest, type InquiryRequest, type Job, type MemoryConfigRequest, MindGraph, type MindGraphConfig, MindGraphError, type NationProps, type OrganizationProps, type PathStep, type PersonProps, type PlaceProps, type PlanRequest, type ProcedureRequest, type PurgeRequest, type RetrieveContextRequest, type RetrieveContextResponse, type RetrieveRequest, type RiskRequest, type SearchResult, type SessionRequest, type StructureRequest, type TraverseRequest };
package/dist/index.js CHANGED
@@ -121,6 +121,30 @@ var MindGraph = class {
121
121
  agent_id: agentId
122
122
  });
123
123
  }
124
+ /** Convenience: create or find a Person entity by label. */
125
+ async findOrCreatePerson(label, props, agentId) {
126
+ return this.findOrCreateEntity(label, { entity_type: "person", ...props }, agentId);
127
+ }
128
+ /** Convenience: create or find an Organization entity by label. */
129
+ async findOrCreateOrganization(label, props, agentId) {
130
+ return this.findOrCreateEntity(label, { entity_type: "organization", ...props }, agentId);
131
+ }
132
+ /** Convenience: create or find a Nation entity by label. */
133
+ async findOrCreateNation(label, props, agentId) {
134
+ return this.findOrCreateEntity(label, { entity_type: "nation", ...props }, agentId);
135
+ }
136
+ /** Convenience: create or find an Event entity by label. */
137
+ async findOrCreateEvent(label, props, agentId) {
138
+ return this.findOrCreateEntity(label, { entity_type: "event", ...props }, agentId);
139
+ }
140
+ /** Convenience: create or find a Place entity by label. */
141
+ async findOrCreatePlace(label, props, agentId) {
142
+ return this.findOrCreateEntity(label, { entity_type: "place", ...props }, agentId);
143
+ }
144
+ /** Convenience: create or find a Concept entity by label. */
145
+ async findOrCreateConcept(label, props, agentId) {
146
+ return this.findOrCreateEntity(label, { entity_type: "concept", ...props }, agentId);
147
+ }
124
148
  /**
125
149
  * Resolve text to an existing entity via alias matching.
126
150
  * Returns `{ uid: string | null }`.
@@ -154,6 +178,40 @@ var MindGraph = class {
154
178
  async structure(req) {
155
179
  return this.post("/epistemic/structure", req);
156
180
  }
181
+ /**
182
+ * Convenience: create a Claim node via the argument endpoint.
183
+ * Returns the full argument response including `claim_uid`.
184
+ */
185
+ async addClaim(label, content, confidence, agentId) {
186
+ return this.post("/epistemic/argument", {
187
+ claim: {
188
+ label,
189
+ confidence,
190
+ props: { content }
191
+ },
192
+ agent_id: agentId
193
+ });
194
+ }
195
+ /**
196
+ * Convenience: create an Evidence node attached to a claim via the argument endpoint.
197
+ * If `claimLabel` and `claimConfidence` are provided, also creates the claim.
198
+ */
199
+ async addEvidence(label, description, agentId) {
200
+ return this.post("/epistemic/argument", {
201
+ claim: { label: `Claim for: ${label}` },
202
+ evidence: [{ label, props: { description } }],
203
+ agent_id: agentId
204
+ });
205
+ }
206
+ /** Convenience: create an Observation node via the reality capture endpoint. */
207
+ async addObservation(label, description, agentId) {
208
+ return this.post("/reality/capture", {
209
+ action: "observation",
210
+ label,
211
+ summary: description,
212
+ agent_id: agentId
213
+ });
214
+ }
157
215
  // ---- Intent Layer ----
158
216
  async commit(req) {
159
217
  return this.post("/intent/commitment", req);
@@ -260,6 +318,24 @@ var MindGraph = class {
260
318
  async deleteNode(uid) {
261
319
  await this.del(`/node/${uid}`);
262
320
  }
321
+ async batchDeleteNodes(params) {
322
+ const body = {};
323
+ if (params.uids) body.uids = params.uids;
324
+ if (params.agentId) body.agent_id = params.agentId;
325
+ if (params.filter) {
326
+ body.filter = {
327
+ node_type: params.filter.nodeType,
328
+ node_types: params.filter.nodeTypes,
329
+ layer: params.filter.layer,
330
+ label_contains: params.filter.labelContains,
331
+ prop_equals: params.filter.propEquals
332
+ };
333
+ }
334
+ if (params.reason) body.reason = params.reason;
335
+ if (params.by) body.by = params.by;
336
+ if (params.hardPurge) body.hard_purge = params.hardPurge;
337
+ return this.post("/nodes/delete", body);
338
+ }
263
339
  async getNodeHistory(uid) {
264
340
  return this.get(`/node/${uid}/history`);
265
341
  }
package/dist/index.mjs CHANGED
@@ -94,6 +94,30 @@ var MindGraph = class {
94
94
  agent_id: agentId
95
95
  });
96
96
  }
97
+ /** Convenience: create or find a Person entity by label. */
98
+ async findOrCreatePerson(label, props, agentId) {
99
+ return this.findOrCreateEntity(label, { entity_type: "person", ...props }, agentId);
100
+ }
101
+ /** Convenience: create or find an Organization entity by label. */
102
+ async findOrCreateOrganization(label, props, agentId) {
103
+ return this.findOrCreateEntity(label, { entity_type: "organization", ...props }, agentId);
104
+ }
105
+ /** Convenience: create or find a Nation entity by label. */
106
+ async findOrCreateNation(label, props, agentId) {
107
+ return this.findOrCreateEntity(label, { entity_type: "nation", ...props }, agentId);
108
+ }
109
+ /** Convenience: create or find an Event entity by label. */
110
+ async findOrCreateEvent(label, props, agentId) {
111
+ return this.findOrCreateEntity(label, { entity_type: "event", ...props }, agentId);
112
+ }
113
+ /** Convenience: create or find a Place entity by label. */
114
+ async findOrCreatePlace(label, props, agentId) {
115
+ return this.findOrCreateEntity(label, { entity_type: "place", ...props }, agentId);
116
+ }
117
+ /** Convenience: create or find a Concept entity by label. */
118
+ async findOrCreateConcept(label, props, agentId) {
119
+ return this.findOrCreateEntity(label, { entity_type: "concept", ...props }, agentId);
120
+ }
97
121
  /**
98
122
  * Resolve text to an existing entity via alias matching.
99
123
  * Returns `{ uid: string | null }`.
@@ -127,6 +151,40 @@ var MindGraph = class {
127
151
  async structure(req) {
128
152
  return this.post("/epistemic/structure", req);
129
153
  }
154
+ /**
155
+ * Convenience: create a Claim node via the argument endpoint.
156
+ * Returns the full argument response including `claim_uid`.
157
+ */
158
+ async addClaim(label, content, confidence, agentId) {
159
+ return this.post("/epistemic/argument", {
160
+ claim: {
161
+ label,
162
+ confidence,
163
+ props: { content }
164
+ },
165
+ agent_id: agentId
166
+ });
167
+ }
168
+ /**
169
+ * Convenience: create an Evidence node attached to a claim via the argument endpoint.
170
+ * If `claimLabel` and `claimConfidence` are provided, also creates the claim.
171
+ */
172
+ async addEvidence(label, description, agentId) {
173
+ return this.post("/epistemic/argument", {
174
+ claim: { label: `Claim for: ${label}` },
175
+ evidence: [{ label, props: { description } }],
176
+ agent_id: agentId
177
+ });
178
+ }
179
+ /** Convenience: create an Observation node via the reality capture endpoint. */
180
+ async addObservation(label, description, agentId) {
181
+ return this.post("/reality/capture", {
182
+ action: "observation",
183
+ label,
184
+ summary: description,
185
+ agent_id: agentId
186
+ });
187
+ }
130
188
  // ---- Intent Layer ----
131
189
  async commit(req) {
132
190
  return this.post("/intent/commitment", req);
@@ -233,6 +291,24 @@ var MindGraph = class {
233
291
  async deleteNode(uid) {
234
292
  await this.del(`/node/${uid}`);
235
293
  }
294
+ async batchDeleteNodes(params) {
295
+ const body = {};
296
+ if (params.uids) body.uids = params.uids;
297
+ if (params.agentId) body.agent_id = params.agentId;
298
+ if (params.filter) {
299
+ body.filter = {
300
+ node_type: params.filter.nodeType,
301
+ node_types: params.filter.nodeTypes,
302
+ layer: params.filter.layer,
303
+ label_contains: params.filter.labelContains,
304
+ prop_equals: params.filter.propEquals
305
+ };
306
+ }
307
+ if (params.reason) body.reason = params.reason;
308
+ if (params.by) body.by = params.by;
309
+ if (params.hardPurge) body.hard_purge = params.hardPurge;
310
+ return this.post("/nodes/delete", body);
311
+ }
236
312
  async getNodeHistory(uid) {
237
313
  return this.get(`/node/${uid}/history`);
238
314
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mindgraph",
3
- "version": "0.1.9",
3
+ "version": "0.2.1",
4
4
  "description": "TypeScript client for the MindGraph Cloud API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",