Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@openfga/sdk

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfga/sdk - npm Package Compare versions

Comparing version 0.3.3 to 0.3.4

7

CHANGELOG.md
# Changelog
## v0.3.4
### [0.3.4](https://github.com/openfga/js-sdk/compare/v0.3.3...v0.3.4) (2024-03-15)
- chore: bump deps. resolves [CVE-2024-28849](https://nvd.nist.gov/vuln/detail/CVE-2024-28849) in
[follow-redirects](https://www.npmjs.com/package/follow-redirects)
## v0.3.3

@@ -4,0 +11,0 @@

2

dist/apiModel.d.ts

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -10,3 +10,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -13,0 +13,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -72,4 +72,4 @@ *

*/
checkValidApiConnection(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
checkValidApiConnection() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
if (this.getAuthorizationModelId(options)) {

@@ -98,4 +98,4 @@ yield this.readAuthorizationModel(options);

*/
listStores(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
listStores() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
return this.api.listStores(options.pageSize, options.continuationToken, options);

@@ -113,4 +113,4 @@ });

*/
createStore(body, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
createStore(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
return this.api.createStore(body, options);

@@ -127,4 +127,4 @@ });

*/
getStore(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
getStore() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
return this.api.getStore(options);

@@ -141,4 +141,4 @@ });

*/
deleteStore(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
deleteStore() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
return this.api.deleteStore(options);

@@ -160,4 +160,4 @@ });

*/
readAuthorizationModels(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
readAuthorizationModels() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
return this.api.readAuthorizationModels(options.pageSize, options.continuationToken, options);

@@ -175,4 +175,4 @@ });

*/
writeAuthorizationModel(body, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
writeAuthorizationModel(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
return this.api.writeAuthorizationModel(body, options);

@@ -190,4 +190,4 @@ });

