ApiLogicServer 14.5.0__py3-none-any.whl → 14.5.4__py3-none-any.whl

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 (50) hide show
  1. api_logic_server_cli/add_cust/add_cust.py +7 -21
  2. api_logic_server_cli/api_logic_server.py +4 -2
  3. api_logic_server_cli/api_logic_server_info.yaml +2 -2
  4. api_logic_server_cli/create_from_model/__pycache__/dbml.cpython-312.pyc +0 -0
  5. api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
  6. api_logic_server_cli/create_from_model/dbml.py +3 -0
  7. api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/{mcp_server_executor.py → mcp_discovery.py} +1 -43
  8. api_logic_server_cli/prototypes/basic_demo/customizations/config/server_setup.py +388 -0
  9. api_logic_server_cli/prototypes/basic_demo/customizations/database/system/SAFRSBaseX.py +139 -0
  10. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/.DS_Store +0 -0
  11. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/README_mcp.md +3 -1
  12. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_client_executor.py +144 -131
  13. api_logic_server_cli/prototypes/basic_demo/customizations/logic/declare_logic.py +22 -2
  14. api_logic_server_cli/prototypes/basic_demo/iteration/logic/declare_logic.py +1 -1
  15. api_logic_server_cli/prototypes/nw/logic/declare_logic.py +2 -2
  16. api_logic_server_cli/prototypes/nw_no_cust/.obsidian/app.json +1 -0
  17. api_logic_server_cli/prototypes/nw_no_cust/.obsidian/appearance.json +1 -0
  18. api_logic_server_cli/prototypes/nw_no_cust/.obsidian/core-plugins.json +31 -0
  19. api_logic_server_cli/prototypes/nw_no_cust/.obsidian/workspace.json +166 -0
  20. apilogicserver-14.5.4.dist-info/METADATA +168 -0
  21. {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/RECORD +25 -43
  22. {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/WHEEL +1 -1
  23. api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/proper_update_def.json +0 -71
  24. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/1_langchain_loader.py +0 -71
  25. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/2_gpt_mcp_prompt.txt +0 -19
  26. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_flow.png +0 -0
  27. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/multi_mcp_orchestration.yaml +0 -49
  28. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/multi_mcp_flow/wny mcp flows.png +0 -0
  29. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/natlang_to_api.py +0 -73
  30. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/curl.txt +0 -5
  31. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP Overview.png +0 -0
  32. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Arch.png +0 -0
  33. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/images/MCP_Overview_Executor.png +0 -0
  34. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/1 - prompt_messages_array.json +0 -10
  35. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/invoke_llm/2 - completion_tool_context.json +0 -12
  36. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/llm_schema.txt +0 -38
  37. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_2.yaml +0 -17393
  38. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3.yaml +0 -16660
  39. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/nw_swagger_3_relaxed.yaml +0 -109
  40. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_server.py +0 -51
  41. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/proxy_serverZ.py +0 -72
  42. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/resources/validate_jsonapi.py +0 -64
  43. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/run_executor.py +0 -23
  44. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/swagger_converter.py +0 -65
  45. api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/z_old/3_executor_test_agent.py +0 -52
  46. api_logic_server_cli/prototypes/manager/README_X.md +0 -663
  47. apilogicserver-14.5.0.dist-info/METADATA +0 -76
  48. {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/entry_points.txt +0 -0
  49. {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/licenses/LICENSE +0 -0
  50. {apilogicserver-14.5.0.dist-info → apilogicserver-14.5.4.dist-info}/top_level.txt +0 -0
@@ -1,109 +0,0 @@
1
- openapi: 3.0.3
2
- info:
3
- title: Customer API
4
- version: 1.0.0
5
- description: API for retrieving customer information, including filtering by country and pagination.
6
-
7
- servers:
8
- - url: https://your-ngrok-url.ngrok-free.app/api
9
-
10
- paths:
11
- /Customer:
12
- get:
13
- summary: List Customers
14
- description: Retrieve a list of customers, optionally filtering by country, limiting results, and sorting.
15
- parameters:
16
- - in: query
17
- name: filter[Country]
18
- schema:
19
- type: string
20
- description: Filter customers by country name (e.g., Germany).
21
- - in: query
22
- name: page[limit]
23
- schema:
24
- type: integer
25
- description: Maximum number of customers to return.
26
- - in: query
27
- name: page[offset]
28
- schema:
29
- type: integer
30
- description: Number of customers to skip before starting to collect results.
31
- - in: query
32
- name: sort
33
- schema:
34
- type: string
35
- description: Field to sort by (e.g., id).
36
- responses:
37
- '200':
38
- description: A list of customers
39
- content:
40
- application/json:
41
- schema:
42
- type: object
43
- properties:
44
- data:
45
- type: array
46
- items:
47
- type: object
48
- properties:
49
- id:
50
- type: string
51
- description: Customer ID
52
- type:
53
- type: string
54
- example: Customer
55
- attributes:
56
- type: object
57
- properties:
58
- CompanyName:
59
- type: string
60
- ContactName:
61
- type: string
62
- ContactTitle:
63
- type: string
64
- Address:
65
- type: string
66
- City:
67
- type: string
68
- Region:
69
- type: string
70
- PostalCode:
71
- type: string
72
- Country:
73
- type: string
74
- Phone:
75
- type: string
76
- Fax:
77
- type: string
78
- Balance:
79
- type: number
80
- CreditLimit:
81
- type: number
82
- OrderCount:
83
- type: integer
84
- UnpaidOrderCount:
85
- type: integer
86
- Client_id:
87
- type: integer
88
- S_CheckSum:
89
- type: string
90
- meta:
91
- type: object
92
- properties:
93
- count:
94
- type: integer
95
- limit:
96
- type: integer
97
- total:
98
- type: integer
99
- links:
100
- type: object
101
- properties:
102
- self:
103
- type: string
104
- next:
105
- type: string
106
- last:
107
- type: string
108
-
109
- components: {}
@@ -1,51 +0,0 @@
1
- from flask import Flask, request, make_response
2
- import requests
3
- import json
4
-
5
- app = Flask(__name__)
6
-
7
- @app.route('/api/Customer')
8
- def proxy_customer():
9
- # The real API endpoint
10
- real_url = 'https://your-real-server.ngrok-free.app/api/Customer'
11
-
12
- try:
13
- # Fetch from the actual API
14
- response = requests.get(real_url, params=request.args, headers={'Accept': 'application/json'})
15
- response.raise_for_status()
16
- real_data = response.json()
17
-
18
- transformed_data = {
19
- "data": [],
20
- "jsonapi": {"version": "1.0"},
21
- "links": {"self": request.url}
22
- }
23
-
24
- # Convert each customer to JSON:API format
25
- for item in real_data.get("data", []):
26
- attributes = item.get("attributes", {})
27
- attributes.pop("Id", None) # Remove duplicate ID if present
28
-
29
- transformed_data["data"].append({
30
- "type": "Customer",
31
- "id": item.get("id") or attributes.get("Id"),
32
- "attributes": attributes
33
- })
34
-
35
- # JSON:API-compliant response
36
- response_json = json.dumps(transformed_data)
37
- response_obj = make_response(response_json)
38
- response_obj.headers["Content-Type"] = "application/vnd.api+json"
39
- return response_obj
40
-
41
- except Exception as e:
42
- error_response = {"errors": [{"title": "Proxy Error", "detail": str(e)}]}
43
- response_json = json.dumps(error_response)
44
- response_obj = make_response(response_json, 500)
45
- response_obj.headers["Content-Type"] = "application/vnd.api+json"
46
- return response_obj
47
-
48
- if __name__ == '__main__':
49
- app.run(host='0.0.0.0', port=6000, debug=True)
50
-
51
- # test: curl "http://localhost:6000/api/Customer?filter%5BCountry%5D=Germany&page%5Blimit%5D=2"
@@ -1,72 +0,0 @@
1
- # Step 1: Install Flask and Requests libraries
2
- # Run this once: pip install flask requests
3
-
4
- import json
5
- from flask import Flask, jsonify, request
6
- from flask import make_response
7
- import requests
8
-
9
- app = Flask(__name__)
10
-
11
- @app.before_request
12
- def before_any_request():
13
- print(f"[DEBUG] Incoming request: {request.method} {request.url}")
14
-
15
- # Step 2: Proxy endpoint to fix /api/Customer
16
- @app.route('/api/Customer')
17
- def proxy_customer():
18
- import pprint
19
- real_url = 'https://your-ngrok-url.ngrok-free.app/api/Customer'
20
- real_url = 'http://localhost:5656/api/Customer'
21
-
22
- try:
23
- print(f"[Proxy] Forwarding to: {real_url}")
24
- print(f"[Proxy] With params: {request.args}")
25
-
26
- response = requests.get(real_url, params=request.args, headers={'Accept': 'application/json'})
27
- response.raise_for_status()
28
- real_data = response.json()
29
-
30
- print("[Proxy] Got response:")
31
- pprint.pprint(real_data)
32
-
33
- transformed_data = {
34
- "data": []
35
- }
36
-
37
- transformed_data = {
38
- "data": [
39
- {
40
- "type": "Customer",
41
- "id": attributes.get("Id"),
42
- "attributes": attributes
43
- } for item in real_data.get("data", [])
44
- if (attributes := item.get("attributes"))
45
- ]
46
- }
47
-
48
- for item in real_data.get("data", []):
49
- attributes = item.get("attributes", {})
50
- attributes.pop("Id", None) # Remove duplicate ID TODO
51
- transformed_data["data"].append({
52
- "type": "Customer",
53
- "id": item.get("id") or attributes.get("Id"),
54
- "attributes": attributes
55
- })
56
-
57
-
58
- response_json = json.dumps(transformed_data)
59
- response_obj = make_response(response_json)
60
- response_obj.headers["Content-Type"] = "application/vnd.api+json"
61
- return response_obj
62
- except Exception as e:
63
- print("[Proxy] ERROR:", e)
64
- return jsonify({"error": str(e)}), 500
65
-
66
- # Run the proxy locally
67
- if __name__ == '__main__':
68
- app.run(host='0.0.0.0', port=6000, debug=True)
69
-
70
- # test:
71
- # http://localhost:6000/api/Customer
72
- # curl "http://localhost:6000/api/Customer?filter%5BCountry%5D=Germany&page%5Blimit%5D=2"
@@ -1,64 +0,0 @@
1
- import requests
2
-
3
- def validate_jsonapi_response(url):
4
- try:
5
- response = requests.get(
6
- url,
7
- headers={"Accept": "application/vnd.api+json"},
8
- timeout=10
9
- )
10
-
11
- validation_report = {
12
- "status_code": response.status_code,
13
- "content_type_correct": False,
14
- "top_level_keys_valid": False,
15
- "resource_objects_valid": False,
16
- "errors": []
17
- }
18
-
19
- # Check Content-Type header
20
- content_type = response.headers.get('Content-Type', '')
21
- if "application/vnd.api+json" in content_type:
22
- validation_report["content_type_correct"] = True
23
- else:
24
- validation_report["errors"].append("Incorrect Content-Type: expected 'application/vnd.api+json'.")
25
-
26
- # Check top-level keys
27
- json_body = response.json()
28
- if any(k in json_body for k in ["data", "errors", "meta"]):
29
- validation_report["top_level_keys_valid"] = True
30
- else:
31
- validation_report["errors"].append("Missing required top-level key: data, errors, or meta.")
32
-
33
- # If data is present, validate resource objects
34
- if "data" in json_body:
35
- data = json_body["data"]
36
- if isinstance(data, list):
37
- resources = data
38
- else:
39
- resources = [data]
40
-
41
- all_resources_valid = True
42
- for res in resources:
43
- if not all(key in res for key in ["id", "type", "attributes"]):
44
- all_resources_valid = False
45
- validation_report["errors"].append(
46
- f"Invalid resource object: missing id, type, or attributes -> {res}"
47
- )
48
- break
49
- validation_report["resource_objects_valid"] = all_resources_valid
50
-
51
- except Exception as e:
52
- validation_report = {
53
- "error": str(e)
54
- }
55
-
56
- return validation_report
57
-
58
- # Example: Replace with your actual URL
59
- test_url = "https://dcba-2601-644-4900-d6f0-806d-b9f7-9f64-7677.ngrok-free.app/api/Customer"
60
-
61
- # Run validator
62
- result = validate_jsonapi_response(test_url)
63
- print(result)
64
- # {'status_code': 200, 'content_type_correct': True, 'top_level_keys_valid': True, 'resource_objects_valid': True, 'errors': []}
@@ -1,23 +0,0 @@
1
- import requests
2
-
3
- tool_context = {
4
- "method": "GET",
5
- "url": "http://localhost:5656/api/Customer",
6
- "query_params": {
7
- "filter[Country]": "Germany",
8
- "page[limit]": 2
9
- },
10
- "headers": {
11
- "Accept": "application/vnd.api+json"
12
- }
13
- }
14
-
15
- response = requests.get(
16
- tool_context["url"],
17
- headers=tool_context["headers"],
18
- params=tool_context["query_params"]
19
- )
20
-
21
- print(f"Status Code: {response.status_code}")
22
- print("Response JSON:")
23
- print(response.json())
@@ -1,65 +0,0 @@
1
- import yaml
2
- import subprocess
3
- import tempfile
4
- import os
5
- '''
6
- convert swagger 2.0 to openapi 3.0
7
- pip install pyyaml
8
- npm install -g swagger2openapi
9
- '''
10
- def filter_swagger(input_file, output_file, include_paths_methods):
11
- """
12
- include_paths_methods: dict of {"/path": ["get", "post", ...]}
13
- """
14
- with open(input_file, 'r') as f:
15
- swagger = yaml.safe_load(f)
16
-
17
- filtered_paths = {}
18
- tags = []
19
- for path, methods in swagger.get('paths', {}).items():
20
- if path in include_paths_methods:
21
- print(f"Filtering path: {path}")
22
- tags.append({"name": path.replace("/", "",2)})
23
- filtered_methods = {
24
- method: op
25
- for method, op in methods.items()
26
- if method.lower() in [m.lower() for m in include_paths_methods[path]]
27
- }
28
- if filtered_methods:
29
- print
30
- filtered_paths[path] = filtered_methods
31
- swagger['tags'] = tags
32
- swagger['paths'] = filtered_paths
33
- info ={}
34
- swagger["info"]['termsOfService'] = 'http://genai-logic.com/terms'
35
-
36
- # Save filtered swagger to a temporary file
37
- with tempfile.NamedTemporaryFile(delete=False, mode='w', suffix='.yaml') as tmp:
38
- yaml.dump(swagger, tmp)
39
- tmp_input_file = tmp.name
40
-
41
- # Call swagger2openapi to convert to OpenAPI 3
42
-
43
- subprocess.run([
44
- 'swagger2openapi',
45
- tmp_input_file,
46
- '-o', output_file,
47
- '--yaml',
48
- ], check=True)
49
-
50
- os.remove(tmp_input_file)
51
- print(f"Converted OpenAPI 3.0 spec written to: {output_file}")
52
-
53
-
54
- # Example usage
55
- if __name__ == "__main__":
56
-
57
- input_swagger_file = 'api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/resources/nw_swagger_2.yaml'
58
- output_openapi_file = 'api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/resources/openapi_3.yaml'
59
- # Choose which paths and methods to include
60
- include = {
61
- "/Customer/": ["get", "post"],
62
- "/Order/": ["get"]
63
- }
64
-
65
- filter_swagger(input_swagger_file, output_openapi_file, include)
@@ -1,52 +0,0 @@
1
- import requests, json
2
-
3
- # MCP-style tool_context
4
- # does not like this pagination
5
- tool_context = {
6
- "method": "GET",
7
- "url": "http://localhost:5656/api/Customer",
8
- "query_params": {
9
- "filter[Country]": "Germany",
10
- "page[limit]": 2
11
- },
12
- "headers": {
13
- "Accept": "application/vnd.api+json"
14
- }
15
- }
16
-
17
- tool_context = { # use this for nw
18
- "method": "GET",
19
- "url": "http://localhost:5656/api/Customer",
20
- "query_params": {
21
- "filter[Country]": "Germany"
22
- },
23
- "headers": {
24
- "Accept": "application/vnd.api+json"
25
- , "Authorization": "Bearer your_token"
26
- }
27
- }
28
-
29
- tool_context = { # use this for genai_demo
30
- "method": "GET",
31
- "url": "http://localhost:5656/api/Customer",
32
- "query_params": {
33
- "filter[name]": "Alice"
34
- },
35
- "headers": {
36
- "Accept": "application/vnd.api+json"
37
- , "Authorization": "Bearer your_token"
38
- }
39
- }
40
-
41
- # Execute as a simulated MCP executor
42
- response = requests.get( # use this for genai_demo
43
- tool_context["url"],
44
- headers=tool_context["headers"],
45
- params=tool_context["query_params"]
46
- )
47
-
48
- # Display result
49
- print(response.status_code)
50
- # Print the response, format it as JSON with indent
51
- print(json.dumps(response.json(), indent=4))
52
-