@apiverve/acrostic 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 +13 -4
- package/index.d.ts +29 -9
- package/index.js +4 -10
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -61,7 +61,8 @@ Using the API is simple. All you have to do is make a request. The API will retu
|
|
|
61
61
|
```javascript
|
|
62
62
|
var query = {
|
|
63
63
|
word: "HAPPY",
|
|
64
|
-
theme: "random"
|
|
64
|
+
theme: "random",
|
|
65
|
+
image: false
|
|
65
66
|
};
|
|
66
67
|
|
|
67
68
|
api.execute(query, function (error, data) {
|
|
@@ -82,7 +83,8 @@ You can also use promises to make requests. The API returns a promise that you c
|
|
|
82
83
|
```javascript
|
|
83
84
|
var query = {
|
|
84
85
|
word: "HAPPY",
|
|
85
|
-
theme: "random"
|
|
86
|
+
theme: "random",
|
|
87
|
+
image: false
|
|
86
88
|
};
|
|
87
89
|
|
|
88
90
|
api.execute(query)
|
|
@@ -104,7 +106,8 @@ You can also use async/await to make requests. The API returns a promise that yo
|
|
|
104
106
|
async function makeRequest() {
|
|
105
107
|
var query = {
|
|
106
108
|
word: "HAPPY",
|
|
107
|
-
theme: "random"
|
|
109
|
+
theme: "random",
|
|
110
|
+
image: false
|
|
108
111
|
};
|
|
109
112
|
|
|
110
113
|
try {
|
|
@@ -165,7 +168,13 @@ async function makeRequest() {
|
|
|
165
168
|
}
|
|
166
169
|
],
|
|
167
170
|
"lineCount": 5,
|
|
168
|
-
"html": "<html><head><title>Acrostic Puzzle</title><style>body {font-family: Arial, sans-serif; padding: 20px; max-width: 700px; margin: 0 auto;}h1 {text-align: center; color: #FF5722;}.intro {text-align: center; color: #666; margin-bottom: 30px;}.puzzle {margin: 20px 0;}.line {display: flex; align-items: center; margin: 10px 0; padding: 10px; background: #f5f5f5; border-radius: 5px;}.number {width: 30px; font-weight: bold; color: #FF5722;}.first-letter {width: 40px; height: 40px; background: #FF5722; color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; border-radius: 5px; margin-right: 10px;}.blanks {display: flex; gap: 3px; margin-right: 15px;}.blank {width: 25px; height: 30px; border-bottom: 2px solid #333;}.clue {flex: 1; font-size: 14px; color: #666; font-style: italic;}.keyword {text-align: center; margin-top: 30px; padding: 20px; background: #FFF3E0; border-radius: 10px;}.keyword-letters {display: flex; justify-content: center; gap: 10px;}.keyword-letter {width: 40px; height: 40px; background: #FF5722; color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; border-radius: 5px;}</style></head><body><h1>Acrostic Puzzle</h1><div class='intro'>Solve the clues. The first letters spell a word!</div><div class='puzzle'><div class='line'><span class='number'>1.</span><span class='first-letter'>H</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Favored by hap, luck, or fortune; lucky; fortunate; successful; prosperous; s...</span></div><div class='line'><span class='number'>2.</span><span class='first-letter'>A</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>Causing amazement; very wonderful; as, amazing grace. -- A*maz'ing*ly, adv.</span></div><div class='line'><span class='number'>3.</span><span class='first-letter'>P</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Possessing or enjoying peace; not disturbed by war, tumult, agitation, anxiet...</span></div><div class='line'><span class='number'>4.</span><span class='first-letter'>P</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Possessing or enjoying peace; not disturbed by war, tumult, agitation, anxiet...</span></div><div class='line'><span class='number'>5.</span><span class='first-letter'>Y</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Not yet mature or aged; young. 'Two youthful knights.' Dryden. Also used fig...</span></div></div><div class='keyword'><p>Hidden word:</p><div class='keyword-letters'><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div></div></div></body></html>"
|
|
171
|
+
"html": "<html><head><title>Acrostic Puzzle</title><style>body {font-family: Arial, sans-serif; padding: 20px; max-width: 700px; margin: 0 auto;}h1 {text-align: center; color: #FF5722;}.intro {text-align: center; color: #666; margin-bottom: 30px;}.puzzle {margin: 20px 0;}.line {display: flex; align-items: center; margin: 10px 0; padding: 10px; background: #f5f5f5; border-radius: 5px;}.number {width: 30px; font-weight: bold; color: #FF5722;}.first-letter {width: 40px; height: 40px; background: #FF5722; color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; border-radius: 5px; margin-right: 10px;}.blanks {display: flex; gap: 3px; margin-right: 15px;}.blank {width: 25px; height: 30px; border-bottom: 2px solid #333;}.clue {flex: 1; font-size: 14px; color: #666; font-style: italic;}.keyword {text-align: center; margin-top: 30px; padding: 20px; background: #FFF3E0; border-radius: 10px;}.keyword-letters {display: flex; justify-content: center; gap: 10px;}.keyword-letter {width: 40px; height: 40px; background: #FF5722; color: white; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; border-radius: 5px;}</style></head><body><h1>Acrostic Puzzle</h1><div class='intro'>Solve the clues. The first letters spell a word!</div><div class='puzzle'><div class='line'><span class='number'>1.</span><span class='first-letter'>H</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Favored by hap, luck, or fortune; lucky; fortunate; successful; prosperous; s...</span></div><div class='line'><span class='number'>2.</span><span class='first-letter'>A</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>Causing amazement; very wonderful; as, amazing grace. -- A*maz'ing*ly, adv.</span></div><div class='line'><span class='number'>3.</span><span class='first-letter'>P</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Possessing or enjoying peace; not disturbed by war, tumult, agitation, anxiet...</span></div><div class='line'><span class='number'>4.</span><span class='first-letter'>P</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Possessing or enjoying peace; not disturbed by war, tumult, agitation, anxiet...</span></div><div class='line'><span class='number'>5.</span><span class='first-letter'>Y</span><span class='blanks'><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span><span class='blank'></span></span><span class='clue'>1. Not yet mature or aged; young. 'Two youthful knights.' Dryden. Also used fig...</span></div></div><div class='keyword'><p>Hidden word:</p><div class='keyword-letters'><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div><div class='keyword-letter'>?</div></div></div></body></html>",
|
|
172
|
+
"image": {
|
|
173
|
+
"imageName": "8b67d4ec-c262-4f7b-9cf1-b8c2766e8c54_acrostic.png",
|
|
174
|
+
"format": ".png",
|
|
175
|
+
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/acrostic/8b67d4ec-c262-4f7b-9cf1-b8c2766e8c54_acrostic.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766009969&Signature=IBbnpk61J5uW7bsfoqRwceF7weeBO%2Bq63BKH7LZpXLhZJk1vYISzRXy%2BPeZnH0t4h%2FvK%2BIJCv84THbV5ym9KkdLUXJK3wYkh8XoyZz%2FyFsBNJ6YCtFLkb0F3AULXyOGEcJ3F3mz4f2oS9P6Wtx4bX8NKVs3B316pY0aJzKo%2Fm5Lnv81i9y%2BRA7EMc9f7M8N9Nin08T%2F4K3W3LxO%2FJUcwocs7UTAORbhCSTqbSn2eIhJLKAN%2B4gSvDghzigwHT9THBVAD1VHgmkfxPNKMqFcarnah7Lfh78RcZM5Zfubl50YgBLVwwwQ%2Bp0Sxbjgeb0osdEkHwAfXbKP2bmA9%2B3TrLA%3D%3D",
|
|
176
|
+
"expires": 1766009969599
|
|
177
|
+
}
|
|
169
178
|
}
|
|
170
179
|
}
|
|
171
180
|
```
|
package/index.d.ts
CHANGED
|
@@ -4,28 +4,48 @@ declare module '@apiverve/acrostic' {
|
|
|
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 acrosticResponse {
|
|
8
19
|
status: string;
|
|
9
20
|
error: string | null;
|
|
10
21
|
data: AcrosticPuzzleGeneratorData;
|
|
11
22
|
code?: number;
|
|
23
|
+
premium?: PremiumInfo;
|
|
12
24
|
}
|
|
13
25
|
|
|
14
26
|
|
|
15
27
|
interface AcrosticPuzzleGeneratorData {
|
|
16
|
-
keyword: string;
|
|
17
|
-
theme: string;
|
|
28
|
+
keyword: null | string;
|
|
29
|
+
theme: null | string;
|
|
18
30
|
lines: Line[];
|
|
19
|
-
lineCount: number;
|
|
20
|
-
html: string;
|
|
31
|
+
lineCount: number | null;
|
|
32
|
+
html: null | string;
|
|
33
|
+
image: Image;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface Image {
|
|
37
|
+
imageName: null | string;
|
|
38
|
+
format: null | string;
|
|
39
|
+
downloadURL: null | string;
|
|
40
|
+
expires: number | null;
|
|
21
41
|
}
|
|
22
42
|
|
|
23
43
|
interface Line {
|
|
24
|
-
position: number;
|
|
25
|
-
letter: string;
|
|
26
|
-
answer: string;
|
|
27
|
-
letterCount: number;
|
|
28
|
-
clue: string;
|
|
44
|
+
position: number | null;
|
|
45
|
+
letter: null | string;
|
|
46
|
+
answer: null | string;
|
|
47
|
+
letterCount: number | null;
|
|
48
|
+
clue: null | string;
|
|
29
49
|
}
|
|
30
50
|
|
|
31
51
|
export default class acrosticWrapper {
|
package/index.js
CHANGED
|
@@ -13,16 +13,10 @@ class acrosticWrapper {
|
|
|
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 acrosticWrapper {
|
|
|
36
30
|
this.baseURL = 'https://api.apiverve.com/v1/acrostic';
|
|
37
31
|
|
|
38
32
|
// Validation rules for parameters (generated from schema)
|
|
39
|
-
this.validationRules = {"word":{"type":"string","required":true},"theme":{"type":"string","required":false,"default":"random"}};
|
|
33
|
+
this.validationRules = {"word":{"type":"string","required":true},"theme":{"type":"string","required":false,"default":"random"},"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/acrostic",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Acrostic Puzzle Generator creates puzzles where the first letters of answer words spell out a hidden keyword.",
|
|
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",
|
|
@@ -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
|
}
|