@nebula-ai/sdk 1.6.0-rc.0 → 1.6.2
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 +2 -8
- package/dist/index.cjs +141 -100
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +214 -84
- package/dist/index.d.ts +214 -84
- package/dist/index.js +141 -100
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -28,7 +28,6 @@ import { Nebula } from "@nebula-ai/sdk";
|
|
|
28
28
|
|
|
29
29
|
const client = new Nebula({
|
|
30
30
|
apiKey: process.env.NEBULA_API_KEY,
|
|
31
|
-
// or: bearerToken: process.env.NEBULA_BEARER_TOKEN,
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
const result = await client.memories.create({
|
|
@@ -47,16 +46,11 @@ a `memory_id` is present); prefer the resource methods for everything else.
|
|
|
47
46
|
|
|
48
47
|
## Auth
|
|
49
48
|
|
|
50
|
-
Pass
|
|
51
|
-
|
|
52
|
-
`apiKey` (one that isn't prefixed with `key_` or `neb_`), the DX layer
|
|
53
|
-
automatically routes it through the `Authorization: Bearer` header
|
|
54
|
-
instead — handy when your app exchanges a workspace token for the SDK
|
|
55
|
-
and doesn't want to think about which header to use.
|
|
49
|
+
Pass your Nebula API key as `apiKey` when constructing the client. It is sent
|
|
50
|
+
via the `Authorization: Bearer` header.
|
|
56
51
|
|
|
57
52
|
```ts
|
|
58
53
|
new Nebula({ apiKey: process.env.NEBULA_API_KEY });
|
|
59
|
-
new Nebula({ bearerToken: process.env.NEBULA_BEARER_TOKEN });
|
|
60
54
|
```
|
|
61
55
|
|
|
62
56
|
## Errors
|
package/dist/index.cjs
CHANGED
|
@@ -126,7 +126,6 @@ const DEFAULT_TIMEOUT_MS = 6e4;
|
|
|
126
126
|
var NebulaCore = class {
|
|
127
127
|
baseUrl;
|
|
128
128
|
apiKey;
|
|
129
|
-
bearerToken;
|
|
130
129
|
defaultHeaders;
|
|
131
130
|
fetchImpl;
|
|
132
131
|
fetchOptions;
|
|
@@ -136,7 +135,6 @@ var NebulaCore = class {
|
|
|
136
135
|
constructor(options = {}) {
|
|
137
136
|
this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
138
137
|
this.apiKey = options.apiKey;
|
|
139
|
-
this.bearerToken = options.bearerToken;
|
|
140
138
|
this.defaultHeaders = filterNullishHeaders(options.defaultHeaders);
|
|
141
139
|
this.fetchImpl = options.fetchImpl ?? globalThis.fetch.bind(globalThis);
|
|
142
140
|
this.fetchOptions = options.fetchOptions ?? {};
|
|
@@ -163,8 +161,7 @@ var NebulaCore = class {
|
|
|
163
161
|
headers.set("User-Agent", this.userAgent);
|
|
164
162
|
headers.set("Accept", "application/json");
|
|
165
163
|
if (hasBody) headers.set("Content-Type", "application/json");
|
|
166
|
-
if (this.apiKey) headers.set("
|
|
167
|
-
if (this.bearerToken) headers.set("Authorization", `Bearer ${this.bearerToken}`);
|
|
164
|
+
if (this.apiKey) headers.set("Authorization", `Bearer ${this.apiKey}`);
|
|
168
165
|
if (perRequest) for (const [k, v] of Object.entries(perRequest)) headers.set(k, v);
|
|
169
166
|
return headers;
|
|
170
167
|
}
|
|
@@ -285,9 +282,8 @@ var ClientResource = class {
|
|
|
285
282
|
this.core = core;
|
|
286
283
|
}
|
|
287
284
|
/**
|
|
288
|
-
*
|
|
289
285
|
* Health probe
|
|
290
|
-
*
|
|
286
|
+
*
|
|
291
287
|
* Lightweight liveness probe. Returns a 200 with a fixed message when the API process is up. Does not verify downstream dependencies (database, storage, workers) — use the internal status endpoints for those.
|
|
292
288
|
* @operationId client.health
|
|
293
289
|
* @endpoint GET /v1/health
|
|
@@ -311,12 +307,11 @@ var CollectionsResource = class {
|
|
|
311
307
|
this.core = core;
|
|
312
308
|
}
|
|
313
309
|
/**
|
|
314
|
-
*
|
|
315
310
|
* Create a new collection
|
|
316
|
-
*
|
|
311
|
+
*
|
|
317
312
|
* Create a new collection and automatically add the creating user
|
|
318
313
|
* to it.
|
|
319
|
-
*
|
|
314
|
+
*
|
|
320
315
|
* This endpoint allows authenticated users to create a new collection
|
|
321
316
|
* with a specified name and optional description. The user creating
|
|
322
317
|
* the collection is automatically added as a member.
|
|
@@ -335,11 +330,10 @@ var CollectionsResource = class {
|
|
|
335
330
|
})).results;
|
|
336
331
|
}
|
|
337
332
|
/**
|
|
338
|
-
*
|
|
339
333
|
* Delete collection
|
|
340
|
-
*
|
|
334
|
+
*
|
|
341
335
|
* Delete an existing collection.
|
|
342
|
-
*
|
|
336
|
+
*
|
|
343
337
|
* This endpoint allows deletion of a collection identified by its
|
|
344
338
|
* UUID. The user must have appropriate permissions to delete the
|
|
345
339
|
* collection. Deleting a collection removes all associations but does
|
|
@@ -358,16 +352,15 @@ var CollectionsResource = class {
|
|
|
358
352
|
})).results;
|
|
359
353
|
}
|
|
360
354
|
/**
|
|
361
|
-
*
|
|
362
355
|
* List collections
|
|
363
|
-
*
|
|
356
|
+
*
|
|
364
357
|
* Returns a cursor-paginated list of collections the authenticated
|
|
365
358
|
* user has access to.
|
|
366
|
-
*
|
|
359
|
+
*
|
|
367
360
|
* Results can be filtered by providing specific collection IDs.
|
|
368
361
|
* Regular users will only see collections they own or have access to.
|
|
369
362
|
* Superusers can see all collections.
|
|
370
|
-
*
|
|
363
|
+
*
|
|
371
364
|
* The collections are returned in order of last modification, with
|
|
372
365
|
* most recent first.
|
|
373
366
|
* @operationId collections.list
|
|
@@ -391,11 +384,10 @@ var CollectionsResource = class {
|
|
|
391
384
|
});
|
|
392
385
|
}
|
|
393
386
|
/**
|
|
394
|
-
*
|
|
395
387
|
* Get collection details
|
|
396
|
-
*
|
|
388
|
+
*
|
|
397
389
|
* Get details of a specific collection.
|
|
398
|
-
*
|
|
390
|
+
*
|
|
399
391
|
* This endpoint retrieves detailed information about a single
|
|
400
392
|
* collection identified by its UUID. The user must have access to the
|
|
401
393
|
* collection to view its details.
|
|
@@ -413,11 +405,10 @@ var CollectionsResource = class {
|
|
|
413
405
|
})).results;
|
|
414
406
|
}
|
|
415
407
|
/**
|
|
416
|
-
*
|
|
417
408
|
* Get a collection by name
|
|
418
|
-
*
|
|
409
|
+
*
|
|
419
410
|
* Retrieve a collection by its (owner_id, name) combination.
|
|
420
|
-
*
|
|
411
|
+
*
|
|
421
412
|
* The authenticated user can only fetch collections they own, or, if
|
|
422
413
|
* superuser, from anyone.
|
|
423
414
|
* @operationId collections.retrieveByName
|
|
@@ -434,11 +425,10 @@ var CollectionsResource = class {
|
|
|
434
425
|
})).results;
|
|
435
426
|
}
|
|
436
427
|
/**
|
|
437
|
-
*
|
|
438
428
|
* Update collection
|
|
439
|
-
*
|
|
429
|
+
*
|
|
440
430
|
* Update an existing collection's configuration.
|
|
441
|
-
*
|
|
431
|
+
*
|
|
442
432
|
* This endpoint allows updating the name, description, and access settings of an
|
|
443
433
|
* existing collection. The user must have appropriate permissions to
|
|
444
434
|
* modify the collection.
|
|
@@ -465,9 +455,8 @@ var ConnectorsResource = class {
|
|
|
465
455
|
this.core = core;
|
|
466
456
|
}
|
|
467
457
|
/**
|
|
468
|
-
*
|
|
469
458
|
* Start OAuth connection flow
|
|
470
|
-
*
|
|
459
|
+
*
|
|
471
460
|
* Start the OAuth connection flow for the given external provider. Returns the authorization URL the user should visit to grant Nebula access. After consent the provider redirects back to Nebula and the connection becomes active.
|
|
472
461
|
* @operationId connectors.connect
|
|
473
462
|
* @endpoint POST /v1/connectors/{provider}/connect
|
|
@@ -484,9 +473,8 @@ var ConnectorsResource = class {
|
|
|
484
473
|
})).results;
|
|
485
474
|
}
|
|
486
475
|
/**
|
|
487
|
-
*
|
|
488
476
|
* Disconnect an external data source
|
|
489
|
-
*
|
|
477
|
+
*
|
|
490
478
|
* Disconnect the named connection, revoking the stored OAuth credentials and stopping future syncs. Optionally pass `delete_memories=true` to also remove every memory this connection had ingested.
|
|
491
479
|
* @operationId connectors.disconnect
|
|
492
480
|
* @endpoint DELETE /v1/connectors/{connection_id}
|
|
@@ -502,9 +490,8 @@ var ConnectorsResource = class {
|
|
|
502
490
|
})).results;
|
|
503
491
|
}
|
|
504
492
|
/**
|
|
505
|
-
*
|
|
506
493
|
* List active connections for a collection
|
|
507
|
-
*
|
|
494
|
+
*
|
|
508
495
|
* Return every connector connection associated with the given collection, with encrypted credentials redacted. Useful for showing the user which third-party data sources are wired up to a collection.
|
|
509
496
|
* @operationId connectors.list
|
|
510
497
|
* @endpoint GET /v1/connectors
|
|
@@ -520,9 +507,8 @@ var ConnectorsResource = class {
|
|
|
520
507
|
})).results;
|
|
521
508
|
}
|
|
522
509
|
/**
|
|
523
|
-
*
|
|
524
510
|
* List available connector providers
|
|
525
|
-
*
|
|
511
|
+
*
|
|
526
512
|
* Return the set of connector provider identifiers (e.g. `google_drive`, `slack`) that this Nebula instance is configured to expose. Pass one of these to `POST /connectors/{provider}/connect` to start an OAuth flow.
|
|
527
513
|
* @operationId connectors.listProviders
|
|
528
514
|
* @endpoint GET /v1/connectors/providers
|
|
@@ -538,9 +524,8 @@ var ConnectorsResource = class {
|
|
|
538
524
|
})).results;
|
|
539
525
|
}
|
|
540
526
|
/**
|
|
541
|
-
*
|
|
542
527
|
* Get a single connection by ID
|
|
543
|
-
*
|
|
528
|
+
*
|
|
544
529
|
* Fetch a single connector connection by its UUID. Returns the connection metadata plus whether the underlying subscription is active. Encrypted credentials are never returned to clients.
|
|
545
530
|
* @operationId connectors.retrieve
|
|
546
531
|
* @endpoint GET /v1/connectors/{connection_id}
|
|
@@ -556,9 +541,8 @@ var ConnectorsResource = class {
|
|
|
556
541
|
})).results;
|
|
557
542
|
}
|
|
558
543
|
/**
|
|
559
|
-
*
|
|
560
544
|
* Manually trigger a sync
|
|
561
|
-
*
|
|
545
|
+
*
|
|
562
546
|
* Schedule an immediate sync for an active connection, bypassing the normal cadence. Returns 409 if a sync is already in progress and 400 if the connection isn't in the `active` state.
|
|
563
547
|
* @operationId connectors.sync
|
|
564
548
|
* @endpoint POST /v1/connectors/{connection_id}/sync
|
|
@@ -582,15 +566,14 @@ var MemoriesResource = class {
|
|
|
582
566
|
this.core = core;
|
|
583
567
|
}
|
|
584
568
|
/**
|
|
585
|
-
*
|
|
586
569
|
* Append content to an engram
|
|
587
|
-
*
|
|
570
|
+
*
|
|
588
571
|
* Append content to an existing engram.
|
|
589
|
-
*
|
|
572
|
+
*
|
|
590
573
|
* **For conversation engrams:**
|
|
591
574
|
* - Provide `messages` array with content, role, and optional metadata
|
|
592
575
|
* - Works like `/conversations/{id}/messages` endpoint
|
|
593
|
-
*
|
|
576
|
+
*
|
|
594
577
|
* **For document engrams:**
|
|
595
578
|
* - Provide either `raw_text` or `chunks` to append additional content
|
|
596
579
|
* - Content will be processed and added to the engram
|
|
@@ -609,11 +592,10 @@ var MemoriesResource = class {
|
|
|
609
592
|
})).results;
|
|
610
593
|
}
|
|
611
594
|
/**
|
|
612
|
-
*
|
|
613
595
|
* Create a new memory (conversation or document)
|
|
614
|
-
*
|
|
596
|
+
*
|
|
615
597
|
* Create a new memory (conversation or document) using clean JSON body.
|
|
616
|
-
*
|
|
598
|
+
*
|
|
617
599
|
* - Use `collection_id` (UUID)
|
|
618
600
|
* - `kind` is optional and inferred from payload shape:
|
|
619
601
|
* - If `messages` present -> conversation
|
|
@@ -636,19 +618,18 @@ var MemoriesResource = class {
|
|
|
636
618
|
})).results;
|
|
637
619
|
}
|
|
638
620
|
/**
|
|
639
|
-
*
|
|
640
621
|
* Get presigned URL for large file upload
|
|
641
|
-
*
|
|
622
|
+
*
|
|
642
623
|
* Get a presigned URL for uploading large files directly to S3.
|
|
643
|
-
*
|
|
624
|
+
*
|
|
644
625
|
* Use this for files larger than 5MB that cannot be sent inline as base64.
|
|
645
626
|
* After uploading, reference the file in memory creation using S3FileReference.
|
|
646
|
-
*
|
|
627
|
+
*
|
|
647
628
|
* Args:
|
|
648
629
|
* filename: Original filename (e.g., "image.jpg")
|
|
649
630
|
* content_type: MIME type (e.g., "image/jpeg", "application/pdf")
|
|
650
631
|
* file_size: Expected file size in bytes (max 100MB)
|
|
651
|
-
*
|
|
632
|
+
*
|
|
652
633
|
* Returns:
|
|
653
634
|
* dict with:
|
|
654
635
|
* - upload_url: Presigned URL for PUT request (expires in 1 hour)
|
|
@@ -675,13 +656,12 @@ var MemoriesResource = class {
|
|
|
675
656
|
})).results;
|
|
676
657
|
}
|
|
677
658
|
/**
|
|
678
|
-
*
|
|
679
659
|
* Delete an engram
|
|
680
|
-
*
|
|
660
|
+
*
|
|
681
661
|
* Delete a specific engram with graph awareness. All chunks corresponding to the
|
|
682
662
|
* engram are deleted, and graph components (entities/relationships) are updated
|
|
683
663
|
* or deleted based on remaining chunk references from other engrams.
|
|
684
|
-
*
|
|
664
|
+
*
|
|
685
665
|
* This method now properly handles graph components and maintains graph integrity
|
|
686
666
|
* for search operations.
|
|
687
667
|
* @operationId memories.delete
|
|
@@ -698,17 +678,16 @@ var MemoriesResource = class {
|
|
|
698
678
|
})).results;
|
|
699
679
|
}
|
|
700
680
|
/**
|
|
701
|
-
*
|
|
702
681
|
* Delete one or more engrams
|
|
703
|
-
*
|
|
682
|
+
*
|
|
704
683
|
* Delete one or more engrams.
|
|
705
|
-
*
|
|
684
|
+
*
|
|
706
685
|
* This endpoint efficiently handles both single and batch deletions.
|
|
707
686
|
* When multiple IDs are provided, it uses optimized batch operations.
|
|
708
|
-
*
|
|
687
|
+
*
|
|
709
688
|
* Args:
|
|
710
689
|
* ids: Either a single UUID or a list of UUIDs to delete
|
|
711
|
-
*
|
|
690
|
+
*
|
|
712
691
|
* Returns:
|
|
713
692
|
* For single deletion: boolean success response
|
|
714
693
|
* For batch deletion: detailed results with successful and failed deletions
|
|
@@ -727,9 +706,8 @@ var MemoriesResource = class {
|
|
|
727
706
|
});
|
|
728
707
|
}
|
|
729
708
|
/**
|
|
730
|
-
*
|
|
731
709
|
* Delete a previously uploaded S3 file
|
|
732
|
-
*
|
|
710
|
+
*
|
|
733
711
|
* Delete a file from S3 that was uploaded via a presigned URL.
|
|
734
712
|
* Verifies the caller owns the file via S3 object metadata.
|
|
735
713
|
* @operationId memories.deleteUpload
|
|
@@ -746,16 +724,15 @@ var MemoriesResource = class {
|
|
|
746
724
|
})).results;
|
|
747
725
|
}
|
|
748
726
|
/**
|
|
749
|
-
*
|
|
750
727
|
* List engrams
|
|
751
|
-
*
|
|
728
|
+
*
|
|
752
729
|
* Returns a cursor-paginated list of engrams the authenticated user
|
|
753
730
|
* has access to.
|
|
754
|
-
*
|
|
731
|
+
*
|
|
755
732
|
* Results can be filtered by providing specific engram IDs or collection IDs.
|
|
756
733
|
* Regular users will only see engrams they own or have access to through
|
|
757
734
|
* collections. Superusers can see all engrams.
|
|
758
|
-
*
|
|
735
|
+
*
|
|
759
736
|
* The engrams are returned in order of creation time, most recent
|
|
760
737
|
* first. The response includes the engram's text field if available.
|
|
761
738
|
* @operationId memories.list
|
|
@@ -781,11 +758,10 @@ var MemoriesResource = class {
|
|
|
781
758
|
});
|
|
782
759
|
}
|
|
783
760
|
/**
|
|
784
|
-
*
|
|
785
761
|
* Recall workflow patterns by intent
|
|
786
|
-
*
|
|
762
|
+
*
|
|
787
763
|
* Workflow-pattern recall over 5 intents.
|
|
788
|
-
*
|
|
764
|
+
*
|
|
789
765
|
* * ``cursor`` -- match the caller's anchor against pattern
|
|
790
766
|
* canonical states, return ranked patterns + position.
|
|
791
767
|
* * ``predict`` -- like cursor but include the predicted next
|
|
@@ -809,15 +785,14 @@ var MemoriesResource = class {
|
|
|
809
785
|
})).results;
|
|
810
786
|
}
|
|
811
787
|
/**
|
|
812
|
-
*
|
|
813
788
|
* Retrieve an engram
|
|
814
|
-
*
|
|
789
|
+
*
|
|
815
790
|
* Retrieves detailed information about a specific engram by its
|
|
816
791
|
* ID.
|
|
817
|
-
*
|
|
792
|
+
*
|
|
818
793
|
* This endpoint returns the engram's metadata, status, and system information. It does not
|
|
819
794
|
* return the engram's content - use the `/engrams/{id}/download` endpoint for that.
|
|
820
|
-
*
|
|
795
|
+
*
|
|
821
796
|
* Users can only retrieve engrams they own or have access to through collections.
|
|
822
797
|
* Superusers can retrieve any engram.
|
|
823
798
|
* @operationId memories.retrieve
|
|
@@ -834,14 +809,13 @@ var MemoriesResource = class {
|
|
|
834
809
|
})).results;
|
|
835
810
|
}
|
|
836
811
|
/**
|
|
837
|
-
*
|
|
838
812
|
* Search memories
|
|
839
|
-
*
|
|
813
|
+
*
|
|
840
814
|
* Perform a search query across your memories.
|
|
841
|
-
*
|
|
815
|
+
*
|
|
842
816
|
* **Standard mode** (collection_ids or readable-scope search): returns hierarchical MemoryRecall
|
|
843
817
|
* with semantics, episodes, procedures, and sources.
|
|
844
|
-
*
|
|
818
|
+
*
|
|
845
819
|
* **Snapshot mode** (snapshot field): returns graph-search results with
|
|
846
820
|
* {entities, relationships} from stateless in-memory traversal.
|
|
847
821
|
* @operationId memories.search
|
|
@@ -859,20 +833,19 @@ var MemoriesResource = class {
|
|
|
859
833
|
})).results;
|
|
860
834
|
}
|
|
861
835
|
/**
|
|
862
|
-
*
|
|
863
836
|
* Update a memory
|
|
864
|
-
*
|
|
837
|
+
*
|
|
865
838
|
* Update memory-level properties including name, metadata, and collection associations.
|
|
866
|
-
*
|
|
839
|
+
*
|
|
867
840
|
* This endpoint allows updating properties of an entire memory (document or conversation)
|
|
868
841
|
* without modifying its content:
|
|
869
842
|
* - **name**: Updates the authoritative engram title
|
|
870
843
|
* - **metadata**: Can replace or merge with existing metadata
|
|
871
844
|
* - **collection_ids**: Updates authoritative engram collection associations
|
|
872
|
-
*
|
|
845
|
+
*
|
|
873
846
|
* Users can only update memories they own or have access to through collections.
|
|
874
847
|
* At least one collection association must be maintained.
|
|
875
|
-
*
|
|
848
|
+
*
|
|
876
849
|
* If collection_id is provided and the engram is shared across collections, a copy-on-write
|
|
877
850
|
* will be performed to create a collection-specific copy before modification.
|
|
878
851
|
* @operationId memories.update
|
|
@@ -898,9 +871,8 @@ var SnapshotsResource = class {
|
|
|
898
871
|
this.core = core;
|
|
899
872
|
}
|
|
900
873
|
/**
|
|
901
|
-
*
|
|
902
874
|
* Export a collection snapshot
|
|
903
|
-
*
|
|
875
|
+
*
|
|
904
876
|
* Export a collection's full graph state as a
|
|
905
877
|
* portable SnapshotEnvelope.
|
|
906
878
|
* @operationId snapshots.export
|
|
@@ -918,9 +890,8 @@ var SnapshotsResource = class {
|
|
|
918
890
|
})).results;
|
|
919
891
|
}
|
|
920
892
|
/**
|
|
921
|
-
*
|
|
922
893
|
* Import a snapshot into an ephemeral collection
|
|
923
|
-
*
|
|
894
|
+
*
|
|
924
895
|
* Import a SnapshotEnvelope into an ephemeral
|
|
925
896
|
* collection. Returns the ephemeral collection UUID.
|
|
926
897
|
* @operationId snapshots.import
|
|
@@ -939,6 +910,89 @@ var SnapshotsResource = class {
|
|
|
939
910
|
}
|
|
940
911
|
};
|
|
941
912
|
//#endregion
|
|
913
|
+
//#region src/resources/workspaces.ts
|
|
914
|
+
var WorkspacesResource = class {
|
|
915
|
+
core;
|
|
916
|
+
constructor(core) {
|
|
917
|
+
this.core = core;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Create workspace storage target
|
|
921
|
+
*
|
|
922
|
+
* Register a customer S3 bucket for hosted BYOC storage.
|
|
923
|
+
* @operationId workspaces.createStorageTarget
|
|
924
|
+
* @endpoint POST /v1/workspaces/{workspace_id}/storage-targets
|
|
925
|
+
*/
|
|
926
|
+
async createStorageTarget(params, options) {
|
|
927
|
+
return (await this.core.request({
|
|
928
|
+
method: "POST",
|
|
929
|
+
path: "/v1/workspaces/{workspace_id}/storage-targets",
|
|
930
|
+
pathParams: { workspace_id: params.workspaceId },
|
|
931
|
+
query: void 0,
|
|
932
|
+
body: params.body,
|
|
933
|
+
idempotent: false,
|
|
934
|
+
signal: options?.signal
|
|
935
|
+
})).results;
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Disable workspace storage target
|
|
939
|
+
*
|
|
940
|
+
* Disable a customer storage target for future collection binds.
|
|
941
|
+
* @operationId workspaces.disableStorageTarget
|
|
942
|
+
* @endpoint DELETE /v1/workspaces/{workspace_id}/storage-targets/{target_id}
|
|
943
|
+
*/
|
|
944
|
+
async disableStorageTarget(params, options) {
|
|
945
|
+
return (await this.core.request({
|
|
946
|
+
method: "DELETE",
|
|
947
|
+
path: "/v1/workspaces/{workspace_id}/storage-targets/{target_id}",
|
|
948
|
+
pathParams: {
|
|
949
|
+
workspace_id: params.workspaceId,
|
|
950
|
+
target_id: params.targetId
|
|
951
|
+
},
|
|
952
|
+
query: void 0,
|
|
953
|
+
idempotent: false,
|
|
954
|
+
signal: options?.signal
|
|
955
|
+
})).results;
|
|
956
|
+
}
|
|
957
|
+
/**
|
|
958
|
+
* List workspace storage targets
|
|
959
|
+
*
|
|
960
|
+
* List customer-owned object storage targets for a workspace.
|
|
961
|
+
* @operationId workspaces.listStorageTargets
|
|
962
|
+
* @endpoint GET /v1/workspaces/{workspace_id}/storage-targets
|
|
963
|
+
*/
|
|
964
|
+
async listStorageTargets(workspaceId, options) {
|
|
965
|
+
return (await this.core.request({
|
|
966
|
+
method: "GET",
|
|
967
|
+
path: "/v1/workspaces/{workspace_id}/storage-targets",
|
|
968
|
+
pathParams: { workspace_id: workspaceId },
|
|
969
|
+
query: void 0,
|
|
970
|
+
idempotent: true,
|
|
971
|
+
signal: options?.signal
|
|
972
|
+
})).results;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Validate workspace storage target
|
|
976
|
+
*
|
|
977
|
+
* Probe a customer storage target and mark it active on success.
|
|
978
|
+
* @operationId workspaces.validateStorageTarget
|
|
979
|
+
* @endpoint POST /v1/workspaces/{workspace_id}/storage-targets/{target_id}/validate
|
|
980
|
+
*/
|
|
981
|
+
async validateStorageTarget(params, options) {
|
|
982
|
+
return (await this.core.request({
|
|
983
|
+
method: "POST",
|
|
984
|
+
path: "/v1/workspaces/{workspace_id}/storage-targets/{target_id}/validate",
|
|
985
|
+
pathParams: {
|
|
986
|
+
workspace_id: params.workspaceId,
|
|
987
|
+
target_id: params.targetId
|
|
988
|
+
},
|
|
989
|
+
query: void 0,
|
|
990
|
+
idempotent: false,
|
|
991
|
+
signal: options?.signal
|
|
992
|
+
})).results;
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
//#endregion
|
|
942
996
|
//#region src/client.ts
|
|
943
997
|
var NebulaClient = class {
|
|
944
998
|
core;
|
|
@@ -947,6 +1001,7 @@ var NebulaClient = class {
|
|
|
947
1001
|
connectors;
|
|
948
1002
|
memories;
|
|
949
1003
|
snapshots;
|
|
1004
|
+
workspaces;
|
|
950
1005
|
constructor(options = {}) {
|
|
951
1006
|
this.core = new NebulaCore(options);
|
|
952
1007
|
this.client = new ClientResource(this.core);
|
|
@@ -954,13 +1009,14 @@ var NebulaClient = class {
|
|
|
954
1009
|
this.connectors = new ConnectorsResource(this.core);
|
|
955
1010
|
this.memories = new MemoriesResource(this.core);
|
|
956
1011
|
this.snapshots = new SnapshotsResource(this.core);
|
|
1012
|
+
this.workspaces = new WorkspacesResource(this.core);
|
|
957
1013
|
}
|
|
958
1014
|
};
|
|
959
1015
|
//#endregion
|
|
960
1016
|
//#region src/lib/dx.ts
|
|
961
1017
|
var Nebula = class extends NebulaClient {
|
|
962
1018
|
constructor(options = {}) {
|
|
963
|
-
super(
|
|
1019
|
+
super(normalizeClientOptions(options));
|
|
964
1020
|
}
|
|
965
1021
|
/**
|
|
966
1022
|
* Polymorphic memory creator: dispatches to memories.create or memories.append
|
|
@@ -1044,21 +1100,12 @@ var Nebula = class extends NebulaClient {
|
|
|
1044
1100
|
}, options);
|
|
1045
1101
|
}
|
|
1046
1102
|
};
|
|
1047
|
-
function normalizeAuthOptions(options) {
|
|
1048
|
-
if (options.apiKey != null && options.bearerToken == null && !looksLikeNebulaAPIKey(options.apiKey)) return {
|
|
1049
|
-
...options,
|
|
1050
|
-
apiKey: void 0,
|
|
1051
|
-
bearerToken: options.apiKey
|
|
1052
|
-
};
|
|
1053
|
-
return options;
|
|
1054
|
-
}
|
|
1055
1103
|
function normalizeClientOptions(options) {
|
|
1056
|
-
const { apiKey, baseUrl: baseUrlAlias, baseURL: baseURLCapAlias, timeout: timeoutAlias,
|
|
1104
|
+
const { apiKey, baseUrl: baseUrlAlias, baseURL: baseURLCapAlias, timeout: timeoutAlias, ...rest } = options;
|
|
1057
1105
|
const restClientOptions = rest;
|
|
1058
1106
|
return {
|
|
1059
1107
|
...restClientOptions,
|
|
1060
1108
|
apiKey: apiKey ?? void 0,
|
|
1061
|
-
bearerToken: bearerToken ?? void 0,
|
|
1062
1109
|
baseUrl: firstDefined(restClientOptions.baseUrl, baseUrlAlias, baseURLCapAlias) ?? void 0,
|
|
1063
1110
|
timeoutMs: firstDefined(restClientOptions.timeoutMs, timeoutAlias) ?? void 0
|
|
1064
1111
|
};
|
|
@@ -1066,12 +1113,6 @@ function normalizeClientOptions(options) {
|
|
|
1066
1113
|
function firstDefined(...values) {
|
|
1067
1114
|
return values.find((value) => value !== void 0);
|
|
1068
1115
|
}
|
|
1069
|
-
function looksLikeNebulaAPIKey(token) {
|
|
1070
|
-
const parts = token.split(".");
|
|
1071
|
-
if (parts.length !== 2) return false;
|
|
1072
|
-
const [publicPart, rawPart] = parts;
|
|
1073
|
-
return Boolean(rawPart) && (publicPart.startsWith("key_") || publicPart.startsWith("neb_"));
|
|
1074
|
-
}
|
|
1075
1116
|
function toMemoryCreateParams(memory) {
|
|
1076
1117
|
const collectionID = memory.collection_id ?? memory.collectionId ?? void 0;
|
|
1077
1118
|
const { collectionId: _ignore, content, memory_id: _ignoreMemoryID, ...rest } = memory;
|