ApiLogicServer 14.3.7__py3-none-any.whl → 14.3.14__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 (57) hide show
  1. api_logic_server_cli/api_logic_server.py +4 -2
  2. api_logic_server_cli/api_logic_server_info.yaml +3 -3
  3. api_logic_server_cli/cli.py +1 -1
  4. api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
  5. api_logic_server_cli/create_from_model/ont_build.py +8 -8
  6. api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/asset-manifest.json +3 -3
  7. api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/build-0213.txt +1 -0
  8. api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/index.html +1 -1
  9. api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/js/main.7c8c0e37.js +3 -0
  10. api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/js/{main.bfe80d1d.js.map → main.7c8c0e37.js.map} +1 -1
  11. api_logic_server_cli/database/nw-gold.sqlite +0 -0
  12. api_logic_server_cli/genai/genai.py +17 -279
  13. api_logic_server_cli/genai/genai_fatal_excp.py +5 -0
  14. api_logic_server_cli/genai/genai_svcs.py +14 -2
  15. api_logic_server_cli/genai/genai_utils.py +1 -1
  16. api_logic_server_cli/prototypes/base/api/expose_api_models.py +1 -1
  17. api_logic_server_cli/prototypes/base/api/system/expression_parser.py +1 -1
  18. api_logic_server_cli/prototypes/base/api_logic_server_run.py +2 -2
  19. api_logic_server_cli/prototypes/base/devops/docker-image/env.list +22 -2
  20. api_logic_server_cli/prototypes/base/devops/docker-standard-image/docker-compose-standard-image.yml +28 -0
  21. api_logic_server_cli/prototypes/base/devops/docker-standard-image/env.list +55 -0
  22. api_logic_server_cli/prototypes/base/devops/readme-devops.md +13 -1
  23. api_logic_server_cli/prototypes/base/docs/logic/readme.md +6 -2
  24. api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py +2 -3
  25. api_logic_server_cli/prototypes/base/logic/readme_declare_logic.md +8 -0
  26. api_logic_server_cli/prototypes/base/security/declare_security.py +2 -0
  27. api_logic_server_cli/prototypes/genai_demo/logic/declare_logic.py +3 -3
  28. api_logic_server_cli/prototypes/manager/.vscode/ApiLogicServer.code-workspace +2 -2
  29. api_logic_server_cli/prototypes/manager/.vscode/launch.json +20 -20
  30. api_logic_server_cli/prototypes/manager/system/Manager_workspace.code-workspace +2 -3
  31. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo.prompt +1 -1
  32. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_formal.prompt +0 -2
  33. api_logic_server_cli/prototypes/manager/system/genai/examples/genai_demo/genai_demo_informal.prompt +0 -2
  34. api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/002_create_db_models.prompt +3 -132
  35. api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/Invoice Made Ready.png +0 -0
  36. api_logic_server_cli/prototypes/manager/system/genai/examples/time_tracking_billing/readme.md +3 -3
  37. api_logic_server_cli/prototypes/manager/system/genai/learning_requests/logic_bank_api.prompt +7 -0
  38. api_logic_server_cli/prototypes/manager/system/genai/webg_local/.DS_Store +0 -0
  39. api_logic_server_cli/prototypes/manager/system/genai/webg_local/run_web_genai.sh +10 -0
  40. api_logic_server_cli/prototypes/manager/system/genai/webg_local/webg-projects/.DS_Store +0 -0
  41. api_logic_server_cli/prototypes/manager/system/genai/webg_local/webg-projects/by-ulid/.DS_Store +0 -0
  42. api_logic_server_cli/prototypes/manager/system/genai/webg_local/webg-projects/public/.DS_Store +0 -0
  43. api_logic_server_cli/prototypes/manager/system/genai/webg_local/webg-projects/wgadmin/.DS_Store +0 -0
  44. api_logic_server_cli/prototypes/manager/system/genai/webg_local/webg-temp/.DS_Store +0 -0
  45. api_logic_server_cli/prototypes/manager/system/genai/webg_local/webg_config/.DS_Store +0 -0
  46. api_logic_server_cli/prototypes/manager/system/genai/webg_local/webg_config/web_genai.txt +8 -0
  47. api_logic_server_cli/prototypes/nw/logic/declare_logic.py +1 -1
  48. api_logic_server_cli/sqlacodegen_wrapper/sqlacodegen/sqlacodegen/codegen.py +2 -2
  49. {ApiLogicServer-14.3.7.dist-info → apilogicserver-14.3.14.dist-info}/METADATA +3 -3
  50. {ApiLogicServer-14.3.7.dist-info → apilogicserver-14.3.14.dist-info}/RECORD +55 -42
  51. {ApiLogicServer-14.3.7.dist-info → apilogicserver-14.3.14.dist-info}/WHEEL +1 -1
  52. api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/build-0106.txt +0 -1
  53. api_logic_server_cli/create_from_model/safrs-react-admin-npm-build/static/js/main.bfe80d1d.js +0 -3
  54. /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
  55. {ApiLogicServer-14.3.7.dist-info → apilogicserver-14.3.14.dist-info}/LICENSE +0 -0
  56. {ApiLogicServer-14.3.7.dist-info → apilogicserver-14.3.14.dist-info}/entry_points.txt +0 -0
  57. {ApiLogicServer-14.3.7.dist-info → apilogicserver-14.3.14.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,7 @@
9
9
  "workbench.editorAssociations": {
10
10
  "*.md": "vscode.markdown.preview.editor"
11
11
  },
12
- "workbench.colorTheme": "Office Theme (Excel)",
13
- "workbench.preferredLightColorTheme": "Office Theme (Excel)"
12
+ "workbench.colorTheme": "Office Theme (Publisher)",
13
+ "workbench.preferredLightColorTheme": "Office Theme (Publisher)"
14
14
  }
