@apiverve/wordladder 1.1.13 → 1.2.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 +24 -15
- package/index.d.ts +29 -10
- package/index.js +4 -10
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -63,7 +63,8 @@ var query = {
|
|
|
63
63
|
start: "cold",
|
|
64
64
|
end: "warm",
|
|
65
65
|
difficulty: "medium",
|
|
66
|
-
count: 1
|
|
66
|
+
count: 1,
|
|
67
|
+
image: false
|
|
67
68
|
};
|
|
68
69
|
|
|
69
70
|
api.execute(query, function (error, data) {
|
|
@@ -86,7 +87,8 @@ var query = {
|
|
|
86
87
|
start: "cold",
|
|
87
88
|
end: "warm",
|
|
88
89
|
difficulty: "medium",
|
|
89
|
-
count: 1
|
|
90
|
+
count: 1,
|
|
91
|
+
image: false
|
|
90
92
|
};
|
|
91
93
|
|
|
92
94
|
api.execute(query)
|
|
@@ -110,7 +112,8 @@ async function makeRequest() {
|
|
|
110
112
|
start: "cold",
|
|
111
113
|
end: "warm",
|
|
112
114
|
difficulty: "medium",
|
|
113
|
-
count: 1
|
|
115
|
+
count: 1,
|
|
116
|
+
image: false
|
|
114
117
|
};
|
|
115
118
|
|
|
116
119
|
try {
|
|
@@ -133,25 +136,31 @@ async function makeRequest() {
|
|
|
133
136
|
"data": {
|
|
134
137
|
"puzzles": [
|
|
135
138
|
{
|
|
136
|
-
"startWord": "
|
|
137
|
-
"endWord": "
|
|
138
|
-
"steps":
|
|
139
|
+
"startWord": "ANIL",
|
|
140
|
+
"endWord": "CUED",
|
|
141
|
+
"steps": 5,
|
|
139
142
|
"solution": [
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
143
|
+
"ANIL",
|
|
144
|
+
"ARIL",
|
|
145
|
+
"ARID",
|
|
146
|
+
"IRID",
|
|
147
|
+
"IRED",
|
|
148
|
+
"CRED",
|
|
149
|
+
"CUED"
|
|
146
150
|
],
|
|
147
151
|
"solvable": true,
|
|
148
|
-
"difficulty": "medium"
|
|
149
|
-
"hint": "(a) A pustule. [Obs.] (b) An annoying, worthless person. Sha"
|
|
152
|
+
"difficulty": "medium"
|
|
150
153
|
}
|
|
151
154
|
],
|
|
152
155
|
"count": 1,
|
|
153
156
|
"difficulty": "medium",
|
|
154
|
-
"html": "<html><head><title>Word Ladder</title><style>body {font-family: Arial, sans-serif; padding: 20px; max-width: 600px; margin: 0 auto;}h1 {text-align: center; color: #4CAF50;}.puzzle {background: #f5f5f5; padding: 25px; margin: 20px 0; border-radius: 10px;}.words {display: flex; justify-content: space-between; align-items: center; margin: 20px 0;}.word {font-size: 28px; font-weight: bold; letter-spacing: 3px; padding: 15px 25px; border-radius: 10px;}.start {background: #4CAF50; color: white;}.end {background: #2196F3; color: white;}.arrow {font-size: 30px; color: #999;}.steps {text-align: center; font-size: 14px; color: #666; margin-bottom: 15px;}.ladder {display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 20px 0;}.rung {width: 150px; height: 40px; border: 2px dashed #ccc; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 18px; letter-spacing: 5px;}.hint {font-size: 13px; color: #888; font-style: italic; margin-top: 10px;}</style></head><body><h1>Word Ladder</h1><p style='text-align:center;'>Change one letter at a time to get from the first word to the last</p><div class='puzzle'><div class='steps'>Puzzle #1 -
|
|
157
|
+
"html": "<html><head><title>Word Ladder</title><style>body {font-family: Arial, sans-serif; padding: 20px; max-width: 600px; margin: 0 auto;}h1 {text-align: center; color: #4CAF50;}.puzzle {background: #f5f5f5; padding: 25px; margin: 20px 0; border-radius: 10px;}.words {display: flex; justify-content: space-between; align-items: center; margin: 20px 0;}.word {font-size: 28px; font-weight: bold; letter-spacing: 3px; padding: 15px 25px; border-radius: 10px;}.start {background: #4CAF50; color: white;}.end {background: #2196F3; color: white;}.arrow {font-size: 30px; color: #999;}.steps {text-align: center; font-size: 14px; color: #666; margin-bottom: 15px;}.ladder {display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 20px 0;}.rung {width: 150px; height: 40px; border: 2px dashed #ccc; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 18px; letter-spacing: 5px;}.hint {font-size: 13px; color: #888; font-style: italic; margin-top: 10px;}</style></head><body><h1>Word Ladder</h1><p style='text-align:center;'>Change one letter at a time to get from the first word to the last</p><div class='puzzle'><div class='steps'>Puzzle #1 - 5 steps</div><div class='words'><span class='word start'>ANIL</span><span class='arrow'>→</span><span class='word end'>CUED</span></div><div class='ladder'><div class='rung'>_ _ _ _</div><div class='rung'>_ _ _ _</div><div class='rung'>_ _ _ _</div><div class='rung'>_ _ _ _</div><div class='rung'>_ _ _ _</div></div></div></body></html>",
|
|
158
|
+
"image": {
|
|
159
|
+
"imageName": "6f0f9e5e-ce0d-4570-a706-8fc5ccbfc948_wordladder.png",
|
|
160
|
+
"format": ".png",
|
|
161
|
+
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/wordladder/6f0f9e5e-ce0d-4570-a706-8fc5ccbfc948_wordladder.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766010731&Signature=FQwH%2FqXC0eYHgHqGKfBoEETrcXALoIpkf2z7HCkmYcFu2IgL2uMbCBi22tEsrlY3yOkksRuZ56C2685lLi98CWvgCF1J9UrYaAWjFtLesnHZ0i%2B0SWYIy5wZLWnVq4UrJDLZVrvSe8lh21mQJrduVY8QqV%2FI0sViUlnlndLMFUfhEQedKYAGRtmXjJlpl1YA9A9%2BtJoqRvMm4YStfJyLJmExPQKnPiRoP6EB6%2B8%2F1WUq5vH3%2BWglijVroxaJ%2BJy6kgQ8qTuVX9%2FzFi8R0DDHZtd0IpcTL8EBvNvHnjRPS4lZB%2Bm3k9GCxqGCnsj8pssu6ymtzGNEqA%2BBqAthODekWw%3D%3D",
|
|
162
|
+
"expires": 1766010731681
|
|
163
|
+
}
|
|
155
164
|
}
|
|
156
165
|
}
|
|
157
166
|
```
|
package/index.d.ts
CHANGED
|
@@ -4,29 +4,48 @@ declare module '@apiverve/wordladder' {
|
|
|
4
4
|
secure?: boolean;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Describes fields the current plan does not unlock. Locked fields arrive as null
|
|
9
|
+
* in `data`; `locked_fields` names them, using dot paths for nested fields.
|
|
10
|
+
* Absent when the plan unlocks everything.
|
|
11
|
+
*/
|
|
12
|
+
export interface PremiumInfo {
|
|
13
|
+
message: string;
|
|
14
|
+
upgrade_url: string;
|
|
15
|
+
locked_fields: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
7
18
|
export interface wordladderResponse {
|
|
8
19
|
status: string;
|
|
9
20
|
error: string | null;
|
|
10
21
|
data: WordLadderGeneratorData;
|
|
11
22
|
code?: number;
|
|
23
|
+
premium?: PremiumInfo;
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
|
|
15
27
|
interface WordLadderGeneratorData {
|
|
16
28
|
puzzles: Puzzle[];
|
|
17
|
-
count: number;
|
|
18
|
-
difficulty: string;
|
|
19
|
-
html: string;
|
|
29
|
+
count: number | null;
|
|
30
|
+
difficulty: null | string;
|
|
31
|
+
html: null | string;
|
|
32
|
+
image: Image;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Image {
|
|
36
|
+
imageName: null | string;
|
|
37
|
+
format: null | string;
|
|
38
|
+
downloadURL: null | string;
|
|
39
|
+
expires: number | null;
|
|
20
40
|
}
|
|
21
41
|
|
|
22
42
|
interface Puzzle {
|
|
23
|
-
startWord: string;
|
|
24
|
-
endWord: string;
|
|
25
|
-
steps: number;
|
|
26
|
-
solution: string[];
|
|
27
|
-
solvable: boolean;
|
|
28
|
-
difficulty: string;
|
|
29
|
-
hint: string;
|
|
43
|
+
startWord: null | string;
|
|
44
|
+
endWord: null | string;
|
|
45
|
+
steps: number | null;
|
|
46
|
+
solution: (null | string)[];
|
|
47
|
+
solvable: boolean | null;
|
|
48
|
+
difficulty: null | string;
|
|
30
49
|
}
|
|
31
50
|
|
|
32
51
|
export default class wordladderWrapper {
|
package/index.js
CHANGED
|
@@ -13,16 +13,10 @@ class wordladderWrapper {
|
|
|
13
13
|
throw new Error('API key must be provided as a non-empty string. Get your API key at: https://apiverve.com');
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
// Validate API key format (GUID or alphanumeric
|
|
17
|
-
const apiKeyPattern = /^[a-zA-Z0-
|
|
16
|
+
// Validate API key format (GUID, prefixed keys like apv_xxx, or alphanumeric)
|
|
17
|
+
const apiKeyPattern = /^[a-zA-Z0-9_-]+$/;
|
|
18
18
|
if (!apiKeyPattern.test(api_key)) {
|
|
19
|
-
throw new Error('Invalid API key format. API key must be alphanumeric and may contain hyphens. Get your API key at: https://apiverve.com');
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Check minimum length (GUIDs are typically 36 chars with hyphens, or 32 without)
|
|
23
|
-
const trimmedKey = api_key.replace(/-/g, '');
|
|
24
|
-
if (trimmedKey.length < 32) {
|
|
25
|
-
throw new Error('Invalid API key. API key appears to be too short. Get your API key at: https://apiverve.com');
|
|
19
|
+
throw new Error('Invalid API key format. API key must be alphanumeric and may contain hyphens and underscores. Get your API key at: https://apiverve.com');
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
if (typeof secure !== 'boolean') {
|
|
@@ -36,7 +30,7 @@ class wordladderWrapper {
|
|
|
36
30
|
this.baseURL = 'https://api.apiverve.com/v1/wordladder';
|
|
37
31
|
|
|
38
32
|
// Validation rules for parameters (generated from schema)
|
|
39
|
-
this.validationRules = {"start":{"type":"string","required":false,"minLength":3,"maxLength":6},"end":{"type":"string","required":false,"minLength":3,"maxLength":6},"difficulty":{"type":"string","required":false,"default":"medium"},"count":{"type":"integer","required":false,"min":1,"max":5,"default":1}};
|
|
33
|
+
this.validationRules = {"start":{"type":"string","required":false,"minLength":3,"maxLength":6},"end":{"type":"string","required":false,"minLength":3,"maxLength":6},"difficulty":{"type":"string","required":false,"default":"medium"},"count":{"type":"integer","required":false,"min":1,"max":5,"default":1},"image":{"type":"boolean","required":false,"default":false}};
|
|
40
34
|
}
|
|
41
35
|
|
|
42
36
|
/**
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apiverve/wordladder",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Word Ladder Generator creates puzzles where players transform one word into another by changing one letter at a time, with each step forming a valid word.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"sideEffects": false,
|
|
8
8
|
"engines": {
|
|
9
|
-
"node": ">=
|
|
9
|
+
"node": ">=18.0.0"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"directory": "npm"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
|
-
""
|
|
26
|
+
"word ladder", "word chain", "doublets", "word puzzle", "vocabulary game"
|
|
27
27
|
],
|
|
28
28
|
"author": {
|
|
29
29
|
"name": "APIVerve",
|
|
@@ -41,8 +41,7 @@
|
|
|
41
41
|
"dotenv": "^16.4.7"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"axios": "1.13.2"
|
|
44
|
+
"axios": "1.13.2",
|
|
45
|
+
"form-data": "^4.0.1"
|
|
47
46
|
}
|
|
48
47
|
}
|