@apiverve/wordscramble 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.
Files changed (4) hide show
  1. package/README.md +28 -24
  2. package/index.d.ts +26 -7
  3. package/index.js +4 -10
  4. package/package.json +5 -6
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
  difficulty: "medium",
64
- count: 5
64
+ count: 5,
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
  difficulty: "medium",
85
- count: 5
86
+ count: 5,
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
  difficulty: "medium",
107
- count: 5
109
+ count: 5,
110
+ image: false
108
111
  };
109
112
 
110
113
  try {
@@ -127,39 +130,40 @@ async function makeRequest() {
127
130
  "data": {
128
131
  "puzzles": [
129
132
  {
130
- "scrambled": "AFYLER",
131
- "answer": "FLAYER",
132
- "letterCount": 6,
133
- "hint": "One who strips off the skin."
133
+ "scrambled": "ISIEMM",
134
+ "answer": "IMMIES",
135
+ "letterCount": 6
134
136
  },
135
137
  {
136
- "scrambled": "PUHIRRC",
137
- "answer": "CHIRRUP",
138
- "letterCount": 7,
139
- "hint": "To quicken or animate by chirping; to cherup. To chirp. Tennyson. The criket chirrups on the hearth..."
138
+ "scrambled": "DRIGIANN",
139
+ "answer": "DRAINING",
140
+ "letterCount": 8
140
141
  },
141
142
  {
142
- "scrambled": "PAINTACO",
143
- "answer": "PACATION",
144
- "letterCount": 8,
145
- "hint": "The act of pacifying; a peacemaking. Coleridge."
143
+ "scrambled": "RDAKCE",
144
+ "answer": "ARCKED",
145
+ "letterCount": 6
146
146
  },
147
147
  {
148
- "scrambled": "OMADTSI",
149
- "answer": "MASTOID",
150
- "letterCount": 7,
151
- "hint": "(a) Resembling the nipple or the breast; -- applied specifically to a process of the temporal bone b..."
148
+ "scrambled": "ERTHASDB",
149
+ "answer": "BREADTHS",
150
+ "letterCount": 8
152
151
  },
153
152
  {
154
- "scrambled": "CRVELAA",
155
- "answer": "ACERVAL",
156
- "letterCount": 7,
157
- "hint": "Pertaining to a heap. [Obs.]"
153
+ "scrambled": "SISSNASA",
154
+ "answer": "ASSASSIN",
155
+ "letterCount": 8
158
156
  }
159
157
  ],
160
158
  "count": 5,
161
159
  "difficulty": "medium",
162
- "html": "<html><head><title>Word Scramble Puzzle</title><style>body {font-family: Arial, sans-serif; padding: 20px; max-width: 600px; margin: 0 auto;}h1 {text-align: center; color: #333;}.puzzle {background: #f5f5f5; padding: 20px; margin: 15px 0; border-radius: 10px;}.scrambled {font-size: 28px; font-weight: bold; letter-spacing: 5px; color: #2196F3; text-align: center;}.hint {font-size: 14px; color: #666; margin-top: 10px; font-style: italic;}.answer-line {margin-top: 15px; border-bottom: 2px solid #333; height: 30px;}.number {font-size: 14px; color: #999;}</style></head><body><h1>Word Scramble</h1><div class='puzzle'><div class='number'>#1 (6 letters)</div><div class='scrambled'>AFYLER</div><div class='hint'>Hint: One who strips off the skin.</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#2 (7 letters)</div><div class='scrambled'>PUHIRRC</div><div class='hint'>Hint: To quicken or animate by chirping; to cherup. To chirp. Tennyson. The criket chirrups on the hearth...</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#3 (8 letters)</div><div class='scrambled'>PAINTACO</div><div class='hint'>Hint: The act of pacifying; a peacemaking. Coleridge.</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#4 (7 letters)</div><div class='scrambled'>OMADTSI</div><div class='hint'>Hint: (a) Resembling the nipple or the breast; -- applied specifically to a process of the temporal bone b...</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#5 (7 letters)</div><div class='scrambled'>CRVELAA</div><div class='hint'>Hint: Pertaining to a heap. [Obs.]</div><div class='answer-line'></div></div></body></html>"
160
+ "html": "<html><head><title>Word Scramble Puzzle</title><style>body {font-family: Arial, sans-serif; padding: 20px; max-width: 600px; margin: 0 auto;}h1 {text-align: center; color: #333;}.puzzle {background: #f5f5f5; padding: 20px; margin: 15px 0; border-radius: 10px;}.scrambled {font-size: 28px; font-weight: bold; letter-spacing: 5px; color: #2196F3; text-align: center;}.hint {font-size: 14px; color: #666; margin-top: 10px; font-style: italic;}.answer-line {margin-top: 15px; border-bottom: 2px solid #333; height: 30px;}.number {font-size: 14px; color: #999;}</style></head><body><h1>Word Scramble</h1><div class='puzzle'><div class='number'>#1 (6 letters)</div><div class='scrambled'>ISIEMM</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#2 (8 letters)</div><div class='scrambled'>DRIGIANN</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#3 (6 letters)</div><div class='scrambled'>RDAKCE</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#4 (8 letters)</div><div class='scrambled'>ERTHASDB</div><div class='answer-line'></div></div><div class='puzzle'><div class='number'>#5 (8 letters)</div><div class='scrambled'>SISSNASA</div><div class='answer-line'></div></div></body></html>",
161
+ "image": {
162
+ "imageName": "d1ae484c-e879-4a0e-95b0-bfa872fa758a_wordscramble.png",
163
+ "format": ".png",
164
+ "downloadURL": "https://storage.googleapis.com/apiverve/APIData/wordscramble/d1ae484c-e879-4a0e-95b0-bfa872fa758a_wordscramble.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766010755&Signature=A9uZl5RTt%2Bk0WWM4onUMA5OyLA4xXdvR2iar2gjYoNWpdlLgYreoRvdOSYdbKpXOUENwtFphQIS6AU5iOKeAD6zC47jFAgFPPR%2BiVJjdluhg%2B37xJXMzSaU3uaFRkO4YWu2zAgSRxPNgtMM3ahbGlU5H5Nv6GGuLBihmIPcw6IVhJXG1LBzt4Vat7FEnfU4GuwJhEcpYINhkuIPTdN7yy%2FjSeBq7ZAgvwJuzDI13Ng5mFcE4uB1qB5B9AiL%2BApnyqoAJljXJbbgzHCtwwg%2FCtTlzMa0C4Biy1ka4f%2Bjf%2Bs8c07khRku4b6MNvuMiRVhjw4tRb3D7Hui%2Bx%2FWyaoB6Pg%3D%3D",
165
+ "expires": 1766010755245
166
+ }
163
167
  }
164
168
  }
165
169
  ```
package/index.d.ts CHANGED
@@ -4,26 +4,45 @@ declare module '@apiverve/wordscramble' {
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 wordscrambleResponse {
8
19
  status: string;
9
20
  error: string | null;
10
21
  data: WordScrambleGeneratorData;
11
22
  code?: number;
23
+ premium?: PremiumInfo;
12
24
  }
13
25
 
14
26
 
15
27
  interface WordScrambleGeneratorData {
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
- scrambled: string;
24
- answer: string;
25
- letterCount: number;
26
- hint: string;
43
+ scrambled: null | string;
44
+ answer: null | string;
45
+ letterCount: number | null;
27
46
  }
28
47
 
29
48
  export default class wordscrambleWrapper {
package/index.js CHANGED
@@ -13,16 +13,10 @@ class wordscrambleWrapper {
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 with hyphens)
17
- const apiKeyPattern = /^[a-zA-Z0-9-]+$/;
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 wordscrambleWrapper {
36
30
  this.baseURL = 'https://api.apiverve.com/v1/wordscramble';
37
31
 
38
32
  // Validation rules for parameters (generated from schema)
39
- this.validationRules = {"difficulty":{"type":"string","required":false,"default":"medium"},"count":{"type":"integer","required":false,"min":1,"max":20,"default":5}};
33
+ this.validationRules = {"difficulty":{"type":"string","required":false,"default":"medium"},"count":{"type":"integer","required":false,"min":1,"max":20,"default":5},"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/wordscramble",
3
- "version": "1.1.13",
3
+ "version": "1.2.0",
4
4
  "description": "Word Scramble Generator creates puzzles where players unscramble letters to form words, with optional hints from dictionary definitions.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "sideEffects": false,
8
8
  "engines": {
9
- "node": ">=14.0.0"
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 scramble", "anagram", "word puzzle", "unscramble", "jumble"
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
- "node-fetch": "^3.3.2",
45
- "promise": "^8.3.0",
46
- "axios": "1.13.2"
44
+ "axios": "1.13.2",
45
+ "form-data": "^4.0.1"
47
46
  }
48
47
  }