diff --git a/README.md b/README.md index b4de6b4a4..f31f89154 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,3 @@ -# Important announcement - -> [!IMPORTANT] -> Please migrate your projects to use [@hey-api/openapi-ts](https://github.com/hey-api/openapi-ts) - -Due to time limitations on my end, this project has been unmaintained for a while now. The `@hey-api/openapi-ts` -project started as a fork with the goal to resolve the most pressing issues. going forward they are planning to -maintain the OpenAPI generator and give it the love it deserves. Please support them with their work and make -sure to migrate your projects: https://heyapi.dev/openapi-ts/migrating.html#openapi-typescript-codegen - -- All open PR's and issues will be archived on the 1st of May 2024 -- All versions of this package will be deprecated in NPM - -👋 Thanks for all the support, downloads and love! Cheers Ferdi. - ---- - # OpenAPI Typescript Codegen [![NPM][npm-image]][npm-url] diff --git a/package-lock.json b/package-lock.json index ebaeda099..02a26f581 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5847,18 +5847,6 @@ "@types/node": "*" } }, - "node_modules/@types/eslint": { - "version": "8.56.7", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.7.tgz", - "integrity": "sha512-SjDvI/x3zsZnOkYZ3lCt9lOZWZLB2jIlNKz+LBgCtDurK0JZcwucxYHn1w2BJkD34dgX9Tjnak0txtq4WTggEA==", - "dev": true, - "optional": true, - "peer": true, - "dependencies": { - "@types/estree": "*", - "@types/json-schema": "*" - } - }, "node_modules/@types/estree": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", diff --git a/package.json b/package.json index 5fd51bd2c..a7da9a629 100644 --- a/package.json +++ b/package.json @@ -1,16 +1,17 @@ { - "name": "openapi-typescript-codegen", - "version": "0.29.0", + "name": "@lamarcke/openapi-typescript-codegen", + "version": "0.29.1", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen", "repository": { "type": "git", - "url": "git+https://github.com/ferdikoomen/openapi-typescript-codegen.git" + "url": "git+https://github.com/Lamarcke/openapi-typescript-codegen.git" }, "bugs": { "url": "https://github.com/ferdikoomen/openapi-typescript-codegen/issues" }, + "module": "CommonJS", "license": "MIT", "keywords": [ "openapi", diff --git a/src/templates/core/CancelablePromise.hbs b/src/templates/core/CancelablePromise.hbs index 3ac435201..be3cf21b2 100644 --- a/src/templates/core/CancelablePromise.hbs +++ b/src/templates/core/CancelablePromise.hbs @@ -21,62 +21,62 @@ export interface OnCancel { } export class CancelablePromise implements Promise { - #isResolved: boolean; - #isRejected: boolean; - #isCancelled: boolean; - readonly #cancelHandlers: (() => void)[]; - readonly #promise: Promise; - #resolve?: (value: T | PromiseLike) => void; - #reject?: (reason?: any) => void; + private _isResolved: boolean; + private _isRejected: boolean; + private _isCancelled: boolean; + readonly cancelHandlers: (() => void)[]; + readonly promise: Promise; + private _resolve?: (value: T | PromiseLike) => void; + private _reject?: (reason?: unknown) => void; constructor( executor: ( resolve: (value: T | PromiseLike) => void, - reject: (reason?: any) => void, + reject: (reason?: unknown) => void, onCancel: OnCancel ) => void ) { - this.#isResolved = false; - this.#isRejected = false; - this.#isCancelled = false; - this.#cancelHandlers = []; - this.#promise = new Promise((resolve, reject) => { - this.#resolve = resolve; - this.#reject = reject; + this._isResolved = false; + this._isRejected = false; + this._isCancelled = false; + this.cancelHandlers = []; + this.promise = new Promise((resolve, reject) => { + this._resolve = resolve; + this._reject = reject; const onResolve = (value: T | PromiseLike): void => { - if (this.#isResolved || this.#isRejected || this.#isCancelled) { + if (this._isResolved || this._isRejected || this._isCancelled) { return; } - this.#isResolved = true; - if (this.#resolve) this.#resolve(value); + this._isResolved = true; + if (this._resolve) this._resolve(value); }; - const onReject = (reason?: any): void => { - if (this.#isResolved || this.#isRejected || this.#isCancelled) { + const onReject = (reason?: unknown): void => { + if (this._isResolved || this._isRejected || this._isCancelled) { return; } - this.#isRejected = true; - if (this.#reject) this.#reject(reason); + this._isRejected = true; + if (this._reject) this._reject(reason); }; const onCancel = (cancelHandler: () => void): void => { - if (this.#isResolved || this.#isRejected || this.#isCancelled) { + if (this._isResolved || this._isRejected || this._isCancelled) { return; } - this.#cancelHandlers.push(cancelHandler); + this.cancelHandlers.push(cancelHandler); }; Object.defineProperty(onCancel, 'isResolved', { - get: (): boolean => this.#isResolved, + get: (): boolean => this._isResolved, }); Object.defineProperty(onCancel, 'isRejected', { - get: (): boolean => this.#isRejected, + get: (): boolean => this._isRejected, }); Object.defineProperty(onCancel, 'isCancelled', { - get: (): boolean => this.#isCancelled, + get: (): boolean => this._isCancelled, }); return executor(onResolve, onReject, onCancel as OnCancel); @@ -89,29 +89,29 @@ export class CancelablePromise implements Promise { public then( onFulfilled?: ((value: T) => TResult1 | PromiseLike) | null, - onRejected?: ((reason: any) => TResult2 | PromiseLike) | null + onRejected?: ((reason: unknown) => TResult2 | PromiseLike) | null ): Promise { - return this.#promise.then(onFulfilled, onRejected); + return this.promise.then(onFulfilled, onRejected); } public catch( - onRejected?: ((reason: any) => TResult | PromiseLike) | null + onRejected?: ((reason: unknown) => TResult | PromiseLike) | null ): Promise { - return this.#promise.catch(onRejected); + return this.promise.catch(onRejected); } public finally(onFinally?: (() => void) | null): Promise { - return this.#promise.finally(onFinally); + return this.promise.finally(onFinally); } public cancel(): void { - if (this.#isResolved || this.#isRejected || this.#isCancelled) { + if (this._isResolved || this._isRejected || this._isCancelled) { return; } - this.#isCancelled = true; - if (this.#cancelHandlers.length) { + this._isCancelled = true; + if (this.cancelHandlers.length) { try { - for (const cancelHandler of this.#cancelHandlers) { + for (const cancelHandler of this.cancelHandlers) { cancelHandler(); } } catch (error) { @@ -119,11 +119,11 @@ export class CancelablePromise implements Promise { return; } } - this.#cancelHandlers.length = 0; - if (this.#reject) this.#reject(new CancelError('Request aborted')); + this.cancelHandlers.length = 0; + if (this._reject) this._reject(new CancelError('Request aborted')); } public get isCancelled(): boolean { - return this.#isCancelled; + return this._isCancelled; } }