apihealthz 1.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/README.md +189 -0
- package/dist/commands/add.js +122 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/addApiCheck.js +14 -0
- package/dist/commands/addApiCheck.js.map +1 -0
- package/dist/commands/apiCheck.js +12 -0
- package/dist/commands/apiCheck.js.map +1 -0
- package/dist/commands/auth.js +26 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/delete.js +45 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/list.js +35 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/services/api.js +20 -0
- package/dist/services/api.js.map +1 -0
- package/dist/services/apiHealth.js +21 -0
- package/dist/services/apiHealth.js.map +1 -0
- package/dist/services/apiHealthz.js +48 -0
- package/dist/services/apiHealthz.js.map +1 -0
- package/dist/services/auth.js +102 -0
- package/dist/services/auth.js.map +1 -0
- package/dist/services/timezone.js +29 -0
- package/dist/services/timezone.js.map +1 -0
- package/dist/utils/config.js +27 -0
- package/dist/utils/config.js.map +1 -0
- package/package.json +28 -0
- package/src/commands/add.ts +136 -0
- package/src/commands/auth.ts +28 -0
- package/src/commands/delete.ts +47 -0
- package/src/commands/list.ts +37 -0
- package/src/index.ts +21 -0
- package/src/services/api.ts +15 -0
- package/src/services/apiHealth.ts +25 -0
- package/src/services/auth.ts +121 -0
- package/src/services/timezone.ts +24 -0
- package/src/utils/config.ts +20 -0
- package/tsconfig.json +33 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import os from "os";
|
|
4
|
+
|
|
5
|
+
const CONFIG_DIR = path.join(os.homedir(), ".apihealthz");
|
|
6
|
+
const TOKEN_PATH = path.join(CONFIG_DIR, "token");
|
|
7
|
+
|
|
8
|
+
export function saveToken(token: string) {
|
|
9
|
+
fs.mkdirSync(CONFIG_DIR, { recursive: true });
|
|
10
|
+
fs.writeFileSync(TOKEN_PATH, token, { mode: 0o600 });
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function getToken(): string | null {
|
|
14
|
+
if (!fs.existsSync(TOKEN_PATH)) return null;
|
|
15
|
+
return fs.readFileSync(TOKEN_PATH, "utf-8");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function clearToken() {
|
|
19
|
+
if (fs.existsSync(TOKEN_PATH)) fs.unlinkSync(TOKEN_PATH);
|
|
20
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Language & Environment */
|
|
4
|
+
"target": "ES2020",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"module": "CommonJS",
|
|
7
|
+
"moduleResolution": "Node",
|
|
8
|
+
|
|
9
|
+
/* Output */
|
|
10
|
+
"outDir": "dist",
|
|
11
|
+
"rootDir": "src",
|
|
12
|
+
"declaration": false,
|
|
13
|
+
"sourceMap": true,
|
|
14
|
+
|
|
15
|
+
/* Strictness */
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noImplicitAny": true,
|
|
18
|
+
"strictNullChecks": true,
|
|
19
|
+
"noImplicitReturns": true,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
|
|
22
|
+
/* Interop & Node */
|
|
23
|
+
"esModuleInterop": true,
|
|
24
|
+
"forceConsistentCasingInFileNames": true,
|
|
25
|
+
"resolveJsonModule": true,
|
|
26
|
+
"skipLibCheck": true,
|
|
27
|
+
|
|
28
|
+
/* Developer Experience */
|
|
29
|
+
"pretty": true
|
|
30
|
+
},
|
|
31
|
+
"include": ["src/**/*.ts"],
|
|
32
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
33
|
+
}
|