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

chore(js-sdk): update JS patch #149

Merged
merged 1 commit into from
Jul 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

var queryParams = new Dictionary<string, string>();
@@ -216,10 +217,11 @@
/// List all stores Returns a paginated list of OpenFGA stores.
/// List all stores Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores.
/// </summary>
/// <exception cref="OpenFga.Sdk.Exceptions.ApiException">Thrown when fails to make API call</exception>
+ /// <param name="pageSize"> (optional)</param>
Expand Down
32 changes: 15 additions & 17 deletions config/clients/js/patches/add-missing-first-param.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
diff --git a/api.ts b/api.ts
index 327e5e1..9c46cb9 100755
--- a/api.ts
+++ b/api.ts
@@ -137,10 +137,11 @@ export const OpenFgaApiAxiosParamCreator = function (configuration: Configuratio
--- clients/fga-js-sdk/api.ts 2023-07-11 18:30:07
+++ api.ts 2023-07-11 18:29:04
@@ -133,10 +133,11 @@
/**
* Create a unique OpenFGA store which will be used to store authorization models and relationship tuples.
* @summary Create a store
Expand All @@ -15,9 +13,9 @@ index 327e5e1..9c46cb9 100755

const localVarPath = "/stores"

@@ -317,11 +318,12 @@ export const OpenFgaApiAxiosParamCreator = function (configuration: Configuratio
@@ -313,11 +314,12 @@
/**
* Returns a paginated list of OpenFGA stores.
* Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores.
* @summary List all stores
+ * @param {number} [pageSize]
* @param {string} [continuationToken]
Expand All @@ -29,7 +27,7 @@ index 327e5e1..9c46cb9 100755

const localVarPath = "/stores"

@@ -702,11 +704,12 @@ export const OpenFgaApiFp = function(configuration: Configuration, credentials:
@@ -698,11 +700,12 @@
/**
* Create a unique OpenFGA store which will be used to store authorization models and relationship tuples.
* @summary Create a store
Expand All @@ -44,9 +42,9 @@ index 327e5e1..9c46cb9 100755
return createRequestFunction(localVarAxiosArgs, globalAxios, configuration, credentials);
},
/**
@@ -754,12 +757,13 @@ export const OpenFgaApiFp = function(configuration: Configuration, credentials:
@@ -750,12 +753,13 @@
/**
* Returns a paginated list of OpenFGA stores.
* Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores.
* @summary List all stores
+ * @param {number} [pageSize]
* @param {string} [continuationToken]
Expand All @@ -60,7 +58,7 @@ index 327e5e1..9c46cb9 100755
return createRequestFunction(localVarAxiosArgs, globalAxios, configuration, credentials);
},
/**
@@ -877,11 +881,12 @@ export const OpenFgaApiFactory = function (configuration: Configuration, credent
@@ -873,11 +877,12 @@
/**
* Create a unique OpenFGA store which will be used to store authorization models and relationship tuples.
* @summary Create a store
Expand All @@ -75,9 +73,9 @@ index 327e5e1..9c46cb9 100755
},
/**
* Delete an OpenFGA store. This does not delete the data associated with the store, like tuples or authorization models.
@@ -924,12 +929,13 @@ export const OpenFgaApiFactory = function (configuration: Configuration, credent
@@ -920,12 +925,13 @@
/**
* Returns a paginated list of OpenFGA stores.
* Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores.
* @summary List all stores
+ * @param {number} [pageSize]
* @param {string} [continuationToken]
Expand All @@ -90,8 +88,8 @@ index 327e5e1..9c46cb9 100755
+ return localVarFp.listStores(pageSize, continuationToken, options).then((request) => request(axios));
},
/**
* The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. tuple_key is optional. If tuple_key is not specified, it will return all tuples in the store.2. `tuple_key.object` is mandatory if tuple_key is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the document type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and an optional continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. ### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that the API will not return writers such as `user:anne` even when all writers are readers. This is because only direct relationship are returned for the READ API. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ] } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`).
@@ -1040,12 +1046,13 @@ export class OpenFgaApi extends BaseAPI {
* The Read API will return the tuples for a certain store that match a query filter specified in the body of the request. It is different from the `/stores/{store_id}/expand` API in that it only returns relationship tuples that are stored in the system and satisfy the query. In the body: 1. `tuple_key` is optional. If not specified, it will return all tuples in the store. 2. `tuple_key.object` is mandatory if `tuple_key` is specified. It can be a full object (e.g., `type:object_id`) or type only (e.g., `type:`). 3. `tuple_key.user` is mandatory if tuple_key is specified in the case the `tuple_key.object` is a type only. ## Examples ### Query for all objects in a type definition To query for all objects that `user:bob` has `reader` relationship in the `document` type definition, call read API with body of ```json { \"tuple_key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:\" } } ``` The API will return tuples and a continuation token, something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `user:bob` has a `reader` relationship with 1 document `document:2021-budget`. Note that this API, unlike the List Objects API, does not evaluate the tuples in the store. The continuation token will be empty if there are no more tuples to query.### Query for all stored relationship tuples that have a particular relation and object To query for all users that have `reader` relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\", \"relation\": \"reader\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`). Note that, even if the model said that all `writers` are also `readers`, the API will not return writers such as `user:anne` because it only returns tuples and does not evaluate them. ### Query for all users with all relationships for a particular document To query for all users that have any relationship with `document:2021-budget`, call read API with body of ```json { \"tuple_key\": { \"object\": \"document:2021-budget\" } } ``` The API will return something like ```json { \"tuples\": [ { \"key\": { \"user\": \"user:anne\", \"relation\": \"writer\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-05T13:42:12.356Z\" }, { \"key\": { \"user\": \"user:bob\", \"relation\": \"reader\", \"object\": \"document:2021-budget\" }, \"timestamp\": \"2021-10-06T15:32:11.128Z\" } ], \"continuation_token\": \"eyJwayI6IkxBVEVTVF9OU0NPTkZJR19hdXRoMHN0b3JlIiwic2siOiIxem1qbXF3MWZLZExTcUoyN01MdTdqTjh0cWgifQ==\" } ``` This means that `document:2021-budget` has 1 `reader` (`user:bob`) and 1 `writer` (`user:anne`).
@@ -1036,12 +1042,13 @@
/**
* Create a unique OpenFGA store which will be used to store authorization models and relationship tuples.
* @summary Create a store
Expand All @@ -107,9 +105,9 @@ index 327e5e1..9c46cb9 100755
}

/**
@@ -1097,13 +1104,14 @@ export class OpenFgaApi extends BaseAPI {
@@ -1093,13 +1100,14 @@
/**
* Returns a paginated list of OpenFGA stores.
* Returns a paginated list of OpenFGA stores and a continuation token to get additional stores. The continuation token will be empty if there are no more stores.
* @summary List all stores
+ * @param {number} [pageSize]
* @param {string} [continuationToken]
Expand Down