Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release(js-sdk): v0.3.0 #250

Merged
merged 4 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
OPENFGA_DOCKER_TAG = v1.4.0-rc1
OPEN_API_URL = https://raw.githubusercontent.com/openfga/api/main/docs/openapiv2/apidocs.swagger.json
OPENAPI_GENERATOR_CLI_DOCKER_TAG = v6.4.0
NODE_DOCKER_TAG = 18-alpine
NODE_DOCKER_TAG = 20-alpine
GO_DOCKER_TAG = 1
DOTNET_DOCKER_TAG = 6.0
GOLINT_DOCKER_TAG = v1.54-alpine
Expand Down Expand Up @@ -169,8 +169,7 @@ build-client: build-openapi
.PHONY: build-openapi
build-openapi: init get-openapi-doc
cat "${DOCS_CACHE_DIR}/openfga.openapiv2.raw.json" | \
docker run --rm -i stedolan/jq \
'(.. | .tags? | select(.)) |= ["OpenFga"] | (.tags? | select(.)) |= [{"name":"OpenFga"}] | del(.definitions.ReadTuplesParams, .definitions.ReadTuplesResponse, .paths."/stores/{store_id}/read-tuples", .definitions.StreamedListObjectsRequest, .definitions.StreamedListObjectsResponse, .paths."/stores/{store_id}/streamed-list-objects")' > \
jq '(.. | .tags? | select(.)) |= ["OpenFga"] | (.tags? | select(.)) |= [{"name":"OpenFga"}] | del(.definitions.ReadTuplesParams, .definitions.ReadTuplesResponse, .paths."/stores/{store_id}/read-tuples", .definitions.StreamedListObjectsRequest, .definitions.StreamedListObjectsResponse, .paths."/stores/{store_id}/streamed-list-objects")' > \
${DOCS_CACHE_DIR}/openfga.openapiv2.json
sed -i -e 's/v1.//g' ${DOCS_CACHE_DIR}/openfga.openapiv2.json

Expand Down
6 changes: 4 additions & 2 deletions config/clients/js/CHANGELOG.md.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

## v0.3.0

### [0.3.0](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/compare/v0.2.10...v0.3.0) (2023-11-01)
### [0.3.0](https://{{gitHost}}/{{gitUserId}}/{{gitRepoId}}/compare/v0.2.10...v0.3.0) (2023-12-11)

- feat!: support for conditions
- feat: support for conditions
- chore: use latest API interfaces
- chore: dependency updates

## v0.2.10

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.2.10",
"packageVersion": "0.3.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
2 changes: 1 addition & 1 deletion config/clients/js/template/.github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: 2
updates:
- package-ecosystem: "gomod"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
Expand Down
12 changes: 6 additions & 6 deletions config/clients/js/template/.github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
fetch-depth: 0

- name: Set up node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
Expand All @@ -46,9 +46,9 @@ jobs:
fetch-depth: 0

- name: Set up node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '18'
node-version: '20'
cache: 'npm'

- name: Install dependencies
Expand Down Expand Up @@ -77,9 +77,9 @@ jobs:
fetch-depth: 0

- name: Set up node
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: '18'
node-version: '20'
registry-url: 'https://registry.npmjs.org'
scope: '@openfga'
always-auth: false
Expand All @@ -105,7 +105,7 @@ jobs:
with:
fetch-depth: 0

- uses: Roang-zero1/github-create-release-action@5cf058ddffa6fa04e5cda07c98570c757dc4a0e1 # v3.0.1
- uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803 # v3.0.1
with:
version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+
env:
Expand Down
16 changes: 8 additions & 8 deletions config/clients/js/template/client.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import {
ReadRequestTupleKey,
ReadResponse,
TupleKey,
TupleKeyWithoutCondition,
WriteAuthorizationModelRequest,
WriteAuthorizationModelResponse,
WriteRequest,
WriteRequestTupleKey,
} from "./apiModel";
import { BaseAPI } from "./base";
import { CallResult, PromiseResult } from "./common";
Expand Down Expand Up @@ -95,8 +95,8 @@ export interface BatchCheckRequestOpts {
}

export interface ClientWriteRequest {
writes?: WriteRequestTupleKey[];
deletes?: WriteRequestTupleKey[];
writes?: TupleKey[];
deletes?: TupleKeyWithoutCondition[];
}

export enum ClientWriteStatus {
Expand All @@ -105,7 +105,7 @@ export enum ClientWriteStatus {
}

export interface ClientWriteSingleResponse {
tuple_key: WriteRequestTupleKey;
tuple_key: TupleKey;
status: ClientWriteStatus;
err?: Error;
}
Expand Down Expand Up @@ -430,7 +430,7 @@ export class {{appShortName}}Client extends BaseAPI {

/**
* WriteTuples - Utility method to write tuples, wraps Write
* @param {WriteRequestTupleKey[]} tuples
* @param {TupleKey[]} tuples
* @param {ClientRequestOptsWithAuthZModelId & ClientWriteRequestOpts} [options]
* @param {string} [options.authorizationModelId] - Overrides the authorization model id in the configuration
* @param {object} [options.transaction]
Expand All @@ -442,15 +442,15 @@ export class {{appShortName}}Client extends BaseAPI {
* @param {number} [options.retryParams.maxRetry] - Override the max number of retries on each API request
* @param {number} [options.retryParams.minWaitInMs] - Override the minimum wait before a retry is initiated
*/
async writeTuples(tuples: WriteRequestTupleKey[], options: ClientRequestOptsWithAuthZModelId & ClientWriteRequestOpts = {}): Promise<ClientWriteResponse> {
async writeTuples(tuples: TupleKey[], options: ClientRequestOptsWithAuthZModelId & ClientWriteRequestOpts = {}): Promise<ClientWriteResponse> {
const { headers = {} } = options;
setHeaderIfNotSet(headers, CLIENT_METHOD_HEADER, "WriteTuples");
return this.write({ writes: tuples }, { ...options, headers });
}

/**
* DeleteTuples - Utility method to delete tuples, wraps Write
* @param {WriteRequestTupleKey[]} tuples
* @param {TupleKeyWithoutCondition[]} tuples
* @param {ClientRequestOptsWithAuthZModelId & ClientWriteRequestOpts} [options]
* @param {string} [options.authorizationModelId] - Overrides the authorization model id in the configuration
* @param {object} [options.transaction]
Expand All @@ -462,7 +462,7 @@ export class {{appShortName}}Client extends BaseAPI {
* @param {number} [options.retryParams.maxRetry] - Override the max number of retries on each API request
* @param {number} [options.retryParams.minWaitInMs] - Override the minimum wait before a retry is initiated
*/
async deleteTuples(tuples: WriteRequestTupleKey[], options: ClientRequestOptsWithAuthZModelId & ClientWriteRequestOpts = {}): Promise<ClientWriteResponse> {
async deleteTuples(tuples: TupleKeyWithoutCondition[], options: ClientRequestOptsWithAuthZModelId & ClientWriteRequestOpts = {}): Promise<ClientWriteResponse> {
const { headers = {} } = options;
setHeaderIfNotSet(headers, CLIENT_METHOD_HEADER, "DeleteTuples");
return this.write({ deletes: tuples }, { ...options, headers });
Expand Down
Loading
Loading