ApiLogicServer 14.3.0__py3-none-any.whl → 14.3.11__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.
- {ApiLogicServer-14.3.0.dist-info → ApiLogicServer-14.3.11.dist-info}/METADATA +3 -3
- {ApiLogicServer-14.3.0.dist-info → ApiLogicServer-14.3.11.dist-info}/RECORD +58 -54
- api_logic_server_cli/api_logic_server.py +2 -1
- api_logic_server_cli/api_logic_server_info.yaml +3 -3
- api_logic_server_cli/cli.py +5 -2
- api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/ont_build.py +9 -9
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/asset-manifest.json +3 -3
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/build-0213.txt +1 -0
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/index.html +1 -1
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/js/main.7c8c0e37.js +3 -0
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/js/{main.bfe80d1d.js.map → main.7c8c0e37.js.map} +1 -1
- api_logic_server_cli/database/nw-gold.sqlite +0 -0
- api_logic_server_cli/genai/genai.py +13 -3
- api_logic_server_cli/genai/genai_svcs.py +2 -0
- api_logic_server_cli/manager.py +20 -16
- api_logic_server_cli/prototypes/base/api/system/expression_parser.py +10 -4
- api_logic_server_cli/prototypes/base/devops/docker-image/env.list +7 -2
- api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py +31 -8
- api_logic_server_cli/prototypes/base/integration/system/RowDictMapper.py +33 -16
- api_logic_server_cli/prototypes/base/logic/declare_logic.py +1 -0
- api_logic_server_cli/prototypes/base/logic/load_verify_rules.py +2 -1
- api_logic_server_cli/prototypes/genai_demo/api/customize_api.py +9 -11
- api_logic_server_cli/prototypes/genai_demo/database/.DS_Store +0 -0
- api_logic_server_cli/prototypes/genai_demo/database/db.sqlite +0 -0
- api_logic_server_cli/prototypes/genai_demo/database/models.py +52 -42
- api_logic_server_cli/prototypes/genai_demo/integration/row_dict_maps/OrderB2B.py +4 -6
- api_logic_server_cli/prototypes/genai_demo/integration/row_dict_maps/__pycache__/OrderB2B.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/integration/row_dict_maps/row_dict_maps_readme.md +3 -0
- api_logic_server_cli/prototypes/genai_demo/logic/__pycache__/declare_logic.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/logic/__pycache__/load_verify_rules.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/logic/declare_logic.py +57 -69
- api_logic_server_cli/prototypes/genai_demo/logic/load_verify_rules.py +216 -0
- api_logic_server_cli/prototypes/genai_demo/logic/logic_discovery/__pycache__/__init__.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/logic/logic_discovery/__pycache__/auto_discovery.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/logic/logic_discovery/__pycache__/error_testing.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/logic/logic_discovery/auto_discovery.py +52 -0
- api_logic_server_cli/prototypes/genai_demo/logic/readme_declare_logic.md +172 -0
- api_logic_server_cli/prototypes/genai_demo/security/__pycache__/declare_security.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/ui/admin/admin.yaml +86 -53
- api_logic_server_cli/prototypes/manager/.vscode/ApiLogicServer.code-workspace +2 -2
- api_logic_server_cli/prototypes/manager/.vscode/launch.json +21 -21
- api_logic_server_cli/prototypes/manager/README.md +1 -1
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.prompt +4 -1
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.response_example +15 -8
- api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_informal.prompt +3 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/002_create_db_models.prompt +3 -132
- api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/Invoice Made Ready.png +0 -0
- api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/readme.md +59 -6
- api_logic_server_cli/prototypes/manager/system/genai/learning_requests/logic_bank_api.prompt +22 -1
- api_logic_server_cli/prototypes/nw/logic/declare_logic.py +1 -1
- api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/sqlacodegen/__pycache__/codegen.cpython-312.pyc +0 -0
- api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/sqlacodegen/codegen.py +2 -1
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/build-0106.txt +0 -1
- api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/js/main.bfe80d1d.js +0 -3
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/__pycache__/copilot_models.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/__pycache__/sample_ai_models.cpython-312.pyc +0 -0
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/sample_ai.chatgpt +0 -16
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/sample_ai.sql +0 -66
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/sample_ai.sqlite +0 -0
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/sample_ai_items.sqlite +0 -0
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/sample_ai_models.py +0 -156
- api_logic_server_cli/prototypes/genai_demo/database/chatgpt/sample_ai_models.sqlite +0 -0
- api_logic_server_cli/prototypes/genai_demo/logic/cocktail-napkin.jpg +0 -0
- {ApiLogicServer-14.3.0.dist-info → ApiLogicServer-14.3.11.dist-info}/LICENSE +0 -0
- {ApiLogicServer-14.3.0.dist-info → ApiLogicServer-14.3.11.dist-info}/WHEEL +0 -0
- {ApiLogicServer-14.3.0.dist-info → ApiLogicServer-14.3.11.dist-info}/entry_points.txt +0 -0
- {ApiLogicServer-14.3.0.dist-info → ApiLogicServer-14.3.11.dist-info}/top_level.txt +0 -0
- /api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/js/{main.bfe80d1d.js.LICENSE.txt → main.7c8c0e37.js.LICENSE.txt} +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
Create a sqlite database for customers, orders, items and product
|
|
3
|
-
|
|
4
|
-
Hints: use autonum keys, allow nulls, Decimal types, foreign keys, no check constraints.
|
|
5
|
-
|
|
6
|
-
Include a notes field for orders.
|
|
7
|
-
|
|
8
|
-
Create a few rows of only customer and product data.
|
|
9
|
-
|
|
10
|
-
Enforce the Check Credit requirement (do not generate check constraints):
|
|
11
|
-
|
|
12
|
-
1. Customer.Balance <= CreditLimit
|
|
13
|
-
2. Customer.Balance = Sum(Order.AmountTotal where date shipped is null)
|
|
14
|
-
3. Order.AmountTotal = Sum(Items.Amount)
|
|
15
|
-
4. Items.Amount = Quantity * UnitPrice
|
|
16
|
-
5. Store the Items.UnitPrice as a copy from Product.UnitPrice
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
-- Create Customers table
|
|
2
|
-
CREATE TABLE Customers (
|
|
3
|
-
CustomerID INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
4
|
-
CustomerName TEXT NOT NULL,
|
|
5
|
-
Address TEXT,
|
|
6
|
-
Phone TEXT,
|
|
7
|
-
Balance DECIMAL(10, 2),
|
|
8
|
-
CreditLimit DECIMAL(10, 2) NOT NULL
|
|
9
|
-
);
|
|
10
|
-
|
|
11
|
-
-- Create Products table
|
|
12
|
-
CREATE TABLE Products (
|
|
13
|
-
ProductID INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
14
|
-
ProductName TEXT NOT NULL,
|
|
15
|
-
UnitPrice DECIMAL(10, 2) NOT NULL
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
-- Create Orders table
|
|
19
|
-
CREATE TABLE Orders (
|
|
20
|
-
OrderID INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
21
|
-
CustomerID INTEGER,
|
|
22
|
-
OrderDate DATETIME DEFAULT CURRENT_TIMESTAMP,
|
|
23
|
-
Notes TEXT,
|
|
24
|
-
ShipDate DATETIME,
|
|
25
|
-
AmountTotal DECIMAL(10, 2),
|
|
26
|
-
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
-- Create Items table
|
|
30
|
-
CREATE TABLE Items (
|
|
31
|
-
ItemID INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
32
|
-
OrderID INTEGER,
|
|
33
|
-
ProductID INTEGER,
|
|
34
|
-
Quantity INTEGER NOT NULL,
|
|
35
|
-
UnitPrice DECIMAL(10, 2),
|
|
36
|
-
Amount DECIMAL(10, 2),
|
|
37
|
-
FOREIGN KEY (OrderID) REFERENCES Orders(OrderID),
|
|
38
|
-
FOREIGN KEY (ProductID) REFERENCES Products(ProductID)
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
-- Insert sample data into Customers table
|
|
42
|
-
INSERT INTO Customers (CustomerName, Address, Phone, Balance, CreditLimit) VALUES
|
|
43
|
-
('John Doe', '123 Main St', '555-1234', 1000.00, 5000.00),
|
|
44
|
-
('Jane Smith', '456 Oak Ave', '555-5678', 500.00, 2000.00);
|
|
45
|
-
|
|
46
|
-
-- Insert sample data into Products table
|
|
47
|
-
INSERT INTO Products (ProductName, UnitPrice) VALUES
|
|
48
|
-
('Widget A', 19.99),
|
|
49
|
-
('Gadget B', 29.99);
|
|
50
|
-
|
|
51
|
-
-- Insert sample data into Orders table
|
|
52
|
-
INSERT INTO Orders (CustomerID, Notes, ShipDate, AmountTotal) VALUES
|
|
53
|
-
(1, 'Order 1', NULL, 0.00),
|
|
54
|
-
(2, 'Order 2', NULL, 0.00);
|
|
55
|
-
|
|
56
|
-
-- Update Items.UnitPrice as a copy from Product.UnitPrice
|
|
57
|
-
UPDATE Items
|
|
58
|
-
SET UnitPrice = (SELECT UnitPrice FROM Products WHERE Products.ProductID = Items.ProductID);
|
|
59
|
-
|
|
60
|
-
-- Update Order.AmountTotal as Sum(Items.Amount)
|
|
61
|
-
UPDATE Orders
|
|
62
|
-
SET AmountTotal = (SELECT SUM(Quantity * UnitPrice) FROM Items WHERE Items.OrderID = Orders.OrderID);
|
|
63
|
-
|
|
64
|
-
-- Update Customer.Balance as Sum(Order.AmountTotal) where ShipDate is null
|
|
65
|
-
UPDATE Customers
|
|
66
|
-
SET Balance = (SELECT SUM(AmountTotal) FROM Orders WHERE Orders.CustomerID = Customers.CustomerID AND Orders.ShipDate IS NULL);
|
|
Binary file
|
|
Binary file
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
from sqlalchemy import Column, DECIMAL, DateTime, ForeignKey, Integer, Text, text
|
|
3
|
-
from sqlalchemy.orm import relationship
|
|
4
|
-
from sqlalchemy.ext.declarative import declarative_base
|
|
5
|
-
|
|
6
|
-
########################################################################################################################
|
|
7
|
-
# Used to test create from-model, eg from copilot
|
|
8
|
-
#
|
|
9
|
-
# Alter this file per your database maintenance policy
|
|
10
|
-
# See https://apilogicserver.github.io/Docs/Project-Rebuild/#rebuilding
|
|
11
|
-
#
|
|
12
|
-
# Created: March 29, 2024 12:18:05
|
|
13
|
-
# Database: sqlite:////Users/val/dev/ApiLogicServer/sample_ai/database/db.sqlite
|
|
14
|
-
# Dialect: sqlite
|
|
15
|
-
#
|
|
16
|
-
# mypy: ignore-errors
|
|
17
|
-
########################################################################################################################
|
|
18
|
-
|
|
19
|
-
from safrs import SAFRSBase
|
|
20
|
-
from flask_login import UserMixin
|
|
21
|
-
import safrs, flask_sqlalchemy
|
|
22
|
-
from safrs import jsonapi_attr
|
|
23
|
-
from flask_sqlalchemy import SQLAlchemy
|
|
24
|
-
from sqlalchemy.orm import relationship
|
|
25
|
-
from sqlalchemy.orm import Mapped
|
|
26
|
-
from sqlalchemy.sql.sqltypes import NullType
|
|
27
|
-
from typing import List
|
|
28
|
-
|
|
29
|
-
db = SQLAlchemy()
|
|
30
|
-
Base = declarative_base() # type: flask_sqlalchemy.model.DefaultMeta
|
|
31
|
-
metadata = Base.metadata
|
|
32
|
-
|
|
33
|
-
#NullType = db.String # datatype fixup
|
|
34
|
-
#TIMESTAMP= db.TIMESTAMP
|
|
35
|
-
|
|
36
|
-
from sqlalchemy.dialects.sqlite import *
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class Customer(SAFRSBase, Base):
|
|
41
|
-
__tablename__ = 'Customers'
|
|
42
|
-
_s_collection_name = 'Customer' # type: ignore
|
|
43
|
-
__bind_key__ = 'None'
|
|
44
|
-
|
|
45
|
-
CustomerID = Column(Integer, primary_key=True)
|
|
46
|
-
CustomerName = Column(Text, nullable=False)
|
|
47
|
-
Address = Column(Text)
|
|
48
|
-
Phone = Column(Text)
|
|
49
|
-
Balance : DECIMAL = Column(DECIMAL(10, 2))
|
|
50
|
-
CreditLimit : DECIMAL = Column(DECIMAL(10, 2), nullable=False)
|
|
51
|
-
|
|
52
|
-
# parent relationships (access parent)
|
|
53
|
-
|
|
54
|
-
# child relationships (access children)
|
|
55
|
-
OrderList : Mapped[List["Order"]] = relationship(back_populates="Customer")
|
|
56
|
-
|
|
57
|
-
@jsonapi_attr
|
|
58
|
-
def _check_sum_(self): # type: ignore [no-redef]
|
|
59
|
-
return None if isinstance(self, flask_sqlalchemy.model.DefaultMeta) \
|
|
60
|
-
else self._check_sum_property if hasattr(self,"_check_sum_property") \
|
|
61
|
-
else None # property does not exist during initialization
|
|
62
|
-
|
|
63
|
-
@_check_sum_.setter
|
|
64
|
-
def _check_sum_(self, value): # type: ignore [no-redef]
|
|
65
|
-
self._check_sum_property = value
|
|
66
|
-
|
|
67
|
-
S_CheckSum = _check_sum_
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
class Product(SAFRSBase, Base):
|
|
71
|
-
__tablename__ = 'Products'
|
|
72
|
-
_s_collection_name = 'Product' # type: ignore
|
|
73
|
-
__bind_key__ = 'None'
|
|
74
|
-
|
|
75
|
-
ProductID = Column(Integer, primary_key=True)
|
|
76
|
-
ProductName = Column(Text, nullable=False)
|
|
77
|
-
UnitPrice : DECIMAL = Column(DECIMAL(10, 2), nullable=False)
|
|
78
|
-
|
|
79
|
-
# parent relationships (access parent)
|
|
80
|
-
|
|
81
|
-
# child relationships (access children)
|
|
82
|
-
ItemList : Mapped[List["Item"]] = relationship(back_populates="Product")
|
|
83
|
-
|
|
84
|
-
@jsonapi_attr
|
|
85
|
-
def _check_sum_(self): # type: ignore [no-redef]
|
|
86
|
-
return None if isinstance(self, flask_sqlalchemy.model.DefaultMeta) \
|
|
87
|
-
else self._check_sum_property if hasattr(self,"_check_sum_property") \
|
|
88
|
-
else None # property does not exist during initialization
|
|
89
|
-
|
|
90
|
-
@_check_sum_.setter
|
|
91
|
-
def _check_sum_(self, value): # type: ignore [no-redef]
|
|
92
|
-
self._check_sum_property = value
|
|
93
|
-
|
|
94
|
-
S_CheckSum = _check_sum_
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
class Order(SAFRSBase, Base):
|
|
98
|
-
__tablename__ = 'Orders'
|
|
99
|
-
_s_collection_name = 'Order' # type: ignore
|
|
100
|
-
__bind_key__ = 'None'
|
|
101
|
-
|
|
102
|
-
OrderID = Column(Integer, primary_key=True)
|
|
103
|
-
CustomerID = Column(ForeignKey('Customers.CustomerID'))
|
|
104
|
-
OrderDate = Column(DateTime, server_default=text("CURRENT_TIMESTAMP"))
|
|
105
|
-
Notes = Column(Text)
|
|
106
|
-
ShipDate = Column(DateTime)
|
|
107
|
-
AmountTotal : DECIMAL = Column(DECIMAL(10, 2))
|
|
108
|
-
|
|
109
|
-
# parent relationships (access parent)
|
|
110
|
-
Customer : Mapped["Customer"] = relationship(back_populates=("OrderList"))
|
|
111
|
-
|
|
112
|
-
# child relationships (access children)
|
|
113
|
-
ItemList : Mapped[List["Item"]] = relationship(back_populates="Order")
|
|
114
|
-
|
|
115
|
-
@jsonapi_attr
|
|
116
|
-
def _check_sum_(self): # type: ignore [no-redef]
|
|
117
|
-
return None if isinstance(self, flask_sqlalchemy.model.DefaultMeta) \
|
|
118
|
-
else self._check_sum_property if hasattr(self,"_check_sum_property") \
|
|
119
|
-
else None # property does not exist during initialization
|
|
120
|
-
|
|
121
|
-
@_check_sum_.setter
|
|
122
|
-
def _check_sum_(self, value): # type: ignore [no-redef]
|
|
123
|
-
self._check_sum_property = value
|
|
124
|
-
|
|
125
|
-
S_CheckSum = _check_sum_
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
class Item(SAFRSBase, Base):
|
|
129
|
-
__tablename__ = 'Items'
|
|
130
|
-
_s_collection_name = 'Item' # type: ignore
|
|
131
|
-
__bind_key__ = 'None'
|
|
132
|
-
|
|
133
|
-
ItemID = Column(Integer, primary_key=True)
|
|
134
|
-
OrderID = Column(ForeignKey('Orders.OrderID'))
|
|
135
|
-
ProductID = Column(ForeignKey('Products.ProductID'))
|
|
136
|
-
Quantity = Column(Integer, nullable=False)
|
|
137
|
-
UnitPrice : DECIMAL = Column(DECIMAL(10, 2))
|
|
138
|
-
Amount : DECIMAL = Column(DECIMAL(10, 2))
|
|
139
|
-
|
|
140
|
-
# parent relationships (access parent)
|
|
141
|
-
Order : Mapped["Order"] = relationship(back_populates=("ItemList"))
|
|
142
|
-
Product : Mapped["Product"] = relationship(back_populates=("ItemList"))
|
|
143
|
-
|
|
144
|
-
# child relationships (access children)
|
|
145
|
-
|
|
146
|
-
@jsonapi_attr
|
|
147
|
-
def _check_sum_(self): # type: ignore [no-redef]
|
|
148
|
-
return None if isinstance(self, flask_sqlalchemy.model.DefaultMeta) \
|
|
149
|
-
else self._check_sum_property if hasattr(self,"_check_sum_property") \
|
|
150
|
-
else None # property does not exist during initialization
|
|
151
|
-
|
|
152
|
-
@_check_sum_.setter
|
|
153
|
-
def _check_sum_(self, value): # type: ignore [no-redef]
|
|
154
|
-
self._check_sum_property = value
|
|
155
|
-
|
|
156
|
-
S_CheckSum = _check_sum_
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|