Skip to content

Commit

Permalink
release(js-sdk): v0.8.0 (#467)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhamzeh authored Jan 14, 2025
2 parents e9ff58a + 33664f9 commit 1b2739d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ indent_style = tab
indent_style = space
indent_size = 4

[*.{js,ts}]
[*.{js,ts,mjs}]
indent_style = space
indent_size = 2

Expand Down
26 changes: 17 additions & 9 deletions config/clients/js/CHANGELOG.md.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@

## [Unreleased](https://github.com/openfga/js-sdk/compare/v{{packageVersion}}...HEAD)

- fix: error correctly if apiUrl is not provided (#161)
- fix: use provided axios instance in credentials refresh (#193)
- feat: add support for `start_time` parameter in `ReadChanges` endpoint
- BREAKING: As of this release, the min node version required by the SDK is now v16.15.0
- feat!: add support for server-side `BatchCheck` method.

BREAKING CHNAGES:

- The minimum noce version required by this SDK is now v16.15.0
## v0.8.0

### [0.8.0](https://github.com/openfga/js-sdk/compare/v0.7.0...v0.8.0) (2025-01-14)

- 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.
- The existing `BatchCheck` method has been renamed to `clientBatchCheck` and it now bundles the results in a field called `result` instead of `responses`.
- The existing `BatchCheckResponse` has been renamed to `ClientBatchCheckResponse`.
- feat: add support for startTime` parameter in `ReadChanges` endpoint
- feat: support contextual tuples and context in assertions
- feat: support contextual tuples in Expand
- fix: error correctly if apiUrl is not provided - thanks @Waheedsys (#161)
- fix: use provided axios instance in credentials refresh - thanks @Siddhant-K-code (#193)
- fix!: The minimum node version required by this SDK is now v16.15.0
- 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)

BREAKING CHANGES:
- The minimum node version required by this SDK is now v16.15.0
- 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`.

## v0.7.0
Expand Down
2 changes: 1 addition & 1 deletion config/clients/js/config.overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"sdkId": "js",
"gitRepoId": "js-sdk",
"packageName": "@openfga/sdk",
"packageVersion": "0.7.0",
"packageVersion": "0.8.0",
"packageDescription": "JavaScript and Node.js SDK for OpenFGA",
"packageDetailedDescription": "This is an autogenerated JavaScript SDK for OpenFGA. It provides a wrapper around the [OpenFGA API definition](https://openfga.dev/api), and includes TS typings.",
"npmRegistry": "https://registry.npmjs.org/",
Expand Down
11 changes: 9 additions & 2 deletions config/clients/js/template/client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
ContextualTupleKeys,
CreateStoreRequest,
CreateStoreResponse,
ExpandRequest,
ExpandRequestTupleKey,
ExpandResponse,
GetStoreResponse,
Expand Down Expand Up @@ -213,7 +214,9 @@ export interface ClientReadChangesRequest {
startTime?: string;
}

export type ClientExpandRequest = ExpandRequestTupleKey;
export type ClientExpandRequest = ExpandRequestTupleKey & Omit<ExpandRequest, "tuple_key" | "authorization_model_id" | "contextual_tuples" | "consistency"> & {
contextualTuples?: Array<TupleKey>
};
export type ClientReadRequest = ReadRequestTupleKey;
export type ClientListObjectsRequest = Omit<ListObjectsRequest, "authorization_model_id" | "contextual_tuples" | "consistency"> & {
contextualTuples?: Array<TupleKey>
Expand Down Expand Up @@ -769,7 +772,11 @@ export class {{appShortName}}Client extends BaseAPI {
async expand(body: ClientExpandRequest, options: ClientRequestOptsWithConsistency = {}): PromiseResult<ExpandResponse> {
return this.api.expand(this.getStoreId(options)!, {
authorization_model_id: this.getAuthorizationModelId(options),
tuple_key: body,
tuple_key: {
object: body.object,
relation: body.relation,
},
contextual_tuples: { tuple_keys: body.contextualTuples || [] },
consistency: options.consistency
}, options);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
import globalAxios, { AxiosInstance } from "axios";

import { assertParamExists, isWellFormedUriString } from "../validation";
import { FgaApiAuthenticationError, FgaApiError, FgaError, FgaValidationError } from "../errors";
import { FgaApiAuthenticationError, FgaApiError, FgaValidationError } from "../errors";
import { attemptHttpRequest } from "../common";
import { AuthCredentialsConfig, ClientCredentialsConfig, CredentialsMethod } from "./types";
import { TelemetryAttributes } from "../telemetry/attributes";
import { MetricRecorder } from "../telemetry/metrics";
import { TelemetryCounters } from "../telemetry/counters";
import { TelemetryConfiguration } from "../telemetry/configuration";

Expand Down Expand Up @@ -169,7 +168,7 @@ export class Credentials {

attributes = TelemetryAttributes.fromResponse({
response,
attributes,
attributes,
});

attributes = TelemetryAttributes.prepare(attributes, this.telemetryConfig.metrics?.counterCredentialsRequest?.attributes);
Expand Down

0 comments on commit 1b2739d

Please sign in to comment.