ApiLogicServer 15.0.20__py3-none-any.whl → 15.0.23__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 (31) hide show
  1. api_logic_server_cli/api_logic_server.py +2 -2
  2. api_logic_server_cli/api_logic_server_info.yaml +2 -2
  3. api_logic_server_cli/genai/genai_admin_app.py +41 -13
  4. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md +119 -0
  5. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-js-Learning-Prompt.md +71 -0
  6. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-config-prompt.md +18 -0
  7. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-json-api-model-prompt.md +89 -0
  8. api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/{Admin-App-Learning-Prompt.md → z-unused-Admin-App-Learning-Prompt.md} +33 -24
  9. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json +3 -0
  10. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/Config.js +527 -0
  11. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/app_loader.js +24 -0
  12. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/.eslintrc +5 -0
  13. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/.yarnrc.yml +4 -0
  14. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/default-settings.js +25 -0
  15. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/default-settings.ts +25 -0
  16. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/errors.js +116 -0
  17. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/errors.ts +116 -0
  18. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/index.test.tsx +7 -0
  19. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/index.tsx +11 -0
  20. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/ra-jsonapi-client.js +577 -0
  21. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/ra-jsonapi-client.ts +577 -0
  22. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/resourceLookup.js +124 -0
  23. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/resourceLookup.ts +124 -0
  24. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/styles.module.css +9 -0
  25. {apilogicserver-15.0.20.dist-info → apilogicserver-15.0.23.dist-info}/METADATA +1 -1
  26. {apilogicserver-15.0.20.dist-info → apilogicserver-15.0.23.dist-info}/RECORD +30 -12
  27. api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/dataProvider.js +0 -110
  28. {apilogicserver-15.0.20.dist-info → apilogicserver-15.0.23.dist-info}/WHEEL +0 -0
  29. {apilogicserver-15.0.20.dist-info → apilogicserver-15.0.23.dist-info}/entry_points.txt +0 -0
  30. {apilogicserver-15.0.20.dist-info → apilogicserver-15.0.23.dist-info}/licenses/LICENSE +0 -0
  31. {apilogicserver-15.0.20.dist-info → apilogicserver-15.0.23.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,116 @@
1
+ import { HttpError, useNotify } from "react-admin";
2
+
3
+ export class NotImplementedError extends Error {
4
+ constructor(message: string) {
5
+ super(message);
6
+ this.message = message;
7
+ this.name = "NotImplementedError";
8
+ }
9
+ }
10
+
11
+ export class SafrsHttpError extends HttpError {
12
+ constructor(message: string, status: number, body: any) {
13
+ super(message, status, body);
14
+ this.name = "SafrsHttpError";
15
+ }
16
+ }
17
+
18
+ export const safrsErrorHandler: HttpErrorHandler = (
19
+ httpError: HttpError
20
+ ): HttpError => {
21
+ /* Example Safrs Error message
22
+ {
23
+ "errors": [
24
+ {
25
+ "title": "Request forbidden -- authorization will not help",
26
+ "detail": "",
27
+ "code": "403"
28
+ }
29
+ ]
30
+ } */
31
+ interface err {
32
+ title?: string;
33
+ detail?: string;
34
+ code?: string;
35
+ }
36
+
37
+ /*
38
+ Example Safrs Error message
39
+ {"errors": [
40
+ {
41
+ "title": "Generic Error: Invalid Relationship 'REL'",
42
+ "detail": "Generic Error: Invalid Relationship 'REL'",
43
+ "code": "400"}]
44
+ }
45
+ */
46
+
47
+ const errors: { errors: err[] } = httpError.body || httpError.message?.body; // JSON.parse(httpError.body.stringify);
48
+ console.warn("safrsErrorHandler", httpError)
49
+ console.warn("safrsErrorHandler errors", errors)
50
+ console.warn("safrsErrorHandler body, status", httpError.body, httpError.status);
51
+ console.warn("safrsErrorHandler2", errors);
52
+ if (errors?.errors?.length > 0) {
53
+ console.warn(`Data error ${errors.errors[0].title}`);
54
+
55
+ return new SafrsHttpError(
56
+ errors.errors[0].title || errors.errors[0].detail || "Unknown Error",
57
+ httpError.status,
58
+ errors.errors[0].code
59
+ );
60
+ }
61
+
62
+ console.log("safrsErrorHandler - not a safrs error", errors);
63
+
64
+ if(httpError.status === 403){
65
+ return new SafrsHttpError(
66
+ "Request forbidden -- authorization will not help",
67
+ httpError.status,
68
+ ""
69
+ )
70
+ }
71
+
72
+ if(httpError.status === 422 || httpError.status === 422){
73
+ // Change 422 to 403 to prevent the make react-admin redirect to the login page
74
+ return new SafrsHttpError(
75
+ "422 - Request forbidden -- auth error " +JSON.stringify(httpError.body),
76
+ 403,
77
+ ""
78
+ )
79
+ }
80
+
81
+ if(httpError.status === 401){
82
+ // Change 422 to 403 to prevent the make react-admin redirect to the login page
83
+ return new SafrsHttpError(
84
+ "401 - Unauthorized " +JSON.stringify(httpError.body),
85
+ 401,
86
+ ""
87
+ )
88
+ }
89
+
90
+ if(httpError.status === 600){
91
+ // Custom WG error message when the backend is starting up but not ready yet
92
+ return new SafrsHttpError(
93
+ httpError.body.message,
94
+ 600,
95
+ httpError.body
96
+ )
97
+ }
98
+
99
+ if(httpError.body){
100
+ return new SafrsHttpError(
101
+ httpError.body.message,
102
+ httpError.status,
103
+ httpError.body
104
+ )
105
+ }
106
+
107
+ return new SafrsHttpError(
108
+ "Unknown Error..",
109
+ httpError.status,
110
+ "")
111
+
112
+ };
113
+
114
+ export interface HttpErrorHandler {
115
+ (httpError: HttpError): HttpError;
116
+ }
@@ -0,0 +1,116 @@
1
+ import { HttpError, useNotify } from "react-admin";
2
+
3
+ export class NotImplementedError extends Error {
4
+ constructor(message: string) {
5
+ super(message);
6
+ this.message = message;
7
+ this.name = "NotImplementedError";
8
+ }
9
+ }
10
+
11
+ export class SafrsHttpError extends HttpError {
12
+ constructor(message: string, status: number, body: any) {
13
+ super(message, status, body);
14
+ this.name = "SafrsHttpError";
15
+ }
16
+ }
17
+
18
+ export const safrsErrorHandler: HttpErrorHandler = (
19
+ httpError: HttpError
20
+ ): HttpError => {
21
+ /* Example Safrs Error message
22
+ {
23
+ "errors": [
24
+ {
25
+ "title": "Request forbidden -- authorization will not help",
26
+ "detail": "",
27
+ "code": "403"
28
+ }
29
+ ]
30
+ } */
31
+ interface err {
32
+ title?: string;
33
+ detail?: string;
34
+ code?: string;
35
+ }
36
+
37
+ /*
38
+ Example Safrs Error message
39
+ {"errors": [
40
+ {
41
+ "title": "Generic Error: Invalid Relationship 'REL'",
42
+ "detail": "Generic Error: Invalid Relationship 'REL'",
43
+ "code": "400"}]
44
+ }
45
+ */
46
+
47
+ const errors: { errors: err[] } = httpError.body || httpError.message?.body; // JSON.parse(httpError.body.stringify);
48
+ console.warn("safrsErrorHandler", httpError)
49
+ console.warn("safrsErrorHandler errors", errors)
50
+ console.warn("safrsErrorHandler body, status", httpError.body, httpError.status);
51
+ console.warn("safrsErrorHandler2", errors);
52
+ if (errors?.errors?.length > 0) {
53
+ console.warn(`Data error ${errors.errors[0].title}`);
54
+
55
+ return new SafrsHttpError(
56
+ errors.errors[0].title || errors.errors[0].detail || "Unknown Error",
57
+ httpError.status,
58
+ errors.errors[0].code
59
+ );
60
+ }
61
+
62
+ console.log("safrsErrorHandler - not a safrs error", errors);
63
+
64
+ if(httpError.status === 403){
65
+ return new SafrsHttpError(
66
+ "Request forbidden -- authorization will not help",
67
+ httpError.status,
68
+ ""
69
+ )
70
+ }
71
+
72
+ if(httpError.status === 422 || httpError.status === 422){
73
+ // Change 422 to 403 to prevent the make react-admin redirect to the login page
74
+ return new SafrsHttpError(
75
+ "422 - Request forbidden -- auth error " +JSON.stringify(httpError.body),
76
+ 403,
77
+ ""
78
+ )
79
+ }
80
+
81
+ if(httpError.status === 401){
82
+ // Change 422 to 403 to prevent the make react-admin redirect to the login page
83
+ return new SafrsHttpError(
84
+ "401 - Unauthorized " +JSON.stringify(httpError.body),
85
+ 401,
86
+ ""
87
+ )
88
+ }
89
+
90
+ if(httpError.status === 600){
91
+ // Custom WG error message when the backend is starting up but not ready yet
92
+ return new SafrsHttpError(
93
+ httpError.body.message,
94
+ 600,
95
+ httpError.body
96
+ )
97
+ }
98
+
99
+ if(httpError.body){
100
+ return new SafrsHttpError(
101
+ httpError.body.message,
102
+ httpError.status,
103
+ httpError.body
104
+ )
105
+ }
106
+
107
+ return new SafrsHttpError(
108
+ "Unknown Error..",
109
+ httpError.status,
110
+ "")
111
+
112
+ };
113
+
114
+ export interface HttpErrorHandler {
115
+ (httpError: HttpError): HttpError;
116
+ }
@@ -0,0 +1,7 @@
1
+ import { ExampleComponent } from '.'
2
+
3
+ describe('ExampleComponent', () => {
4
+ it('is truthy', () => {
5
+ expect(ExampleComponent).toBeTruthy()
6
+ })
7
+ })
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ // import styles from './styles.module.css'
3
+
4
+ interface Props {
5
+ text: string;
6
+ }
7
+
8
+ export const ExampleComponent = ({ text }: Props) => {
9
+ // return <div className={styles.test}>Example Component: {text}</div>
10
+ return <div>Example Component: {text}</div>;
11
+ };