15
15
  }
@@ -24,7 +24,7 @@
24
24
  "internalConsoleOptions": "openOnSessionStart"
25
25
  },
26
26
  {
27
- "name": " 1.1 GENAI - Iterate (first, add prompt to system/genai/temp/<project>)",
27
+ "name": " - 1.1 GENAI - Iterate (first, add prompt to system/genai/temp/<project>)",
28
28
  "type": "debugpy",
29
29
  "request": "launch",
30
30
  "program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
@@ -43,7 +43,7 @@
43
43
  "internalConsoleOptions": "openOnSessionStart"
44
44
  },
45
45
  {
46
- "name": " 1.2 GENAI - Retry from repaired chatgpt response",
46
+ "name": " - 1.2 GENAI - Retry from repaired chatgpt response",
47
47
  "type": "debugpy",
48
48
  "request": "launch",
49
49
  "program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
@@ -63,7 +63,7 @@
63
63
  "internalConsoleOptions": "openOnSessionStart"
64
64
  },
65
65
  {
66
- "name": " 1.3 GENAI - Retry from repaired model",
66
+ "name": " - 1.3 GENAI - Retry from repaired model",
67
67
  "type": "debugpy",
68
68
  "request": "launch",
69
69
  "program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
@@ -84,7 +84,7 @@
84
84
  "internalConsoleOptions": "openOnSessionStart"
85
85
  },
86
86
  {
87
- "name": " 1.4 GENAI - Postgresql",
87
+ "name": " - 1.4 GENAI - Postgresql",
88
88
  "type": "debugpy",
89
89
  "request": "launch",
90
90
  "program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
@@ -124,21 +124,7 @@
124
124
  "internalConsoleOptions": "openOnSessionStart"
125
125
  },
126
126
  {
127
- "name": " - API Logic Server Run (run project from manager)",
128
- "type": "debugpy",
129
- "request": "launch",
130
- "cwd": "${workspaceFolder}/${input:runProjectName}",
131
- "env": {
132
- "PYTHONHASHSEED": "0",
133
- "APILOGICSERVER_DEBUG": "False",
134
- "OPT_LOCKING": "optional"},
135
- "justMyCode": false,
136
- "program": "api_logic_server_run.py",
137
- "redirectOutput": true,
138
- "console": "integratedTerminal"
139
- },
140
- {
141
- "name": "ApiLogicServer Create nw_sample_nocust",
127
+ "name": " - ApiLogicServer Create nw_sample_nocust",
142
128
  "type": "debugpy",
143
129
  "request": "launch",
144
130
  "program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
@@ -157,7 +143,7 @@
157
143
  "internalConsoleOptions": "openOnSessionStart"
158
144
  },
159
145
  {
160
- "name": "ApiLogicServer Create nw_sample With Customizations",
146
+ "name": " - ApiLogicServer Create nw_sample With Customizations",
161
147
  "type": "debugpy",
162
148
  "request": "launch",
163
149
  "program": "${workspaceFolder}/venv/lib/python3.12/site-packages/api_logic_server_cli/cli.py",
@@ -175,6 +161,20 @@
175
161
  "console": "internalConsole",
176
162
  "internalConsoleOptions": "openOnSessionStart"
177
163
  },
