Skip to content

Commit 571b53f

Browse files
authored
release: v0.8.0 (#196)
2 parents edb9edf + 26bbce9 commit 571b53f

File tree

10 files changed

+3605
-39
lines changed

10 files changed

+3605
-39
lines changed

CHANGELOG.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,25 @@
11
# Changelog
22

33

4-
## [Unreleased](https://github.com/openfga/js-sdk/compare/v0.7.0...HEAD)
4+
## [Unreleased](https://github.com/openfga/js-sdk/compare/v0.8.0...HEAD)
55

6-
- fix: error correctly if apiUrl is not provided (#161)
7-
- feat: add support for `start_time` parameter in `ReadChanges` endpoint
8-
- BREAKING: As of this release, the min node version required by the SDK is now v16.15.0
9-
- feat!: add support for server-side `BatchCheck` method.
6+
## v0.8.0
107

11-
BREAKING CHNAGES:
8+
### [0.8.0](https://github.com/openfga/js-sdk/compare/v0.7.0...v0.8.0) (2025-01-14)
129

13-
- The minimum noce version required by this SDK is now v16.15.0
10+
- feat!: add support for server-side `BatchCheck` method. This is a more efficient way to check on multiple tuples than calling the existing client-side `BatchCheck`. Using this method requires an OpenFGA [v1.8.0+](https://github.com/openfga/openfga/releases/tag/v1.8.0) server.
11+
- The existing `BatchCheck` method has been renamed to `clientBatchCheck` and it now bundles the results in a field called `result` instead of `responses`.
12+
- The existing `BatchCheckResponse` has been renamed to `ClientBatchCheckResponse`.
13+
- feat: add support for startTime` parameter in `ReadChanges` endpoint
14+
- feat: support contextual tuples and context in assertions
15+
- feat: support contextual tuples in Expand
16+
- fix: error correctly if apiUrl is not provided - thanks @Waheedsys (#161)
17+
- fix: use provided axios instance in credentials refresh - thanks @Siddhant-K-code (#193)
18+
- fix!: The minimum node version required by this SDK is now v16.15.0
19+
- chore(docs): various cleanup and improvements - thanks @tmsagarofficial (#164), @vil02 (https://github.com/openfga/sdk-generator/pull/424, https://github.com/openfga/sdk-generator/pull/422), @sccalabr (https://github.com/openfga/sdk-generator/pull/433)
20+
21+
BREAKING CHANGES:
22+
- The minimum node version required by this SDK is now v16.15.0
1423
- Usage of the existing `batchCheck` method should now use the `clientBatchCheck` method. The existing `BatchCheckResponse` has been renamed to `ClientBatchCheckResponse` and it now bundles the results in a field called `result` instead of `responses`.
1524

1625
## v0.7.0

api.ts

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

apiModel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,12 @@ export interface ExpandRequest {
613613
* @memberof ExpandRequest
614614
*/
615615
consistency?: ConsistencyPreference;
616+
/**
617+
*
618+
* @type {ContextualTupleKeys}
619+
* @memberof ExpandRequest
620+
*/
621+
contextual_tuples?: ContextualTupleKeys;
616622
}
617623

618624

client.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
ContextualTupleKeys,
2929
CreateStoreRequest,
3030
CreateStoreResponse,
31+
ExpandRequest,
3132
ExpandRequestTupleKey,
3233
ExpandResponse,
3334
GetStoreResponse,
@@ -224,7 +225,9 @@ export interface ClientReadChangesRequest {
224225
startTime?: string;
225226
}
226227

227-
export type ClientExpandRequest = ExpandRequestTupleKey;
228+
export type ClientExpandRequest = ExpandRequestTupleKey & Omit<ExpandRequest, "tuple_key" | "authorization_model_id" | "contextual_tuples" | "consistency"> & {
229+
contextualTuples?: Array<TupleKey>
230+
};
228231
export type ClientReadRequest = ReadRequestTupleKey;
229232
export type ClientListObjectsRequest = Omit<ListObjectsRequest, "authorization_model_id" | "contextual_tuples" | "consistency"> & {
230233
contextualTuples?: Array<TupleKey>
@@ -780,7 +783,11 @@ export class OpenFgaClient extends BaseAPI {
780783
async expand(body: ClientExpandRequest, options: ClientRequestOptsWithConsistency = {}): PromiseResult<ExpandResponse> {
781784
return this.api.expand(this.getStoreId(options)!, {
782785
authorization_model_id: this.getAuthorizationModelId(options),
783-
tuple_key: body,
786+
tuple_key: {
787+
object: body.object,
788+
relation: body.relation,
789+
},
790+
contextual_tuples: { tuple_keys: body.contextualTuples || [] },
784791
consistency: options.consistency
785792
}, options);
786793
}

configuration.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const DEFAULT_MAX_RETRY = 3;
2222
// default minimum wait period in retry - but will backoff exponentially
2323
const DEFAULT_MIN_WAIT_MS = 100;
2424

25-
const DEFAULT_USER_AGENT = "openfga-sdk js/0.7.0";
25+
const DEFAULT_USER_AGENT = "openfga-sdk js/0.8.0";
2626

2727
export interface RetryParams {
2828
maxRetry?: number;
@@ -75,7 +75,7 @@ export class Configuration {
7575
* @type {string}
7676
* @memberof Configuration
7777
*/
78-
private static sdkVersion = "0.7.0";
78+
private static sdkVersion = "0.8.0";
7979

8080
/**
8181
* provide the full api URL (e.g. `https://api.fga.example`)

credentials/credentials.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414
import globalAxios, { AxiosInstance } from "axios";
1515

1616
import { assertParamExists, isWellFormedUriString } from "../validation";
17-
import { FgaApiAuthenticationError, FgaApiError, FgaError, FgaValidationError } from "../errors";
17+
import { FgaApiAuthenticationError, FgaApiError, FgaValidationError } from "../errors";
1818
import { attemptHttpRequest } from "../common";
1919
import { AuthCredentialsConfig, ClientCredentialsConfig, CredentialsMethod } from "./types";
2020
import { TelemetryAttributes } from "../telemetry/attributes";
21-
import { MetricRecorder } from "../telemetry/metrics";
2221
import { TelemetryCounters } from "../telemetry/counters";
2322
import { TelemetryConfiguration } from "../telemetry/configuration";
2423

@@ -28,7 +27,7 @@ export class Credentials {
2827

2928
public static init(configuration: { credentials: AuthCredentialsConfig, telemetry: TelemetryConfiguration, baseOptions?: any }, axios: AxiosInstance = globalAxios): Credentials {
3029
return new Credentials(configuration.credentials, axios, configuration.telemetry, configuration.baseOptions);
31-
}
30+
}
3231

3332
public constructor(private authConfig: AuthCredentialsConfig, private axios: AxiosInstance = globalAxios, private telemetryConfig: TelemetryConfiguration, private baseOptions?: any) {
3433
this.initConfig();

example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Steps
3131
2. In the Example `package.json` change the `@openfga/sdk` dependency from a semver range like below
3232
```json
3333
"dependencies": {
34-
"@openfga/sdk": "^0.7.0"
34+
"@openfga/sdk": "^0.8.0"
3535
}
3636
```
3737
to a `file:` reference like below

example/example1/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"start": "node example1.mjs"
1010
},
1111
"dependencies": {
12-
"@openfga/sdk": "^0.7.0"
12+
"@openfga/sdk": "^0.8.0"
1313
},
1414
"engines": {
1515
"node": ">=16.13.0"

0 commit comments

Comments
 (0)