@cocreate/api
Advanced tools
Comparing version 1.20.5 to 1.20.6
{ | ||
"name": "@cocreate/api", | ||
"version": "1.20.5", | ||
"version": "1.20.6", | ||
"description": "A simple api helper component in vanilla javascript used by JavaScript developers to create thirdparty api intergrations. CoCreate-api includes the client component and server side for api processing. Thirdparty apis can be accessible using HTML5 attributes and/or JavaScript API. ", | ||
@@ -62,9 +62,9 @@ "keywords": [ | ||
"dependencies": { | ||
"@cocreate/actions": "^1.15.1", | ||
"@cocreate/crud-client": "^1.32.2", | ||
"@cocreate/element-prototype": "^1.15.0", | ||
"@cocreate/render": "^1.37.1", | ||
"@cocreate/socket-client": "^1.36.1", | ||
"@cocreate/utils": "^1.30.0" | ||
"@cocreate/actions": "^1.18.1", | ||
"@cocreate/crud-client": "^1.33.8", | ||
"@cocreate/element-prototype": "^1.22.2", | ||
"@cocreate/render": "^1.40.3", | ||
"@cocreate/socket-client": "^1.39.0", | ||
"@cocreate/utils": "^1.33.6" | ||
} | ||
} |
@@ -127,3 +127,32 @@ /*globals CustomEvent, config*/ | ||
// TODO: handle $param operator | ||
/** | ||
* TODO: Implement Enhanced API Configuration Handling | ||
* | ||
* Description: | ||
* - Implement functionality to dynamically handle API configurations, supporting both complete and base URL endpoints with automatic method-based path appending. | ||
* - Enable dynamic generation of query parameters from a designated object (`stripe` in the examples) when `query` is true. | ||
* | ||
* Requirements: | ||
* 1. Dynamic Endpoint Handling: | ||
* - Check if the endpoint configuration is a complete URL or a base URL. | ||
* - If the `method` derived path is not already included in the endpoint, append it dynamically. | ||
* Example: | ||
* `{ "method": "stripe.accounts.retrieve", "endpoint": "https://api.stripe.com", "query": true, "stripe": { "acct": "acct_123", "name": "John Doe" } }` | ||
* `{ "method": "stripe.accounts.retrieve", "endpoint": "https://api.stripe.com/accounts/retrieve", "query": true, "stripe": { "acct": "acct_123", "name": "John Doe" } }` | ||
* - Develop logic to parse the `method` and check against the endpoint. If necessary, append the appropriate API method segment. | ||
* | ||
* 2. Query Parameter Handling: | ||
* - Dynamically construct and append query parameters from the `stripe` object if `query` is true. Ensure proper URL-encoding of keys and values. | ||
* | ||
* 3. Security: | ||
* - Use the `method` for permission checks, ensuring that each API request complies with security protocols. | ||
* | ||
* 4. Testing: | ||
* - Test both scenarios where the endpoint may or may not include the method path to ensure the dynamic construction works correctly. | ||
* - Ensure that all query parameters are correctly formatted and appended. | ||
* | ||
* Notes: | ||
* - Consider utility functions for parsing and modifying URLs, as well as for encoding parameters. | ||
* - Maintain clear and detailed documentation for each part of the implementation to assist future development and troubleshooting. | ||
*/ | ||
getData: async function ({ name, method, element, form }) { | ||
@@ -167,3 +196,2 @@ let data = {} | ||
// TODO: handle $param operator | ||
setData: function ({ name, method, data, form }) { | ||
@@ -170,0 +198,0 @@ if (!form) |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
191502
364
Updated@cocreate/actions@^1.18.1
Updated@cocreate/render@^1.40.3
Updated@cocreate/utils@^1.33.6