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,124 @@
1
+ interface Relationship {
2
+ data: null | { id: string; type: string } | Array<{ id: string; type: string }>;
3
+ relationships?: { [key: string]: Relationship };
4
+ }
5
+
6
+ /**
7
+ * A map-like class that maps resource linkage objects {id: 1, type: "user"} to concrete resources with attributes and
8
+ * relationships
9
+ */
10
+ export default class ResourceLookup {
11
+ lookup: Map<any, any>;
12
+ includes: string[];
13
+
14
+ /**
15
+ * Constructs a new lookup map
16
+ * @param {Object} response A JSON API response, in JSON format
17
+ */
18
+ constructor(response: any) {
19
+ this.lookup = new Map();
20
+ this.includes = [];
21
+
22
+ // If the response wasn't a JSON dictionary, we can't and don't need to build a lookup
23
+ if (typeof response !== 'object') return;
24
+
25
+ let resources;
26
+ // if (response.hasOwnProperty('included')) {
27
+ if (Object.prototype.hasOwnProperty.call(response, 'included')) {
28
+ resources = [...response.data, ...response.included];
29
+ } else {
30
+ resources = response.data;
31
+ }
32
+
33
+ // Iterate over each resource returned and put each in the lookup
34
+ for (const entry of resources) {
35
+ const key = this.getKey(entry);
36
+ this.lookup.set(key, entry);
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Calculates a hashable key for JSON API resources
42
+ * @param resource A resource linkage object
43
+ * @returns {string}
44
+ */
45
+ getKey(resource: any) {
46
+ return `${resource.type}:${resource.id}`;
47
+ }
48
+
49
+ /**
50
+ * Looks up a resource
51
+ * @param resource A resource linkage object
52
+ * @returns {Object}
53
+ */
54
+ get(resource: any) {
55
+ // If we don't have included data for this resource, just return the Resource Linkage object, since that's still
56
+ // useful
57
+ if (this.has(resource)) {
58
+ return this.lookup.get(this.getKey(resource));
59
+ } else {
60
+ return structuredClone(resource);
61
+ }
62
+ }
63
+
64
+ /**
65
+ * Returns true if the resource is in the lookup
66
+ * @param resource
67
+ * @returns {boolean}
68
+ */
69
+ has(resource: any) {
70
+ return this.lookup.has(this.getKey(resource));
71
+ }
72
+
73
+ /**
74
+ * Converts a JSON API data object (with id, type, and attributes fields) into a flattened object
75
+ * @param {Object} response A JSON API data object
76
+ */
77
+ unwrapData(response: any) {
78
+ // The base resource object, merge the attributes and the id/type fields
79
+ const result = Object.assign(
80
+ {
81
+ id: response?.id,
82
+ ja_type: response?.type,
83
+ type: response?.Type || response?.type,
84
+ attributes: response.attributes || {},
85
+ },
86
+ response.attributes
87
+ );
88
+
89
+ // Deal with relationships
90
+ if (Object.prototype.hasOwnProperty.call(response, 'relationships')) {
91
+ result.relationships = response.relationships;
92
+ for (const [relationshipName, relationship] of Object.entries(response.relationships)) {
93
+ if ((relationship as Relationship).data === null) {
94
+ result[relationshipName] = null;
95
+ }
96
+
97
+ if (!(relationship as Relationship).data) {
98
+ continue;
99
+ } else if (Array.isArray((relationship as Relationship).data && (relationship as Relationship).data)) {
100
+ result[relationshipName] = (relationship as Relationship).data?.map((linkage: any) => {
101
+ const resource = this.get(linkage);
102
+ const lresult = structuredClone(this.unwrapData(resource));
103
+ Object.entries(lresult.attributes || {}).map(([key, value]) => {
104
+ lresult[key] = value;
105
+ });
106
+ result.relationships[relationshipName].data = result[relationshipName];
107
+ return lresult;
108
+ });
109
+ } else if ((relationship as Relationship).data?.id) {
110
+ const resource = this.get((relationship as Relationship).data);
111
+ result[relationshipName] = this.unwrapData(resource);
112
+ result.relationships[relationshipName].data = result[relationshipName];
113
+ }
114
+ }
115
+ }
116
+
117
+ try {
118
+ JSON.stringify(structuredClone(result));
119
+ } catch (e) {
120
+ return null;
121
+ }
122
+ return structuredClone(result);
123
+ }
124
+ }
@@ -0,0 +1,9 @@
1
+ /* add css module styles here (optional) */
2
+
3
+ .test {
4
+ margin: 2em;
5
+ padding: 0.5em;
6
+ border: 2px solid #000;
7
+ font-size: 2em;
8
+ text-align: center;
9
+ }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ApiLogicServer
3
- Version: 15.0.20
3
+ Version: 15.0.23
4
4
  Author-email: Val Huber <apilogicserver@gmail.com>
5
5
  License: BSD-3-Clause
6
6
  Project-URL: Homepage, https://www.genai-logic.com
@@ -1,6 +1,6 @@
1
1
  api_logic_server_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- api_logic_server_cli/api_logic_server.py,sha256=odfTuoa5G1UhbXUX2w6ncwBoeTq8A3z2iIJaVjl3vJE,96357
3
- api_logic_server_cli/api_logic_server_info.yaml,sha256=3gmA9nbJa0v4WDFNefQrtAd4XrM7-EuQ2F7F7KRkjRs,128
2
+ api_logic_server_cli/api_logic_server.py,sha256=fU5lBs9fB7FoO7xp4haYugQK_k8Wa25SxEtlHlvUqls,96379
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
6
6
  api_logic_server_cli/cli_args_project.py,sha256=I5no_fGRV_ZsK3SuttVDAaQYI4Q5zCjx6LojGkM024w,4645
@@ -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=L_9vFXS1VqNiX2TOJGbYLPDoo5d-BxfF9Zky0jrZRc4,7607
479
+ api_logic_server_cli/genai/genai_admin_app.py,sha256=Za05GVi_lQHW5n6D_jPcJQ4f4A_MUqOBLODmDXGno7Y,9603
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
@@ -1210,13 +1210,17 @@ api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv-
1210
1210
  api_logic_server_cli/prototypes/manager/system/app_model_editor/venv_setup/venv.ps1,sha256=_-LfKkLw5HOkZsF59BGCqM9Zsk3n1oDIyDb4emy0O08,698
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
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Learning-Prompt.md,sha256=eDoJYVwWEOpIO8xFpXL0_1mNZqC5M1zneTWejqC9Yj4,4920
1213
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-Resource-Learning-Prompt.md,sha256=VzsqOAnN6cOCWmPtVObNy9VgptJIy88sfOFIa5bgcqw,3562
1214
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-App-js-Learning-Prompt.md,sha256=75FA3txqJ1viIyqt9O6nGpi17As7aSgVyUJ1rImriKc,2054
1215
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-config-prompt.md,sha256=fyP8X1q9tM3i6bTVioa7ieM_aTUfk4GPo08aOWZ60-0,932
1216
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/Admin-json-api-model-prompt.md,sha256=5Zp9q_lpY225qceQ3UhF4Fyd-85hDKkD-r3BWYmcs6Y,2890
1214
1217
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/notes.md,sha256=0m0eGWrmznV8s6Z0pegSrceGHXs6pmdnMUK5gaHijVk,187
1218
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/app_learning/z-unused-Admin-App-Learning-Prompt.md,sha256=umbU4-AQ42dTshT3m3bmBpu2omYb1eYfT40VCDsuVmc,5297
1215
1219
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/.DS_Store,sha256=AnV79PLm6F_E6PkLoTv-GaJZpUGP_xdRkNEqrAYGYuE,6148
1216
1220
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/README.md,sha256=XZWAqxnRWxZ1yVS65g3j6etrcdxX1QDf2TZSms67Yd0,489
1217
1221
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/README_create_react_app.md,sha256=cOr7x6X9RmqjITtafhsqQTg8vl1Ob8X0WC78WL21CdE,3359
1218
1222
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package-lock.json,sha256=dG1s4WtUFp0ZhVWGwp_Ocv-Ii2c92Xb4FWqHFc0m7KU,698058
1219
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json,sha256=-Xyjx9cCemvi7aHvmakLl-5Or95Q7qpGXw1KSnR64RE,1024
1223
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/package.json,sha256=6_nHZ8UzSaDWUPv6DyGJ3QAO392tc2rc8JPOp7V7gz4,1114
1220
1224
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/favicon.ico,sha256=PRD32mxgMXg0AIFmjErFs66XQ8qaJiqw_NMS-7n0i90,3870
1221
1225
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/index.html,sha256=IK_Be2NYv99ddFEyJc1Kc0Q_oL0VuUSvceFD9pSlz3w,1721
1222
1226
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/public/logo192.png,sha256=w4Y5bscNs2CAdbX7-qxKscyqhroFpoqzk-xVHrZsPgA,5347
@@ -1226,12 +1230,26 @@ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-t
1226
1230
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/App.css,sha256=xaxC5Wv4w063QddSvIeRRPGG18oKSPy7c7lnF396kkA,564
1227
1231
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/App.js,sha256=4UQ6vsIP493EBI4NokLvZilWwr24rjnZyx55KcHkXTA,528
1228
1232
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/App.test.js,sha256=93hGkxlLhlfRv3DDfqcPSi1pTEVm7EFVCo5lDrYAqqQ,246
1229
- api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/dataProvider.js,sha256=IImP6XdWjswfamiD4JmV_Cl8yEJTAM06ABXcn4NmzyQ,3289
1233
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/Config.js,sha256=c2H9MMc3h2STlHPfjFRnu1FR-drNTRKzC8zVeZk7UkI,15025
1234
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/app_loader.js,sha256=Q_7ZzwnFdK-yjPC_SBLvXoZnckWNgl7b_QZ-D2Nhq4I,791
1230
1235
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/index.css,sha256=2vIsKWyAHT1TMIM2HMWfvcIuW_5SiqS60Zc7VMxUSKQ,366
1231
1236
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/index.js,sha256=OfaJG-vOhWzmBOpFDwis4m-huTFBWYWIH7syP2O6Jvs,535
1232
1237
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/logo.svg,sha256=YACw6bCwWz8RLeBPDQOXaKHbY1iP-bbvcJnb1xYy84M,2632
1233
1238
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/reportWebVitals.js,sha256=cUhRZphWFSgGwon5qsYkC0FLusUMYO5PfmJH8x6sDBw,362
1234
1239
  api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/setupTests.js,sha256=Ilg3WdAEX9-NYsnbCqy6n9i93eecZxqgjJfc_U6TDMY,241
1240
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/.eslintrc,sha256=t-c1eTha4RlY0Hj-ZMVVOJeylWuhxL4EeYPQSOPmn7M,36
1241
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/.yarnrc.yml,sha256=DxEgU1XD47JdoQr-a4zIOlcG5yaWPbDY83m1CAdEkBM,119
1242
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/default-settings.js,sha256=6_SFVrGh7vADgTVNXWRvL5qBUTDUsjNEz_lRDtytMTU,758
1243
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/default-settings.ts,sha256=6_SFVrGh7vADgTVNXWRvL5qBUTDUsjNEz_lRDtytMTU,758
1244
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/errors.js,sha256=Z4ZMAs9yssl6O3Ua40W1TpWHb_v8Ys2B141k4QQg0Ic,2892
1245
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/errors.ts,sha256=Z4ZMAs9yssl6O3Ua40W1TpWHb_v8Ys2B141k4QQg0Ic,2892
1246
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/index.test.tsx,sha256=KNm7nE7RYvNe8hoL1FKzlzpvNCPR-rHNXnePVfJWKKg,151
1247
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/index.tsx,sha256=N2XJTsQDCHD6KQxvqbqRxTgxiXSEZDUK0JzdV8wksi4,293
1248
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/ra-jsonapi-client.js,sha256=VwwfvkCchZuPeRVF_QC_tMwpsfUIZynjI23k6MdNkf0,20598
1249
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/ra-jsonapi-client.ts,sha256=tNd_iOOOXC9xsMqkqPamxQ0IbYQxKE0Afmz67P92zWw,20608
1250
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/resourceLookup.js,sha256=nV_j3KpDeUpD8sPsGJeOqi6lUvcPbheJtLdqU5nENPs,4366
1251
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/resourceLookup.ts,sha256=FlsEiPVX_U-22glUGoscj3qcYdnfMJ_9Wa2Vi4CV2xs,4471
1252
+ api_logic_server_cli/prototypes/manager/system/genai/app_templates/react-admin-template/src/rav4-jsonapi-client/styles.module.css,sha256=AuGbjqBQu2by4z5APJvQAWk44ocrdQ9lCopqYCJXCy0,154
1235
1253
  api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_create_db.py,sha256=F9UMTYVDHVUo4lxRFDYTpLtTgHer4g65Kld-hrq8mMM,589
1236
1254
  api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_imports.py,sha256=RhXYcL1MzTlYMhwX5jLv05Wqj185fpD940oRHenRxrw,967
1237
1255
  api_logic_server_cli/prototypes/manager/system/genai/create_db_models_inserts/create_db_models_prefix.py,sha256=_rQsqDG2ieNxSsv28t7f9Z5Bs6IMASl8rVunVZIHyUk,301
@@ -2256,9 +2274,9 @@ api_logic_server_cli/tools/mini_skel/database/system/SAFRSBaseX.py,sha256=p8C7AF
2256
2274
  api_logic_server_cli/tools/mini_skel/database/system/TestDataBase.py,sha256=U02SYqThsbY5g3DX7XGaiMxjZBuOpzvtPS6RfI1WQFg,371
2257
2275
  api_logic_server_cli/tools/mini_skel/logic/declare_logic.py,sha256=fTrlHyqMeZsw_TyEXFa1VlYBL7fzjZab5ONSXO7aApo,175
2258
2276
  api_logic_server_cli/tools/mini_skel/logic/load_verify_rules.py,sha256=Rr5bySJpYCZmNPF2h-phcPJ53nAOPcT_ohZpCD93-a0,7530
2259
- apilogicserver-15.0.20.dist-info/licenses/LICENSE,sha256=67BS7VC-Z8GpaR3wijngQJkHWV04qJrwQArVgn9ldoI,1485
2260
- apilogicserver-15.0.20.dist-info/METADATA,sha256=ZkGCw_JHN9pPl5jbglZ0YqMpa8AtmD5cvblaO_GG-Gk,6553
2261
- apilogicserver-15.0.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2262
- apilogicserver-15.0.20.dist-info/entry_points.txt,sha256=KiLloZJ3c_RW-nIDqBtoE0WEsQTnZ3dELwHLWi23LMA,103
2263
- apilogicserver-15.0.20.dist-info/top_level.txt,sha256=-r0AT_GEApleihg-jIh0OMvzzc0BO1RuhhOpE91H5qI,21
2264
- apilogicserver-15.0.20.dist-info/RECORD,,
2277
+ apilogicserver-15.0.23.dist-info/licenses/LICENSE,sha256=67BS7VC-Z8GpaR3wijngQJkHWV04qJrwQArVgn9ldoI,1485
2278
+ apilogicserver-15.0.23.dist-info/METADATA,sha256=eg8g5J_kp79GVy4Ss0BHev7r7zz_5kdQTienVcNYsYU,6553
2279
+ apilogicserver-15.0.23.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
2280
+ apilogicserver-15.0.23.dist-info/entry_points.txt,sha256=KiLloZJ3c_RW-nIDqBtoE0WEsQTnZ3dELwHLWi23LMA,103
2281
+ apilogicserver-15.0.23.dist-info/top_level.txt,sha256=-r0AT_GEApleihg-jIh0OMvzzc0BO1RuhhOpE91H5qI,21
2282
+ apilogicserver-15.0.23.dist-info/RECORD,,
@@ -1,110 +0,0 @@
1
- import { fetchUtils } from 'react-admin';
2
-
3
- const apiUrl = 'http://localhost:5656/api';
4
- const httpClient = fetchUtils.fetchJson;
5
-
6
- const convertId = (record) => ({
7
- ...record.attributes,
8
- id: record.id,
9
- });
10
-
11
- export const dataProvider = {
12
- getList: async (resource, params) => {
13
- const { page, perPage } = params.pagination;
14
- const { field, order } = params.sort;
15
- const query = {
16
- [`page[number]`]: page,
17
- [`page[size]`]: perPage,
18
- [`sort`]: order === 'ASC' ? field : `-${field}`,
19
- };
20
-
21
- // Filters (e.g. filter[name]=Alice)
22
- Object.entries(params.filter || {}).forEach(([key, value]) => {
23
- query[`filter[${key}]`] = value;
24
- });
25
-
26
- const url = `${apiUrl}/${resource}?${new URLSearchParams(query).toString()}`;
27
- const { json } = await httpClient(url);
28
- return {
29
- data: json.data.map(convertId),
30
- total: json.meta?.total || json.data.length,
31
- };
32
- },
33
-
34
- getOne: async (resource, params) => {
35
- const url = `${apiUrl}/${resource}/${params.id}`;
36
- const { json } = await httpClient(url);
37
- return {
38
- data: convertId(json.data),
39
- };
40
- },
41
-
42
- getMany: async (resource, params) => {
43
- const promises = params.ids.map((id) =>
44
- httpClient(`${apiUrl}/${resource}/${id}`).then(({ json }) => convertId(json.data))
45
- );
46
- const data = await Promise.all(promises);
47
- return { data };
48
- },
49
-
50
- getManyReference: async (resource, params) => {
51
- const { page, perPage } = params.pagination;
52
- const { field, order } = params.sort;
53
- const query = {
54
- [`page[number]`]: page,
55
- [`page[size]`]: perPage,
56
- [`sort`]: order === 'ASC' ? field : `-${field}`,
57
- [`filter[${params.target}]`]: params.id,
58
- };
59
-
60
- const url = `${apiUrl}/${resource}?${new URLSearchParams(query).toString()}`;
61
- const { json } = await httpClient(url);
62
- return {
63
- data: json.data.map(convertId),
64
- total: json.meta?.total || json.data.length,
65
- };
66
- },
67
-
68
- create: async (resource, params) => {
69
- const url = `${apiUrl}/${resource}`;
70
- const body = {
71
- data: {
72
- type: resource,
73
- attributes: params.data,
74
- },
75
- };
76
- const { json } = await httpClient(url, {
77
- method: 'POST',
78
- body: JSON.stringify(body),
79
- });
80
- return {
81
- data: convertId(json.data),
82
- };
83
- },
84
-
85
- update: async (resource, params) => {
86
- const url = `${apiUrl}/${resource}/${params.id}`;
87
- const body = {
88
- data: {
89
- type: resource,
90
- id: params.id,
91
- attributes: params.data,
92
- },
93
- };
94
- const { json } = await httpClient(url, {
95
- method: 'PATCH',
96
- body: JSON.stringify(body),
97
- });
98
- return {
99
- data: convertId(json.data),
100
- };
101
- },
102
-
103
- delete: async (resource, params) => {
104
- const url = `${apiUrl}/${resource}/${params.id}`;
105
- await httpClient(url, {
106
- method: 'DELETE',
107
- });
108
- return { data: { id: params.id } };
109
- },
110
- };