164
+ {
165
+ "name": "API Logic Server Run (run project from manager)",
166
+ "type": "debugpy",
167
+ "request": "launch",
168
+ "cwd": "${workspaceFolder}/${input:runProjectName}",
169
+ "env": {
170
+ "PYTHONHASHSEED": "0",
171
+ "APILOGICSERVER_DEBUG": "False",
172
+ "OPT_LOCKING": "optional"},
173
+ "justMyCode": false,
174
+ "program": "api_logic_server_run.py",
175
+ "redirectOutput": true,
176
+ "console": "integratedTerminal"
177
+ },
178
178
  {
179
179
  "name": "App Model Editor - Prepare",
180
180
  "type": "node",
@@ -9,8 +9,7 @@
9
9
  "workbench.editorAssociations": {
10
10
  "*.md": "vscode.markdown.preview.editor"
11
11
  },
12
- "workbench.colorTheme": "Arduino",
13
- "workbench.preferredHighContrastLightColorTheme": "Arduino",
14
- "workbench.preferredLightColorTheme": "Arduino"
12
+ "workbench.colorTheme": "Office Theme (Publisher)",
13
+ "workbench.preferredLightColorTheme": "Office Theme (Publisher)"
15
14
  }
16
15
  }
@@ -14,7 +14,7 @@ Use case: Check Credit
14
14
  Use case: App Integration
15
15
  1. Send the Order to Kafka topic 'order_shipping' if the date_shipped is not None.
16
16
 
17
- Ensure each customer has a unique name.
17
+ Ensure each customer and product has a unique name.
18
18
 
19
19
  Ensure each Item quantity is not null.
20
20
 
@@ -2,8 +2,6 @@ Create a system with customers, orders, items and products.
2
2
 
3
3
  Include a notes field for orders.
4
4
 
5
- Use LogicBank to enforce business logic.
6
-
7
5
  Use case: Check Credit
8
6
  1. Customer.balance <= credit_limit
9
7
  2. Customer.balance = Sum(Order.amount_total where date_shipped is null)
@@ -2,8 +2,6 @@ Create a system with customers, orders, items and products.
2
2
 
3
3
  Include a notes field for orders.
4
4
 
5
- Use LogicBank to enforce business logic.
6
-
7
5
  Use case: Check Credit
8
6
  1. The Customer's balance is less than the credit limit
9
7
  2. The Customer's balance is the sum of the Order amount_total where date_shipped is null
@@ -1,6 +1,4 @@
1
- Use SQLAlchemy to create a sqlite database named system/genai/temp/create_db_models.sqlite for the following requirements. These requirements are very important!
2
- Requirements:
3
- <Requirements>
1
+
4
2
  Generate a project time tracking and invoice application
5
3
 
6
4
  Use these names for tables and attributes:
@@ -53,142 +51,15 @@ Formula: is_paid when invoice balance is than or equal to zero
53
51
  Task Count is count of InvoiceItem
54
52
  Task completed count is count of InvoiceItem where is_completed is True
55
53
  Formula: is ready when Task Count is equal to Task Completed Count
54
+ When Invoice is_ready send row to Kafka with topic 'invoice_ready'
56
55
 
57
56
 
58
57
  Use Case: InvoiceItem
59
58
  InvoiceItem task amount is copied from Task total task amount billed
60
- InvoiceItem is_completed is sum of Task is_completed when True
59
+ Task is_completed is sum of InvoiceItem is_completed
61
60
 
62
61
 
63
62
 
64
63
  .
65
64
  Create at least 8 tables (models)
66
65
  .
