ApiLogicServer 14.4.0__py3-none-any.whl → 14.5.3__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.
- api_logic_server_cli/add_cust/add_cust.py +269 -0
- api_logic_server_cli/api_logic_server.py +18 -238
- api_logic_server_cli/api_logic_server_info.yaml +3 -3
- api_logic_server_cli/cli.py +38 -28
- api_logic_server_cli/create_from_model/__pycache__/api_logic_server_utils.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/dbml.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_build.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/__pycache__/ont_create.cpython-312.pyc +0 -0
- api_logic_server_cli/create_from_model/api_logic_server_utils.py +47 -0
- api_logic_server_cli/create_from_model/dbml.py +113 -58
- api_logic_server_cli/create_from_model/ont_build.py +83 -60
- api_logic_server_cli/create_from_model/ont_create.py +2 -1
- api_logic_server_cli/database/basic_demo.sqlite +0 -0
- api_logic_server_cli/database/basic_demo.txt +1 -0
- api_logic_server_cli/database/basic_demo_wg.sqlite +0 -0
- api_logic_server_cli/manager.py +3 -2
- api_logic_server_cli/prototypes/base/.vscode/launch.json +3 -2
- api_logic_server_cli/prototypes/base/config/config.py +66 -11
- api_logic_server_cli/prototypes/base/config/default.env +7 -1
- api_logic_server_cli/prototypes/base/database/test_data/readme.md +2 -1
- api_logic_server_cli/prototypes/base/integration/kafka/kafka_producer.py +5 -2
- api_logic_server_cli/prototypes/base/integration/n8n/n8n_producer.py +68 -21
- api_logic_server_cli/prototypes/base/integration/n8n/n8n_readme.md +19 -0
- api_logic_server_cli/prototypes/base/test/basic/server_test.py +1 -1
- api_logic_server_cli/prototypes/basic_demo/README.md +29 -52
- api_logic_server_cli/prototypes/basic_demo/customizations/api/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/mcp_discovery.py +139 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/api/api_discovery/openapi.py +92 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/config/default.env +13 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/config/server_setup.py +388 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/db.sqlite +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/models.py +131 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/database/system/SAFRSBaseX.py +136 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/.DS_Store +0 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/README_mcp.md +15 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_client_executor.py +350 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_schema.txt +47 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/mcp/mcp_server_discovery.json +9 -0
- api_logic_server_cli/prototypes/{nw_no_cust/integration/mcp → basic_demo/customizations/integration/openai_function}/3_executor_test_agent.py +20 -6
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/README_functon.md +201 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/ai_plugin.json +17 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/nw-swagger_3.json +1731 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/snippets.txt +5 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3 genai_demo_with_get.json +1731 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3.json +1782 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo.json +264 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/integration/openai_function/swagger_3_genai_demo_with_update.json +1782 -0
- api_logic_server_cli/prototypes/basic_demo/customizations/logic/declare_logic.py +79 -41
- api_logic_server_cli/prototypes/basic_demo/customizations/security/declare_security.py +11 -12
- api_logic_server_cli/prototypes/basic_demo/customizations/ui/admin/admin.yaml +166 -0
- api_logic_server_cli/prototypes/basic_demo/iteration/api/{customize_api.py → api_discovery/order_b2b.py} +17 -23
- api_logic_server_cli/prototypes/basic_demo/iteration/database/db.sqlite +0 -0
- api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/OrderB2B.py +6 -5
- api_logic_server_cli/prototypes/basic_demo/iteration/integration/row_dict_maps/OrderShipping.py +4 -4
- api_logic_server_cli/prototypes/basic_demo/iteration/logic/declare_logic.py +69 -43
- api_logic_server_cli/prototypes/basic_demo/iteration/ui/admin/admin.yaml +125 -50
- api_logic_server_cli/prototypes/manager/README.md +4 -0
- api_logic_server_cli/prototypes/nw/logic/declare_logic.py +2 -2
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/app.json +1 -0
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/appearance.json +1 -0
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/core-plugins.json +31 -0
- api_logic_server_cli/prototypes/nw_no_cust/.obsidian/workspace.json +166 -0
- api_logic_server_cli/prototypes/nw_no_cust/Tutorial.md +45 -26
- api_logic_server_cli/prototypes/nw_no_cust/api/api_discovery/openapi.py +130 -0
- api_logic_server_cli/prototypes/nw_no_cust/api/api_discovery/proper_update_def.json +71 -0
- api_logic_server_cli/prototypes/nw_no_cust/config/default.env +13 -0
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/package-lock.json +9725 -1180
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/package.json +3 -6
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/app/shared/app.services.config.ts +1 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/css/app.scss +4 -0
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/i18n/en.json +1 -1
- api_logic_server_cli/prototypes/ont_app/ontimize_seed/src/assets/i18n/es.json +14 -12
- api_logic_server_cli/prototypes/ont_app/templates/app_config.jinja +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/date_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/textarea_template.html +1 -1
- api_logic_server_cli/prototypes/ont_app/templates/timestamp_template.html +1 -1
- api_logic_server_cli/prototypes/sample_ai/logic/declare_logic.py +30 -13
- apilogicserver-14.5.3.dist-info/METADATA +168 -0
- {apilogicserver-14.4.0.dist-info → apilogicserver-14.5.3.dist-info}/RECORD +84 -61
- {apilogicserver-14.4.0.dist-info → apilogicserver-14.5.3.dist-info}/WHEEL +1 -1
- api_logic_server_cli/prototypes/basic_demo/apply_customizations.ps1 +0 -17
- api_logic_server_cli/prototypes/basic_demo/apply_customizations.sh +0 -14
- api_logic_server_cli/prototypes/basic_demo/apply_iteration.ps1 +0 -20
- api_logic_server_cli/prototypes/basic_demo/apply_iteration.sh +0 -15
- api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/1_langchain_loader.py +0 -19
- api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/2_gpt_mcp_prompt.txt +0 -19
- api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/README.md +0 -17
- api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/resources/curl.txt +0 -4
- api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/resources/nw_swagger_3.yaml +0 -16660
- api_logic_server_cli/prototypes/nw_no_cust/integration/mcp/run_executor.py +0 -23
- apilogicserver-14.4.0.dist-info/METADATA +0 -76
- {apilogicserver-14.4.0.dist-info → apilogicserver-14.5.3.dist-info}/entry_points.txt +0 -0
- {apilogicserver-14.4.0.dist-info → apilogicserver-14.5.3.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-14.4.0.dist-info → apilogicserver-14.5.3.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
from api_logic_server_cli.cli_args_project import Project
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
import sqlalchemy
|
|
4
|
+
from sqlalchemy.orm import Session
|
|
5
|
+
from sqlalchemy.ext.declarative import declarative_base
|
|
6
|
+
import logging
|
|
7
|
+
import importlib.util
|
|
8
|
+
from api_logic_server_cli.create_from_model import api_logic_server_utils as api_logic_server_utils
|
|
9
|
+
from shutil import copyfile
|
|
10
|
+
import shutil, os
|
|
11
|
+
import create_from_model.api_logic_server_utils as create_utils
|
|
12
|
+
|
|
13
|
+
log = logging.getLogger('create_from_model.model_creation_services')
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
'''
|
|
17
|
+
samples and demos - simulate customizations - https://apilogicserver.github.io/Docs/Doc-Home/#start-install-samples-training
|
|
18
|
+
1. nw - sample code
|
|
19
|
+
2. genai_demo - GenAI (ChatGPT to create model, add rules VSC)
|
|
20
|
+
3. basic_demo - small db, no GenAI (w/ iteration)
|
|
21
|
+
4. sample_ai - CoPilot, no GenAI (w/ iteration)
|
|
22
|
+
5. Tech AI - just an article, no automated customizations...
|
|
23
|
+
|
|
24
|
+
Note: many require: rebuild-from-database --project_name=./ --db_url=sqlite:///database/db.sqlite
|
|
25
|
+
'''
|
|
26
|
+
|
|
27
|
+
def add_genai_customizations(project: Project, do_show_messages: bool = True, do_security: bool = True):
|
|
28
|
+
""" Add customizations `prototypes/genai_demo` to genai (default creation)
|
|
29
|
+
|
|
30
|
+
0. Initial: create_project_and_overlay_prototypes() -- minor: just creates the readme
|
|
31
|
+
* When done with genai logic prompt, logic is pre-created (in logic/declare_logic.py)
|
|
32
|
+
1. Deep copy prototypes/genai_demo (adds logic and security, and custom end point)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
log.debug("\n\n==================================================================")
|
|
39
|
+
nw_messages = ""
|
|
40
|
+
do_security = True # other demos can explain security, here just make it work
|
|
41
|
+
if do_security:
|
|
42
|
+
if do_show_messages:
|
|
43
|
+
nw_messages = "Add sample_ai / genai_demo customizations - enabling security"
|
|
44
|
+
project.add_auth(is_nw=True, msg=nw_messages)
|
|
45
|
+
|
|
46
|
+
# overlay genai_demo := sample_ai + sample_ai_iteration
|
|
47
|
+
nw_path = (project.api_logic_server_dir_path).\
|
|
48
|
+
joinpath('prototypes/genai_demo') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
49
|
+
create_utils.recursive_overwrite(nw_path, project.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
50
|
+
|
|
51
|
+
if do_show_messages:
|
|
52
|
+
log.info("\nExplore key customization files:")
|
|
53
|
+
log.info(f'..api/customize_api.py')
|
|
54
|
+
log.info(f'..logic/declare_logic.py')
|
|
55
|
+
log.info(f'..security/declare_security.py\n')
|
|
56
|
+
if project.is_tutorial == False:
|
|
57
|
+
log.info(".. all customizations complete\n")
|
|
58
|
+
|
|
59
|
+
def fix_nw_datamodel(project_directory: str):
|
|
60
|
+
"""update sqlite data model for cascade delete, aliases -- fixme moving to add_cust
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
project_directory (str): project creation dir
|
|
64
|
+
"""
|
|
65
|
+
models_file_name = Path(project_directory).joinpath('database/models.py')
|
|
66
|
+
do_add_manual = True if models_file_name.is_file() and not create_utils.does_file_contain(search_for="manual fix", in_file=models_file_name) else False
|
|
67
|
+
if not do_add_manual:
|
|
68
|
+
log.debug(f'.. .. ..ALREADY SET cascade delete and column alias for sample database database/models.py')
|
|
69
|
+
pass # should not occur, just being careful
|
|
70
|
+
else:
|
|
71
|
+
log.debug(f'.. .. ..Setting cascade delete and column alias for sample database database/models.py')
|
|
72
|
+
create_utils.replace_string_in_file(in_file=models_file_name,
|
|
73
|
+
search_for='OrderDetailList : Mapped[List["OrderDetail"]] = relationship(back_populates="Order")',
|
|
74
|
+
replace_with='OrderDetailList : Mapped[List["OrderDetail"]] = relationship(cascade="all, delete", back_populates="Order") # manual fix')
|
|
75
|
+
create_utils.replace_string_in_file(in_file=models_file_name,
|
|
76
|
+
search_for="ShipPostalCode = Column(String(8000))",
|
|
77
|
+
replace_with="ShipZip = Column('ShipPostalCode', String(8000)) # manual fix - alias")
|
|
78
|
+
create_utils.replace_string_in_file(in_file=models_file_name,
|
|
79
|
+
search_for="CategoryName_ColumnName = Column(String(8000))",
|
|
80
|
+
replace_with="CategoryName = Column('CategoryName_ColumnName', String(8000)) # manual fix - alias")
|
|
81
|
+
|
|
82
|
+
def add_nw_customizations(project: Project, do_show_messages: bool = True, do_security: bool = True):
|
|
83
|
+
""" Add customizations to nw (default creation)
|
|
84
|
+
|
|
85
|
+
1. Add-sqlite-security (optionally - not used for initial creation)
|
|
86
|
+
|
|
87
|
+
2. Deep copy project_prototype_nw (adds logic)
|
|
88
|
+
|
|
89
|
+
3. Create readme files: Tutorial (copy_md), api/integration_defs/readme.md
|
|
90
|
+
|
|
91
|
+
4. Add database customizations
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
log.debug("\n\n==================================================================")
|
|
97
|
+
nw_messages = ""
|
|
98
|
+
if do_security:
|
|
99
|
+
if do_show_messages:
|
|
100
|
+
nw_messages = "Add northwind customizations - enabling security"
|
|
101
|
+
project.add_auth(is_nw=True, msg=nw_messages)
|
|
102
|
+
|
|
103
|
+
nw_path = (project.api_logic_server_dir_path).\
|
|
104
|
+
joinpath('prototypes/nw') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
105
|
+
if os.path.isfile(project.project_directory_path.joinpath('ui/admin/admin.yaml')):
|
|
106
|
+
copyfile(src = project.project_directory_path.joinpath('ui/admin/admin.yaml'),
|
|
107
|
+
dst = project.project_directory_path.joinpath('ui/admin/admin_no_customizations.yaml'))
|
|
108
|
+
create_utils.recursive_overwrite(nw_path, project.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
109
|
+
|
|
110
|
+
project.create_nw_tutorial_and_readme()
|
|
111
|
+
|
|
112
|
+
# z_copy_md(project = project, from_doc_file="Sample-Integration.md", to_project_file='integration/Sample-Integration.md')
|
|
113
|
+
create_utils.copy_md(project = project, from_doc_file = "Sample-Integration.md", to_project_file='integration/Sample-Integration.md')
|
|
114
|
+
|
|
115
|
+
fix_nw_datamodel(project_directory=project.project_directory)
|
|
116
|
+
|
|
117
|
+
if do_show_messages:
|
|
118
|
+
log.info("\nExplore key customization files:")
|
|
119
|
+
log.info(f'..api/customize_api.py')
|
|
120
|
+
log.info(f'..database/customize_models.py')
|
|
121
|
+
log.info(f'..logic/declare_logic.py')
|
|
122
|
+
log.info(f'..security/declare_security.py\n')
|
|
123
|
+
if project.is_tutorial == False:
|
|
124
|
+
log.info(".. all customizations complete\n")
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def add_basic_demo_customizations(project: Project, do_show_messages: bool = True):
|
|
128
|
+
""" Add customizations to basic_demo (default creation)
|
|
129
|
+
|
|
130
|
+
1. Deep copy prototypes/basic_demo (adds logic and security)
|
|
131
|
+
|
|
132
|
+
2. Create readme files: Sample-AI (copy_md), api/integration_defs/readme.md TODO not done, fix cmts
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
log.debug("\n\n==================================================================")
|
|
138
|
+
nw_messages = ""
|
|
139
|
+
do_security = False # disabled - keep clear what "activate security" means for reader
|
|
140
|
+
if do_security:
|
|
141
|
+
if do_show_messages:
|
|
142
|
+
nw_messages = "Add basic_demo customizations - enabling security"
|
|
143
|
+
project.add_auth(is_nw=True, msg=nw_messages)
|
|
144
|
+
|
|
145
|
+
nw_path = (project.api_logic_server_dir_path).\
|
|
146
|
+
joinpath('prototypes/basic_demo/customizations') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/basic_demo/customizations')
|
|
147
|
+
create_utils.recursive_overwrite(nw_path, project.project_directory)
|
|
148
|
+
|
|
149
|
+
if do_show_messages:
|
|
150
|
+
log.info("\nExplore key customization files:")
|
|
151
|
+
log.info(f'..logic/declare_logic.py')
|
|
152
|
+
log.info(f'..security/declare_security.py\n')
|
|
153
|
+
log.info(f'Explore MCP (Model Context Protocol): https://apilogicserver.github.io/Docs/Integration-MCP/\n')
|
|
154
|
+
log.info(f'Next Steps: activate security')
|
|
155
|
+
log.info(f'..ApiLogicServer add-auth --db_url=auth')
|
|
156
|
+
if project.is_tutorial == False:
|
|
157
|
+
log.info(".. complete\n")
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def add_basic_demo_iteration(project: Project, do_show_messages: bool = True, do_security: bool = True):
|
|
161
|
+
""" Iterate data model for basic_demo (default creation)
|
|
162
|
+
|
|
163
|
+
1. Deep copy prototypes/basic_demo/iteration (adds db, logic)
|
|
164
|
+
|
|
165
|
+
Args:
|
|
166
|
+
"""
|
|
167
|
+
|
|
168
|
+
log.debug("\n\n==================================================================")
|
|
169
|
+
|
|
170
|
+
nw_path = (project.api_logic_server_dir_path).\
|
|
171
|
+
joinpath('prototypes/basic_demo/iteration')
|
|
172
|
+
create_utils.recursive_overwrite(nw_path, project.project_directory) # ~/dev/ApiLogicServer/ApiLogicServer-dev/servers/basic_demo
|
|
173
|
+
if do_show_messages:
|
|
174
|
+
log.info("\nNext Step:")
|
|
175
|
+
log.info(f'..ApiLogicServer rebuild-from-database --db_url=sqlite:///database/db.sqlite')
|
|
176
|
+
log.info(".. complete\n")
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def add_sample_ai_customizations(project: Project, do_show_messages: bool = True):
|
|
180
|
+
""" Add customizations to sample_ai (default creation)
|
|
181
|
+
|
|
182
|
+
1. Deep copy prototypes/sample_ai (adds logic and security)
|
|
183
|
+
|
|
184
|
+
2. Create readme files: Sample-AI (copy_md), api/integration_defs/readme.md TODO not done, fix cmts
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
log.debug("\n\n==================================================================")
|
|
190
|
+
nw_messages = ""
|
|
191
|
+
do_security = False # disabled - keep clear what "activate security" means for reader
|
|
192
|
+
if do_security:
|
|
193
|
+
if do_show_messages:
|
|
194
|
+
nw_messages = "Add sample_ai customizations - enabling security"
|
|
195
|
+
project.add_auth(is_nw=True, msg=nw_messages)
|
|
196
|
+
|
|
197
|
+
nw_path = (project.api_logic_server_dir_path).\
|
|
198
|
+
joinpath('prototypes/sample_ai') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
199
|
+
create_utils.recursive_overwrite(nw_path, project.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
200
|
+
|
|
201
|
+
if do_show_messages:
|
|
202
|
+
log.info("\nExplore key customization files:")
|
|
203
|
+
log.info(f'..api/customize_api.py')
|
|
204
|
+
log.info(f'..logic/declare_logic.py')
|
|
205
|
+
log.info(f'..security/declare_security.py\n')
|
|
206
|
+
log.info(f'Next Steps: activate security')
|
|
207
|
+
log.info(f'..ApiLogicServer add-auth --db_url=auth')
|
|
208
|
+
if project.is_tutorial == False:
|
|
209
|
+
log.info(".. complete\n")
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def add_sample_ai_iteration(project: Project, do_show_messages: bool = True, do_security: bool = True):
|
|
213
|
+
""" Iterate data model for sample_ai (default creation)
|
|
214
|
+
|
|
215
|
+
1. Deep copy prototypes/sample_ai_iteration (adds db, logic)
|
|
216
|
+
|
|
217
|
+
Args:
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
log.debug("\n\n==================================================================")
|
|
221
|
+
|
|
222
|
+
nw_path = (project.api_logic_server_dir_path).\
|
|
223
|
+
joinpath('prototypes/sample_ai_iteration') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
224
|
+
create_utils.recursive_overwrite(nw_path, project.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
225
|
+
if do_show_messages:
|
|
226
|
+
log.info("\nNext Step:")
|
|
227
|
+
log.info(f'..ApiLogicServer rebuild-from-database --project_name=./ --db_url=sqlite:///database/db.sqlite')
|
|
228
|
+
log.info(".. complete\n")
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def add_cust(project: Project, models_py_path: Path, project_name: str):
|
|
232
|
+
''' determine which project, then call a customizer above '''
|
|
233
|
+
|
|
234
|
+
log.debug(f"\ncli[add-cust] models_py_path={models_py_path}")
|
|
235
|
+
if not models_py_path.exists():
|
|
236
|
+
raise Exception("Customizations are northwind/genai-specific - models.py does not exist")
|
|
237
|
+
|
|
238
|
+
project_is_genai_demo = False
|
|
239
|
+
''' can't use project.is_genai_demo because this is not the create command...'''
|
|
240
|
+
|
|
241
|
+
if project.project_directory_path.joinpath('docs/project_is_genai_demo.txt').exists():
|
|
242
|
+
project_is_genai_demo = True
|
|
243
|
+
|
|
244
|
+
project.abs_db_url, project.nw_db_status, project.model_file_name = create_utils.get_abs_db_url("0. Using Sample DB", project)
|
|
245
|
+
if create_utils.does_file_contain(search_for="CategoryTableNameTest", in_file=models_py_path):
|
|
246
|
+
add_nw_customizations(project=project, do_security=False)
|
|
247
|
+
log.info("\nNext step - add authentication:\n $ ApiLogicServer add-auth --db_url=auth\n\n")
|
|
248
|
+
|
|
249
|
+
# elif project_is_genai_demo and create_utils.does_file_contain(search_for="Customer", in_file=models_py_path):
|
|
250
|
+
# add_genai_customizations(project=project, do_security=False)
|
|
251
|
+
|
|
252
|
+
elif project_name == 'sample_ai' and create_utils.does_file_contain(search_for="CustomerName = Column(Text", in_file=models_py_path):
|
|
253
|
+
cocktail_napkin_path = project.project_directory_path.joinpath('logic/cocktail-napkin.jpg')
|
|
254
|
+
is_customized = cocktail_napkin_path.exists()
|
|
255
|
+
if not is_customized:
|
|
256
|
+
add_sample_ai_customizations(project=project)
|
|
257
|
+
else:
|
|
258
|
+
add_sample_ai_iteration(project=project)
|
|
259
|
+
|
|
260
|
+
elif (project_is_genai_demo or project_name == 'basic_demo') and create_utils.does_file_contain(search_for="Customer", in_file=models_py_path):
|
|
261
|
+
cocktail_napkin_path = project.project_directory_path.joinpath('logic/cocktail-napkin.jpg')
|
|
262
|
+
is_customized = cocktail_napkin_path.exists()
|
|
263
|
+
if not is_customized:
|
|
264
|
+
add_basic_demo_customizations(project=project)
|
|
265
|
+
else:
|
|
266
|
+
add_basic_demo_iteration(project=project)
|
|
267
|
+
|
|
268
|
+
else:
|
|
269
|
+
raise Exception("Customizations are northwind/genai-specific - models.py has neither CategoryTableNameTest nor Customer")
|
|
@@ -12,9 +12,11 @@ ApiLogicServer CLI: given a database url, create [and run] customizable ApiLogic
|
|
|
12
12
|
Called from api_logic_server_cli.py, by instantiating the ProjectRun object.
|
|
13
13
|
'''
|
|
14
14
|
|
|
15
|
-
__version__ = "14.
|
|
15
|
+
__version__ = "14.05.03" # last public release: 14.04.00
|
|
16
16
|
recent_changes = \
|
|
17
17
|
f'\n\nRecent Changes:\n' +\
|
|
18
|
+
"\t05/19/2024 - 14.05.03: mcp filters with working date range (AND), email stub, use basic_demo custs for genai_demo \n"\
|
|
19
|
+
"\t05/16/2024 - 14.05.00: safrs 3.1.7, running mcp preview \n"\
|
|
18
20
|
"\t04/27/2024 - 14.04.00: Graphics preview, Vibe install fix, Improved IDE Chat Logic, MCP Exploration \n"\
|
|
19
21
|
"\t03/30/2024 - 14.03.25: WebGenAI fixes for Kafka and Keycloak \n"\
|
|
20
22
|
"\t03/19/2024 - 14.03.20: licensed webgenai docker, [87] sra fix for home.js \n"\
|
|
@@ -60,7 +62,7 @@ import importlib
|
|
|
60
62
|
import fnmatch
|
|
61
63
|
from dotmap import DotMap
|
|
62
64
|
import api_logic_server_cli.create_from_model.create_db_from_model as create_db_from_model
|
|
63
|
-
|
|
65
|
+
import add_cust.add_cust as add_cust
|
|
64
66
|
|
|
65
67
|
def is_docker() -> bool:
|
|
66
68
|
""" running docker? dir exists: /home/api_logic_server """
|
|
@@ -179,7 +181,7 @@ def delete_dir(dir_path, msg):
|
|
|
179
181
|
|
|
180
182
|
|
|
181
183
|
def recursive_overwrite(src, dest, ignore=None):
|
|
182
|
-
"""
|
|
184
|
+
""" moving to api_logic_server_utils
|
|
183
185
|
copyTree, with overwrite
|
|
184
186
|
thanks: https://stackoverflow.com/questions/12683834/how-to-copy-directory-recursively-in-python-and-overwrite-all
|
|
185
187
|
"""
|
|
@@ -334,7 +336,8 @@ def create_project_and_overlay_prototypes(project: 'ProjectRun', msg: str) -> st
|
|
|
334
336
|
log.debug(".. ..Copying nw customizations: logic, custom api, readme, tests, admin app")
|
|
335
337
|
if project.nw_db_status == 'nw':
|
|
336
338
|
log.error("\n==> System Error: Unexpected customization for nw. Please contact support.\n")
|
|
337
|
-
|
|
339
|
+
|
|
340
|
+
add_cust.add_nw_customizations(project=project, do_security=False, do_show_messages=False)
|
|
338
341
|
|
|
339
342
|
if project.nw_db_status in ["nw+"]:
|
|
340
343
|
log.debug(".. ..Copy in nw+ customizations: readme, perform_customizations")
|
|
@@ -415,7 +418,8 @@ def create_project_and_overlay_prototypes(project: 'ProjectRun', msg: str) -> st
|
|
|
415
418
|
# readme now opens automatically, so use that...
|
|
416
419
|
shutil.move(project.project_directory_path.joinpath('readme.md'),
|
|
417
420
|
project.project_directory_path.joinpath('readme_standard.md'))
|
|
418
|
-
create_utils.copy_md(project = project, from_doc_file = "Sample-Genai.md", to_project_file='readme.md')
|
|
421
|
+
# create_utils.copy_md(project = project, from_doc_file = "Sample-Genai.md", to_project_file='readme.md')
|
|
422
|
+
create_utils.copy_md(project = project, from_doc_file = "Sample-Basic-Demo.md", to_project_file='readme.md')
|
|
419
423
|
|
|
420
424
|
if "postgres" or "mysql" in project.db_url:
|
|
421
425
|
fixup_devops_for_postgres_mysql(project)
|
|
@@ -525,7 +529,7 @@ def resolve_home(name: str) -> str:
|
|
|
525
529
|
return result
|
|
526
530
|
|
|
527
531
|
def fix_nw_datamodel(project_directory: str):
|
|
528
|
-
"""update sqlite data model for cascade delete, aliases
|
|
532
|
+
"""update sqlite data model for cascade delete, aliases -- fixme moving to add_cust
|
|
529
533
|
|
|
530
534
|
Args:
|
|
531
535
|
project_directory (str): project creation dir
|
|
@@ -1219,8 +1223,9 @@ from database import <project.bind_key>_models
|
|
|
1219
1223
|
# log.info(".. docs: https://apilogicserver.github.io/Docs/Security-Activation")
|
|
1220
1224
|
|
|
1221
1225
|
config_file = f'{self.project_directory}/config/config.py'
|
|
1226
|
+
env_file = f'{self.project_directory}/config/default.env'
|
|
1222
1227
|
is_enabled = create_utils.does_file_contain(search_for="SECURITY_ENABLED = True",
|
|
1223
|
-
in_file=
|
|
1228
|
+
in_file=env_file)
|
|
1224
1229
|
is_sql = create_utils.does_file_contain(search_for="authentication_provider.sql.auth_provider import",
|
|
1225
1230
|
in_file=config_file)
|
|
1226
1231
|
was_provider_type = "sql" if is_sql else "keycloak"
|
|
@@ -1240,8 +1245,8 @@ from database import <project.bind_key>_models
|
|
|
1240
1245
|
if is_enabled:
|
|
1241
1246
|
log.info(f'\n\n.. ..Disabling security for current provider type: {was_provider_type}\n')
|
|
1242
1247
|
create_utils.assign_value_to_key_in_file(value=False,
|
|
1243
|
-
key="
|
|
1244
|
-
in_file=
|
|
1248
|
+
key="SECURITY_ENABLED",
|
|
1249
|
+
in_file=env_file)
|
|
1245
1250
|
else:
|
|
1246
1251
|
log.info(f'\n.. .. ..No action taken - already disabled for current provider type: {was_provider_type}\n')
|
|
1247
1252
|
return
|
|
@@ -1260,8 +1265,8 @@ from database import <project.bind_key>_models
|
|
|
1260
1265
|
log.info("\n.. Authorization is declared in security/declare_security.py")
|
|
1261
1266
|
|
|
1262
1267
|
log.info(f'\n..{provider_note}') # set enabled, provider in config
|
|
1263
|
-
create_utils.assign_value_to_key_in_file(in_file=
|
|
1264
|
-
key="
|
|
1268
|
+
create_utils.assign_value_to_key_in_file(in_file=env_file, \
|
|
1269
|
+
key="SECURITY_ENABLED", value=True)
|
|
1265
1270
|
self.set_provider(from_value=was_provider_type, to_value=self.auth_provider_type, config_file=config_file)
|
|
1266
1271
|
if self.auth_provider_type == "keycloak":
|
|
1267
1272
|
use_keycloak =True
|
|
@@ -1539,231 +1544,6 @@ from database import <project.bind_key>_models
|
|
|
1539
1544
|
create_utils.copy_md(project = self, from_doc_file = "Tutorial-3.md", to_project_file='Tutorial.md')
|
|
1540
1545
|
# z_copy_md(project = self, from_doc_file="Tutorial-3.md", to_project_file='Tutorial.md')
|
|
1541
1546
|
|
|
1542
|
-
'''
|
|
1543
|
-
samples and demos - simulate customizations - https://apilogicserver.github.io/Docs/Doc-Home/#start-install-samples-training
|
|
1544
|
-
1. nw - sample code
|
|
1545
|
-
2. genai_demo - GenAI (ChatGPT to create model, add rules VSC)
|
|
1546
|
-
3. basic_demo - small db, no GenAI (w/ iteration)
|
|
1547
|
-
4. sample_ai - CoPilot, no GenAI (w/ iteration)
|
|
1548
|
-
5. Tech AI - just an article, no automated customizations...
|
|
1549
|
-
'''
|
|
1550
|
-
|
|
1551
|
-
def add_genai_customizations(self, do_show_messages: bool = True, do_security: bool = True):
|
|
1552
|
-
""" Add customizations to genai (default creation)
|
|
1553
|
-
|
|
1554
|
-
0. Initial: create_project_and_overlay_prototypes() -- minor: just creates the readme
|
|
1555
|
-
* When done with genai logic prompt, logic is pre-created (in logic/declare_logic.py)
|
|
1556
|
-
1. Deep copy prototypes/genai_demo (adds logic and security, and custom end point)
|
|
1557
|
-
|
|
1558
|
-
WebGenAI DX:
|
|
1559
|
-
|
|
1560
|
-
0. Convention: click the Blue Button
|
|
1561
|
-
* Home/Create Project
|
|
1562
|
-
* Home/Open App
|
|
1563
|
-
* Landing
|
|
1564
|
-
* Overview[Manager]/Open
|
|
1565
|
-
* Overview/GitHub
|
|
1566
|
-
* App Home / Develop --> GitHub
|
|
1567
|
-
0. demo --> codespaces. Where are instructions (what is CS, how do I load/run)?
|
|
1568
|
-
1. Name can be any, iff created with APILOGICPROJECT_IS_GENAI_DEMO
|
|
1569
|
-
2. Bypass duplicate discovery logic iff created with APILOGICPROJECT_IS_GENAI_DEMO
|
|
1570
|
-
3. TODO:
|
|
1571
|
-
* cd project
|
|
1572
|
-
* als add-cust # add customizations
|
|
1573
|
-
* run, and use place b2b order service - end point is not activated.
|
|
1574
|
-
|
|
1575
|
-
Args:
|
|
1576
|
-
"""
|
|
1577
|
-
|
|
1578
|
-
log.debug("\n\n==================================================================")
|
|
1579
|
-
nw_messages = ""
|
|
1580
|
-
do_security = True # other demos can explain security, here just make it work
|
|
1581
|
-
if do_security:
|
|
1582
|
-
if do_show_messages:
|
|
1583
|
-
nw_messages = "Add sample_ai / genai_demo customizations - enabling security"
|
|
1584
|
-
self.add_auth(is_nw=True, msg=nw_messages)
|
|
1585
|
-
|
|
1586
|
-
# overlay genai_demo := sample_ai + sample_ai_iteration
|
|
1587
|
-
nw_path = (self.api_logic_server_dir_path).\
|
|
1588
|
-
joinpath('prototypes/genai_demo') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
1589
|
-
recursive_overwrite(nw_path, self.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
1590
|
-
|
|
1591
|
-
if do_show_messages:
|
|
1592
|
-
log.info("\nExplore key customization files:")
|
|
1593
|
-
log.info(f'..api/customize_api.py')
|
|
1594
|
-
log.info(f'..logic/declare_logic.py')
|
|
1595
|
-
log.info(f'..security/declare_security.py\n')
|
|
1596
|
-
if self.is_tutorial == False:
|
|
1597
|
-
log.info(".. all customizations complete\n")
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
def add_nw_customizations(self, do_show_messages: bool = True, do_security: bool = True):
|
|
1601
|
-
""" Add customizations to nw (default creation)
|
|
1602
|
-
|
|
1603
|
-
1. Add-sqlite-security (optionally - not used for initial creation)
|
|
1604
|
-
|
|
1605
|
-
2. Deep copy project_prototype_nw (adds logic)
|
|
1606
|
-
|
|
1607
|
-
3. Create readme files: Tutorial (copy_md), api/integration_defs/readme.md
|
|
1608
|
-
|
|
1609
|
-
4. Add database customizations
|
|
1610
|
-
|
|
1611
|
-
Args:
|
|
1612
|
-
"""
|
|
1613
|
-
|
|
1614
|
-
log.debug("\n\n==================================================================")
|
|
1615
|
-
nw_messages = ""
|
|
1616
|
-
if do_security:
|
|
1617
|
-
if do_show_messages:
|
|
1618
|
-
nw_messages = "Add northwind customizations - enabling security"
|
|
1619
|
-
self.add_auth(is_nw=True, msg=nw_messages)
|
|
1620
|
-
|
|
1621
|
-
nw_path = (self.api_logic_server_dir_path).\
|
|
1622
|
-
joinpath('prototypes/nw') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
1623
|
-
if os.path.isfile(self.project_directory_path.joinpath('ui/admin/admin.yaml')):
|
|
1624
|
-
copyfile(src = self.project_directory_path.joinpath('ui/admin/admin.yaml'),
|
|
1625
|
-
dst = self.project_directory_path.joinpath('ui/admin/admin_no_customizations.yaml'))
|
|
1626
|
-
recursive_overwrite(nw_path, self.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
1627
|
-
|
|
1628
|
-
self.create_nw_tutorial_and_readme()
|
|
1629
|
-
|
|
1630
|
-
# z_copy_md(project = self, from_doc_file="Sample-Integration.md", to_project_file='integration/Sample-Integration.md')
|
|
1631
|
-
create_utils.copy_md(project = self, from_doc_file = "Sample-Integration.md", to_project_file='integration/Sample-Integration.md')
|
|
1632
|
-
|
|
1633
|
-
fix_nw_datamodel(project_directory=self.project_directory)
|
|
1634
|
-
|
|
1635
|
-
if do_show_messages:
|
|
1636
|
-
log.info("\nExplore key customization files:")
|
|
1637
|
-
log.info(f'..api/customize_api.py')
|
|
1638
|
-
log.info(f'..database/customize_models.py')
|
|
1639
|
-
log.info(f'..logic/declare_logic.py')
|
|
1640
|
-
log.info(f'..security/declare_security.py\n')
|
|
1641
|
-
if self.is_tutorial == False:
|
|
1642
|
-
log.info(".. all customizations complete\n")
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
def add_basic_demo_customizations(self, do_show_messages: bool = True):
|
|
1646
|
-
""" Add customizations to basic_demo (default creation)
|
|
1647
|
-
|
|
1648
|
-
1. Deep copy prototypes/basic_demo (adds logic and security)
|
|
1649
|
-
|
|
1650
|
-
2. Create readme files: Sample-AI (copy_md), api/integration_defs/readme.md TODO not done, fix cmts
|
|
1651
|
-
|
|
1652
|
-
Args:
|
|
1653
|
-
"""
|
|
1654
|
-
|
|
1655
|
-
log.debug("\n\n==================================================================")
|
|
1656
|
-
nw_messages = ""
|
|
1657
|
-
do_security = False # disabled - keep clear what "activate security" means for reader
|
|
1658
|
-
if do_security:
|
|
1659
|
-
if do_show_messages:
|
|
1660
|
-
nw_messages = "Add basic_demo customizations - enabling security"
|
|
1661
|
-
self.add_auth(is_nw=True, msg=nw_messages)
|
|
1662
|
-
|
|
1663
|
-
nw_path = (self.api_logic_server_dir_path).\
|
|
1664
|
-
joinpath('prototypes/basic_demo/customizations') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/basic_demo/customizations')
|
|
1665
|
-
recursive_overwrite(nw_path, self.project_directory)
|
|
1666
|
-
|
|
1667
|
-
if do_show_messages:
|
|
1668
|
-
log.info("\nExplore key customization files:")
|
|
1669
|
-
log.info(f'..logic/declare_logic.py')
|
|
1670
|
-
log.info(f'..security/declare_security.py\n')
|
|
1671
|
-
log.info(f'Next Steps: activate security')
|
|
1672
|
-
log.info(f'..ApiLogicServer add-auth --db_url=auth')
|
|
1673
|
-
if self.is_tutorial == False:
|
|
1674
|
-
log.info(".. complete\n")
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
def add_basic_demo_iteration(self, do_show_messages: bool = True, do_security: bool = True):
|
|
1678
|
-
""" Iterate data model for basic_demo (default creation)
|
|
1679
|
-
|
|
1680
|
-
1. Deep copy prototypes/basic_demo/iteration (adds db, logic)
|
|
1681
|
-
|
|
1682
|
-
Args:
|
|
1683
|
-
"""
|
|
1684
|
-
|
|
1685
|
-
log.debug("\n\n==================================================================")
|
|
1686
|
-
|
|
1687
|
-
nw_path = (self.api_logic_server_dir_path).\
|
|
1688
|
-
joinpath('prototypes/basic_demo/iteration')
|
|
1689
|
-
recursive_overwrite(nw_path, self.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
1690
|
-
if do_show_messages:
|
|
1691
|
-
log.info("\nNext Step:")
|
|
1692
|
-
log.info(f'..ApiLogicServer rebuild-from-database --db_url=sqlite:///database/db.sqlite')
|
|
1693
|
-
log.info(".. complete\n")
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
def add_sample_ai_customizations(self, do_show_messages: bool = True):
|
|
1697
|
-
""" Add customizations to sample_ai (default creation)
|
|
1698
|
-
|
|
1699
|
-
1. Deep copy prototypes/sample_ai (adds logic and security)
|
|
1700
|
-
|
|
1701
|
-
2. Create readme files: Sample-AI (copy_md), api/integration_defs/readme.md TODO not done, fix cmts
|
|
1702
|
-
|
|
1703
|
-
Args:
|
|
1704
|
-
"""
|
|
1705
|
-
|
|
1706
|
-
log.debug("\n\n==================================================================")
|
|
1707
|
-
nw_messages = ""
|
|
1708
|
-
do_security = False # disabled - keep clear what "activate security" means for reader
|
|
1709
|
-
if do_security:
|
|
1710
|
-
if do_show_messages:
|
|
1711
|
-
nw_messages = "Add sample_ai customizations - enabling security"
|
|
1712
|
-
self.add_auth(is_nw=True, msg=nw_messages)
|
|
1713
|
-
|
|
1714
|
-
nw_path = (self.api_logic_server_dir_path).\
|
|
1715
|
-
joinpath('prototypes/sample_ai') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
1716
|
-
recursive_overwrite(nw_path, self.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
1717
|
-
|
|
1718
|
-
if do_show_messages:
|
|
1719
|
-
log.info("\nExplore key customization files:")
|
|
1720
|
-
log.info(f'..api/customize_api.py')
|
|
1721
|
-
log.info(f'..logic/declare_logic.py')
|
|
1722
|
-
log.info(f'..security/declare_security.py\n')
|
|
1723
|
-
log.info(f'Next Steps: activate security')
|
|
1724
|
-
log.info(f'..ApiLogicServer add-auth --db_url=auth')
|
|
1725
|
-
if self.is_tutorial == False:
|
|
1726
|
-
log.info(".. complete\n")
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
def add_sample_ai_iteration(self, do_show_messages: bool = True, do_security: bool = True):
|
|
1730
|
-
""" Iterate data model for sample_ai (default creation)
|
|
1731
|
-
|
|
1732
|
-
1. Deep copy prototypes/sample_ai_iteration (adds db, logic)
|
|
1733
|
-
|
|
1734
|
-
Args:
|
|
1735
|
-
"""
|
|
1736
|
-
|
|
1737
|
-
log.debug("\n\n==================================================================")
|
|
1738
|
-
|
|
1739
|
-
nw_path = (self.api_logic_server_dir_path).\
|
|
1740
|
-
joinpath('prototypes/sample_ai_iteration') # PosixPath('/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/ApiLogicServer-src/api_logic_server_cli/prototypes/nw')
|
|
1741
|
-
recursive_overwrite(nw_path, self.project_directory) # '/Users/val/dev/ApiLogicServer/ApiLogicServer-dev/org_git/tutorial/1. Instant_Creation'
|
|
1742
|
-
if do_show_messages:
|
|
1743
|
-
log.info("\nNext Step:")
|
|
1744
|
-
log.info(f'..ApiLogicServer rebuild-from-database --project_name=./ --db_url=sqlite:///database/db.sqlite')
|
|
1745
|
-
log.info(".. complete\n")
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
def genai_get_logic(self, prompt: str) -> list[str]: # TODO drop old code
|
|
1749
|
-
""" Get logic from ChatGPT prompt
|
|
1750
|
-
Args:
|
|
1751
|
-
"""
|
|
1752
|
-
|
|
1753
|
-
prompt_array = prompt.split('\n')
|
|
1754
|
-
logic_text = list()
|
|
1755
|
-
line_num = 0
|
|
1756
|
-
logic_lines = 0
|
|
1757
|
-
writing = False
|
|
1758
|
-
for each_line in prompt_array:
|
|
1759
|
-
line_num += 1
|
|
1760
|
-
if "Enforce" in each_line:
|
|
1761
|
-
writing = True
|
|
1762
|
-
elif writing:
|
|
1763
|
-
logic_lines += 1
|
|
1764
|
-
logic_text.append(each_line)
|
|
1765
|
-
return logic_text
|
|
1766
|
-
|
|
1767
1547
|
|
|
1768
1548
|
def tutorial(self, msg: str="", create: str='tutorial'):
|
|
1769
1549
|
"""
|
|
@@ -1816,7 +1596,7 @@ from database import <project.bind_key>_models
|
|
|
1816
1596
|
|
|
1817
1597
|
self.project_name = with_cust
|
|
1818
1598
|
self.command = "add-cust"
|
|
1819
|
-
|
|
1599
|
+
add_cust.add_nw_customizations(project = self, do_show_messages=False, do_security=False)
|
|
1820
1600
|
self.run = save_run # remove logic below
|
|
1821
1601
|
|
|
1822
1602
|
|
|
@@ -1829,7 +1609,7 @@ from database import <project.bind_key>_models
|
|
|
1829
1609
|
|
|
1830
1610
|
self.project_name = with_cust
|
|
1831
1611
|
self.command = "add-cust"
|
|
1832
|
-
|
|
1612
|
+
add_cust.add_nw_customizations(project = self, do_show_messages=False)
|
|
1833
1613
|
self.run = save_run
|
|
1834
1614
|
|
|
1835
1615
|
if create != "tutorial":
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
last_created_date:
|
|
2
|
-
last_created_project_name:
|
|
3
|
-
last_created_version: 14.
|
|
1
|
+
last_created_date: May 18, 2025 16:45:45
|
|
2
|
+
last_created_project_name: ../../../servers/basic_demo
|
|
3
|
+
last_created_version: 14.05.02
|