yes-as-a-service-api-client 1.0.1 → 1.1.2
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 +43 -5
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
|
-

|
|
2
|
+

|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
2
8
|
# Yes As A Service API Client
|
|
9
|
+
|
|
3
10
|
A tiny JavaScript/TypeScript client for the Yes As A Service API — fetch random positive affirmations with a single request.
|
|
4
11
|
|
|
5
12
|
### 📦 Installation
|
|
13
|
+
|
|
6
14
|
```console
|
|
7
15
|
npm install yes-as-a-service-api-client
|
|
8
16
|
```
|
|
9
17
|
|
|
10
|
-
###
|
|
18
|
+
### 🐚 Design Philosophy
|
|
19
|
+
|
|
11
20
|
1. Zero configuration
|
|
12
21
|
2. No inputs required
|
|
13
22
|
3. Minimal surface area
|
|
@@ -16,12 +25,13 @@ npm install yes-as-a-service-api-client
|
|
|
16
25
|
6. TypeScript-first
|
|
17
26
|
|
|
18
27
|
### 🔤 Example Usage
|
|
28
|
+
|
|
19
29
|
```javascript
|
|
20
|
-
import { getAYes } from
|
|
30
|
+
import { getAYes } from 'yes-as-a-service-api-client';
|
|
21
31
|
|
|
22
32
|
async function run() {
|
|
23
33
|
const response = await getAYes();
|
|
24
|
-
if (response.code ===
|
|
34
|
+
if (response.code === 'api-ok') {
|
|
25
35
|
console.log(response.payload?.affirmation);
|
|
26
36
|
} else {
|
|
27
37
|
console.error(response.message);
|
|
@@ -49,9 +59,37 @@ run();
|
|
|
49
59
|
}*/
|
|
50
60
|
```
|
|
51
61
|
|
|
52
|
-
###
|
|
62
|
+
### 📗 Test Coverage
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
PASS src/get-a-yes/index.test.ts
|
|
66
|
+
getAYes
|
|
67
|
+
✓ returns api-ok and payload when fetch resolves with ok=true
|
|
68
|
+
✓ returns api-fail when response.ok is false
|
|
69
|
+
✓ returns api-fail when fetch throws
|
|
70
|
+
✓ returns api-fail when json parsing fails
|
|
71
|
+
✓ returns object payload with affirmation on success (payload test)
|
|
72
|
+
✓ returns null payload on fetch error (payload null test)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
----------|---------|----------|---------|---------|-------------------
|
|
77
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
78
|
+
----------|---------|----------|---------|---------|-------------------
|
|
79
|
+
All files | 100 | 100 | 100 | 100 |
|
|
80
|
+
index.ts | 100 | 100 | 100 | 100 |
|
|
81
|
+
----------|---------|----------|---------|---------|-------------------
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 📘 Contributing
|
|
85
|
+
|
|
53
86
|
Contributions, suggestions, and improvements are welcome.<br/>
|
|
54
87
|
Feel free to open issues or pull requests.
|
|
55
88
|
|
|
89
|
+
### 🔒 Security & Privacy
|
|
90
|
+
1. This package is open source and intended to provide reusable utilities for application development. It does not collect, store, transmit, sell, or share user data, and it does not include analytics, tracking, telemetry, cookies, local storage usage, backend services, or project-owned data collection mechanisms.
|
|
91
|
+
2. For more details, including vulnerability reporting guidance and consumer security recommendations, please see the [Security Policy](https://github.com/NPM-Workbench/vowelz/yes-as-a-service-api-client/policy).
|
|
92
|
+
|
|
56
93
|
### ❤️ Support
|
|
94
|
+
|
|
57
95
|
Like this project? Support it with a github star, it would mean a lot to me! Cheers and Happy Coding.
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "yes-as-a-service-api-client",
|
|
3
3
|
"description": "A minimal JavaScript/TypeScript client for the Yes As A Service API — an API that always responds with a positive affirmation.",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.1.2",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsc",
|
|
19
|
-
"prepublishOnly": "npm run build"
|
|
19
|
+
"prepublishOnly": "npm run build",
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"test:watch": "jest --watch",
|
|
22
|
+
"test:coverage": "jest --coverage"
|
|
20
23
|
},
|
|
21
24
|
"keywords": [
|
|
22
25
|
"yes-as-a-service",
|
|
@@ -31,6 +34,10 @@
|
|
|
31
34
|
],
|
|
32
35
|
"license": "MIT",
|
|
33
36
|
"devDependencies": {
|
|
37
|
+
"@types/jest": "^29.5.12",
|
|
38
|
+
"jest": "^29.7.0",
|
|
39
|
+
"ts-jest": "^29.1.2",
|
|
40
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
34
41
|
"typescript": "^5.9.3"
|
|
35
42
|
},
|
|
36
43
|
"repository": {
|