Skip to content

Commit 9b56137

Browse files
authored
fix: set the consistency parameter correctly in OpenFGAClient (#143)
2 parents 15829c3 + 1370a12 commit 9b56137

File tree

7 files changed

+298
-253
lines changed

7 files changed

+298
-253
lines changed

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
"rules": {
2020
"@typescript-eslint/no-unused-vars": ["warn"],
2121
"@typescript-eslint/no-explicit-any": ["warn"],
22+
"@typescript-eslint/no-require-imports":["error", { allowAsImport: true }],
2223
"indent": [
2324
"error",
2425
2

api.ts

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

client.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,7 @@ export class OpenFgaClient extends BaseAPI {
417417
const readRequest: ReadRequest = {
418418
page_size: options.pageSize,
419419
continuation_token: options.continuationToken,
420+
consistency: options.consistency
420421
};
421422
if (body.user || body.object || body.relation) {
422423
readRequest.tuple_key = body;
@@ -580,7 +581,8 @@ export class OpenFgaClient extends BaseAPI {
580581
},
581582
context: body.context,
582583
contextual_tuples: { tuple_keys: body.contextualTuples || [] },
583-
authorization_model_id: this.getAuthorizationModelId(options)
584+
authorization_model_id: this.getAuthorizationModelId(options),
585+
consistency: options.consistency
584586
}, options);
585587
}
586588

@@ -641,6 +643,7 @@ export class OpenFgaClient extends BaseAPI {
641643
return this.api.expand(this.getStoreId(options)!, {
642644
authorization_model_id: this.getAuthorizationModelId(options),
643645
tuple_key: body,
646+
consistency: options.consistency
644647
}, options);
645648
}
646649

@@ -663,6 +666,7 @@ export class OpenFgaClient extends BaseAPI {
663666
type: body.type,
664667
context: body.context,
665668
contextual_tuples: { tuple_keys: body.contextualTuples || [] },
669+
consistency: options.consistency
666670
}, options);
667671
}
668672

@@ -721,6 +725,7 @@ export class OpenFgaClient extends BaseAPI {
721725
user_filters: body.user_filters,
722726
context: body.context,
723727
contextual_tuples: body.contextualTuples || [],
728+
consistency: options.consistency
724729
}, options);
725730
}
726731

0 commit comments

Comments
 (0)