Skip to content

Commit

Permalink
fix: set the consistency parameter correctly in OpenFGAClient (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
jimmyjames authored Aug 28, 2024
2 parents 15829c3 + 1370a12 commit 9b56137
Show file tree
Hide file tree
Showing 7 changed files with 298 additions and 253 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module.exports = {
"rules": {
"@typescript-eslint/no-unused-vars": ["warn"],
"@typescript-eslint/no-explicit-any": ["warn"],
"@typescript-eslint/no-require-imports":["error", { allowAsImport: true }],
"indent": [
"error",
2
Expand Down
16 changes: 8 additions & 8 deletions api.ts

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ export class OpenFgaClient extends BaseAPI {
const readRequest: ReadRequest = {
page_size: options.pageSize,
continuation_token: options.continuationToken,
consistency: options.consistency
};
if (body.user || body.object || body.relation) {
readRequest.tuple_key = body;
Expand Down Expand Up @@ -580,7 +581,8 @@ export class OpenFgaClient extends BaseAPI {
},
context: body.context,
contextual_tuples: { tuple_keys: body.contextualTuples || [] },
authorization_model_id: this.getAuthorizationModelId(options)
authorization_model_id: this.getAuthorizationModelId(options),
consistency: options.consistency
}, options);
}

Expand Down Expand Up @@ -641,6 +643,7 @@ export class OpenFgaClient extends BaseAPI {
return this.api.expand(this.getStoreId(options)!, {
authorization_model_id: this.getAuthorizationModelId(options),
tuple_key: body,
consistency: options.consistency
}, options);
}

Expand All @@ -663,6 +666,7 @@ export class OpenFgaClient extends BaseAPI {
type: body.type,
context: body.context,
contextual_tuples: { tuple_keys: body.contextualTuples || [] },
consistency: options.consistency
}, options);
}

Expand Down Expand Up @@ -721,6 +725,7 @@ export class OpenFgaClient extends BaseAPI {
user_filters: body.user_filters,
context: body.context,
contextual_tuples: body.contextualTuples || [],
consistency: options.consistency
}, options);
}

Expand Down
Loading

0 comments on commit 9b56137

Please sign in to comment.