@nebius/js-sdk 0.1.3 → 0.1.4
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 +17 -27
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ This repository contains the Nebius SDK for interacting with Nebius AI services
|
|
|
4
4
|
|
|
5
5
|
## Quick links
|
|
6
6
|
|
|
7
|
-
- API reference
|
|
8
|
-
- Generated TypeScript sources from protos: `src/api/`
|
|
7
|
+
- [API reference, generated by TypeDoc](https://nebius.github.io/js-sdk/documents/SERVICES.html)
|
|
8
|
+
- Generated TypeScript sources from protos: `src/api/` (not committed, one has to generate themselves)
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
@@ -53,7 +53,7 @@ This section collects practical how-to recipes. They show common initialization
|
|
|
53
53
|
|
|
54
54
|
### Initialize the SDK
|
|
55
55
|
|
|
56
|
-
The [`SDK`](
|
|
56
|
+
The [`SDK`](https://nebius.github.io/js-sdk/classes/sdk.SDK.html) is the base.
|
|
57
57
|
|
|
58
58
|
Here is the simplest way to initialize it:
|
|
59
59
|
|
|
@@ -101,9 +101,9 @@ const sdk = new SDK({
|
|
|
101
101
|
});
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
or use a [credentials file reader](
|
|
104
|
+
or use a [credentials file reader](https://nebius.github.io/js-sdk/classes/runtime_service_account_credentials_file.CredentialsFileReader.html)
|
|
105
105
|
|
|
106
|
-
Refer to TypeDoc for all the constructor options: [SDK class](
|
|
106
|
+
Refer to TypeDoc for all the constructor options: [SDK class](https://nebius.github.io/js-sdk/classes/sdk.SDK.html) and [Config class](https://nebius.github.io/js-sdk/classes/runtime_cli_config.Config.html).
|
|
107
107
|
|
|
108
108
|
### Test credentials and SDK lifecycle
|
|
109
109
|
|
|
@@ -124,7 +124,7 @@ await sdk.close();
|
|
|
124
124
|
|
|
125
125
|
### Calling services and operations
|
|
126
126
|
|
|
127
|
-
Generated service clients take the `sdk` instance as the first parameter. Many RPCs return an [`Operation`](
|
|
127
|
+
Generated service clients take the `sdk` instance as the first parameter. Many RPCs return an [`Operation`](https://nebius.github.io/js-sdk/classes/runtime_operation.Operation.html) object — use `.result` to access a helper that exposes `.wait()` and `.resourceId()`.
|
|
128
128
|
|
|
129
129
|
```ts
|
|
130
130
|
import { SDK } from './src/sdk';
|
|
@@ -158,11 +158,11 @@ Some methods may include `parentId` in the requests, for certain methods this fi
|
|
|
158
158
|
- Methods `list` and `getByName` with an empty `parentId`
|
|
159
159
|
- All other methods, except `update`, with an empty `metadata.parentId`
|
|
160
160
|
|
|
161
|
-
The `parentId` will only be set if it was preset at the initialization, either from the [CLI `Config`](
|
|
161
|
+
The `parentId` will only be set if it was preset at the initialization, either from the [CLI `Config`](https://nebius.github.io/js-sdk/classes/runtime_cli_config.Config.html) or from the `parentId` attribute from the [SDK](https://nebius.github.io/js-sdk/classes/sdk.SDK.html).
|
|
162
162
|
|
|
163
163
|
### Error handling and request metadata
|
|
164
164
|
|
|
165
|
-
RPC errors are surfaced as normal thrown errors. The runtime [`Request`](
|
|
165
|
+
RPC errors are surfaced as normal thrown errors. The runtime [`Request`](https://nebius.github.io/js-sdk/classes/runtime_request.Request.html) and [`Operation`](https://nebius.github.io/js-sdk/classes/runtime_operation.Operation.html) helpers expose metadata and status information, as well as request and trace IDs.
|
|
166
166
|
|
|
167
167
|
#### Retrieve request id / trace id
|
|
168
168
|
|
|
@@ -178,7 +178,7 @@ console.log({ requestId, traceId });
|
|
|
178
178
|
|
|
179
179
|
#### Token renewal options
|
|
180
180
|
|
|
181
|
-
When using renewable bearers (service accounts or other long-lived credentials), the SDK can perform token renewal on-demand for a specific request and surface renewal errors to that call. In TypeScript you express these hints by passing `authorizationOptions` on the gRPC call options object. See the runtime token docs for general behaviour: [runtime token docs](
|
|
181
|
+
When using renewable bearers (service accounts or other long-lived credentials), the SDK can perform token renewal on-demand for a specific request and surface renewal errors to that call. In TypeScript you express these hints by passing `authorizationOptions` on the gRPC call options object. See the runtime token docs for general behaviour: [runtime token docs](https://nebius.github.io/js-sdk/classes/runtime_token.Token.html) and the authorization options interface: [AuthorizationOptions](https://nebius.github.io/js-sdk/interfaces/runtime_authorization_provider.AuthorizationOptions.html).
|
|
182
182
|
|
|
183
183
|
Preferred TypeScript pattern — pass `authorizationOptions` in the call options:
|
|
184
184
|
|
|
@@ -213,11 +213,11 @@ const listResp = await opService.list({ resourceId: '...' } as any);
|
|
|
213
213
|
// listResp.operations contains OperationWrapper elements; call opService.get(opId) to fetch real Operation
|
|
214
214
|
```
|
|
215
215
|
|
|
216
|
-
See [OperationService](
|
|
216
|
+
See [OperationService](https://nebius.github.io/js-sdk/classes/api_nebius_common_v1.OperationService.html) and the service `getOperationService()` docs (for example: [BucketService](https://nebius.github.io/js-sdk/classes/api_nebius_storage_v1.BucketService.html#getoperationservice)).
|
|
217
217
|
|
|
218
218
|
### Update / reset-mask helpers
|
|
219
219
|
|
|
220
|
-
When performing partial updates, the generated types and helpers follow the usual pattern: construct an update request and provide update masks where required. See the generated service docs (for example [BucketService](
|
|
220
|
+
When performing partial updates, the generated types and helpers follow the usual pattern: construct an update request and provide update masks where required. See the generated service docs (for example [BucketService](https://nebius.github.io/js-sdk/classes/api_nebius_storage_v1.BucketService.html)) for the exact request shapes and helper methods.
|
|
221
221
|
|
|
222
222
|
#### Updating with manually set `X-ResetMask`
|
|
223
223
|
|
|
@@ -237,7 +237,7 @@ const op = await bucketSvc.update(updateReq, undefined as any, md);
|
|
|
237
237
|
await op.wait();
|
|
238
238
|
```
|
|
239
239
|
|
|
240
|
-
See [ensureResetMaskInMetadata](
|
|
240
|
+
See [ensureResetMaskInMetadata](https://nebius.github.io/js-sdk/functions/runtime_resetmask.ensureResetMaskInMetadata.html) and [resetMaskFromMessage](https://nebius.github.io/js-sdk/functions/runtime_resetmask.resetMaskFromMessage.html) for details on how the mask is derived.
|
|
241
241
|
|
|
242
242
|
### Timeouts, retries and long-running operations
|
|
243
243
|
|
|
@@ -303,28 +303,18 @@ Notes:
|
|
|
303
303
|
|
|
304
304
|
### Where to look for types and detailed API
|
|
305
305
|
|
|
306
|
-
- SDK overview and constructor options: [
|
|
307
|
-
- CLI config reader: [
|
|
308
|
-
- Token/bearer implementations: [
|
|
309
|
-
|
|
310
|
-
If you want runnable examples in the repo, I can add a small `examples/` folder with one or two canonical scripts (auth via token, auth via service account) and ensure they typecheck with the project; tell me if you'd like that.
|
|
306
|
+
- SDK overview and constructor options: [SDK class](https://nebius.github.io/js-sdk/classes/sdk.SDK.html).
|
|
307
|
+
- CLI config reader: [Config class](https://nebius.github.io/js-sdk/classes/runtime_cli_config.Config.html).
|
|
308
|
+
- Token/bearer implementations: [Token](https://nebius.github.io/js-sdk/classes/runtime_token.Token.html) and specific classes like [`StaticBearer`](https://nebius.github.io/js-sdk/classes/runtime_token_static.StaticBearer.html), [`EnvBearer`](https://nebius.github.io/js-sdk/classes/runtime_token_static.EnvBearer.html), [`FileBearer`](https://nebius.github.io/js-sdk/classes/runtime_token_file.FileBearer.html), [`ServiceAccountBearer`](https://nebius.github.io/js-sdk/classes/runtime_token_service_account.ServiceAccountBearer.html).
|
|
311
309
|
|
|
312
310
|
## API reference / types
|
|
313
311
|
|
|
314
|
-
Type definitions and the full API reference are generated by TypeDoc and written to `docs/api`.
|
|
315
|
-
|
|
316
|
-
Useful docs (open the MD files in `docs/api` or browse in GitHub):
|
|
317
|
-
|
|
318
|
-
- SDK overview: [docs/api/sdk/README.md](docs/api/sdk/README.md) — includes the `SDK` class docs ([SDK class](docs/api/sdk/classes/SDK.md)).
|
|
319
|
-
- CLI-style config reader: [docs/api/runtime/cli_config/README.md](docs/api/runtime/cli_config/README.md) and the `Config` class ([Config class](docs/api/runtime/cli_config/classes/Config.md)).
|
|
320
|
-
- Token and bearer helpers: [docs/api/runtime/token/README.md](docs/api/runtime/token/README.md) and token classes like [StaticBearer](docs/api/runtime/token/static/classes/StaticBearer.md), [EnvBearer](docs/api/runtime/token/static/classes/EnvBearer.md) and [FileBearer](docs/api/runtime/token/file/classes/FileBearer.md).
|
|
321
|
-
|
|
322
|
-
When editing or consuming the SDK in TypeScript, prefer the generated types in `src/generated/` and the docs in [docs/api](docs/api/).
|
|
312
|
+
Type definitions and the full API reference are generated by TypeDoc and written to `docs/api`. [List of all available services](https://nebius.github.io/js-sdk/documents/SERVICES.html).
|
|
323
313
|
|
|
324
314
|
## Notes & tips
|
|
325
315
|
|
|
326
316
|
- Generated code in `src/api/` is ignored by the linters. Do not edit generated files by hand.
|
|
327
|
-
- If you need type-level documentation,
|
|
317
|
+
- If you need type-level documentation, [see API reference](https://nebius.github.io/js-sdk/modules/api_nebius.html).
|
|
328
318
|
- For CI and automated docs publishing, the project includes `typedoc` config and build scripts under `package.json`.
|
|
329
319
|
|
|
330
320
|
### Contributing
|