Skip to content

Commit

Permalink
chore: bump to 1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
beomjungil committed Jun 15, 2024
1 parent c085ad2 commit b9f9966
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
*.js
generated/
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.14.0
20.14.0
2 changes: 1 addition & 1 deletion docs/docs/api/height-app-api.patchtasksfieldseffect.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Update fields
export type PatchTasksFieldsEffect = {
type: 'fields';
fieldTemplateId: string;
fields: {
field: {
text?: string | null;
date?: string | null;
recursion?: any | null;
Expand Down
4 changes: 2 additions & 2 deletions docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ components:
required:
- type
- fieldTemplateId
- fields
- field
properties:
type:
type: string
Expand All @@ -1575,7 +1575,7 @@ components:
fieldTemplateId:
type: string
format: uuid
fields:
field:
type: object
properties:
text:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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 <[email protected]> (https://github.com/beomjungil)",
Expand Down Expand Up @@ -60,4 +60,4 @@
"dependencies": {
"cross-fetch": "^3.1.5"
}
}
}
13 changes: 8 additions & 5 deletions src/Height.ts
Original file line number Diff line number Diff line change
@@ -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';

/**
Expand Down Expand Up @@ -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',
}
},
});
}

Expand Down Expand Up @@ -100,7 +100,7 @@ export class Height extends Methods {
};
};

public async apiRequest(config: ApiConfig, request: Record<string, unknown> | undefined): Promise<unknown> {
public async apiRequest (config: ApiConfig, request: Record<string, unknown> | undefined): Promise<unknown> {
const { url, body } = this.normalizeArguments(config, request);

return new Promise((resolve, reject) => {
Expand All @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/utils/omit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

const omit = <T>(obj: T, ...keys: Array<keyof T>) => {
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
const ret = {} as {
[K in keyof typeof obj]: (typeof obj)[K]
};
Expand Down

0 comments on commit b9f9966

Please sign in to comment.