*/
readAuthorizationModel(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
readAuthorizationModel() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
const authorizationModelId = this.getAuthorizationModelId(options);

@@ -208,5 +208,5 @@ if (!authorizationModelId) {

*/
readLatestAuthorizationModel(options = {}) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
readLatestAuthorizationModel() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
var _a;
const { headers = {} } = options;

@@ -235,4 +235,4 @@ (0, utils_1.setHeaderIfNotSet)(headers, CLIENT_METHOD_HEADER, "ReadLatestAuthorizationModel");

*/
readChanges(body, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
readChanges(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
return this.api.readChanges(body === null || body === void 0 ? void 0 : body.type, options.pageSize, options.continuationToken, options);

@@ -252,4 +252,4 @@ });

*/
read(body = {}, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
read() {
return __awaiter(this, arguments, void 0, function* (body = {}, options = {}) {
const readRequest = {

@@ -279,5 +279,5 @@ page_size: options.pageSize,

*/
write(body, options = {}) {
var _a, e_1, _b, _c, _d, e_2, _e, _f;
return __awaiter(this, void 0, void 0, function* () {
write(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
var _a, e_1, _b, _c, _d, e_2, _e, _f;
const { transaction = {}, headers = {} } = options;

@@ -389,4 +389,4 @@ const { maxPerChunk = 1, // 1 has to be the default otherwise the chunks will be sent in transactions

*/
writeTuples(tuples, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
writeTuples(tuples_1) {
return __awaiter(this, arguments, void 0, function* (tuples, options = {}) {
const { headers = {} } = options;

@@ -411,4 +411,4 @@ (0, utils_1.setHeaderIfNotSet)(headers, CLIENT_METHOD_HEADER, "WriteTuples");

*/
deleteTuples(tuples, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
deleteTuples(tuples_1) {
return __awaiter(this, arguments, void 0, function* (tuples, options = {}) {
const { headers = {} } = options;

@@ -432,4 +432,4 @@ (0, utils_1.setHeaderIfNotSet)(headers, CLIENT_METHOD_HEADER, "DeleteTuples");

*/
check(body, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
check(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
return this.api.check({

@@ -458,5 +458,5 @@ tuple_key: {

*/
batchCheck(body, options = {}) {
var _a, e_3, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
batchCheck(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
var _a, e_3, _b, _c;
const { headers = {}, maxParallelRequests = DEFAULT_MAX_METHOD_PARALLEL_REQS } = options;

@@ -510,4 +510,4 @@ (0, utils_1.setHeaderIfNotSet)(headers, CLIENT_METHOD_HEADER, "BatchCheck");

*/
expand(body, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
expand(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
return this.api.expand({

@@ -529,4 +529,4 @@ authorization_model_id: this.getAuthorizationModelId(options),

*/
listObjects(body, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
listObjects(body_1) {
return __awaiter(this, arguments, void 0, function* (body, options = {}) {
return this.api.listObjects({

@@ -552,4 +552,4 @@ authorization_model_id: this.getAuthorizationModelId(options),

*/
listRelations(listRelationsRequest, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
listRelations(listRelationsRequest_1) {
return __awaiter(this, arguments, void 0, function* (listRelationsRequest, options = {}) {
const { user, object, relations, contextualTuples, context } = listRelationsRequest;

@@ -588,4 +588,4 @@ const { headers = {}, maxParallelRequests = DEFAULT_MAX_METHOD_PARALLEL_REQS } = options;

*/
readAssertions(options = {}) {
return __awaiter(this, void 0, void 0, function* () {
readAssertions() {
return __awaiter(this, arguments, void 0, function* (options = {}) {
return this.api.readAssertions(this.getAuthorizationModelId(options), options);

@@ -604,4 +604,4 @@ });

*/
writeAssertions(assertions, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
writeAssertions(assertions_1) {
return __awaiter(this, arguments, void 0, function* (assertions, options = {}) {
return this.api.writeAssertions(this.getAuthorizationModelId(options), {

@@ -608,0 +608,0 @@ assertions: assertions.map(assertion => ({

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -119,4 +119,4 @@ *

function attemptHttpRequest(request, config, axiosInstance) {
var _a;
return __awaiter(this, void 0, void 0, function* () {
var _a;
let iterationCount = 0;

@@ -175,3 +175,3 @@ do {

}
return (axios = axiosInstance) => __awaiter(this, void 0, void 0, function* () {
return (...args_1) => __awaiter(this, [...args_1], void 0, function* (axios = axiosInstance) {
yield (0, exports.setBearerAuthToObject)(axiosArgs.options.headers, credentials);

@@ -178,0 +178,0 @@ const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: configuration.getBasePath() + axiosArgs.url });

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -23,3 +23,3 @@ *

const DEFAULT_MIN_WAIT_MS = 100;
const DEFAULT_USER_AGENT = "openfga-sdk js/0.3.2";
const DEFAULT_USER_AGENT = "openfga-sdk js/0.3.4";
function GetDefaultRetryParams(maxRetry = DEFAULT_MAX_RETRY, minWaitInMs = DEFAULT_MIN_WAIT_MS) {

@@ -129,2 +129,2 @@ return {

*/
Configuration.sdkVersion = "0.3.2";
Configuration.sdkVersion = "0.3.4";

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -94,4 +94,4 @@ *

getAccessTokenHeader() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
var _a;
const accessTokenValue = yield this.getAccessTokenValue();

@@ -115,4 +115,4 @@ switch ((_a = this.authConfig) === null || _a === void 0 ? void 0 : _a.method) {

getAccessTokenValue() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
var _a;
switch ((_a = this.authConfig) === null || _a === void 0 ? void 0 : _a.method) {

@@ -136,4 +136,4 @@ case types_1.CredentialsMethod.None:

refreshAccessToken() {
var _a;
return __awaiter(this, void 0, void 0, function* () {
var _a;
const clientCredentials = (_a = this.authConfig) === null || _a === void 0 ? void 0 : _a.config;

@@ -140,0 +140,0 @@ try {

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -10,3 +10,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -13,0 +13,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

@@ -7,3 +7,3 @@ /**

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -10,0 +10,0 @@ *

@@ -8,3 +8,3 @@ "use strict";

* Documentation: https://openfga.dev/docs
* Support: https://discord.gg/8naAwJfWN6
* Support: https://openfga.dev/community
* License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE)

@@ -11,0 +11,0 @@ *

{
"name": "@openfga/sdk",
"version": "0.3.3",
"version": "0.3.4",
"description": "JavaScript and Node.js SDK for OpenFGA",

@@ -30,11 +30,11 @@ "author": "OpenFGA",

"@types/jest": "^29.5.12",
"@types/node": "^20.11.20",
"@types/node": "^20.11.28",
"@types/tiny-async-pool": "^2.0.3",
"@typescript-eslint/eslint-plugin": "^7.0.2",
"@typescript-eslint/parser": "^7.0.2",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"nock": "^13.5.3",
"nock": "^13.5.4",
"ts-jest": "^29.1.2",
"typescript": "^5.3.3"
"typescript": "^5.4.2"
},

@@ -41,0 +41,0 @@ "files": [

@@ -7,3 +7,3 @@ # JavaScript and Node.js SDK for OpenFGA

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fopenfga%2Fjs-sdk.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fopenfga%2Fjs-sdk?ref=badge_shield)
[![Discord Server](https://img.shields.io/discord/759188666072825867?color=7289da&logo=discord "Discord Server")](https://discord.gg/8naAwJfWN6)
[![Join our community](https://img.shields.io/badge/slack-cncf_%23openfga-40abb8.svg?logo=slack)](https://openfga.dev/community)
[![Twitter](https://img.shields.io/twitter/follow/openfga?color=%23179CF0&logo=twitter&style=flat-square "@openfga on Twitter")](https://twitter.com/openfga)

@@ -64,3 +64,3 @@

- [Twitter](https://twitter.com/openfga)
- [OpenFGA Discord Community](https://discord.gg/8naAwJfWN6)
- [OpenFGA Community](https://openfga.dev/community)
- [Zanzibar Academy](https://zanzibar.academy)

@@ -89,5 +89,5 @@ - [Google's Zanzibar Paper (2019)](https://research.google/pubs/pub48190/)

The documentation below refers to the `OpenFgaClient`, to read the documentation for `OpenFgaApi`, check out the [`v0.2.2` documentation](https://github.com/openfga/js-sdk/tree/v0.2.2#readme).
We strongly recommend you initialize the `OpenFgaClient` only once and then re-use it throughout your app, otherwise you will incur the cost of having to re-initialize multiple times or at every request, the cost of reduced connection pooling and re-use, and would be particularly costly in the client credentials flow, as that flow will be preformed on every request.
> The OpenFgaClient will by default retry API requests up to 15 times on 429 and 5xx errors.
> The `OpenFgaClient` will by default retry API requests up to 15 times on 429 and 5xx errors.

@@ -94,0 +94,0 @@ #### No Credentials

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc