diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index 2370ae17..a706e153 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -1 +1,4 @@ .npmignore +configuration.ts +common.ts +base.ts diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index d2f6975a..585091bc 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,68 +1,16 @@ .codecov.yml -.eslintignore -.eslintrc.js -.fossa.yml .github/CODEOWNERS .github/ISSUE_TEMPLATE/bug_report.yaml .github/ISSUE_TEMPLATE/config.yaml .github/ISSUE_TEMPLATE/feature_request.yaml .gitignore -.gitignore -.madgerc .npmrc -CHANGELOG.md CONTRIBUTING.md LICENSE README.md VERSION.txt api.ts apiModel.ts -base.ts -client.ts -common.ts -configuration.ts -credentials/credentials.ts -credentials/index.ts -credentials/types.ts -docs/opentelemetry.md -errors.ts -example/Makefile -example/README.md -example/example1/example1.mjs -example/example1/package.json -example/opentelemetry/.env.example -example/opentelemetry/.npmrc -example/opentelemetry/README.md -example/opentelemetry/instrumentation.mjs -example/opentelemetry/opentelemetry.mjs -example/opentelemetry/package.json +constants/index.ts git_push.sh index.ts -package.json -telemetry/attributes.ts -telemetry/configuration.ts -telemetry/counters.ts -telemetry/histograms.ts -telemetry/metrics.ts -tests/client.test.ts -tests/headers.test.ts -tests/helpers/default-config.ts -tests/helpers/index.ts -tests/helpers/nocks.ts -tests/index.test.ts -tests/jest.config.js -tests/telemetry/attributes.test.ts -tests/telemetry/configuration.test.ts -tests/telemetry/counters.test.ts -tests/telemetry/histograms.test.ts -tests/telemetry/metrics.test.ts -tests/tsconfig.spec.json -tests/validation.test.ts -tsconfig.json -utils/assert-never.ts -utils/chunk-array.ts -utils/generate-random-id.ts -utils/index.ts -utils/set-header-if-not-set.ts -utils/set-not-enumerable-property.ts -validation.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 47cff816..17efe5f6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -10,7 +10,7 @@ Reading and following these guidelines will help us make the contribution proces * [Getting Started](#getting-started) * [Making Changes](#making-changes) * [Opening Issues](#opening-issues) - * [Submitting Pull Requests](#submitting-pull-requests) [Note: We are not accepting Pull Requests at this time!] + * [Submitting Pull Requests](#submitting-pull-requests) * [Getting in Touch](#getting-in-touch) * [Have a question or problem?](#have-a-question-or-problem) * [Vulnerability Reporting](#vulnerability-reporting) @@ -23,17 +23,23 @@ By participating and contributing to this project, you are expected to uphold ou ### Making Changes -When contributing to a repository, the first step is to open an issue on [sdk-generator](https://github.com/openfga/sdk-generator) to discuss the change you wish to make before making them. +When contributing to a repository, the first step is to open [an issue](https://github.com/openfga/js-sdk/issues) to discuss the change you wish to make before making them. ### Opening Issues Before you submit a new issue please make sure to search all open and closed issues. It is possible your feature request/issue has already been answered. Make sure to also check the [OpenFGA discussions](https://github.com/orgs/openfga/discussions). -That repo includes an issue template that will walk through all the places to check before submitting your issue here. Please follow the instructions there to make sure this is not a duplicate issue and that we have everything we need to research and reproduce this problem. +The repo includes an issue template that will walk through all the places to check before submitting your issue here. Please follow the instructions there to make sure this is not a duplicate issue and that we have everything we need to research and reproduce this problem. + +If you have found a bug or if you have a feature request, please report them in the [repo issues](https://github.com/openfga/js-sdk/issues). Cross-SDK bugs and feature requests can be additionally reported in the [sdk-generator repo](https://github.com/openfga/sdk-generator/issues) issues section, where the individual SDK issue is then linked. + +**Please do not report security vulnerabilities on the public GitHub issue tracker.** ### Submitting Pull Requests -While we accept Pull Requests on this repository, the SDKs are autogenerated so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well. +Feel free to submit a Pull Request against this repository. Please make sure to follow the existing code style and include tests where applicable. + +Some files in this repository are autogenerated. These files have a comment at the top indicating that they are autogenerated and should not be modified directly - the files are usually identified by a header marking them as such, or by their inclusion in [`.openapi-generator/FILES`](./.openapi-generator/FILES). Changes to these files should be made in the [sdk-generator](https://github.com/openfga/sdk-generator) repository in tandem, so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well. ## Getting in touch diff --git a/README.md b/README.md index aa199e45..eea0eddb 100644 --- a/README.md +++ b/README.md @@ -830,13 +830,7 @@ This SDK supports producing metrics that can be consumed as part of an [OpenTele ## Contributing -### Issues - -If you have found a bug or if you have a feature request, please report them on the [sdk-generator repo](https://github.com/openfga/sdk-generator/issues) issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. - -### Pull Requests - -While we accept Pull Requests on this repository, the SDKs are autogenerated so please consider additionally submitting your Pull Requests to the [sdk-generator](https://github.com/openfga/sdk-generator) and linking the two PRs together and to the corresponding issue. This will greatly assist the OpenFGA team in being able to give timely reviews as well as deploying fixes and updates to our other SDKs as well. +See [CONTRIBUTING](./CONTRIBUTING.md) for details. ## Author diff --git a/base.ts b/base.ts index 58d84cb7..ed01083b 100644 --- a/base.ts +++ b/base.ts @@ -1,17 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - -// Some imports not used depending on template conditions import globalAxios, { AxiosInstance } from "axios"; import * as http from "http"; import * as https from "https"; diff --git a/client.ts b/client.ts index c5cdf28f..d6278fa1 100644 --- a/client.ts +++ b/client.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { AxiosResponse, AxiosInstance } from "axios"; import asyncPool = require("tiny-async-pool"); @@ -60,6 +47,7 @@ import { setHeaderIfNotSet, } from "./utils"; import { isWellFormedUlidString } from "./validation"; +import SdkConstants from "./constants"; export type UserClientConfigurationParams = UserConfigurationParams & { storeId?: string; @@ -101,10 +89,10 @@ export class ClientConfiguration extends Configuration { } } -const DEFAULT_MAX_METHOD_PARALLEL_REQS = 10; -const DEFAULT_MAX_BATCH_SIZE = 50; -const CLIENT_METHOD_HEADER = "X-OpenFGA-Client-Method"; -const CLIENT_BULK_REQUEST_ID_HEADER = "X-OpenFGA-Client-Bulk-Request-Id"; +const DEFAULT_MAX_METHOD_PARALLEL_REQS = SdkConstants.ClientMaxMethodParallelRequests; +const DEFAULT_MAX_BATCH_SIZE = SdkConstants.ClientMaxBatchSize; +const CLIENT_METHOD_HEADER = SdkConstants.ClientMethodHeader; +const CLIENT_BULK_REQUEST_ID_HEADER = SdkConstants.ClientBulkRequestIdHeader; export interface ClientRequestOpts { retryParams?: RetryParams; diff --git a/common.ts b/common.ts index 4bdd79e7..f48c28ef 100644 --- a/common.ts +++ b/common.ts @@ -1,19 +1,7 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios"; import { Configuration } from "./configuration"; +import SdkConstants from "./constants"; import type { Credentials } from "./credentials"; import { FgaApiError, @@ -26,19 +14,13 @@ import { } from "./errors"; import { setNotEnumerableProperty } from "./utils"; import { TelemetryAttribute, TelemetryAttributes } from "./telemetry/attributes"; -import { MetricRecorder } from "./telemetry/metrics"; import { TelemetryHistograms } from "./telemetry/histograms"; /** * * @export */ -export const DUMMY_BASE_URL = "https://example.com"; -// Retry-After header validation: minimum 1 second, maximum 30 minutes (1800 seconds) -const MIN_RETRY_DELAY_MS = 1_000; // 1 second -const MAX_RETRY_DELAY_MS = 1_800_000; // 30 minutes -// Exponential backoff cap: maximum 120 seconds (2 minutes) -const MAX_EXPONENTIAL_BACKOFF_MS = 120_000; // 120 seconds +export const DUMMY_BASE_URL = `https://${SdkConstants.SampleBaseDomain}`; /** * @@ -145,16 +127,16 @@ function calculateExponentialBackoffWithJitter(retryAttempt: number, minWaitInMs const minDelayMs = Math.ceil(2 ** retryAttempt * minWaitInMs); const maxDelayMs = Math.ceil(2 ** (retryAttempt + 1) * minWaitInMs); const randomDelayMs = Math.floor(Math.random() * (maxDelayMs - minDelayMs) + minDelayMs); - return Math.min(randomDelayMs, MAX_EXPONENTIAL_BACKOFF_MS); + return Math.min(randomDelayMs, SdkConstants.MaxBackoffTimeInSec * 1000); } /** * Validates if a retry delay is within acceptable bounds * @param delayMs - Delay in milliseconds - * @returns True if delay is between MIN_RETRY_DELAY_MS and MAX_RETRY_DELAY_MS + * @returns True if delay is between {@link SdkConstants.DefaultMinWaitInMs}ms and {@link SdkConstants.RetryHeaderMaxAllowableDurationInSec}s */ function isValidRetryDelay(delayMs: number): boolean { - return delayMs >= MIN_RETRY_DELAY_MS && delayMs <= MAX_RETRY_DELAY_MS; + return delayMs >= SdkConstants.DefaultMinWaitInMs && delayMs <= SdkConstants.RetryHeaderMaxAllowableDurationInSec * 1000; } /** @@ -163,7 +145,13 @@ function isValidRetryDelay(delayMs: number): boolean { * @returns Delay in milliseconds if valid, undefined otherwise */ function parseRetryAfterHeader(headers: Record): number | undefined { - const retryAfterHeader = headers["retry-after"] || headers["Retry-After"]; + // Find the retry-after header regardless of case + const retryAfterHeaderNameLower = SdkConstants.RetryAfterHeaderName.toLowerCase(); + const retryAfterKey = Object.keys(headers).find(key => + key.toLowerCase() === retryAfterHeaderNameLower + ); + + const retryAfterHeader = retryAfterKey ? headers[retryAfterKey] : undefined; if (!retryAfterHeader) { return undefined; @@ -281,7 +269,7 @@ export async function attemptHttpRequest( retryDelayMs = calculateExponentialBackoffWithJitter(iterationCount, config.minWaitInMs); } - await new Promise(r => setTimeout(r, Math.min(retryDelayMs, MAX_RETRY_DELAY_MS))); + await new Promise(r => setTimeout(r, Math.min(retryDelayMs, SdkConstants.RetryHeaderMaxAllowableDurationInSec * 1000))); } } while (iterationCount < config.maxRetry + 1); } @@ -293,8 +281,8 @@ export const createRequestFunction = function (axiosArgs: RequestArgs, axiosInst configuration.isValid(); const retryParams = axiosArgs.options?.retryParams ? axiosArgs.options?.retryParams : configuration.retryParams; - const maxRetry:number = retryParams ? retryParams.maxRetry : 0; - const minWaitInMs:number = retryParams ? retryParams.minWaitInMs : 0; + const maxRetry: number = retryParams?.maxRetry ?? 0; + const minWaitInMs: number = retryParams?.minWaitInMs ?? 0; const start = performance.now(); diff --git a/configuration.ts b/configuration.ts index 537a300f..feb2627d 100644 --- a/configuration.ts +++ b/configuration.ts @@ -1,28 +1,16 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { ApiTokenConfig, AuthCredentialsConfig, ClientCredentialsConfig, CredentialsMethod } from "./credentials/types"; import { FgaValidationError, } from "./errors"; -import { assertParamExists, isWellFormedUlidString, isWellFormedUriString } from "./validation"; +import { assertParamExists, isWellFormedUriString } from "./validation"; import { TelemetryConfig, TelemetryConfiguration } from "./telemetry/configuration"; +import SdkConstants from "./constants"; // default maximum number of retry -const DEFAULT_MAX_RETRY = 3; +const DEFAULT_MAX_RETRY = SdkConstants.DefaultMaxRetry; // default minimum wait period in retry - but will backoff exponentially -const DEFAULT_MIN_WAIT_MS = 100; +const DEFAULT_MIN_WAIT_MS = SdkConstants.DefaultMinWaitInMs; -const DEFAULT_USER_AGENT = "openfga-sdk js/0.9.0"; +const DEFAULT_USER_AGENT = SdkConstants.UserAgent; export interface RetryParams { maxRetry?: number; @@ -45,7 +33,7 @@ export interface UserConfigurationParams { telemetry?: TelemetryConfig; } -export function GetDefaultRetryParams (maxRetry = DEFAULT_MAX_RETRY, minWaitInMs = DEFAULT_MIN_WAIT_MS) { +export function GetDefaultRetryParams (maxRetry: number = DEFAULT_MAX_RETRY, minWaitInMs: number = DEFAULT_MIN_WAIT_MS) { return { maxRetry: maxRetry, minWaitInMs: minWaitInMs, @@ -75,7 +63,7 @@ export class Configuration { * @type {string} * @memberof Configuration */ - private static sdkVersion = "0.9.0"; + private static sdkVersion = SdkConstants.SdkVersion; /** * provide the full api URL (e.g. `https://api.fga.example`) @@ -192,7 +180,7 @@ export class Configuration { ); } - if (this.retryParams?.maxRetry && this.retryParams.maxRetry > 15) { + if (this.retryParams?.maxRetry && this.retryParams.maxRetry > SdkConstants.RetryMaxAllowedNumber) { throw new FgaValidationError("Configuration.retryParams.maxRetry exceeds maximum allowed limit of 15"); } diff --git a/constants/index.ts b/constants/index.ts new file mode 100644 index 00000000..d5b98440 --- /dev/null +++ b/constants/index.ts @@ -0,0 +1,165 @@ +/** + * JavaScript and Node.js SDK for OpenFGA + * + * API version: 1.x + * Website: https://openfga.dev + * Documentation: https://openfga.dev/docs + * Support: https://openfga.dev/community + * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) + * + * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. + */ + + +/** + * Version of the OpenFGA JavaScript SDK. + */ +const SdkVersion = "0.9.0"; + +/** + * User agent used in HTTP requests. + */ +const UserAgent = "openfga-sdk js/0.9.0"; + +/** + * Example API domain for documentation/tests. + */ +const SampleBaseDomain = "fga.example"; + +/** + * API URL used for tests. + */ +const TestApiUrl = `https://api.${SampleBaseDomain}`; + +/** + * API Token Issuer URL used for tests. + */ +const TestIssuerUrl = `https://issuer.${SampleBaseDomain}`; + +/** + * Default API URL. + */ +const DefaultApiUrl = "http://localhost:8080"; + +// Retry configuration + +/** + * Maximum allowed number of retries for HTTP requests. + */ +const RetryMaxAllowedNumber = 15; + +/** + * Default maximum number of retries for HTTP requests. + */ +const DefaultMaxRetry = 3; + +/** + * Default minimum wait time between retries in milliseconds. + */ +const DefaultMinWaitInMs = 100; + +/** + * Maximum backoff time in seconds. + */ +const MaxBackoffTimeInSec = 120; + +/** + * Maximum allowable duration for retry headers in seconds. + */ +const RetryHeaderMaxAllowableDurationInSec = 1800; + +/** + * Standard HTTP header for retry-after. + */ +const RetryAfterHeaderName = "Retry-After"; + +/** + * Rate limit reset header name. + */ +const RateLimitResetHeaderName = "X-RateLimit-Reset"; + +/** + * Alternative rate limit reset header name. + */ +const RateLimitResetAltHeaderName = "X-Rate-Limit-Reset"; + +// Client methods + +/** + * Maximum number of parallel requests for a single method. + */ +const ClientMaxMethodParallelRequests = 10; + +/** + * Maximum batch size for batch requests. + */ +const ClientMaxBatchSize = 50; + +/** + * Header used to identify the client method. + */ +const ClientMethodHeader = "X-OpenFGA-Client-Method"; + +/** + * Header used to identify bulk requests. + */ +const ClientBulkRequestIdHeader = "X-OpenFGA-Client-Bulk-Request-Id"; + +// Connection options + +/** + * Default timeout for HTTP requests in milliseconds. + */ +const DefaultRequestTimeoutInMs = 10000; + +/** + * Default connection timeout in milliseconds. + */ +const DefaultConnectionTimeoutInMs = 10000; + +// Token management + +/** + * Buffer time in seconds before token expiry to consider it expired. + */ +const TokenExpiryThresholdBufferInSec = 300; + +/** + * Jitter time in seconds to add randomness to token expiry checks. + */ +const TokenExpiryJitterInSec = 300; + +// FGA Response Headers + +/** + * Response header name for query duration in milliseconds. + */ +const QueryDurationHeaderName = "fga-query-duration-ms"; + +const SdkConstants = Object.freeze({ + SdkVersion, + UserAgent, + SampleBaseDomain, + TestApiUrl, + TestIssuerUrl, + DefaultApiUrl, + RetryMaxAllowedNumber, + DefaultMaxRetry, + DefaultMinWaitInMs, + MaxBackoffTimeInSec, + RetryHeaderMaxAllowableDurationInSec, + RetryAfterHeaderName, + RateLimitResetHeaderName, + RateLimitResetAltHeaderName, + ClientMaxMethodParallelRequests, + ClientMaxBatchSize, + ClientMethodHeader, + ClientBulkRequestIdHeader, + DefaultRequestTimeoutInMs, + DefaultConnectionTimeoutInMs, + TokenExpiryThresholdBufferInSec, + TokenExpiryJitterInSec, + QueryDurationHeaderName, +}); + +export default SdkConstants; \ No newline at end of file diff --git a/errors.ts b/errors.ts index f947d0fc..76291074 100644 --- a/errors.ts +++ b/errors.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { AxiosError, AxiosHeaderValue, Method } from "axios"; import { ErrorCode, diff --git a/tests/client.test.ts b/tests/client.test.ts index 39c09c22..a8c06fc5 100644 --- a/tests/client.test.ts +++ b/tests/client.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import * as nock from "nock"; import { diff --git a/tests/headers.test.ts b/tests/headers.test.ts index 73c2d6de..cfc3f5e6 100644 --- a/tests/headers.test.ts +++ b/tests/headers.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import * as nock from "nock"; import { OpenFgaClient, UserClientConfigurationParams } from "../index"; import { baseConfig } from "./helpers/default-config"; diff --git a/tests/helpers/default-config.ts b/tests/helpers/default-config.ts index e44bb003..1dd2bebd 100644 --- a/tests/helpers/default-config.ts +++ b/tests/helpers/default-config.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { ClientConfiguration, UserClientConfigurationParams } from "../../client"; import { CredentialsMethod } from "../../credentials"; diff --git a/tests/helpers/index.ts b/tests/helpers/index.ts index 89707c03..3a37f229 100644 --- a/tests/helpers/index.ts +++ b/tests/helpers/index.ts @@ -1,15 +1,2 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - export { getNocks } from "./nocks"; export { baseConfig, defaultConfiguration } from "./default-config"; diff --git a/tests/helpers/nocks.ts b/tests/helpers/nocks.ts index f865c903..bc461236 100644 --- a/tests/helpers/nocks.ts +++ b/tests/helpers/nocks.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import type * as Nock from "nock"; import { diff --git a/tests/index.test.ts b/tests/index.test.ts index 0c4a2676..5be22a46 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import * as nock from "nock"; import { diff --git a/tests/telemetry/attributes.test.ts b/tests/telemetry/attributes.test.ts index 81162071..4a004fe6 100644 --- a/tests/telemetry/attributes.test.ts +++ b/tests/telemetry/attributes.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { TelemetryAttribute, TelemetryAttributes } from "../../telemetry/attributes"; describe("TelemetryAttributes", () => { diff --git a/tests/telemetry/configuration.test.ts b/tests/telemetry/configuration.test.ts index 1b0f7814..ade0081b 100644 --- a/tests/telemetry/configuration.test.ts +++ b/tests/telemetry/configuration.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { TelemetryConfiguration, TelemetryMetricConfig } from "../../telemetry/configuration"; import { TelemetryAttribute } from "../../telemetry/attributes"; import { TelemetryMetric } from "../../telemetry/metrics"; diff --git a/tests/telemetry/counters.test.ts b/tests/telemetry/counters.test.ts index 5fb4453d..64ddb575 100644 --- a/tests/telemetry/counters.test.ts +++ b/tests/telemetry/counters.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { TelemetryCounters } from "../../telemetry/counters"; describe("TelemetryCounters", () => { diff --git a/tests/telemetry/histograms.test.ts b/tests/telemetry/histograms.test.ts index 265ef38f..a62a9a2b 100644 --- a/tests/telemetry/histograms.test.ts +++ b/tests/telemetry/histograms.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { TelemetryHistograms } from "../../telemetry/histograms"; describe("TelemetryHistograms", () => { diff --git a/tests/telemetry/metrics.test.ts b/tests/telemetry/metrics.test.ts index 823c6ff7..7414194c 100644 --- a/tests/telemetry/metrics.test.ts +++ b/tests/telemetry/metrics.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { MetricRecorder } from "../../telemetry/metrics"; import { TelemetryCounters } from "../../telemetry/counters"; import { TelemetryHistograms } from "../../telemetry/histograms"; diff --git a/tests/validation.test.ts b/tests/validation.test.ts index e0d45e3f..96e3ddc2 100644 --- a/tests/validation.test.ts +++ b/tests/validation.test.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { isWellFormedUlidString } from "../validation"; describe("validation.ts", () => { diff --git a/utils/assert-never.ts b/utils/assert-never.ts index 15bcb94e..f7affa08 100644 --- a/utils/assert-never.ts +++ b/utils/assert-never.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - export function assertNever(value: never): never { throw new Error(`Assertion failed. Unacceptable value: '${value}'`); } diff --git a/utils/chunk-array.ts b/utils/chunk-array.ts index 48da58fa..a15a0ca0 100644 --- a/utils/chunk-array.ts +++ b/utils/chunk-array.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - export function chunkArray(inputArray: T[], maxChunkSize: number): T[][] { const arrayOfArrays = []; diff --git a/utils/generate-random-id.ts b/utils/generate-random-id.ts index 681311a2..ba88ec0a 100644 --- a/utils/generate-random-id.ts +++ b/utils/generate-random-id.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { randomUUID, randomBytes } from "crypto"; /** diff --git a/utils/index.ts b/utils/index.ts index aaf4f57c..441a9a1a 100644 --- a/utils/index.ts +++ b/utils/index.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - export * from "./assert-never"; export * from "./chunk-array"; export * from "./generate-random-id"; diff --git a/utils/set-header-if-not-set.ts b/utils/set-header-if-not-set.ts index 29a79ebe..c9b26226 100644 --- a/utils/set-header-if-not-set.ts +++ b/utils/set-header-if-not-set.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - export function setHeaderIfNotSet(headers: Record, key: string, value: string): void { if (!headers[key] && value) { headers[key] = value; diff --git a/utils/set-not-enumerable-property.ts b/utils/set-not-enumerable-property.ts index 3397f0bf..c5976dbb 100644 --- a/utils/set-not-enumerable-property.ts +++ b/utils/set-not-enumerable-property.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - export function setNotEnumerableProperty(entity: object, property: string, value: T) { Object.defineProperty(entity, property, { enumerable: false, diff --git a/validation.ts b/validation.ts index ee4d6ead..33d75b21 100644 --- a/validation.ts +++ b/validation.ts @@ -1,16 +1,3 @@ -/** - * JavaScript and Node.js SDK for OpenFGA - * - * API version: 1.x - * Website: https://openfga.dev - * Documentation: https://openfga.dev/docs - * Support: https://openfga.dev/community - * License: [Apache-2.0](https://github.com/openfga/js-sdk/blob/main/LICENSE) - * - * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT. - */ - - import { FgaRequiredParamError } from "./errors"; /**