67
- </Requirements>
68
-
69
- Hints: use autonum keys (for all tables - including for link/join/junction/intersection tables), allow nulls, foreign keys, no check constraints.
70
-
71
- Be sure to create classes, never tables.
72
- Class names are singular, and first letter is capitalized.
73
-
74
- If you create sum, count or formula Logic Bank rules, then you MUST create a corresponding column in the data model.
75
-
76
- Remember that SQLite DateTime type only accepts Python datetime and date objects as input,
77
- this means you can not enter string attributes where a date or datetime object is expected.
78
-
79
- Don't install additional packages.
80
- Don't use the faker pip package.
81
-
82
- When creating SQLAlchemy data model classes, follow these guidelines carefully:
83
- * Use foreign key columns instead of relationship names for the data.
84
- * Do not specify nullable unless explicitly specified.
85
- * Do not use unique unless explicitly specified.
86
- * Do not use Float unless explicitly specified.
87
- * Generate the classes ONLY.
88
- * Do NOT generate imports.
89
- * Do NOT generate connect statements.
90
- * Do NOT generate engines.
91
-
92
- Create 4 rows of test data for each table, and follow these guidelines carefully:
93
- * Create separate objects for each test data row, not in arrays.
94
- * Be sure to initialize derived attributes for test data rows - including all sums and counts, but do not rely on Logic Bank,
95
- and do not generate db.execute statements.
96
- * Do not create arrays of test data.
97
- * Do not create a function to load test data.
98
- * Do not print the test data.
99
- * Use double quotes " for strings.
100
- * For test data, format dates as date(year, month, day).
101
-
102
- <responseFormat>
103
- class Rule(BaseModel):
104
- name: str
105
- description: str
106
- use_case: str # specified use case or requirement name (use 'General' if missing)
107
- entity: str # the entity being constrained or derived
108
- code: str # logicbank rule code
109
-
110
- class Model(BaseModel):
111
- classname: str
112
- code: str # sqlalchemy model code
113
- sqlite_create: str # sqlite create table statement
114
- description: str
115
- name: str
116
-
117
- class TestDataRow(BaseModel):
118
- test_data_row_variable: str # the Python test data row variable
119
- code: str # Python code to create a test data row instance
120
-
121
- class WGResult(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
122
- # response: str # result
123
- models : List[Model] # list of sqlalchemy classes in the response
124
- rules : List[Rule] # list rule declarations
125
- test_data: str
126
- test_data_rows: List[TestDataRow] # list of test data rows
127
- test_data_sqlite: str # test data as sqlite INSERT statements
128
- name: str # suggest a short name for the project
129
-
130
- Format the response as a WGResult.
131
-
132
- </responseFormat>
133
-
134
- <responseFormat>
135
-
136
- class Rule(BaseModel):
137
-
138
- name: str
139
-
140
- description: str
141
-
142
- use_case: str # specified use case or requirement name (use 'General' if missing)
143
-
144
- entity: str # the entity being constrained or derived
145
-
146
- code: str # logicbank rule code
147
-
148
-
149
-
150
- class Model(BaseModel):
151
-
152
- classname: str
153
-
154
- code: str # sqlalchemy model code
155
-
156
- sqlite_create: str # sqlite create table statement
157
-
158
- description: str
159
-
160
- name: str
161
-
162
-
163
-
164
- class TestDataRow(BaseModel):
165
-
166
- test_data_row_variable: str # the Python test data row variable
167
-
168
- code: str # Python code to create a test data row instance
169
-
170
-
171
-
172
- class WGResult(BaseModel): # must match system/genai/prompt_inserts/response_format.prompt
173
-
174
- # response: str # result
175
-
176
- models : List[Model] # list of sqlalchemy classes in the response
177
-
178
- rules : List[Rule] # list rule declarations
179
-
180
- test_data: str
181
-
182
- test_data_rows: List[TestDataRow] # list of test data rows
183
-
184
- test_data_sqlite: str # test data as sqlite INSERT statements
185
-
186
- name: str # suggest a short name for the project
187
-
188
-
189
-
190
- Format the response as a WGResult.
191
-
192
-
193
-
194
- </responseFormat>
@@ -49,8 +49,8 @@ $npm install && npm start # install and start the NodeJS/Angular app
49
49
  You can delete the existing sample data or you can start by entering new data. To test the logic - follow these steps:
50
50
  ```
51
51
  1. Enter new Client
52
- 2. Enter new Person (works for Client)
53
- 3. Enter new Project for client (enter billing rate)
52
+ 2. Enter new Person (works for Client, Billing Rate 100)
53
+ 3. Enter new Project for client
54
54
  4. Enter new Task for Project
55
55
  5. Enter new Timesheet - enter task and person for client (enter hours worked)
56
56
 
@@ -58,4 +58,4 @@ Watch Rules fired in log and then review the sums, counts, formula and constrain
58
58
  Note: The Client total amount should be the same value as Project, Task, and Timesheet.
59
59
 
60
60
  Bonus: Enter an Invoice for a Client/Project then add Invoice Item for a specific Client Task. Once the invoice is ready - we can add a new Event (logic) to send to Kafka.
61
- ```
61
+ ```
@@ -139,6 +139,13 @@ class Rule:
139
139
  Rule.after_flush_row_event(on_class=Order, calling=kafka_producer.send_row_to_kafka,
140
140
  if_condition=lambda row: row.date_shipped is not None,
141
141
  with_args={"topic": "order_shipping"})
142
+ Prompt:
143
+ Send the Product to Kafka topic 'ready_to_ship' if the is_complete is True
144
+ Response:
145
+ Rule.after_flush_row_event(on_class=Product, calling=kafka_producer.send_row_to_kafka,
146
+ if_condition=lambda row: row.is_complete is True,
147
+ with_args={"topic": "ready_to_ship"})
148
+
142
149
 
143
150
  Expanded example:
144
151
 
@@ -0,0 +1,10 @@
1
+ # Run WebGenAI locally from docker container
2
+
3
+ # Before running, update ./system/genai/webg_local/webg_config/web_genai.txt
4
+ # See: https://apilogicserver.github.io/Docs/WebGenAI-CLI/#configuration
5
+
6
+ # cd <manager>
7
+ # sh system/genai/webg_local/run_web_genai.sh
8
+ # Find projects at: system/genai/webg_local/webg_projects/by-ulid
9
+
10
+ docker run -it --rm --name webgenie -p 8282:80 --env-file ./system/genai/webg_local/webg_config/web_genai.txt -v ./system/genai/webg_local/webg_temp:/tmp -v ./system/genai/webg_local/webg_projects:/opt/projects apilogicserver/web_genai
@@ -0,0 +1,8 @@
1
+ # App configuration
2
+ APILOGICPROJECT_EXTERNAL_PORT=8282
3
+ APILOGICPROJECT_PORT=5657
4
+ APILOGICSERVER_CHATGPT_APIKEY=sk-proj-< your api key >
5
+
6
+ # WebGenAI security configuration
7
+ # login password for the admin user
8
+ # ADMIN_PASSWORD=password
@@ -191,7 +191,7 @@ def declare_logic():
191
191
 
192
192
 
193
193
  def ship_ready_orders_only(row: Order, old_row: Order, logic_row: LogicRow) -> bool:
194
- invalid_row = row.Ready == False and row.ShippedDate is not None and old_row.ShippedDate is None
194
+ invalid_row = logic_row.is_updated() and row.Ready == False and row.ShippedDate is not None and old_row.ShippedDate is None
195
195
  return not invalid_row
196
196
 
197
197
  Rule.constraint(validate=Order, # Do not ship orders that are not ready
@@ -360,8 +360,8 @@ class ModelClass(Model):
360
360
  camel-case and singlularize, with provisions for reserved word (Date) and collisions (Dates & _Dates)
361
361
  """
362
362
  tablename = cls._convert_to_valid_identifier(tablename)
363
- if tablename in ["Dates"]: # ApiLogicServer
364
- tablename = tablename + "Classs"
363
+ if tablename in ["Dates", "dates", "Column", "column"]: # ApiLogicServer
364
+ tablename = tablename + "Cls"
365
365
  camel_case_name = ''.join(part[:1].upper() + part[1:] for part in tablename.split('_'))
366
366
  if camel_case_name in ["Dates"]:
367
367
  camel_case_name = camel_case_name + "_Classs"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: ApiLogicServer
3
- Version: 14.3.7
3
+ Version: 14.3.14
4
4
  Author-email: Val Huber <apilogicserver@gmail.com>
5
5
  License: BSD-3-Clause
6
6
  Project-URL: Homepage, https://apilogicserver.github.io/Docs/
@@ -35,7 +35,7 @@ Requires-Dist: Flask-SQLAlchemy==3.0.3
35
35
  Requires-Dist: flask-swagger-ui>=4.11.1
36
36
  Requires-Dist: flask_bcrypt==1.0.1
37
37
  Requires-Dist: itsdangerous==2.1.2
38
- Requires-Dist: Jinja2==3.1.2
38
+ Requires-Dist: Jinja2==3.1.5
39
39
  Requires-Dist: MarkupSafe==2.1.3
40
40
  Requires-Dist: six==1.16.0
41
41
  Requires-Dist: SQLAlchemy==2.0.15
@@ -47,7 +47,7 @@ Requires-Dist: Flask-Login==0.6.2
47
47
  Requires-Dist: Flask-OpenID==1.3.0
48
48
  Requires-Dist: python-dotenv==0.15.0
49
49
  Requires-Dist: email-validator==1.1.1
50
- Requires-Dist: LogicBank>=1.20.25
50
+ Requires-Dist: LogicBank>=1.20.26
51
51
  Requires-Dist: cryptography==36.0.1
52
52
  Requires-Dist: rsa
53
53
  Requires-Dist: PyMySQL==1.0.3