diff --git a/.eslintignore b/.eslintignore index ab7762f..3fbb4e6 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ dist *.js +generated/ diff --git a/.nvmrc b/.nvmrc index e6db45a..48b14e6 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.14.0 +20.14.0 diff --git a/docs/docs/api/height-app-api.patchtasksfieldseffect.md b/docs/docs/api/height-app-api.patchtasksfieldseffect.md index 25fc60c..56cefa7 100644 --- a/docs/docs/api/height-app-api.patchtasksfieldseffect.md +++ b/docs/docs/api/height-app-api.patchtasksfieldseffect.md @@ -18,7 +18,7 @@ Update fields export type PatchTasksFieldsEffect = { type: 'fields'; fieldTemplateId: string; - fields: { + field: { text?: string | null; date?: string | null; recursion?: any | null; diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 2d21a63..c21ced2 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -1566,7 +1566,7 @@ components: required: - type - fieldTemplateId - - fields + - field properties: type: type: string @@ -1575,7 +1575,7 @@ components: fieldTemplateId: type: string format: uuid - fields: + field: type: object properties: text: diff --git a/package.json b/package.json index 0792111..0e3e4d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "height-app-api", - "version": "1.0.6", + "version": "1.0.7", "description": "Unofficial TypeScript Wrapper for Height App API", "license": "MIT", "author": "Beomjun Gil (https://github.com/beomjungil)", @@ -60,4 +60,4 @@ "dependencies": { "cross-fetch": "^3.1.5" } -} +} \ No newline at end of file diff --git a/src/Height.ts b/src/Height.ts index 809022e..bccf833 100644 --- a/src/Height.ts +++ b/src/Height.ts @@ -1,6 +1,6 @@ import 'cross-fetch/polyfill'; import { type HeightConfig } from './HeightConfig'; -import { type ApiConfig, Methods } from './Methods'; +import { Methods, type ApiConfig } from './Methods'; import omit from './utils/omit'; /** @@ -28,16 +28,16 @@ export class Height extends Methods { /** * @param config - Configuration for Height API Wrapper */ - constructor(config: HeightConfig) { + constructor (config: HeightConfig) { super(); this.config = config; - this.api = (path, init) => fetch('https://api.height.app' + path, { + this.api = async (path, init) => fetch('https://api.height.app' + path, { ...init, headers: { ...(init.headers ?? {}), Authorization: `api-key ${this.config.secretKey}`, 'Content-Type': 'application/json', - } + }, }); } @@ -100,7 +100,7 @@ export class Height extends Methods { }; }; - public async apiRequest(config: ApiConfig, request: Record | undefined): Promise { + public async apiRequest (config: ApiConfig, request: Record | undefined): Promise { const { url, body } = this.normalizeArguments(config, request); return new Promise((resolve, reject) => { @@ -112,10 +112,13 @@ export class Height extends Methods { : undefined, }) .then((response) => { + // eslint-disable-next-line @typescript-eslint/no-floating-promises response.json().then(resolve); }) .catch((error) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access if (error.response != null) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access reject(error.response.data); } reject(error); diff --git a/src/utils/omit.ts b/src/utils/omit.ts index 8125fdf..e833fa9 100644 --- a/src/utils/omit.ts +++ b/src/utils/omit.ts @@ -1,5 +1,6 @@ const omit = (obj: T, ...keys: Array) => { + // eslint-disable-next-line @typescript-eslint/consistent-type-assertions const ret = {} as { [K in keyof typeof obj]: (typeof obj)[K] };