ApiLogicServer 15.0.25__py3-none-any.whl → 15.0.26__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/api_logic_server.py +2 -2
- api_logic_server_cli/genai/genai_admin_app.py +29 -19
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md +36 -2
- {apilogicserver-15.0.25.dist-info → apilogicserver-15.0.26.dist-info}/METADATA +1 -1
- {apilogicserver-15.0.25.dist-info → apilogicserver-15.0.26.dist-info}/RECORD +9 -9
- {apilogicserver-15.0.25.dist-info → apilogicserver-15.0.26.dist-info}/WHEEL +0 -0
- {apilogicserver-15.0.25.dist-info → apilogicserver-15.0.26.dist-info}/entry_points.txt +0 -0
- {apilogicserver-15.0.25.dist-info → apilogicserver-15.0.26.dist-info}/licenses/LICENSE +0 -0
- {apilogicserver-15.0.25.dist-info → apilogicserver-15.0.26.dist-info}/top_level.txt +0 -0
|
@@ -12,10 +12,10 @@ 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__ = "15.00.
|
|
15
|
+
__version__ = "15.00.26" # last public release: 15.00.25 (15.00.12)
|
|
16
16
|
recent_changes = \
|
|
17
17
|
f'\n\nRecent Changes:\n' +\
|
|
18
|
-
"\t06/
|
|
18
|
+
"\t06/25/2024 - 15.00.26: Tech Preview: als genai-app w/ sra provider+model+grid_cascadeAdd, import fix, bug [96] \n"\
|
|
19
19
|
"\t06/10/2024 - 15.00.12: MCP Security, win fixes for readme, graphics quotes \n"\
|
|
20
20
|
"\t06/08/2024 - 15.00.10: MCP, optional shortening of stacktrace lines, bugfix[92] \n"\
|
|
21
21
|
"\t05/16/2024 - 14.05.00: safrs 3.1.7, running mcp preview \n"\
|
|
@@ -38,7 +38,7 @@ class JSResponseFormat(BaseModel): # must match system/genai/prompt_inserts/res
|
|
|
38
38
|
|
|
39
39
|
class GenAIAdminApp:
|
|
40
40
|
|
|
41
|
-
def __init__(self, project: Project, app_name: str, schema: str, genai_version:
|
|
41
|
+
def __init__(self, project: Project, app_name: str, schema: str, genai_version: str):
|
|
42
42
|
self.start_time = time.time()
|
|
43
43
|
|
|
44
44
|
self.api_version = genai_version
|
|
@@ -82,6 +82,7 @@ class GenAIAdminApp:
|
|
|
82
82
|
shutil.copytree(self.react_admin_template_path, self.ui_project_path, dirs_exist_ok=True)
|
|
83
83
|
|
|
84
84
|
# self.parse_resources()
|
|
85
|
+
self.standard_imports = self.read_standard_imports()
|
|
85
86
|
self.a_generate_resource_files()
|
|
86
87
|
self.b_generate_app_js()
|
|
87
88
|
# comes from copytree, above -- self.c_generate_data_provider()
|
|
@@ -94,27 +95,36 @@ class GenAIAdminApp:
|
|
|
94
95
|
log.info('> npm install')
|
|
95
96
|
log.info('> npm start')
|
|
96
97
|
|
|
98
|
+
def read_standard_imports(self) -> List[str]:
|
|
99
|
+
'''grr
|
|
100
|
+
|
|
101
|
+
openAI very often ignores the EXACTLY imports,<br>
|
|
102
|
+
so read them manually for later resource creation
|
|
103
|
+
'''
|
|
104
|
+
learning = self.admin_app_resource_learning.splitlines()
|
|
105
|
+
result_lines = []
|
|
106
|
+
preamble_done = False
|
|
107
|
+
for each_line in learning:
|
|
108
|
+
if '<sample-code' in each_line:
|
|
109
|
+
preamble_done = True
|
|
110
|
+
continue
|
|
111
|
+
if 'end mandatory imports' in each_line:
|
|
112
|
+
result_lines.append(each_line)
|
|
113
|
+
result_lines.append("")
|
|
114
|
+
break
|
|
115
|
+
if preamble_done:
|
|
116
|
+
result_lines.append(each_line)
|
|
117
|
+
return result_lines
|
|
118
|
+
|
|
97
119
|
|
|
98
120
|
def a_generate_resource_files(self):
|
|
99
121
|
|
|
100
|
-
def fix_resource(raw_source: str) -> str:
|
|
101
|
-
''' Remove
|
|
102
|
-
And horrific override of ChatGPT refusal to generate imports AS DIRECTED
|
|
122
|
+
def fix_resource(genai_app: GenAIAdminApp, raw_source: str) -> str:
|
|
123
|
+
''' Remove occasional begin/end code markers <br>
|
|
124
|
+
And horrific override of ChatGPT refusal to generate imports AS DIRECTED!<br>
|
|
103
125
|
ToDo: lint, and repeat generation if errors detected
|
|
104
126
|
'''
|
|
105
|
-
|
|
106
|
-
// begin MANDATORY imports (always generated EXACTLY)
|
|
107
|
-
import React from 'react';
|
|
108
|
-
import { List, FunctionField, Datagrid, TextField, DateField, NumberField } from 'react-admin';
|
|
109
|
-
import { ReferenceField, ReferenceManyField } from 'react-admin';
|
|
110
|
-
import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
|
|
111
|
-
import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
|
|
112
|
-
import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
|
|
113
|
-
import { Grid, Typography, Box, Divider } from '@mui/material';
|
|
114
|
-
// end mandatory imports
|
|
115
|
-
|
|
116
|
-
// generate pages and components...
|
|
117
|
-
'''
|
|
127
|
+
|
|
118
128
|
source_lines = raw_source.splitlines()
|
|
119
129
|
result_lines = []
|
|
120
130
|
imports_done = False
|
|
@@ -126,7 +136,7 @@ import { Grid, Typography, Box, Divider } from '@mui/material';
|
|
|
126
136
|
else:
|
|
127
137
|
break
|
|
128
138
|
if do_mandatory_imports := True and not imports_done and '= (props) =>' in each_line:
|
|
129
|
-
result_lines =
|
|
139
|
+
result_lines = list(genai_app.standard_imports)
|
|
130
140
|
imports_done = True
|
|
131
141
|
result_lines.append(each_line)
|
|
132
142
|
# return source_lines as a string
|
|
@@ -150,7 +160,7 @@ import { Grid, Typography, Box, Divider } from '@mui/material';
|
|
|
150
160
|
response_as=JSResponseFormat)
|
|
151
161
|
response_dict = json.loads(output)
|
|
152
162
|
target_file = self.ui_src_path / f"{each_resource_name}.js"
|
|
153
|
-
source_code = fix_resource(response_dict['code'])
|
|
163
|
+
source_code = fix_resource(self, response_dict['code'])
|
|
154
164
|
utils.write_file(target_file, source_code)
|
|
155
165
|
log.info(f"\n✅ Wrote: {target_file}")
|
|
156
166
|
|
|
@@ -16,7 +16,10 @@ import { ReferenceField, ReferenceManyField } from 'react-admin';
|
|
|
16
16
|
import { TabbedShowLayout, Tab, SimpleShowLayout, TextInput, NumberInput, DateTimeInput } from 'react-admin';
|
|
17
17
|
import { ReferenceInput, SelectInput, SimpleForm, Show, Edit, Create } from 'react-admin';
|
|
18
18
|
import { Filter, Pagination, BooleanField, BooleanInput, Labeled } from 'react-admin';
|
|
19
|
-
import {
|
|
19
|
+
import { EditButton, DeleteButton, CreateButton } from 'react-admin';
|
|
20
|
+
import { Grid, Typography, Box, Divider, Button } from '@mui/material';
|
|
21
|
+
import { useRecordContext, useRedirect, Link, required } from 'react-admin';
|
|
22
|
+
import AddIcon from '@mui/icons-material/Add';
|
|
20
23
|
// end mandatory imports
|
|
21
24
|
|
|
22
25
|
// Filter for Customer List
|
|
@@ -79,8 +82,11 @@ export const CustomerShow = (props) => {
|
|
|
79
82
|
<DateField source="CreatedOn" label="Created On" />
|
|
80
83
|
<NumberField source="amount_total" label="Amount Total" options={{ style: 'currency', currency: 'USD' }} />
|
|
81
84
|
<DateField source="date_shipped" label="Date Shipped" />
|
|
85
|
+
<EditButton />
|
|
86
|
+
<DeleteButton />
|
|
82
87
|
</Datagrid>
|
|
83
88
|
</ReferenceManyField>
|
|
89
|
+
<AddOrderButton />
|
|
84
90
|
</Tab>
|
|
85
91
|
...
|
|
86
92
|
</TabbedShowLayout>
|
|
@@ -88,6 +94,29 @@ export const CustomerShow = (props) => {
|
|
|
88
94
|
);
|
|
89
95
|
};
|
|
90
96
|
|
|
97
|
+
// Custom Add Order Button
|
|
98
|
+
const AddOrderButton = () => {
|
|
99
|
+
const record = useRecordContext();
|
|
100
|
+
const redirect = useRedirect();
|
|
101
|
+
|
|
102
|
+
const handleClick = () => {
|
|
103
|
+
// Use the newer React Admin approach for pre-filling forms
|
|
104
|
+
redirect(`/Order/create?source=${encodeURIComponent(JSON.stringify({ customer_id: record?.id }))}`);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Button
|
|
109
|
+
variant="contained"
|
|
110
|
+
color="primary"
|
|
111
|
+
startIcon={<AddIcon />}
|
|
112
|
+
onClick={handleClick}
|
|
113
|
+
sx={{ mt: 2 }}
|
|
114
|
+
>
|
|
115
|
+
Add New Order
|
|
116
|
+
</Button>
|
|
117
|
+
);
|
|
118
|
+
};
|
|
119
|
+
|
|
91
120
|
// Customer Create
|
|
92
121
|
export const CustomerCreate = (props) => {
|
|
93
122
|
return (
|
|
@@ -162,7 +191,12 @@ For each resource (`Customer`, `Order` etc) and **fully** implement:
|
|
|
162
191
|
Use:
|
|
163
192
|
|
|
164
193
|
- `<ReferenceField>` for foreign key displays
|
|
165
|
-
- `<ReferenceInput>` for foreign key input
|
|
194
|
+
- `<ReferenceInput>` for foreign key input, like this (IMPORTANT: validate is on SelectInput, NEVER ReferenceInput )
|
|
195
|
+
```
|
|
196
|
+
<ReferenceInput source="customer_id" reference="Customer" fullWidth>
|
|
197
|
+
<SelectInput optionText="name" validate={required()} />
|
|
198
|
+
</ReferenceInput>
|
|
199
|
+
```
|
|
166
200
|
- `<ReferenceManyField>` for tabbed child lists
|
|
167
201
|
|
|
168
202
|
Use the attribute order from the schema.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
api_logic_server_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
api_logic_server_cli/api_logic_server.py,sha256=
|
|
2
|
+
api_logic_server_cli/api_logic_server.py,sha256=3u1SUUCgh3cRxHuhflye-1IMuzwrJp3QONSz1o04tZw,96395
|
|
3
3
|
api_logic_server_cli/api_logic_server_info.yaml,sha256=Rmy2DSMNBLtlV9PP_hqmn2FojD2AAinPVOfnTbwu6oE,128
|
|
4
4
|
api_logic_server_cli/cli.py,sha256=bSc3sj9df94pIx0HyRYKOojOv3M360UNQgieJAgg9IM,85002
|
|
5
5
|
api_logic_server_cli/cli_args_base.py,sha256=lr27KkOB7_WpZwTs7LgiK8LKDIHMKQkoZCTnE99BFxw,3280
|
|
@@ -476,7 +476,7 @@ api_logic_server_cli/genai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
|
476
476
|
api_logic_server_cli/genai/client.py,sha256=36gyz-dqxj4dJj1SGtO9NZsy9-cfnf4d7uahHimwqHk,772
|
|
477
477
|
api_logic_server_cli/genai/genai.py,sha256=rt4XW_xmo-D5fLD8DQBHMjrU7Teflw43S8lR-tJd4KU,47014
|
|
478
478
|
api_logic_server_cli/genai/genai_admin_app copy.py,sha256=d1E6kNVhq-xqhUh2j52V4cOTJxEiZgWhja1_kLJXKX8,4665
|
|
479
|
-
api_logic_server_cli/genai/genai_admin_app.py,sha256=
|
|
479
|
+
api_logic_server_cli/genai/genai_admin_app.py,sha256=IO9aSvOXmY5wiJl74awPo3PxE1ibKjqtUDbpik46NkE,9754
|
|
480
480
|
api_logic_server_cli/genai/genai_fatal_excp.py,sha256=1FmDVcXVRqmG0JMVZ7l4KqMOdpff3KGZ2LPAGtw304Q,179
|
|
481
481
|
api_logic_server_cli/genai/genai_graphics.py,sha256=9ao0os6rUKY5u2caeLtgyDsNEuVQXq4KcKV575fNC58,20610
|
|
482
482
|
api_logic_server_cli/genai/genai_logic_builder.py,sha256=u_89UtrALIfcMtW6p0SZ78lCmwRqerA5igyY2hDvjlk,26150
|
|
@@ -1211,7 +1211,7 @@ api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv.
|
|
|
1211
1211
|
api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv.sh,sha256=aWX9fa8fe6aO9ifBIZEgGY5UGh4I0arOoCwBzDsxgU8,893
|
|
1212
1212
|
api_logic_server_cli/prototypes/manager/system/genai/.DS_Store,sha256=ndrcwHjeXXcVbvjdiQNuyCtmI6m-kvDLoEnr0fFJsuY,6148
|
|
1213
1213
|
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt copy.md,sha256=cDkLjSRPZxfmgDZhObilm1K67ZweOv9TkGT6cTpZNOM,6741
|
|
1214
|
-
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md,sha256=
|
|
1214
|
+
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md,sha256=L2nPSDJ3NzGHwQziN2d6z2PoH4RKGo6tuCGEGgLyhOE,8063
|
|
1215
1215
|
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-js-Learning-Prompt.md,sha256=75FA3txqJ1viIyqt9O6nGpi17As7aSgVyUJ1rImriKc,2054
|
|
1216
1216
|
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-config-prompt.md,sha256=fyP8X1q9tM3i6bTVioa7ieM_aTUfk4GPo08aOWZ60-0,932
|
|
1217
1217
|
api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-json-api-model-prompt.md,sha256=5Zp9q_lpY225qceQ3UhF4Fyd-85hDKkD-r3BWYmcs6Y,2890
|
|
@@ -2275,9 +2275,9 @@ api_logic_server_cli/tools/mini_skel/database/system/SAFRSBaseX.py,sha256=p8C7AF
|
|
|
2275
2275
|
api_logic_server_cli/tools/mini_skel/database/system/TestDataBase.py,sha256=U02SYqThsbY5g3DX7XGaiMxjZBuOpzvtPS6RfI1WQFg,371
|
|
2276
2276
|
api_logic_server_cli/tools/mini_skel/logic/declare_logic.py,sha256=fTrlHyqMeZsw_TyEXFa1VlYBL7fzjZab5ONSXO7aApo,175
|
|
2277
2277
|
api_logic_server_cli/tools/mini_skel/logic/load_verify_rules.py,sha256=Rr5bySJpYCZmNPF2h-phcPJ53nAOPcT_ohZpCD93-a0,7530
|
|
2278
|
-
apilogicserver-15.0.
|
|
2279
|
-
apilogicserver-15.0.
|
|
2280
|
-
apilogicserver-15.0.
|
|
2281
|
-
apilogicserver-15.0.
|
|
2282
|
-
apilogicserver-15.0.
|
|
2283
|
-
apilogicserver-15.0.
|
|
2278
|
+
apilogicserver-15.0.26.dist-info/licenses/LICENSE,sha256=67BS7VC-Z8GpaR3wijngQJkHWV04qJrwQArVgn9ldoI,1485
|
|
2279
|
+
apilogicserver-15.0.26.dist-info/METADATA,sha256=38bB2lGjbj1sZM1OjXOJsv8EsfcgbRW4HLOKFEibN6g,6553
|
|
2280
|
+
apilogicserver-15.0.26.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
2281
|
+
apilogicserver-15.0.26.dist-info/entry_points.txt,sha256=KiLloZJ3c_RW-nIDqBtoE0WEsQTnZ3dELwHLWi23LMA,103
|
|
2282
|
+
apilogicserver-15.0.26.dist-info/top_level.txt,sha256=-r0AT_GEApleihg-jIh0OMvzzc0BO1RuhhOpE91H5qI,21
|
|
2283
|
+
apilogicserver-15.0.26.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|