@hapiboo/api 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -14
- package/eslint.config.mjs +0 -16
- package/package.dev.json +0 -30
- package/package.public.json +0 -32
- package/src/index.ts +0 -57
- package/tsconfig.base.json +0 -18
- package/tsconfig.dev.json +0 -7
- package/tsconfig.public.json +0 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hapiboo/api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "MK13 Studio Hapiboo - API call services",
|
|
5
5
|
"author": "MK13 Studio",
|
|
6
6
|
"license": "ISC",
|
|
@@ -9,24 +9,23 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
12
15
|
"dependencies": {
|
|
13
|
-
"@hapiboo/core": "^
|
|
16
|
+
"@hapiboo/core": "^3.0.1",
|
|
14
17
|
"axios": "^1.11.0"
|
|
15
18
|
},
|
|
16
19
|
"devDependencies": {
|
|
17
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
18
|
-
"@typescript-eslint/parser": "^8.
|
|
19
|
-
"eslint": "^9.
|
|
20
|
-
"typescript": "5.
|
|
21
|
-
"typescript-eslint": "^8.
|
|
20
|
+
"@typescript-eslint/eslint-plugin": "^8.51.0",
|
|
21
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
22
|
+
"eslint": "^9.39.2",
|
|
23
|
+
"typescript": "^5.9.3",
|
|
24
|
+
"typescript-eslint": "^8.51.0"
|
|
22
25
|
},
|
|
23
26
|
"scripts": {
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"s_build": "tsc --project tsconfig.public.json",
|
|
28
|
-
"s_lint": "eslint 'src/*.ts'",
|
|
29
|
-
"s_check": "bash ../../scripts/publish.sh ./",
|
|
30
|
-
"s_publish": "pnpm s_clean && pnpm i && pnpm s_lint && pnpm s_build && pnpm s_check && pnpm s_dev"
|
|
27
|
+
"publish-check": "bash ../../scripts/publish.sh ./",
|
|
28
|
+
"ci:publish-prepare": "rm -f pnpm-lock.yaml && rm -rf node_modules dist && pnpm install --ignore-workspace --no-frozen-lockfile && eslint 'src/*.ts' && echo \"Linter OK\" && tsc && echo \"Build OK\"",
|
|
29
|
+
"ci:publish": "pnpm ci:publish-prepare && pnpm publish-check"
|
|
31
30
|
}
|
|
32
31
|
}
|
package/eslint.config.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import tseslint from "typescript-eslint";
|
|
2
|
-
import { defineConfig } from "eslint/config";
|
|
3
|
-
|
|
4
|
-
export default defineConfig([
|
|
5
|
-
...tseslint.configs.recommended,
|
|
6
|
-
{
|
|
7
|
-
files: ["**/*.{ts,mts,cts}"],
|
|
8
|
-
rules: {
|
|
9
|
-
"@typescript-eslint/no-namespace": "off",
|
|
10
|
-
indent: ['error', 4],
|
|
11
|
-
'linebreak-style': ['error', 'unix'],
|
|
12
|
-
quotes: ['error', 'single'],
|
|
13
|
-
semi: ['error', 'always'],
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
]);
|
package/package.dev.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hapiboo/api",
|
|
3
|
-
"version": "2.0.1-dev",
|
|
4
|
-
"description": "MK13 Studio Hapiboo - API call services",
|
|
5
|
-
"author": "MK13 Studio",
|
|
6
|
-
"license": "ISC",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"s_public": "cp package.public.json package.json",
|
|
11
|
-
"s_dev": "cp package.dev.json package.json",
|
|
12
|
-
"s_clean": "rm -f pnpm-lock.yaml && rm -rf node_modules dist",
|
|
13
|
-
"s_dependency": "cd .. && cd __core && pnpm s_build",
|
|
14
|
-
"s_build": "tsc --project tsconfig.dev.json",
|
|
15
|
-
"s_lint": "eslint 'src/*.ts'",
|
|
16
|
-
"s_lint_fix": "eslint 'src/*.ts' --fix",
|
|
17
|
-
"s_prepare": "pnpm s_clean && pnpm i && pnpm s_lint && pnpm s_build"
|
|
18
|
-
},
|
|
19
|
-
"dependencies": {
|
|
20
|
-
"@hapiboo/core": "workspace:*",
|
|
21
|
-
"axios": "^1.11.0"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
25
|
-
"@typescript-eslint/parser": "^8.38.0",
|
|
26
|
-
"eslint": "^9.32.0",
|
|
27
|
-
"typescript": "5.8.3",
|
|
28
|
-
"typescript-eslint": "^8.38.0"
|
|
29
|
-
}
|
|
30
|
-
}
|
package/package.public.json
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@hapiboo/api",
|
|
3
|
-
"version": "2.0.0",
|
|
4
|
-
"description": "MK13 Studio Hapiboo - API call services",
|
|
5
|
-
"author": "MK13 Studio",
|
|
6
|
-
"license": "ISC",
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"types": "dist/index.d.ts",
|
|
9
|
-
"publishConfig": {
|
|
10
|
-
"access": "public"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"s_public": "cp package.public.json package.json",
|
|
14
|
-
"s_dev": "cp package.dev.json package.json",
|
|
15
|
-
"s_clean": "rm -f pnpm-lock.yaml && rm -rf node_modules dist",
|
|
16
|
-
"s_build": "tsc --project tsconfig.public.json",
|
|
17
|
-
"s_lint": "eslint 'src/*.ts'",
|
|
18
|
-
"s_check": "bash ../../scripts/publish.sh ./",
|
|
19
|
-
"s_publish": "pnpm s_clean && pnpm i && pnpm s_lint && pnpm s_build && pnpm s_check && pnpm s_dev"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@hapiboo/core": "^2.0.0",
|
|
23
|
-
"axios": "^1.11.0"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@typescript-eslint/eslint-plugin": "^8.38.0",
|
|
27
|
-
"@typescript-eslint/parser": "^8.38.0",
|
|
28
|
-
"eslint": "^9.32.0",
|
|
29
|
-
"typescript": "5.8.3",
|
|
30
|
-
"typescript-eslint": "^8.38.0"
|
|
31
|
-
}
|
|
32
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import axios, { AxiosInstance, AxiosResponse } from 'axios';
|
|
2
|
-
import { promise, ResponseError, IResponsePromise, IResponsePromiseVoid } from '@hapiboo/core';
|
|
3
|
-
|
|
4
|
-
function caller() : AxiosInstance{
|
|
5
|
-
return axios.create();
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export namespace apiProvider {
|
|
9
|
-
export function post<TIn, TOut>(uri: string, headers: Partial<Record<string, string>>, body?: TIn): IResponsePromise<TOut> {
|
|
10
|
-
return promise.createPromise((resolve, reject) => {
|
|
11
|
-
caller().post<TOut, AxiosResponse<TOut>>(uri, body, { headers: headers })
|
|
12
|
-
.then((response: { data: TOut; }) => {
|
|
13
|
-
resolve(response.data);
|
|
14
|
-
}).catch((error: Error) => {
|
|
15
|
-
reject(ResponseError.getErrorResponse(error));
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export function postVoid<TIn>(uri: string, headers: Partial<Record<string, string>>, body?: TIn): IResponsePromiseVoid {
|
|
20
|
-
return promise.createVoidPromise((resolve, reject) => {
|
|
21
|
-
caller().post(uri, body, { headers: headers })
|
|
22
|
-
.then(() => {
|
|
23
|
-
resolve();
|
|
24
|
-
}).catch((error: Error) => {
|
|
25
|
-
reject(ResponseError.getErrorResponse(error));
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
export function get<TOut>(uri: string, headers: Partial<Record<string, string>>): IResponsePromise<TOut> {
|
|
30
|
-
return promise.createPromise((resolve, reject) => {
|
|
31
|
-
caller().get<TOut>(uri, { headers: headers })
|
|
32
|
-
.then((response: { data: TOut; }) => {
|
|
33
|
-
resolve(response.data);
|
|
34
|
-
}).catch((error: Error) => {
|
|
35
|
-
reject(ResponseError.getErrorResponse(error));
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
export function getStream(uri: string, headers: Partial<Record<string, string>>): IResponsePromise<{contentType: string, contentLength: number, content: Buffer}> {
|
|
40
|
-
return promise.createPromise((resolve, reject) => {
|
|
41
|
-
caller().get<Buffer>(uri, { headers: headers, responseType: 'arraybuffer'})
|
|
42
|
-
.then((response) => {
|
|
43
|
-
let ct = response.headers['content-type'];
|
|
44
|
-
if (!ct) {
|
|
45
|
-
ct = response.headers['Content-Type'];
|
|
46
|
-
}
|
|
47
|
-
let cl = response.headers['content-length'];
|
|
48
|
-
if (!cl) {
|
|
49
|
-
cl = response.headers['Content-Length'];
|
|
50
|
-
}
|
|
51
|
-
resolve({ content: response.data, contentType: ct, contentLength: +cl });
|
|
52
|
-
}).catch((error: Error) => {
|
|
53
|
-
reject(ResponseError.getErrorResponse(error));
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
package/tsconfig.base.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["ES2020"],
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"rootDir": "./src",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"moduleResolution": "node",
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"declaration": true,
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*"],
|
|
17
|
-
"exclude": ["node_modules", "dist"]
|
|
18
|
-
}
|
package/tsconfig.dev.json
DELETED