@apiverve/recipe 1.1.12 → 1.1.13

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 CHANGED
@@ -1,12 +1,13 @@
1
- # Recipes API
1
+ # Recipe Generator API
2
2
 
3
- Recipes is a simple tool for getting recipe information. It returns information on various recipes.
3
+ Recipe Generator is an AI-powered tool for generating detailed recipes. It returns complete recipes with ingredients, instructions, prep time, cook time, and servings.
4
4
 
5
5
  ![Build Status](https://img.shields.io/badge/build-passing-green)
6
6
  ![Code Climate](https://img.shields.io/badge/maintainability-B-purple)
7
7
  ![Prod Ready](https://img.shields.io/badge/production-ready-blue)
8
+ [![npm version](https://img.shields.io/npm/v/@apiverve/recipe.svg)](https://www.npmjs.com/package/@apiverve/recipe)
8
9
 
9
- This is a Javascript Wrapper for the [Recipes API](https://apiverve.com/marketplace/recipe)
10
+ This is a Javascript Wrapper for the [Recipe Generator API](https://apiverve.com/marketplace/recipe?utm_source=npm&utm_medium=readme)
10
11
 
11
12
  ---
12
13
 
@@ -26,16 +27,16 @@ yarn add @apiverve/recipe
26
27
 
27
28
  ## Configuration
28
29
 
29
- Before using the Recipes API client, you have to setup your account and obtain your API Key.
30
- You can get it by signing up at [https://apiverve.com](https://apiverve.com)
30
+ Before using the Recipe Generator API client, you have to setup your account and obtain your API Key.
31
+ You can get it by signing up at [https://apiverve.com](https://apiverve.com?utm_source=npm&utm_medium=readme)
31
32
 
32
33
  ---
33
34
 
34
35
  ## Quick Start
35
36
 
36
- [Get started with the Quick Start Guide](https://docs.apiverve.com/quickstart)
37
+ [Get started with the Quick Start Guide](https://docs.apiverve.com/quickstart?utm_source=npm&utm_medium=readme)
37
38
 
38
- The Recipes API documentation is found here: [https://docs.apiverve.com/ref/recipe](https://docs.apiverve.com/ref/recipe).
39
+ The Recipe Generator API documentation is found here: [https://docs.apiverve.com/ref/recipe](https://docs.apiverve.com/ref/recipe?utm_source=npm&utm_medium=readme).
39
40
  You can find parameters, example responses, and status codes documented here.
40
41
 
41
42
  ### Setup
@@ -59,7 +60,7 @@ Using the API is simple. All you have to do is make a request. The API will retu
59
60
 
60
61
  ```javascript
61
62
  var query = {
62
- name: "cake"
63
+ name: "chicken fajitas"
63
64
  };
64
65
 
65
66
  api.execute(query, function (error, data) {
@@ -79,7 +80,7 @@ You can also use promises to make requests. The API returns a promise that you c
79
80
 
80
81
  ```javascript
81
82
  var query = {
82
- name: "cake"
83
+ name: "chicken fajitas"
83
84
  };
84
85
 
85
86
  api.execute(query)
@@ -100,7 +101,7 @@ You can also use async/await to make requests. The API returns a promise that yo
100
101
  ```javascript
101
102
  async function makeRequest() {
102
103
  var query = {
103
- name: "cake"
104
+ name: "chicken fajitas"
104
105
  };
105
106
 
106
107
  try {
@@ -121,33 +122,24 @@ async function makeRequest() {
121
122
  "status": "ok",
122
123
  "error": null,
123
124
  "data": {
124
- "count": 1,
125
- "recipes": [
126
- {
127
- "instructions": "Heat the oil in a large, non-stick frying pan or wok and stir-fry the chicken and peppers for 2 mins. Sprinkle over the spices and cook for 30 secs more, stirring. Tip the tomatoes into the pan and stir in the chipotle paste. Simmer for 5 mins or until the sauce is thick and glossy, stirring regularly. Stir in the spring onions and coriander, cook for 1 min more, then remove from the heat and leave to cool. Cut the tortillas into quarters, then cut each quarter into three pieces, so you have 36 triangles. Place 1 tsp of the chicken mixture and a little cheese at the widest end of a triangle. Roll the pointed end of the triangle around the filling and secure with a cocktail stick. Place on a baking tray lined with baking parchment. Fill and roll the other triangles. Cover with cling film and chill for up to 8 hrs until ready to reheat. To make the dip, mash all the ingredients in a bowl until almost smooth. Cover the surface of the dip with cling film and chill for up to 24 hrs. When ready to serve, heat oven to 200C/180C fan/gas 6. Uncover the fajitas and bake for 6-8 mins or until hot throughout. Serve with the guacamole.",
128
- "name": "Mini Chicken Fajitas",
129
- "ingredients": [
130
- "2 tbsp sunflower oil",
131
- "2 skinless chicken breasts, cut into 1½ cm/½ in chunks",
132
- "1 red pepper, deseeded and cut into 1½ cm/½ in chunks",
133
- "1 yellow pepper, deseeded and cut into 1½ cm/½ in chunks",
134
- "1 tsp ground cumin",
135
- "1 tsp ground coriander",
136
- "¼ tsp hot chilli powder",
137
- "227g can chopped tomatoes",
138
- "2 tbsp chipotle paste",
139
- "4 spring onions, trimmed and thinly sliced",
140
- "large pack coriander, leaves chopped",
141
- "3 large flour tortillas",
142
- "75g ready-grated mozzarella",
143
- "1 ripe avocado, stoned and peeled",
144
- "juice 1 large lime",
145
- "1 garlic clove, crushed",
146
- "2 heaped tbsp finely chopped coriander",
147
- "36 cocktail sticks"
148
- ]
149
- }
150
- ]
125
+ "name": "Chicken Fajitas",
126
+ "description": "A flavorful and easy-to-make dish with marinated chicken, bell peppers, and onions, served with warm tortillas and your favorite toppings.",
127
+ "ingredients": [
128
+ "1.5 pounds boneless, skinless chicken breasts, sliced into strips",
129
+ "1 red bell pepper, sliced",
130
+ "1 green bell pepper, sliced",
131
+ "1 yellow bell pepper, sliced",
132
+ "1 large onion, sliced",
133
+ "2 tablespoons olive oil",
134
+ "1 packet (1 ounce) fajita seasoning",
135
+ "1/2 cup water",
136
+ "12 flour tortillas",
137
+ "Optional toppings: sour cream, guacamole, salsa, shredded cheese, chopped cilantro"
138
+ ],
139
+ "instructions": "1. In a bowl, combine the chicken strips with fajita seasoning and water. Marinate for at least 15 minutes.\n2. Heat olive oil in a large skillet or cast-iron pan over medium-high heat.\n3. Add the chicken and cook until browned and cooked through, about 5-7 minutes.\n4. Add the bell peppers and onion to the skillet. Cook, stirring occasionally, until softened, about 5-7 minutes.\n5. Warm the tortillas according to package directions.\n6. Serve the chicken and vegetables in warm tortillas with your favorite toppings.",
140
+ "prep_time": "15 minutes",
141
+ "cook_time": "20 minutes",
142
+ "servings": 4
151
143
  }
152
144
  }
153
145
  ```
@@ -156,7 +148,7 @@ async function makeRequest() {
156
148
 
157
149
  ## Customer Support
158
150
 
159
- Need any assistance? [Get in touch with Customer Support](https://apiverve.com/contact).
151
+ Need any assistance? [Get in touch with Customer Support](https://apiverve.com/contact?utm_source=npm&utm_medium=readme).
160
152
 
161
153
  ---
162
154
 
@@ -168,14 +160,14 @@ Stay up to date by following [@apiverveHQ](https://twitter.com/apiverveHQ) on Tw
168
160
 
169
161
  ## Legal
170
162
 
171
- All usage of the APIVerve website, API, and services is subject to the [APIVerve Terms of Service](https://apiverve.com/terms) and all legal documents and agreements.
163
+ All usage of the APIVerve website, API, and services is subject to the [APIVerve Terms of Service](https://apiverve.com/terms?utm_source=npm&utm_medium=readme), [Privacy Policy](https://apiverve.com/privacy?utm_source=npm&utm_medium=readme), and [Refund Policy](https://apiverve.com/refund?utm_source=npm&utm_medium=readme).
172
164
 
173
165
  ---
174
166
 
175
167
  ## License
176
168
  Licensed under the The MIT License (MIT)
177
169
 
178
- Copyright (©) 2025 APIVerve, and EvlarSoft LLC
170
+ Copyright (©) 2026 APIVerve, and EvlarSoft LLC
179
171
 
180
172
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
181
173
 
package/index.d.ts CHANGED
@@ -7,20 +7,19 @@ declare module '@apiverve/recipe' {
7
7
  export interface recipeResponse {
8
8
  status: string;
9
9
  error: string | null;
10
- data: RecipesData;
10
+ data: RecipeGeneratorData;
11
11
  code?: number;
12
12
  }
13
13
 
14
14
 
15
- interface RecipesData {
16
- count: number;
17
- recipes: Recipe[];
18
- }
19
-
20
- interface Recipe {
21
- instructions: string;
15
+ interface RecipeGeneratorData {
22
16
  name: string;
17
+ description: string;
23
18
  ingredients: string[];
19
+ instructions: string;
20
+ prepTime: string;
21
+ cookTime: string;
22
+ servings: number;
24
23
  }
25
24
 
26
25
  export default class recipeWrapper {
package/index.js CHANGED
@@ -34,6 +34,102 @@ class recipeWrapper {
34
34
 
35
35
  // secure is deprecated, all requests must be made over HTTPS
36
36
  this.baseURL = 'https://api.apiverve.com/v1/recipe';
37
+
38
+ // Validation rules for parameters (generated from schema)
39
+ this.validationRules = {"name":{"type":"string","required":true}};
40
+ }
41
+
42
+ /**
43
+ * Validate query parameters against schema rules
44
+ * @param {Object} query - The query parameters to validate
45
+ * @throws {Error} - If validation fails
46
+ */
47
+ validateParams(query) {
48
+ const errors = [];
49
+
50
+ for (const [paramName, rules] of Object.entries(this.validationRules)) {
51
+ const value = query[paramName];
52
+
53
+ // Check required
54
+ if (rules.required && (value === undefined || value === null || value === '')) {
55
+ errors.push(`Required parameter [${paramName}] is missing.`);
56
+ continue;
57
+ }
58
+
59
+ // Skip validation if value is not provided and not required
60
+ if (value === undefined || value === null) {
61
+ continue;
62
+ }
63
+
64
+ // Type validation
65
+ if (rules.type === 'integer' || rules.type === 'number') {
66
+ const numValue = Number(value);
67
+ if (isNaN(numValue)) {
68
+ errors.push(`Parameter [${paramName}] must be a valid ${rules.type}.`);
69
+ continue;
70
+ }
71
+
72
+ if (rules.type === 'integer' && !Number.isInteger(numValue)) {
73
+ errors.push(`Parameter [${paramName}] must be an integer.`);
74
+ continue;
75
+ }
76
+
77
+ // Min/max validation for numbers
78
+ if (rules.min !== undefined && numValue < rules.min) {
79
+ errors.push(`Parameter [${paramName}] must be at least ${rules.min}.`);
80
+ }
81
+ if (rules.max !== undefined && numValue > rules.max) {
82
+ errors.push(`Parameter [${paramName}] must be at most ${rules.max}.`);
83
+ }
84
+ } else if (rules.type === 'string') {
85
+ if (typeof value !== 'string') {
86
+ errors.push(`Parameter [${paramName}] must be a string.`);
87
+ continue;
88
+ }
89
+
90
+ // Length validation for strings
91
+ if (rules.minLength !== undefined && value.length < rules.minLength) {
92
+ errors.push(`Parameter [${paramName}] must be at least ${rules.minLength} characters.`);
93
+ }
94
+ if (rules.maxLength !== undefined && value.length > rules.maxLength) {
95
+ errors.push(`Parameter [${paramName}] must be at most ${rules.maxLength} characters.`);
96
+ }
97
+
98
+ // Format validation
99
+ if (rules.format) {
100
+ const formatPatterns = {
101
+ 'email': /^[^\s@]+@[^\s@]+\.[^\s@]+$/,
102
+ 'url': /^https?:\/\/.+/i,
103
+ 'ip': /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/,
104
+ 'date': /^\d{4}-\d{2}-\d{2}$/,
105
+ 'hexColor': /^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/
106
+ };
107
+
108
+ if (formatPatterns[rules.format] && !formatPatterns[rules.format].test(value)) {
109
+ errors.push(`Parameter [${paramName}] must be a valid ${rules.format}.`);
110
+ }
111
+ }
112
+ } else if (rules.type === 'boolean') {
113
+ if (typeof value !== 'boolean' && value !== 'true' && value !== 'false') {
114
+ errors.push(`Parameter [${paramName}] must be a boolean.`);
115
+ }
116
+ } else if (rules.type === 'array') {
117
+ if (!Array.isArray(value)) {
118
+ errors.push(`Parameter [${paramName}] must be an array.`);
119
+ }
120
+ }
121
+
122
+ // Enum validation
123
+ if (rules.enum && Array.isArray(rules.enum)) {
124
+ if (!rules.enum.includes(value)) {
125
+ errors.push(`Parameter [${paramName}] must be one of: ${rules.enum.join(', ')}.`);
126
+ }
127
+ }
128
+ }
129
+
130
+ if (errors.length > 0) {
131
+ throw new Error(`Validation failed: ${errors.join(' ')} See documentation: https://docs.apiverve.com/ref/recipe`);
132
+ }
37
133
  }
38
134
 
39
135
  async execute(query, callback) {
@@ -58,14 +154,8 @@ class recipeWrapper {
58
154
  }
59
155
  }
60
156
 
61
- var requiredParams = ["name"];
62
- if (requiredParams.length > 0) {
63
- for (var i = 0; i < requiredParams.length; i++) {
64
- if (!query[requiredParams[i]]) {
65
- throw new Error(`Required parameter [${requiredParams[i]}] is missing. See documentation: https://docs.apiverve.com/ref/recipe`);
66
- }
67
- }
68
- }
157
+ // Validate parameters against schema rules
158
+ this.validateParams(query);
69
159
 
70
160
  const method = 'GET';
71
161
  const url = method === 'POST' ? this.baseURL : this.constructURL(query);
@@ -108,7 +198,7 @@ class recipeWrapper {
108
198
  constructURL(query) {
109
199
  let url = this.baseURL;
110
200
 
111
- if(query && typeof query === 'object')
201
+ if(query && typeof query === 'object')
112
202
  {
113
203
  if (Object.keys(query).length > 0) {
114
204
  const queryString = Object.keys(query)
@@ -119,6 +209,7 @@ class recipeWrapper {
119
209
  }
120
210
  return url;
121
211
  }
212
+
122
213
  }
123
214
 
124
215
  module.exports = recipeWrapper;
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "@apiverve/recipe",
3
- "version": "1.1.12",
4
- "description": "Recipes is a simple tool for getting recipe information. It returns information on various recipes.",
3
+ "version": "1.1.13",
4
+ "description": "Recipe Generator is an AI-powered tool for generating detailed recipes. It returns complete recipes with ingredients, instructions, prep time, cook time, and servings.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
+ "sideEffects": false,
8
+ "engines": {
9
+ "node": ">=14.0.0"
10
+ },
11
+ "files": [
12
+ "index.js",
13
+ "index.d.ts",
14
+ "LICENSE"
15
+ ],
7
16
  "scripts": {
8
17
  "test": "mocha",
9
18
  "example": "node examples/basic.js"
@@ -14,14 +23,18 @@
14
23
  "directory": "npm"
15
24
  },
16
25
  "keywords": [
17
- "recipes", "recipes api", "recipes tool", "recipes software", "recipes service"
26
+ ""
18
27
  ],
19
- "author": "APIVerve <hello@apiverve.com> (http://apiverve.com/)",
28
+ "author": {
29
+ "name": "APIVerve",
30
+ "email": "hello@apiverve.com",
31
+ "url": "https://apiverve.com"
32
+ },
20
33
  "license": "MIT",
21
34
  "bugs": {
22
35
  "url": "https://github.com/apiverve/recipe-api/issues"
23
36
  },
24
- "homepage": "https://apiverve.com/marketplace/recipe?utm_source=npm",
37
+ "homepage": "https://apiverve.com/marketplace/recipe?utm_source=npm&utm_medium=homepage",
25
38
  "devDependencies": {
26
39
  "mocha": "^11.0.1",
27
40
  "chai": "^5.1.2",
package/examples/basic.js DELETED
@@ -1,38 +0,0 @@
1
- /**
2
- * Basic Example - Recipes API
3
- *
4
- * This example demonstrates how to use the Recipes API.
5
- * Make sure to set your API key in the .env file or replace '[YOUR_API_KEY]' below.
6
- */
7
-
8
- require('dotenv').config();
9
- const recipeAPI = require('../index.js');
10
-
11
- // Initialize the API client
12
- const api = new recipeAPI({
13
- api_key: process.env.API_KEY || '[YOUR_API_KEY]'
14
- });
15
-
16
- // Example query
17
- var query = {
18
- name: "cake"
19
- };
20
-
21
- // Make the API request using callback
22
- console.log('Making request to Recipes API...\n');
23
-
24
- api.execute(query, function (error, data) {
25
- if (error) {
26
- console.error('Error occurred:');
27
- if (error.error) {
28
- console.error('Message:', error.error);
29
- console.error('Status:', error.status);
30
- } else {
31
- console.error(JSON.stringify(error, null, 2));
32
- }
33
- return;
34
- }
35
-
36
- console.log('Response:');
37
- console.log(JSON.stringify(data, null, 2));
38
- });
package/tmp/build.dat DELETED
@@ -1 +0,0 @@
1
- #