@nebula-ai/sdk 1.3.0 → 1.4.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/LICENSE +18 -4
- package/README.md +42 -346
- package/dist/index.cjs +1268 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2824 -0
- package/dist/index.d.ts +2824 -0
- package/dist/index.js +1244 -0
- package/dist/index.js.map +1 -0
- package/package.json +40 -141
- package/CHANGELOG.md +0 -35
- package/api-promise.d.mts +0 -2
- package/api-promise.d.mts.map +0 -1
- package/api-promise.d.ts +0 -2
- package/api-promise.d.ts.map +0 -1
- package/api-promise.js +0 -6
- package/api-promise.js.map +0 -1
- package/api-promise.mjs +0 -2
- package/api-promise.mjs.map +0 -1
- package/client.d.mts +0 -205
- package/client.d.mts.map +0 -1
- package/client.d.ts +0 -205
- package/client.d.ts.map +0 -1
- package/client.js +0 -505
- package/client.js.map +0 -1
- package/client.mjs +0 -501
- package/client.mjs.map +0 -1
- package/core/api-promise.d.mts +0 -46
- package/core/api-promise.d.mts.map +0 -1
- package/core/api-promise.d.ts +0 -46
- package/core/api-promise.d.ts.map +0 -1
- package/core/api-promise.js +0 -74
- package/core/api-promise.js.map +0 -1
- package/core/api-promise.mjs +0 -70
- package/core/api-promise.mjs.map +0 -1
- package/core/error.d.mts +0 -46
- package/core/error.d.mts.map +0 -1
- package/core/error.d.ts +0 -46
- package/core/error.d.ts.map +0 -1
- package/core/error.js +0 -113
- package/core/error.js.map +0 -1
- package/core/error.mjs +0 -97
- package/core/error.mjs.map +0 -1
- package/core/resource.d.mts +0 -6
- package/core/resource.d.mts.map +0 -1
- package/core/resource.d.ts +0 -6
- package/core/resource.d.ts.map +0 -1
- package/core/resource.js +0 -11
- package/core/resource.js.map +0 -1
- package/core/resource.mjs +0 -7
- package/core/resource.mjs.map +0 -1
- package/core/uploads.d.mts +0 -3
- package/core/uploads.d.mts.map +0 -1
- package/core/uploads.d.ts +0 -3
- package/core/uploads.d.ts.map +0 -1
- package/core/uploads.js +0 -6
- package/core/uploads.js.map +0 -1
- package/core/uploads.mjs +0 -2
- package/core/uploads.mjs.map +0 -1
- package/error.d.mts +0 -2
- package/error.d.mts.map +0 -1
- package/error.d.ts +0 -2
- package/error.d.ts.map +0 -1
- package/error.js +0 -6
- package/error.js.map +0 -1
- package/error.mjs +0 -2
- package/error.mjs.map +0 -1
- package/index.d.mts +0 -13
- package/index.d.mts.map +0 -1
- package/index.d.ts +0 -13
- package/index.d.ts.map +0 -1
- package/index.js +0 -43
- package/index.js.map +0 -1
- package/index.mjs +0 -13
- package/index.mjs.map +0 -1
- package/internal/builtin-types.d.mts +0 -73
- package/internal/builtin-types.d.mts.map +0 -1
- package/internal/builtin-types.d.ts +0 -73
- package/internal/builtin-types.d.ts.map +0 -1
- package/internal/builtin-types.js +0 -4
- package/internal/builtin-types.js.map +0 -1
- package/internal/builtin-types.mjs +0 -3
- package/internal/builtin-types.mjs.map +0 -1
- package/internal/detect-platform.d.mts +0 -15
- package/internal/detect-platform.d.mts.map +0 -1
- package/internal/detect-platform.d.ts +0 -15
- package/internal/detect-platform.d.ts.map +0 -1
- package/internal/detect-platform.js +0 -162
- package/internal/detect-platform.js.map +0 -1
- package/internal/detect-platform.mjs +0 -157
- package/internal/detect-platform.mjs.map +0 -1
- package/internal/errors.d.mts +0 -3
- package/internal/errors.d.mts.map +0 -1
- package/internal/errors.d.ts +0 -3
- package/internal/errors.d.ts.map +0 -1
- package/internal/errors.js +0 -41
- package/internal/errors.js.map +0 -1
- package/internal/errors.mjs +0 -36
- package/internal/errors.mjs.map +0 -1
- package/internal/headers.d.mts +0 -20
- package/internal/headers.d.mts.map +0 -1
- package/internal/headers.d.ts +0 -20
- package/internal/headers.d.ts.map +0 -1
- package/internal/headers.js +0 -79
- package/internal/headers.js.map +0 -1
- package/internal/headers.mjs +0 -74
- package/internal/headers.mjs.map +0 -1
- package/internal/parse.d.mts +0 -12
- package/internal/parse.d.mts.map +0 -1
- package/internal/parse.d.ts +0 -12
- package/internal/parse.d.ts.map +0 -1
- package/internal/parse.js +0 -40
- package/internal/parse.js.map +0 -1
- package/internal/parse.mjs +0 -37
- package/internal/parse.mjs.map +0 -1
- package/internal/qs/formats.d.mts +0 -7
- package/internal/qs/formats.d.mts.map +0 -1
- package/internal/qs/formats.d.ts +0 -7
- package/internal/qs/formats.d.ts.map +0 -1
- package/internal/qs/formats.js +0 -13
- package/internal/qs/formats.js.map +0 -1
- package/internal/qs/formats.mjs +0 -9
- package/internal/qs/formats.mjs.map +0 -1
- package/internal/qs/index.d.mts +0 -10
- package/internal/qs/index.d.mts.map +0 -1
- package/internal/qs/index.d.ts +0 -10
- package/internal/qs/index.d.ts.map +0 -1
- package/internal/qs/index.js +0 -14
- package/internal/qs/index.js.map +0 -1
- package/internal/qs/index.mjs +0 -10
- package/internal/qs/index.mjs.map +0 -1
- package/internal/qs/stringify.d.mts +0 -3
- package/internal/qs/stringify.d.mts.map +0 -1
- package/internal/qs/stringify.d.ts +0 -3
- package/internal/qs/stringify.d.ts.map +0 -1
- package/internal/qs/stringify.js +0 -277
- package/internal/qs/stringify.js.map +0 -1
- package/internal/qs/stringify.mjs +0 -274
- package/internal/qs/stringify.mjs.map +0 -1
- package/internal/qs/types.d.mts +0 -57
- package/internal/qs/types.d.mts.map +0 -1
- package/internal/qs/types.d.ts +0 -57
- package/internal/qs/types.d.ts.map +0 -1
- package/internal/qs/types.js +0 -3
- package/internal/qs/types.js.map +0 -1
- package/internal/qs/types.mjs +0 -2
- package/internal/qs/types.mjs.map +0 -1
- package/internal/qs/utils.d.mts +0 -15
- package/internal/qs/utils.d.mts.map +0 -1
- package/internal/qs/utils.d.ts +0 -15
- package/internal/qs/utils.d.ts.map +0 -1
- package/internal/qs/utils.js +0 -230
- package/internal/qs/utils.js.map +0 -1
- package/internal/qs/utils.mjs +0 -217
- package/internal/qs/utils.mjs.map +0 -1
- package/internal/request-options.d.mts +0 -79
- package/internal/request-options.d.mts.map +0 -1
- package/internal/request-options.d.ts +0 -79
- package/internal/request-options.d.ts.map +0 -1
- package/internal/request-options.js +0 -14
- package/internal/request-options.js.map +0 -1
- package/internal/request-options.mjs +0 -10
- package/internal/request-options.mjs.map +0 -1
- package/internal/shim-types.d.mts +0 -17
- package/internal/shim-types.d.mts.map +0 -1
- package/internal/shim-types.d.ts +0 -17
- package/internal/shim-types.d.ts.map +0 -1
- package/internal/shim-types.js +0 -4
- package/internal/shim-types.js.map +0 -1
- package/internal/shim-types.mjs +0 -3
- package/internal/shim-types.mjs.map +0 -1
- package/internal/shims.d.mts +0 -20
- package/internal/shims.d.mts.map +0 -1
- package/internal/shims.d.ts +0 -20
- package/internal/shims.d.ts.map +0 -1
- package/internal/shims.js +0 -92
- package/internal/shims.js.map +0 -1
- package/internal/shims.mjs +0 -85
- package/internal/shims.mjs.map +0 -1
- package/internal/to-file.d.mts +0 -45
- package/internal/to-file.d.mts.map +0 -1
- package/internal/to-file.d.ts +0 -45
- package/internal/to-file.d.ts.map +0 -1
- package/internal/to-file.js +0 -91
- package/internal/to-file.js.map +0 -1
- package/internal/to-file.mjs +0 -88
- package/internal/to-file.mjs.map +0 -1
- package/internal/tslib.js +0 -81
- package/internal/tslib.mjs +0 -17
- package/internal/types.d.mts +0 -69
- package/internal/types.d.mts.map +0 -1
- package/internal/types.d.ts +0 -69
- package/internal/types.d.ts.map +0 -1
- package/internal/types.js +0 -4
- package/internal/types.js.map +0 -1
- package/internal/types.mjs +0 -3
- package/internal/types.mjs.map +0 -1
- package/internal/uploads.d.mts +0 -42
- package/internal/uploads.d.mts.map +0 -1
- package/internal/uploads.d.ts +0 -42
- package/internal/uploads.d.ts.map +0 -1
- package/internal/uploads.js +0 -141
- package/internal/uploads.js.map +0 -1
- package/internal/uploads.mjs +0 -131
- package/internal/uploads.mjs.map +0 -1
- package/internal/utils/base64.d.mts +0 -3
- package/internal/utils/base64.d.mts.map +0 -1
- package/internal/utils/base64.d.ts +0 -3
- package/internal/utils/base64.d.ts.map +0 -1
- package/internal/utils/base64.js +0 -38
- package/internal/utils/base64.js.map +0 -1
- package/internal/utils/base64.mjs +0 -33
- package/internal/utils/base64.mjs.map +0 -1
- package/internal/utils/bytes.d.mts +0 -4
- package/internal/utils/bytes.d.mts.map +0 -1
- package/internal/utils/bytes.d.ts +0 -4
- package/internal/utils/bytes.d.ts.map +0 -1
- package/internal/utils/bytes.js +0 -31
- package/internal/utils/bytes.js.map +0 -1
- package/internal/utils/bytes.mjs +0 -26
- package/internal/utils/bytes.mjs.map +0 -1
- package/internal/utils/env.d.mts +0 -9
- package/internal/utils/env.d.mts.map +0 -1
- package/internal/utils/env.d.ts +0 -9
- package/internal/utils/env.d.ts.map +0 -1
- package/internal/utils/env.js +0 -22
- package/internal/utils/env.js.map +0 -1
- package/internal/utils/env.mjs +0 -18
- package/internal/utils/env.mjs.map +0 -1
- package/internal/utils/log.d.mts +0 -37
- package/internal/utils/log.d.mts.map +0 -1
- package/internal/utils/log.d.ts +0 -37
- package/internal/utils/log.d.ts.map +0 -1
- package/internal/utils/log.js +0 -86
- package/internal/utils/log.js.map +0 -1
- package/internal/utils/log.mjs +0 -80
- package/internal/utils/log.mjs.map +0 -1
- package/internal/utils/path.d.mts +0 -15
- package/internal/utils/path.d.mts.map +0 -1
- package/internal/utils/path.d.ts +0 -15
- package/internal/utils/path.d.ts.map +0 -1
- package/internal/utils/path.js +0 -79
- package/internal/utils/path.js.map +0 -1
- package/internal/utils/path.mjs +0 -74
- package/internal/utils/path.mjs.map +0 -1
- package/internal/utils/query.d.mts +0 -2
- package/internal/utils/query.d.mts.map +0 -1
- package/internal/utils/query.d.ts +0 -2
- package/internal/utils/query.d.ts.map +0 -1
- package/internal/utils/query.js +0 -10
- package/internal/utils/query.js.map +0 -1
- package/internal/utils/query.mjs +0 -6
- package/internal/utils/query.mjs.map +0 -1
- package/internal/utils/sleep.d.mts +0 -2
- package/internal/utils/sleep.d.mts.map +0 -1
- package/internal/utils/sleep.d.ts +0 -2
- package/internal/utils/sleep.d.ts.map +0 -1
- package/internal/utils/sleep.js +0 -7
- package/internal/utils/sleep.js.map +0 -1
- package/internal/utils/sleep.mjs +0 -3
- package/internal/utils/sleep.mjs.map +0 -1
- package/internal/utils/uuid.d.mts +0 -5
- package/internal/utils/uuid.d.mts.map +0 -1
- package/internal/utils/uuid.d.ts +0 -5
- package/internal/utils/uuid.d.ts.map +0 -1
- package/internal/utils/uuid.js +0 -19
- package/internal/utils/uuid.js.map +0 -1
- package/internal/utils/uuid.mjs +0 -15
- package/internal/utils/uuid.mjs.map +0 -1
- package/internal/utils/values.d.mts +0 -18
- package/internal/utils/values.d.mts.map +0 -1
- package/internal/utils/values.d.ts +0 -18
- package/internal/utils/values.d.ts.map +0 -1
- package/internal/utils/values.js +0 -112
- package/internal/utils/values.js.map +0 -1
- package/internal/utils/values.mjs +0 -94
- package/internal/utils/values.mjs.map +0 -1
- package/internal/utils.d.mts +0 -8
- package/internal/utils.d.mts.map +0 -1
- package/internal/utils.d.ts +0 -8
- package/internal/utils.d.ts.map +0 -1
- package/internal/utils.js +0 -12
- package/internal/utils.js.map +0 -1
- package/internal/utils.mjs +0 -9
- package/internal/utils.mjs.map +0 -1
- package/lib/dx.d.mts +0 -96
- package/lib/dx.d.mts.map +0 -1
- package/lib/dx.d.ts +0 -96
- package/lib/dx.d.ts.map +0 -1
- package/lib/dx.js +0 -239
- package/lib/dx.js.map +0 -1
- package/lib/dx.mjs +0 -235
- package/lib/dx.mjs.map +0 -1
- package/resource.d.mts +0 -2
- package/resource.d.mts.map +0 -1
- package/resource.d.ts +0 -2
- package/resource.d.ts.map +0 -1
- package/resource.js +0 -6
- package/resource.js.map +0 -1
- package/resource.mjs +0 -2
- package/resource.mjs.map +0 -1
- package/resources/collections.d.mts +0 -289
- package/resources/collections.d.mts.map +0 -1
- package/resources/collections.d.ts +0 -289
- package/resources/collections.d.ts.map +0 -1
- package/resources/collections.js +0 -72
- package/resources/collections.js.map +0 -1
- package/resources/collections.mjs +0 -68
- package/resources/collections.mjs.map +0 -1
- package/resources/connectors.d.mts +0 -148
- package/resources/connectors.d.mts.map +0 -1
- package/resources/connectors.d.ts +0 -148
- package/resources/connectors.d.ts.map +0 -1
- package/resources/connectors.js +0 -50
- package/resources/connectors.js.map +0 -1
- package/resources/connectors.mjs +0 -46
- package/resources/connectors.mjs.map +0 -1
- package/resources/index.d.mts +0 -6
- package/resources/index.d.mts.map +0 -1
- package/resources/index.d.ts +0 -6
- package/resources/index.d.ts.map +0 -1
- package/resources/index.js +0 -13
- package/resources/index.js.map +0 -1
- package/resources/index.mjs +0 -6
- package/resources/index.mjs.map +0 -1
- package/resources/memories.d.mts +0 -1737
- package/resources/memories.d.mts.map +0 -1
- package/resources/memories.d.ts +0 -1737
- package/resources/memories.d.ts.map +0 -1
- package/resources/memories.js +0 -157
- package/resources/memories.js.map +0 -1
- package/resources/memories.mjs +0 -153
- package/resources/memories.mjs.map +0 -1
- package/resources/snapshots.d.mts +0 -281
- package/resources/snapshots.d.mts.map +0 -1
- package/resources/snapshots.d.ts +0 -281
- package/resources/snapshots.d.ts.map +0 -1
- package/resources/snapshots.js +0 -22
- package/resources/snapshots.js.map +0 -1
- package/resources/snapshots.mjs +0 -18
- package/resources/snapshots.mjs.map +0 -1
- package/resources/top-level.d.mts +0 -14
- package/resources/top-level.d.mts.map +0 -1
- package/resources/top-level.d.ts +0 -14
- package/resources/top-level.d.ts.map +0 -1
- package/resources/top-level.js +0 -4
- package/resources/top-level.js.map +0 -1
- package/resources/top-level.mjs +0 -3
- package/resources/top-level.mjs.map +0 -1
- package/resources.d.mts +0 -2
- package/resources.d.mts.map +0 -1
- package/resources.d.ts +0 -2
- package/resources.d.ts.map +0 -1
- package/resources.js +0 -5
- package/resources.js.map +0 -1
- package/resources.mjs +0 -2
- package/resources.mjs.map +0 -1
- package/src/api-promise.ts +0 -2
- package/src/client.ts +0 -892
- package/src/core/README.md +0 -3
- package/src/core/api-promise.ts +0 -92
- package/src/core/error.ts +0 -130
- package/src/core/resource.ts +0 -11
- package/src/core/uploads.ts +0 -2
- package/src/error.ts +0 -2
- package/src/index.ts +0 -36
- package/src/internal/README.md +0 -3
- package/src/internal/builtin-types.ts +0 -93
- package/src/internal/detect-platform.ts +0 -196
- package/src/internal/errors.ts +0 -33
- package/src/internal/headers.ts +0 -97
- package/src/internal/parse.ts +0 -56
- package/src/internal/qs/LICENSE.md +0 -13
- package/src/internal/qs/README.md +0 -3
- package/src/internal/qs/formats.ts +0 -10
- package/src/internal/qs/index.ts +0 -13
- package/src/internal/qs/stringify.ts +0 -385
- package/src/internal/qs/types.ts +0 -71
- package/src/internal/qs/utils.ts +0 -265
- package/src/internal/request-options.ts +0 -93
- package/src/internal/shim-types.ts +0 -26
- package/src/internal/shims.ts +0 -107
- package/src/internal/to-file.ts +0 -154
- package/src/internal/types.ts +0 -95
- package/src/internal/uploads.ts +0 -187
- package/src/internal/utils/base64.ts +0 -40
- package/src/internal/utils/bytes.ts +0 -32
- package/src/internal/utils/env.ts +0 -18
- package/src/internal/utils/log.ts +0 -127
- package/src/internal/utils/path.ts +0 -88
- package/src/internal/utils/query.ts +0 -7
- package/src/internal/utils/sleep.ts +0 -3
- package/src/internal/utils/uuid.ts +0 -17
- package/src/internal/utils/values.ts +0 -105
- package/src/internal/utils.ts +0 -9
- package/src/lib/.keep +0 -4
- package/src/lib/dx.ts +0 -459
- package/src/resource.ts +0 -2
- package/src/resources/collections.ts +0 -474
- package/src/resources/connectors.ts +0 -236
- package/src/resources/index.ts +0 -56
- package/src/resources/memories.ts +0 -2409
- package/src/resources/snapshots.ts +0 -387
- package/src/resources/top-level.ts +0 -19
- package/src/resources.ts +0 -1
- package/src/tsconfig.json +0 -11
- package/src/uploads.ts +0 -2
- package/src/version.ts +0 -1
- package/uploads.d.mts +0 -2
- package/uploads.d.mts.map +0 -1
- package/uploads.d.ts +0 -2
- package/uploads.d.ts.map +0 -1
- package/uploads.js +0 -6
- package/uploads.js.map +0 -1
- package/uploads.mjs +0 -2
- package/uploads.mjs.map +0 -1
- package/version.d.mts +0 -2
- package/version.d.mts.map +0 -1
- package/version.d.ts +0 -2
- package/version.d.ts.map +0 -1
- package/version.js +0 -5
- package/version.js.map +0 -1
- package/version.mjs +0 -2
- package/version.mjs.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2026 Nebula
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,371 +1,67 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nebula-ai/sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official Nebula API SDK for TypeScript. Provides typed access to the public
|
|
4
|
+
Nebula REST API: collections, memories, connectors, snapshots, and system
|
|
5
|
+
health.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
It is generated with [Stainless](https://www.stainless.com/).
|
|
10
|
-
|
|
11
|
-
## Installation
|
|
12
|
-
|
|
13
|
-
```sh
|
|
9
|
+
```bash
|
|
14
10
|
npm install @nebula-ai/sdk
|
|
11
|
+
# or
|
|
12
|
+
bun add @nebula-ai/sdk
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
The full API of this library can be found in [api.md](api.md).
|
|
20
|
-
|
|
21
|
-
<!-- prettier-ignore -->
|
|
22
|
-
```js
|
|
23
|
-
import Nebula from '@nebula-ai/sdk';
|
|
24
|
-
|
|
25
|
-
const client = new Nebula({
|
|
26
|
-
accessToken: process.env['NEBULA_BEARER_TOKEN'], // This is the default and can be omitted
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const collection = await client.collections.create({
|
|
30
|
-
name: 'Example collection',
|
|
31
|
-
description: 'Memory store for my app',
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
console.log(collection.results);
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Request & Response types
|
|
38
|
-
|
|
39
|
-
This library includes TypeScript definitions for all request params and response fields. You may import and use them like so:
|
|
40
|
-
|
|
41
|
-
<!-- prettier-ignore -->
|
|
42
|
-
```ts
|
|
43
|
-
import Nebula from '@nebula-ai/sdk';
|
|
44
|
-
|
|
45
|
-
const client = new Nebula({
|
|
46
|
-
accessToken: process.env['NEBULA_BEARER_TOKEN'], // This is the default and can be omitted
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
const params: Nebula.CollectionCreateParams = {
|
|
50
|
-
name: 'Example collection',
|
|
51
|
-
description: 'Memory store for my app',
|
|
52
|
-
};
|
|
53
|
-
const collection: Nebula.CollectionCreateResponse = await client.collections.create(params);
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Documentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.
|
|
57
|
-
|
|
58
|
-
## Handling errors
|
|
59
|
-
|
|
60
|
-
When the library is unable to connect to the API,
|
|
61
|
-
or if the API returns a non-success status code (i.e., 4xx or 5xx response),
|
|
62
|
-
a subclass of `APIError` will be thrown:
|
|
63
|
-
|
|
64
|
-
<!-- prettier-ignore -->
|
|
65
|
-
```ts
|
|
66
|
-
const collection = await client.collections
|
|
67
|
-
.create({ name: 'Example collection', description: 'Memory store for my app' })
|
|
68
|
-
.catch(async (err) => {
|
|
69
|
-
if (err instanceof Nebula.APIError) {
|
|
70
|
-
console.log(err.status); // 400
|
|
71
|
-
console.log(err.name); // BadRequestError
|
|
72
|
-
console.log(err.headers); // {server: 'nginx', ...}
|
|
73
|
-
} else {
|
|
74
|
-
throw err;
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
Error codes are as follows:
|
|
80
|
-
|
|
81
|
-
| Status Code | Error Type |
|
|
82
|
-
| ----------- | -------------------------- |
|
|
83
|
-
| 400 | `BadRequestError` |
|
|
84
|
-
| 401 | `AuthenticationError` |
|
|
85
|
-
| 403 | `PermissionDeniedError` |
|
|
86
|
-
| 404 | `NotFoundError` |
|
|
87
|
-
| 422 | `UnprocessableEntityError` |
|
|
88
|
-
| 429 | `RateLimitError` |
|
|
89
|
-
| >=500 | `InternalServerError` |
|
|
90
|
-
| N/A | `APIConnectionError` |
|
|
91
|
-
|
|
92
|
-
### Retries
|
|
93
|
-
|
|
94
|
-
Certain errors will be automatically retried 2 times by default, with a short exponential backoff.
|
|
95
|
-
Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,
|
|
96
|
-
429 Rate Limit, and >=500 Internal errors will all be retried by default.
|
|
97
|
-
|
|
98
|
-
You can use the `maxRetries` option to configure or disable this:
|
|
99
|
-
|
|
100
|
-
<!-- prettier-ignore -->
|
|
101
|
-
```js
|
|
102
|
-
// Configure the default for all requests:
|
|
103
|
-
const client = new Nebula({
|
|
104
|
-
maxRetries: 0, // default is 2
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// Or, configure per-request:
|
|
108
|
-
await client.collections.create({ name: 'Example collection', description: 'Memory store for my app' }, {
|
|
109
|
-
maxRetries: 5,
|
|
110
|
-
});
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Timeouts
|
|
114
|
-
|
|
115
|
-
Requests time out after 1 minute by default. You can configure this with a `timeout` option:
|
|
116
|
-
|
|
117
|
-
<!-- prettier-ignore -->
|
|
118
|
-
```ts
|
|
119
|
-
// Configure the default for all requests:
|
|
120
|
-
const client = new Nebula({
|
|
121
|
-
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// Override per-request:
|
|
125
|
-
await client.collections.create({ name: 'Example collection', description: 'Memory store for my app' }, {
|
|
126
|
-
timeout: 5 * 1000,
|
|
127
|
-
});
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
On timeout, an `APIConnectionTimeoutError` is thrown.
|
|
131
|
-
|
|
132
|
-
Note that requests which time out will be [retried twice by default](#retries).
|
|
133
|
-
|
|
134
|
-
## Advanced Usage
|
|
135
|
-
|
|
136
|
-
### Accessing raw Response data (e.g., headers)
|
|
137
|
-
|
|
138
|
-
The "raw" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.
|
|
139
|
-
This method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.
|
|
140
|
-
|
|
141
|
-
You can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.
|
|
142
|
-
Unlike `.asResponse()` this method consumes the body, returning once it is parsed.
|
|
143
|
-
|
|
144
|
-
<!-- prettier-ignore -->
|
|
145
|
-
```ts
|
|
146
|
-
const client = new Nebula();
|
|
147
|
-
|
|
148
|
-
const response = await client.collections
|
|
149
|
-
.create({ name: 'Example collection', description: 'Memory store for my app' })
|
|
150
|
-
.asResponse();
|
|
151
|
-
console.log(response.headers.get('X-My-Header'));
|
|
152
|
-
console.log(response.statusText); // access the underlying Response object
|
|
153
|
-
|
|
154
|
-
const { data: collection, response: raw } = await client.collections
|
|
155
|
-
.create({ name: 'Example collection', description: 'Memory store for my app' })
|
|
156
|
-
.withResponse();
|
|
157
|
-
console.log(raw.headers.get('X-My-Header'));
|
|
158
|
-
console.log(collection.results);
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Logging
|
|
162
|
-
|
|
163
|
-
> [!IMPORTANT]
|
|
164
|
-
> All log messages are intended for debugging only. The format and content of log messages
|
|
165
|
-
> may change between releases.
|
|
166
|
-
|
|
167
|
-
#### Log levels
|
|
168
|
-
|
|
169
|
-
The log level can be configured in two ways:
|
|
170
|
-
|
|
171
|
-
1. Via the `NEBULA_LOG` environment variable
|
|
172
|
-
2. Using the `logLevel` client option (overrides the environment variable if set)
|
|
173
|
-
|
|
174
|
-
```ts
|
|
175
|
-
import Nebula from '@nebula-ai/sdk';
|
|
176
|
-
|
|
177
|
-
const client = new Nebula({
|
|
178
|
-
logLevel: 'debug', // Show all log messages
|
|
179
|
-
});
|
|
180
|
-
```
|
|
181
|
-
|
|
182
|
-
Available log levels, from most to least verbose:
|
|
183
|
-
|
|
184
|
-
- `'debug'` - Show debug messages, info, warnings, and errors
|
|
185
|
-
- `'info'` - Show info messages, warnings, and errors
|
|
186
|
-
- `'warn'` - Show warnings and errors (default)
|
|
187
|
-
- `'error'` - Show only errors
|
|
188
|
-
- `'off'` - Disable all logging
|
|
189
|
-
|
|
190
|
-
At the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.
|
|
191
|
-
Some authentication-related headers are redacted, but sensitive data in request and response bodies
|
|
192
|
-
may still be visible.
|
|
193
|
-
|
|
194
|
-
#### Custom logger
|
|
195
|
-
|
|
196
|
-
By default, this library logs to `globalThis.console`. You can also provide a custom logger.
|
|
197
|
-
Most logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.
|
|
198
|
-
|
|
199
|
-
When providing a custom logger, the `logLevel` option still controls which messages are emitted, messages
|
|
200
|
-
below the configured level will not be sent to your logger.
|
|
15
|
+
## Quick start
|
|
201
16
|
|
|
202
17
|
```ts
|
|
203
|
-
import Nebula from
|
|
204
|
-
import pino from 'pino';
|
|
205
|
-
|
|
206
|
-
const logger = pino();
|
|
18
|
+
import { Nebula } from "@nebula-ai/sdk";
|
|
207
19
|
|
|
208
20
|
const client = new Nebula({
|
|
209
|
-
|
|
210
|
-
|
|
21
|
+
apiKey: process.env.NEBULA_API_KEY,
|
|
22
|
+
// or: bearerToken: process.env.NEBULA_BEARER_TOKEN,
|
|
211
23
|
});
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### Making custom/undocumented requests
|
|
215
24
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
#### Undocumented endpoints
|
|
220
|
-
|
|
221
|
-
To make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.
|
|
222
|
-
Options on the client, such as retries, will be respected when making these requests.
|
|
223
|
-
|
|
224
|
-
```ts
|
|
225
|
-
await client.post('/some/path', {
|
|
226
|
-
body: { some_prop: 'foo' },
|
|
227
|
-
query: { some_query_arg: 'bar' },
|
|
25
|
+
const id = await client.storeMemory({
|
|
26
|
+
collection_id: "01234567-...",
|
|
27
|
+
raw_text: "hello, world",
|
|
228
28
|
});
|
|
229
|
-
```
|
|
230
29
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
To make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented
|
|
234
|
-
parameter. This library doesn't validate at runtime that the request matches the type, so any extra values you
|
|
235
|
-
send will be sent as-is.
|
|
236
|
-
|
|
237
|
-
```ts
|
|
238
|
-
client.collections.create({
|
|
239
|
-
// ...
|
|
240
|
-
// @ts-expect-error baz is not yet public
|
|
241
|
-
baz: 'undocumented option',
|
|
242
|
-
});
|
|
30
|
+
const results = await client.search({ query: "hello" });
|
|
243
31
|
```
|
|
244
32
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
#### Undocumented response properties
|
|
252
|
-
|
|
253
|
-
To access undocumented response properties, you may access the response object with `// @ts-expect-error` on
|
|
254
|
-
the response object, or cast the response object to the requisite type. Like the request params, we do not
|
|
255
|
-
validate or strip extra properties from the response from the API.
|
|
256
|
-
|
|
257
|
-
### Customizing the fetch client
|
|
258
|
-
|
|
259
|
-
By default, this library expects a global `fetch` function is defined.
|
|
260
|
-
|
|
261
|
-
If you want to use a different `fetch` function, you can either polyfill the global:
|
|
262
|
-
|
|
263
|
-
```ts
|
|
264
|
-
import fetch from 'my-fetch';
|
|
265
|
-
|
|
266
|
-
globalThis.fetch = fetch;
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
Or pass it to the client:
|
|
270
|
-
|
|
271
|
-
```ts
|
|
272
|
-
import Nebula from '@nebula-ai/sdk';
|
|
273
|
-
import fetch from 'my-fetch';
|
|
274
|
-
|
|
275
|
-
const client = new Nebula({ fetch });
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
### Fetch options
|
|
279
|
-
|
|
280
|
-
If you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)
|
|
281
|
-
|
|
282
|
-
```ts
|
|
283
|
-
import Nebula from '@nebula-ai/sdk';
|
|
284
|
-
|
|
285
|
-
const client = new Nebula({
|
|
286
|
-
fetchOptions: {
|
|
287
|
-
// `RequestInit` options
|
|
288
|
-
},
|
|
289
|
-
});
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
#### Configuring proxies
|
|
293
|
-
|
|
294
|
-
To modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy
|
|
295
|
-
options to requests:
|
|
296
|
-
|
|
297
|
-
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg" align="top" width="18" height="21"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>
|
|
298
|
-
|
|
299
|
-
```ts
|
|
300
|
-
import Nebula from '@nebula-ai/sdk';
|
|
301
|
-
import * as undici from 'undici';
|
|
302
|
-
|
|
303
|
-
const proxyAgent = new undici.ProxyAgent('http://localhost:8888');
|
|
304
|
-
const client = new Nebula({
|
|
305
|
-
fetchOptions: {
|
|
306
|
-
dispatcher: proxyAgent,
|
|
307
|
-
},
|
|
308
|
-
});
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg" align="top" width="18" height="21"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>
|
|
312
|
-
|
|
313
|
-
```ts
|
|
314
|
-
import Nebula from '@nebula-ai/sdk';
|
|
315
|
-
|
|
316
|
-
const client = new Nebula({
|
|
317
|
-
fetchOptions: {
|
|
318
|
-
proxy: 'http://localhost:8888',
|
|
319
|
-
},
|
|
320
|
-
});
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
<img src="https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg" align="top" width="18" height="21"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>
|
|
324
|
-
|
|
325
|
-
```ts
|
|
326
|
-
import Nebula from 'npm:@nebula-ai/sdk';
|
|
327
|
-
|
|
328
|
-
const httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });
|
|
329
|
-
const client = new Nebula({
|
|
330
|
-
fetchOptions: {
|
|
331
|
-
client: httpClient,
|
|
332
|
-
},
|
|
333
|
-
});
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
## Frequently Asked Questions
|
|
337
|
-
|
|
338
|
-
## Semantic versioning
|
|
339
|
-
|
|
340
|
-
This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:
|
|
341
|
-
|
|
342
|
-
1. Changes that only affect static types, without breaking runtime behavior.
|
|
343
|
-
2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_
|
|
344
|
-
3. Changes that we do not expect to impact the vast majority of users in practice.
|
|
345
|
-
|
|
346
|
-
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
33
|
+
The high-level methods (`storeMemory`, `search`, `deleteMemory`, ...) come
|
|
34
|
+
from the handwritten DX layer at `src/lib/dx.ts`. The low-level resource
|
|
35
|
+
clients (`client.memories.*`, `client.collections.*`, ...) are generated
|
|
36
|
+
directly from the OpenAPI spec and remain available as
|
|
37
|
+
`client.memories.create(...)`, `client.memories.search(...)`, etc.
|
|
347
38
|
|
|
348
|
-
|
|
39
|
+
## Auth
|
|
349
40
|
|
|
350
|
-
|
|
41
|
+
The constructor accepts both `apiKey` / `bearerToken` (camelCase) and the
|
|
42
|
+
snake_case aliases `api_key` / `access_token`. If you pass an API key that
|
|
43
|
+
doesn't look like a Nebula key (not prefixed with `key_` or `neb_`), the
|
|
44
|
+
DX layer automatically routes it through the bearer-token header instead.
|
|
351
45
|
|
|
352
|
-
|
|
46
|
+
## Errors
|
|
353
47
|
|
|
354
|
-
|
|
48
|
+
All HTTP errors map to a typed exception hierarchy:
|
|
355
49
|
|
|
356
|
-
-
|
|
357
|
-
-
|
|
358
|
-
-
|
|
359
|
-
-
|
|
360
|
-
-
|
|
361
|
-
-
|
|
362
|
-
-
|
|
363
|
-
-
|
|
50
|
+
- `NebulaBadRequestError` (400)
|
|
51
|
+
- `NebulaUnauthorizedError` (401)
|
|
52
|
+
- `NebulaForbiddenError` (403)
|
|
53
|
+
- `NebulaNotFoundError` (404)
|
|
54
|
+
- `NebulaConflictError` (409)
|
|
55
|
+
- `NebulaValidationError` (422)
|
|
56
|
+
- `NebulaRateLimitError` (429) — carries `retryAfter` when the server returns `Retry-After`
|
|
57
|
+
- `NebulaServerError` (5xx)
|
|
58
|
+
- `NebulaConnectionError` / `NebulaTimeoutError` — transport-level
|
|
364
59
|
|
|
365
|
-
|
|
60
|
+
## Docs
|
|
366
61
|
|
|
367
|
-
|
|
62
|
+
- API reference: https://docs.zeroset.com
|
|
63
|
+
- Migration notes: see `MIGRATION.md` in the source repo
|
|
368
64
|
|
|
369
|
-
##
|
|
65
|
+
## License
|
|
370
66
|
|
|
371
|
-
|
|
67
|
+
MIT
|