@statezero/core 0.2.22 → 0.2.25
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.
- package/dist/actions/backend1/django_app/calculate-hash.d.ts +57 -0
- package/dist/actions/backend1/django_app/calculate-hash.js +80 -0
- package/dist/actions/backend1/django_app/calculate-hash.schema.json +148 -0
- package/dist/actions/backend1/django_app/get-current-username.d.ts +29 -0
- package/dist/actions/backend1/django_app/get-current-username.js +65 -0
- package/dist/actions/backend1/django_app/get-current-username.schema.json +47 -0
- package/dist/actions/backend1/django_app/get-server-status.d.ts +38 -0
- package/dist/actions/backend1/django_app/get-server-status.js +68 -0
- package/dist/actions/backend1/django_app/get-server-status.schema.json +93 -0
- package/dist/actions/backend1/django_app/get-user-info.d.ts +44 -0
- package/dist/actions/backend1/django_app/get-user-info.js +70 -0
- package/dist/actions/backend1/django_app/get-user-info.schema.json +127 -0
- package/dist/actions/backend1/django_app/index.d.ts +1 -0
- package/dist/actions/backend1/django_app/index.js +6 -0
- package/dist/actions/backend1/django_app/process-data.d.ts +51 -0
- package/dist/actions/backend1/django_app/process-data.js +78 -0
- package/dist/actions/backend1/django_app/process-data.schema.json +117 -0
- package/dist/actions/backend1/django_app/send-notification.d.ts +55 -0
- package/dist/actions/backend1/django_app/send-notification.js +81 -0
- package/dist/actions/backend1/django_app/send-notification.schema.json +175 -0
- package/dist/actions/backend1/index.d.ts +1 -0
- package/dist/actions/backend1/index.js +1 -0
- package/dist/actions/default/django_app/calculate-hash.d.ts +57 -0
- package/dist/actions/default/django_app/calculate-hash.js +80 -0
- package/dist/actions/default/django_app/calculate-hash.schema.json +148 -0
- package/dist/actions/default/django_app/get-current-username.d.ts +29 -0
- package/dist/actions/default/django_app/get-current-username.js +65 -0
- package/dist/actions/default/django_app/get-current-username.schema.json +47 -0
- package/dist/actions/default/django_app/get-server-status.d.ts +38 -0
- package/dist/actions/default/django_app/get-server-status.js +68 -0
- package/dist/actions/default/django_app/get-server-status.schema.json +93 -0
- package/dist/actions/default/django_app/get-user-info.d.ts +44 -0
- package/dist/actions/default/django_app/get-user-info.js +70 -0
- package/dist/actions/default/django_app/get-user-info.schema.json +127 -0
- package/dist/actions/default/django_app/index.d.ts +1 -0
- package/dist/actions/default/django_app/index.js +6 -0
- package/dist/actions/default/django_app/process-data.d.ts +51 -0
- package/dist/actions/default/django_app/process-data.js +78 -0
- package/dist/actions/default/django_app/process-data.schema.json +117 -0
- package/dist/actions/default/django_app/send-notification.d.ts +55 -0
- package/dist/actions/default/django_app/send-notification.js +81 -0
- package/dist/actions/default/django_app/send-notification.schema.json +175 -0
- package/dist/actions/default/index.d.ts +1 -0
- package/dist/actions/default/index.js +1 -0
- package/dist/actions/index.d.ts +1 -0
- package/dist/actions/index.js +5 -0
- package/dist/filtering/localFiltering.d.ts +1 -8
- package/dist/filtering/localFiltering.js +123 -47
- package/dist/flavours/django/dates.js +4 -1
- package/dist/flavours/django/serializers.js +8 -4
- package/dist/models/backend1/django_app/comprehensivemodel.d.ts +894 -0
- package/dist/models/backend1/django_app/comprehensivemodel.js +71 -0
- package/dist/models/backend1/django_app/comprehensivemodel.schema.json +870 -0
- package/dist/models/backend1/django_app/custompkmodel.d.ts +92 -0
- package/dist/models/backend1/django_app/custompkmodel.js +69 -0
- package/dist/models/backend1/django_app/custompkmodel.schema.json +71 -0
- package/dist/models/backend1/django_app/dailyrate.d.ts +230 -0
- package/dist/models/backend1/django_app/dailyrate.js +71 -0
- package/dist/models/backend1/django_app/dailyrate.schema.json +212 -0
- package/dist/models/backend1/django_app/deepmodellevel1.d.ts +140 -0
- package/dist/models/backend1/django_app/deepmodellevel1.js +72 -0
- package/dist/models/backend1/django_app/deepmodellevel1.schema.json +114 -0
- package/dist/models/backend1/django_app/deepmodellevel2.d.ts +118 -0
- package/dist/models/backend1/django_app/deepmodellevel2.js +71 -0
- package/dist/models/backend1/django_app/deepmodellevel2.schema.json +92 -0
- package/dist/models/backend1/django_app/deepmodellevel3.d.ts +92 -0
- package/dist/models/backend1/django_app/deepmodellevel3.js +69 -0
- package/dist/models/backend1/django_app/deepmodellevel3.schema.json +69 -0
- package/dist/models/backend1/django_app/dummymodel.d.ts +134 -0
- package/dist/models/backend1/django_app/dummymodel.js +71 -0
- package/dist/models/backend1/django_app/dummymodel.schema.json +109 -0
- package/dist/models/backend1/django_app/dummyrelatedmodel.d.ts +92 -0
- package/dist/models/backend1/django_app/dummyrelatedmodel.js +69 -0
- package/dist/models/backend1/django_app/dummyrelatedmodel.schema.json +69 -0
- package/dist/models/backend1/django_app/filetest.d.ts +140 -0
- package/dist/models/backend1/django_app/filetest.js +69 -0
- package/dist/models/backend1/django_app/filetest.schema.json +111 -0
- package/dist/models/backend1/django_app/index.d.ts +1 -0
- package/dist/models/backend1/django_app/index.js +21 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.d.ts +118 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.js +71 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.schema.json +94 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.d.ts +118 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.js +71 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.schema.json +94 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.d.ts +134 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.js +71 -0
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.schema.json +112 -0
- package/dist/models/backend1/django_app/modelwithcustompkrelation.d.ts +118 -0
- package/dist/models/backend1/django_app/modelwithcustompkrelation.js +71 -0
- package/dist/models/backend1/django_app/modelwithcustompkrelation.schema.json +93 -0
- package/dist/models/backend1/django_app/modelwithrestrictedfields.d.ts +134 -0
- package/dist/models/backend1/django_app/modelwithrestrictedfields.js +71 -0
- package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +111 -0
- package/dist/models/backend1/django_app/namefiltercustompkmodel.d.ts +92 -0
- package/dist/models/backend1/django_app/namefiltercustompkmodel.js +69 -0
- package/dist/models/backend1/django_app/namefiltercustompkmodel.schema.json +71 -0
- package/dist/models/backend1/django_app/order.d.ts +220 -0
- package/dist/models/backend1/django_app/order.js +71 -0
- package/dist/models/backend1/django_app/order.schema.json +203 -0
- package/dist/models/backend1/django_app/orderitem.d.ts +172 -0
- package/dist/models/backend1/django_app/orderitem.js +72 -0
- package/dist/models/backend1/django_app/orderitem.schema.json +149 -0
- package/dist/models/backend1/django_app/product.d.ts +254 -0
- package/dist/models/backend1/django_app/product.js +71 -0
- package/dist/models/backend1/django_app/product.schema.json +277 -0
- package/dist/models/backend1/django_app/productcategory.d.ts +92 -0
- package/dist/models/backend1/django_app/productcategory.js +69 -0
- package/dist/models/backend1/django_app/productcategory.schema.json +70 -0
- package/dist/models/backend1/django_app/rateplan.d.ts +92 -0
- package/dist/models/backend1/django_app/rateplan.js +69 -0
- package/dist/models/backend1/django_app/rateplan.schema.json +70 -0
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.d.ts +108 -0
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.js +69 -0
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +87 -0
- package/dist/models/backend1/fileobject.d.ts +4 -0
- package/dist/models/backend1/fileobject.js +9 -0
- package/dist/models/backend1/index.d.ts +2 -0
- package/dist/models/backend1/index.js +2 -0
- package/dist/models/default/django_app/comprehensivemodel.d.ts +894 -0
- package/dist/models/default/django_app/comprehensivemodel.js +71 -0
- package/dist/models/default/django_app/comprehensivemodel.schema.json +870 -0
- package/dist/models/default/django_app/custompkmodel.d.ts +92 -0
- package/dist/models/default/django_app/custompkmodel.js +69 -0
- package/dist/models/default/django_app/custompkmodel.schema.json +71 -0
- package/dist/models/default/django_app/dailyrate.d.ts +230 -0
- package/dist/models/default/django_app/dailyrate.js +71 -0
- package/dist/models/default/django_app/dailyrate.schema.json +212 -0
- package/dist/models/default/django_app/deepmodellevel1.d.ts +128 -0
- package/dist/models/default/django_app/deepmodellevel1.js +72 -0
- package/dist/models/default/django_app/deepmodellevel1.schema.json +102 -0
- package/dist/models/default/django_app/deepmodellevel2.d.ts +106 -0
- package/dist/models/default/django_app/deepmodellevel2.js +71 -0
- package/dist/models/default/django_app/deepmodellevel2.schema.json +80 -0
- package/dist/models/default/django_app/deepmodellevel3.d.ts +80 -0
- package/dist/models/default/django_app/deepmodellevel3.js +69 -0
- package/dist/models/default/django_app/deepmodellevel3.schema.json +57 -0
- package/dist/models/default/django_app/dummymodel.d.ts +122 -0
- package/dist/models/default/django_app/dummymodel.js +71 -0
- package/dist/models/default/django_app/dummymodel.schema.json +97 -0
- package/dist/models/default/django_app/dummyrelatedmodel.d.ts +80 -0
- package/dist/models/default/django_app/dummyrelatedmodel.js +69 -0
- package/dist/models/default/django_app/dummyrelatedmodel.schema.json +57 -0
- package/dist/models/default/django_app/filetest.d.ts +128 -0
- package/dist/models/default/django_app/filetest.js +69 -0
- package/dist/models/default/django_app/filetest.schema.json +99 -0
- package/dist/models/default/django_app/index.d.ts +1 -0
- package/dist/models/default/django_app/index.js +21 -0
- package/dist/models/default/django_app/m2mdepthtestlevel1.d.ts +118 -0
- package/dist/models/default/django_app/m2mdepthtestlevel1.js +71 -0
- package/dist/models/default/django_app/m2mdepthtestlevel1.schema.json +94 -0
- package/dist/models/default/django_app/m2mdepthtestlevel2.d.ts +118 -0
- package/dist/models/default/django_app/m2mdepthtestlevel2.js +71 -0
- package/dist/models/default/django_app/m2mdepthtestlevel2.schema.json +94 -0
- package/dist/models/default/django_app/m2mdepthtestlevel3.d.ts +134 -0
- package/dist/models/default/django_app/m2mdepthtestlevel3.js +71 -0
- package/dist/models/default/django_app/m2mdepthtestlevel3.schema.json +112 -0
- package/dist/models/default/django_app/modelwithcustompkrelation.d.ts +118 -0
- package/dist/models/default/django_app/modelwithcustompkrelation.js +71 -0
- package/dist/models/default/django_app/modelwithcustompkrelation.schema.json +93 -0
- package/dist/models/default/django_app/modelwithrestrictedfields.d.ts +134 -0
- package/dist/models/default/django_app/modelwithrestrictedfields.js +71 -0
- package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +111 -0
- package/dist/models/default/django_app/namefiltercustompkmodel.d.ts +92 -0
- package/dist/models/default/django_app/namefiltercustompkmodel.js +69 -0
- package/dist/models/default/django_app/namefiltercustompkmodel.schema.json +71 -0
- package/dist/models/default/django_app/order.d.ts +220 -0
- package/dist/models/default/django_app/order.js +71 -0
- package/dist/models/default/django_app/order.schema.json +203 -0
- package/dist/models/default/django_app/orderitem.d.ts +172 -0
- package/dist/models/default/django_app/orderitem.js +72 -0
- package/dist/models/default/django_app/orderitem.schema.json +149 -0
- package/dist/models/default/django_app/product.d.ts +254 -0
- package/dist/models/default/django_app/product.js +71 -0
- package/dist/models/default/django_app/product.schema.json +277 -0
- package/dist/models/default/django_app/productcategory.d.ts +92 -0
- package/dist/models/default/django_app/productcategory.js +69 -0
- package/dist/models/default/django_app/productcategory.schema.json +70 -0
- package/dist/models/default/django_app/rateplan.d.ts +92 -0
- package/dist/models/default/django_app/rateplan.js +69 -0
- package/dist/models/default/django_app/rateplan.schema.json +70 -0
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.d.ts +108 -0
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.js +69 -0
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +87 -0
- package/dist/models/default/fileobject.d.ts +4 -0
- package/dist/models/default/fileobject.js +9 -0
- package/dist/models/default/index.d.ts +2 -0
- package/dist/models/default/index.js +2 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.js +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated. Do not make direct changes to the file.
|
|
3
|
+
* Action: Get Server Status
|
|
4
|
+
* App: django_app
|
|
5
|
+
*/
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { configInstance, parseStateZeroError, serializeActionPayload } from '../../../../src';
|
|
9
|
+
import actionSchema from './get-server-status.schema.json' assert { type: 'json' };
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for the response of getServerStatus.
|
|
12
|
+
*/
|
|
13
|
+
export const getServerStatusResponseSchema = z.object({ status: z.string(),
|
|
14
|
+
timestamp: z.string().datetime({ message: "Invalid ISO 8601 datetime string" }),
|
|
15
|
+
random_number: z.number().int(),
|
|
16
|
+
server_info: z.record(z.any()),
|
|
17
|
+
demo_data: z.record(z.any()) });
|
|
18
|
+
/**
|
|
19
|
+
* Get server status and random data (no authentication required)
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
22
|
+
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
23
|
+
*/
|
|
24
|
+
export async function getServerStatus(axiosOverrides = {}) {
|
|
25
|
+
// Construct the data payload from the function arguments
|
|
26
|
+
const rawPayload = {};
|
|
27
|
+
// Serialize payload - handles model instances (extracts PK), files, dates, etc.
|
|
28
|
+
const payload = serializeActionPayload(rawPayload, actionSchema.input_properties);
|
|
29
|
+
const config = configInstance.getConfig();
|
|
30
|
+
const backend = config.backendConfigs['default'];
|
|
31
|
+
if (!backend) {
|
|
32
|
+
throw new Error(`No backend configuration found for key: default`);
|
|
33
|
+
}
|
|
34
|
+
const baseUrl = backend.API_URL.replace(/\/+$/, '');
|
|
35
|
+
const actionUrl = `${baseUrl}/actions/get_server_status/`;
|
|
36
|
+
const headers = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
|
|
37
|
+
try {
|
|
38
|
+
const response = await axios.post(actionUrl, payload, {
|
|
39
|
+
headers: { 'Content-Type': 'application/json', ...headers },
|
|
40
|
+
...axiosOverrides,
|
|
41
|
+
});
|
|
42
|
+
return getServerStatusResponseSchema.parse(response.data);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
if (error instanceof z.ZodError) {
|
|
46
|
+
throw new Error(`Get Server Status failed: Invalid response from server. Details: ${error.message}`);
|
|
47
|
+
}
|
|
48
|
+
if (error.response && error.response.data) {
|
|
49
|
+
const parsedError = parseStateZeroError(error.response.data);
|
|
50
|
+
if (Error.captureStackTrace) {
|
|
51
|
+
Error.captureStackTrace(parsedError, getServerStatus);
|
|
52
|
+
}
|
|
53
|
+
throw parsedError;
|
|
54
|
+
}
|
|
55
|
+
else if (error.request) {
|
|
56
|
+
throw new Error(`Get Server Status failed: No response received from server.`);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw new Error(`Get Server Status failed: ${error.message}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
export default getServerStatus;
|
|
64
|
+
getServerStatus.actionName = 'get_server_status';
|
|
65
|
+
getServerStatus.title = 'Get Server Status';
|
|
66
|
+
getServerStatus.app = 'django_app';
|
|
67
|
+
getServerStatus.permissions = [];
|
|
68
|
+
getServerStatus.configKey = 'default';
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action_name": "get_server_status",
|
|
3
|
+
"app": "django_app",
|
|
4
|
+
"title": "Get Server Status",
|
|
5
|
+
"docstring": "Get server status and random data (no authentication required)",
|
|
6
|
+
"class_name": "GetServerStatus",
|
|
7
|
+
"input_properties": {},
|
|
8
|
+
"response_properties": {
|
|
9
|
+
"status": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"title": "Status",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": null,
|
|
14
|
+
"nullable": false,
|
|
15
|
+
"format": null,
|
|
16
|
+
"max_length": null,
|
|
17
|
+
"choices": null,
|
|
18
|
+
"default": null,
|
|
19
|
+
"validators": [],
|
|
20
|
+
"max_digits": null,
|
|
21
|
+
"decimal_places": null,
|
|
22
|
+
"read_only": false,
|
|
23
|
+
"ref": null
|
|
24
|
+
},
|
|
25
|
+
"timestamp": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"title": "Timestamp",
|
|
28
|
+
"required": true,
|
|
29
|
+
"description": null,
|
|
30
|
+
"nullable": false,
|
|
31
|
+
"format": "date-time",
|
|
32
|
+
"max_length": null,
|
|
33
|
+
"choices": null,
|
|
34
|
+
"default": null,
|
|
35
|
+
"validators": [],
|
|
36
|
+
"max_digits": null,
|
|
37
|
+
"decimal_places": null,
|
|
38
|
+
"read_only": false,
|
|
39
|
+
"ref": null
|
|
40
|
+
},
|
|
41
|
+
"random_number": {
|
|
42
|
+
"type": "integer",
|
|
43
|
+
"title": "Random number",
|
|
44
|
+
"required": true,
|
|
45
|
+
"description": null,
|
|
46
|
+
"nullable": false,
|
|
47
|
+
"format": null,
|
|
48
|
+
"max_length": null,
|
|
49
|
+
"choices": null,
|
|
50
|
+
"default": null,
|
|
51
|
+
"validators": [],
|
|
52
|
+
"max_digits": null,
|
|
53
|
+
"decimal_places": null,
|
|
54
|
+
"read_only": false,
|
|
55
|
+
"ref": null
|
|
56
|
+
},
|
|
57
|
+
"server_info": {
|
|
58
|
+
"type": "object",
|
|
59
|
+
"title": "Server info",
|
|
60
|
+
"required": true,
|
|
61
|
+
"description": null,
|
|
62
|
+
"nullable": false,
|
|
63
|
+
"format": null,
|
|
64
|
+
"max_length": null,
|
|
65
|
+
"choices": null,
|
|
66
|
+
"default": null,
|
|
67
|
+
"validators": [],
|
|
68
|
+
"max_digits": null,
|
|
69
|
+
"decimal_places": null,
|
|
70
|
+
"read_only": false,
|
|
71
|
+
"ref": null
|
|
72
|
+
},
|
|
73
|
+
"demo_data": {
|
|
74
|
+
"type": "object",
|
|
75
|
+
"title": "Demo data",
|
|
76
|
+
"required": true,
|
|
77
|
+
"description": null,
|
|
78
|
+
"nullable": false,
|
|
79
|
+
"format": null,
|
|
80
|
+
"max_length": null,
|
|
81
|
+
"choices": null,
|
|
82
|
+
"default": null,
|
|
83
|
+
"validators": [],
|
|
84
|
+
"max_digits": null,
|
|
85
|
+
"decimal_places": null,
|
|
86
|
+
"read_only": false,
|
|
87
|
+
"ref": null
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"relationships": {},
|
|
91
|
+
"permissions": [],
|
|
92
|
+
"display": null
|
|
93
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get current user information (no serializers - simple action)
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
5
|
+
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
6
|
+
*/
|
|
7
|
+
export function getUserInfo(axiosOverrides?: Object): Promise<Object>;
|
|
8
|
+
export namespace getUserInfo {
|
|
9
|
+
let actionName: string;
|
|
10
|
+
let title: string;
|
|
11
|
+
let app: string;
|
|
12
|
+
let permissions: string[];
|
|
13
|
+
let configKey: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Zod schema for the response of getUserInfo.
|
|
17
|
+
*/
|
|
18
|
+
export const getUserInfoResponseSchema: z.ZodObject<{
|
|
19
|
+
username: z.ZodString;
|
|
20
|
+
email: z.ZodString;
|
|
21
|
+
is_staff: z.ZodBoolean;
|
|
22
|
+
is_superuser: z.ZodBoolean;
|
|
23
|
+
date_joined: z.ZodString;
|
|
24
|
+
last_login: z.ZodNullable<z.ZodString>;
|
|
25
|
+
server_time: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
username: string;
|
|
28
|
+
email: string;
|
|
29
|
+
is_staff: boolean;
|
|
30
|
+
is_superuser: boolean;
|
|
31
|
+
date_joined: string;
|
|
32
|
+
last_login: string | null;
|
|
33
|
+
server_time: string;
|
|
34
|
+
}, {
|
|
35
|
+
username: string;
|
|
36
|
+
email: string;
|
|
37
|
+
is_staff: boolean;
|
|
38
|
+
is_superuser: boolean;
|
|
39
|
+
date_joined: string;
|
|
40
|
+
last_login: string | null;
|
|
41
|
+
server_time: string;
|
|
42
|
+
}>;
|
|
43
|
+
export default getUserInfo;
|
|
44
|
+
import { z } from 'zod';
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated. Do not make direct changes to the file.
|
|
3
|
+
* Action: Get User Info
|
|
4
|
+
* App: django_app
|
|
5
|
+
*/
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { configInstance, parseStateZeroError, serializeActionPayload } from '../../../../src';
|
|
9
|
+
import actionSchema from './get-user-info.schema.json' assert { type: 'json' };
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for the response of getUserInfo.
|
|
12
|
+
*/
|
|
13
|
+
export const getUserInfoResponseSchema = z.object({ username: z.string(),
|
|
14
|
+
email: z.string().email(),
|
|
15
|
+
is_staff: z.boolean(),
|
|
16
|
+
is_superuser: z.boolean(),
|
|
17
|
+
date_joined: z.string().datetime({ message: "Invalid ISO 8601 datetime string" }),
|
|
18
|
+
last_login: z.string().datetime({ message: "Invalid ISO 8601 datetime string" }).nullable(),
|
|
19
|
+
server_time: z.string().datetime({ message: "Invalid ISO 8601 datetime string" }) });
|
|
20
|
+
/**
|
|
21
|
+
* Get current user information (no serializers - simple action)
|
|
22
|
+
*
|
|
23
|
+
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
24
|
+
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
25
|
+
*/
|
|
26
|
+
export async function getUserInfo(axiosOverrides = {}) {
|
|
27
|
+
// Construct the data payload from the function arguments
|
|
28
|
+
const rawPayload = {};
|
|
29
|
+
// Serialize payload - handles model instances (extracts PK), files, dates, etc.
|
|
30
|
+
const payload = serializeActionPayload(rawPayload, actionSchema.input_properties);
|
|
31
|
+
const config = configInstance.getConfig();
|
|
32
|
+
const backend = config.backendConfigs['default'];
|
|
33
|
+
if (!backend) {
|
|
34
|
+
throw new Error(`No backend configuration found for key: default`);
|
|
35
|
+
}
|
|
36
|
+
const baseUrl = backend.API_URL.replace(/\/+$/, '');
|
|
37
|
+
const actionUrl = `${baseUrl}/actions/get_user_info/`;
|
|
38
|
+
const headers = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
|
|
39
|
+
try {
|
|
40
|
+
const response = await axios.post(actionUrl, payload, {
|
|
41
|
+
headers: { 'Content-Type': 'application/json', ...headers },
|
|
42
|
+
...axiosOverrides,
|
|
43
|
+
});
|
|
44
|
+
return getUserInfoResponseSchema.parse(response.data);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
if (error instanceof z.ZodError) {
|
|
48
|
+
throw new Error(`Get User Info failed: Invalid response from server. Details: ${error.message}`);
|
|
49
|
+
}
|
|
50
|
+
if (error.response && error.response.data) {
|
|
51
|
+
const parsedError = parseStateZeroError(error.response.data);
|
|
52
|
+
if (Error.captureStackTrace) {
|
|
53
|
+
Error.captureStackTrace(parsedError, getUserInfo);
|
|
54
|
+
}
|
|
55
|
+
throw parsedError;
|
|
56
|
+
}
|
|
57
|
+
else if (error.request) {
|
|
58
|
+
throw new Error(`Get User Info failed: No response received from server.`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
throw new Error(`Get User Info failed: ${error.message}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export default getUserInfo;
|
|
66
|
+
getUserInfo.actionName = 'get_user_info';
|
|
67
|
+
getUserInfo.title = 'Get User Info';
|
|
68
|
+
getUserInfo.app = 'django_app';
|
|
69
|
+
getUserInfo.permissions = ['IsAuthenticated'];
|
|
70
|
+
getUserInfo.configKey = 'default';
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action_name": "get_user_info",
|
|
3
|
+
"app": "django_app",
|
|
4
|
+
"title": "Get User Info",
|
|
5
|
+
"docstring": "Get current user information (no serializers - simple action)",
|
|
6
|
+
"class_name": "GetUserInfo",
|
|
7
|
+
"input_properties": {},
|
|
8
|
+
"response_properties": {
|
|
9
|
+
"username": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"title": "Username",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": null,
|
|
14
|
+
"nullable": false,
|
|
15
|
+
"format": null,
|
|
16
|
+
"max_length": null,
|
|
17
|
+
"choices": null,
|
|
18
|
+
"default": null,
|
|
19
|
+
"validators": [],
|
|
20
|
+
"max_digits": null,
|
|
21
|
+
"decimal_places": null,
|
|
22
|
+
"read_only": false,
|
|
23
|
+
"ref": null
|
|
24
|
+
},
|
|
25
|
+
"email": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"title": "Email",
|
|
28
|
+
"required": true,
|
|
29
|
+
"description": null,
|
|
30
|
+
"nullable": false,
|
|
31
|
+
"format": "email",
|
|
32
|
+
"max_length": null,
|
|
33
|
+
"choices": null,
|
|
34
|
+
"default": null,
|
|
35
|
+
"validators": [],
|
|
36
|
+
"max_digits": null,
|
|
37
|
+
"decimal_places": null,
|
|
38
|
+
"read_only": false,
|
|
39
|
+
"ref": null
|
|
40
|
+
},
|
|
41
|
+
"is_staff": {
|
|
42
|
+
"type": "boolean",
|
|
43
|
+
"title": "Is staff",
|
|
44
|
+
"required": true,
|
|
45
|
+
"description": null,
|
|
46
|
+
"nullable": false,
|
|
47
|
+
"format": null,
|
|
48
|
+
"max_length": null,
|
|
49
|
+
"choices": null,
|
|
50
|
+
"default": null,
|
|
51
|
+
"validators": [],
|
|
52
|
+
"max_digits": null,
|
|
53
|
+
"decimal_places": null,
|
|
54
|
+
"read_only": false,
|
|
55
|
+
"ref": null
|
|
56
|
+
},
|
|
57
|
+
"is_superuser": {
|
|
58
|
+
"type": "boolean",
|
|
59
|
+
"title": "Is superuser",
|
|
60
|
+
"required": true,
|
|
61
|
+
"description": null,
|
|
62
|
+
"nullable": false,
|
|
63
|
+
"format": null,
|
|
64
|
+
"max_length": null,
|
|
65
|
+
"choices": null,
|
|
66
|
+
"default": null,
|
|
67
|
+
"validators": [],
|
|
68
|
+
"max_digits": null,
|
|
69
|
+
"decimal_places": null,
|
|
70
|
+
"read_only": false,
|
|
71
|
+
"ref": null
|
|
72
|
+
},
|
|
73
|
+
"date_joined": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"title": "Date joined",
|
|
76
|
+
"required": true,
|
|
77
|
+
"description": null,
|
|
78
|
+
"nullable": false,
|
|
79
|
+
"format": "date-time",
|
|
80
|
+
"max_length": null,
|
|
81
|
+
"choices": null,
|
|
82
|
+
"default": null,
|
|
83
|
+
"validators": [],
|
|
84
|
+
"max_digits": null,
|
|
85
|
+
"decimal_places": null,
|
|
86
|
+
"read_only": false,
|
|
87
|
+
"ref": null
|
|
88
|
+
},
|
|
89
|
+
"last_login": {
|
|
90
|
+
"type": "string",
|
|
91
|
+
"title": "Last login",
|
|
92
|
+
"required": true,
|
|
93
|
+
"description": null,
|
|
94
|
+
"nullable": true,
|
|
95
|
+
"format": "date-time",
|
|
96
|
+
"max_length": null,
|
|
97
|
+
"choices": null,
|
|
98
|
+
"default": null,
|
|
99
|
+
"validators": [],
|
|
100
|
+
"max_digits": null,
|
|
101
|
+
"decimal_places": null,
|
|
102
|
+
"read_only": false,
|
|
103
|
+
"ref": null
|
|
104
|
+
},
|
|
105
|
+
"server_time": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"title": "Server time",
|
|
108
|
+
"required": true,
|
|
109
|
+
"description": null,
|
|
110
|
+
"nullable": false,
|
|
111
|
+
"format": "date-time",
|
|
112
|
+
"max_length": null,
|
|
113
|
+
"choices": null,
|
|
114
|
+
"default": null,
|
|
115
|
+
"validators": [],
|
|
116
|
+
"max_digits": null,
|
|
117
|
+
"decimal_places": null,
|
|
118
|
+
"read_only": false,
|
|
119
|
+
"ref": null
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"relationships": {},
|
|
123
|
+
"permissions": [
|
|
124
|
+
"IsAuthenticated"
|
|
125
|
+
],
|
|
126
|
+
"display": null
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process a list of numbers with various mathematical operations
|
|
3
|
+
*
|
|
4
|
+
* @param any[] data - List of numbers to process
|
|
5
|
+
* @param 'sum' | 'avg' | 'max' | 'min' operation - Mathematical operation to perform
|
|
6
|
+
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
7
|
+
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
8
|
+
*/
|
|
9
|
+
export function processData(data: any, operation: any, axiosOverrides?: Object): Promise<Object>;
|
|
10
|
+
export namespace processData {
|
|
11
|
+
let actionName: string;
|
|
12
|
+
let title: string;
|
|
13
|
+
let app: string;
|
|
14
|
+
let permissions: string[];
|
|
15
|
+
let configKey: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Zod schema for the input of processData.
|
|
19
|
+
* NOTE: This is an object schema for validating the data payload.
|
|
20
|
+
*/
|
|
21
|
+
export const processDataInputSchema: z.ZodObject<{
|
|
22
|
+
data: z.ZodArray<z.ZodAny, "many">;
|
|
23
|
+
operation: z.ZodEnum<["sum", "avg", "max", "min"]>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
data: any[];
|
|
26
|
+
operation: "min" | "max" | "avg" | "sum";
|
|
27
|
+
}, {
|
|
28
|
+
data: any[];
|
|
29
|
+
operation: "min" | "max" | "avg" | "sum";
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Zod schema for the response of processData.
|
|
33
|
+
*/
|
|
34
|
+
export const processDataResponseSchema: z.ZodObject<{
|
|
35
|
+
operation: z.ZodString;
|
|
36
|
+
result: z.ZodNumber;
|
|
37
|
+
processed_count: z.ZodNumber;
|
|
38
|
+
execution_time_ms: z.ZodNumber;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
operation: string;
|
|
41
|
+
result: number;
|
|
42
|
+
processed_count: number;
|
|
43
|
+
execution_time_ms: number;
|
|
44
|
+
}, {
|
|
45
|
+
operation: string;
|
|
46
|
+
result: number;
|
|
47
|
+
processed_count: number;
|
|
48
|
+
execution_time_ms: number;
|
|
49
|
+
}>;
|
|
50
|
+
export default processData;
|
|
51
|
+
import { z } from 'zod';
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated. Do not make direct changes to the file.
|
|
3
|
+
* Action: Process Data
|
|
4
|
+
* App: django_app
|
|
5
|
+
*/
|
|
6
|
+
import axios from 'axios';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { configInstance, parseStateZeroError, serializeActionPayload } from '../../../../src';
|
|
9
|
+
import actionSchema from './process-data.schema.json' assert { type: 'json' };
|
|
10
|
+
/**
|
|
11
|
+
* Zod schema for the input of processData.
|
|
12
|
+
* NOTE: This is an object schema for validating the data payload.
|
|
13
|
+
*/
|
|
14
|
+
export const processDataInputSchema = z.object({ data: z.array(z.any()),
|
|
15
|
+
operation: z.enum(["sum", "avg", "max", "min"]) });
|
|
16
|
+
/**
|
|
17
|
+
* Zod schema for the response of processData.
|
|
18
|
+
*/
|
|
19
|
+
export const processDataResponseSchema = z.object({ operation: z.string(),
|
|
20
|
+
result: z.number(),
|
|
21
|
+
processed_count: z.number().int(),
|
|
22
|
+
execution_time_ms: z.number().int() });
|
|
23
|
+
/**
|
|
24
|
+
* Process a list of numbers with various mathematical operations
|
|
25
|
+
*
|
|
26
|
+
* @param any[] data - List of numbers to process
|
|
27
|
+
* @param 'sum' | 'avg' | 'max' | 'min' operation - Mathematical operation to perform
|
|
28
|
+
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
29
|
+
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
30
|
+
*/
|
|
31
|
+
export async function processData(data, operation, axiosOverrides = {}) {
|
|
32
|
+
// Construct the data payload from the function arguments
|
|
33
|
+
const rawPayload = {
|
|
34
|
+
data,
|
|
35
|
+
operation
|
|
36
|
+
};
|
|
37
|
+
// Serialize payload - handles model instances (extracts PK), files, dates, etc.
|
|
38
|
+
const payload = serializeActionPayload(rawPayload, actionSchema.input_properties);
|
|
39
|
+
const config = configInstance.getConfig();
|
|
40
|
+
const backend = config.backendConfigs['default'];
|
|
41
|
+
if (!backend) {
|
|
42
|
+
throw new Error(`No backend configuration found for key: default`);
|
|
43
|
+
}
|
|
44
|
+
const baseUrl = backend.API_URL.replace(/\/+$/, '');
|
|
45
|
+
const actionUrl = `${baseUrl}/actions/process_data/`;
|
|
46
|
+
const headers = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
|
|
47
|
+
try {
|
|
48
|
+
const response = await axios.post(actionUrl, payload, {
|
|
49
|
+
headers: { 'Content-Type': 'application/json', ...headers },
|
|
50
|
+
...axiosOverrides,
|
|
51
|
+
});
|
|
52
|
+
return processDataResponseSchema.parse(response.data);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
if (error instanceof z.ZodError) {
|
|
56
|
+
throw new Error(`Process Data failed: Invalid response from server. Details: ${error.message}`);
|
|
57
|
+
}
|
|
58
|
+
if (error.response && error.response.data) {
|
|
59
|
+
const parsedError = parseStateZeroError(error.response.data);
|
|
60
|
+
if (Error.captureStackTrace) {
|
|
61
|
+
Error.captureStackTrace(parsedError, processData);
|
|
62
|
+
}
|
|
63
|
+
throw parsedError;
|
|
64
|
+
}
|
|
65
|
+
else if (error.request) {
|
|
66
|
+
throw new Error(`Process Data failed: No response received from server.`);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
throw new Error(`Process Data failed: ${error.message}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
export default processData;
|
|
74
|
+
processData.actionName = 'process_data';
|
|
75
|
+
processData.title = 'Process Data';
|
|
76
|
+
processData.app = 'django_app';
|
|
77
|
+
processData.permissions = ['HasValidApiKey'];
|
|
78
|
+
processData.configKey = 'default';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action_name": "process_data",
|
|
3
|
+
"app": "django_app",
|
|
4
|
+
"title": "Process Data",
|
|
5
|
+
"docstring": "Process a list of numbers with various mathematical operations",
|
|
6
|
+
"class_name": "ProcessData",
|
|
7
|
+
"input_properties": {
|
|
8
|
+
"data": {
|
|
9
|
+
"type": "array",
|
|
10
|
+
"title": "Data",
|
|
11
|
+
"required": true,
|
|
12
|
+
"description": "List of numbers to process",
|
|
13
|
+
"nullable": false,
|
|
14
|
+
"format": null,
|
|
15
|
+
"max_length": null,
|
|
16
|
+
"choices": null,
|
|
17
|
+
"default": null,
|
|
18
|
+
"validators": [],
|
|
19
|
+
"max_digits": null,
|
|
20
|
+
"decimal_places": null,
|
|
21
|
+
"read_only": false,
|
|
22
|
+
"ref": null
|
|
23
|
+
},
|
|
24
|
+
"operation": {
|
|
25
|
+
"type": "string",
|
|
26
|
+
"title": "Operation",
|
|
27
|
+
"required": true,
|
|
28
|
+
"description": "Mathematical operation to perform",
|
|
29
|
+
"nullable": false,
|
|
30
|
+
"format": null,
|
|
31
|
+
"max_length": null,
|
|
32
|
+
"choices": {
|
|
33
|
+
"sum": "Sum",
|
|
34
|
+
"avg": "Average",
|
|
35
|
+
"max": "Maximum",
|
|
36
|
+
"min": "Minimum"
|
|
37
|
+
},
|
|
38
|
+
"default": null,
|
|
39
|
+
"validators": [],
|
|
40
|
+
"max_digits": null,
|
|
41
|
+
"decimal_places": null,
|
|
42
|
+
"read_only": false,
|
|
43
|
+
"ref": null
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"response_properties": {
|
|
47
|
+
"operation": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"title": "Operation",
|
|
50
|
+
"required": true,
|
|
51
|
+
"description": null,
|
|
52
|
+
"nullable": false,
|
|
53
|
+
"format": null,
|
|
54
|
+
"max_length": null,
|
|
55
|
+
"choices": null,
|
|
56
|
+
"default": null,
|
|
57
|
+
"validators": [],
|
|
58
|
+
"max_digits": null,
|
|
59
|
+
"decimal_places": null,
|
|
60
|
+
"read_only": false,
|
|
61
|
+
"ref": null
|
|
62
|
+
},
|
|
63
|
+
"result": {
|
|
64
|
+
"type": "number",
|
|
65
|
+
"title": "Result",
|
|
66
|
+
"required": true,
|
|
67
|
+
"description": null,
|
|
68
|
+
"nullable": false,
|
|
69
|
+
"format": null,
|
|
70
|
+
"max_length": null,
|
|
71
|
+
"choices": null,
|
|
72
|
+
"default": null,
|
|
73
|
+
"validators": [],
|
|
74
|
+
"max_digits": null,
|
|
75
|
+
"decimal_places": null,
|
|
76
|
+
"read_only": false,
|
|
77
|
+
"ref": null
|
|
78
|
+
},
|
|
79
|
+
"processed_count": {
|
|
80
|
+
"type": "integer",
|
|
81
|
+
"title": "Processed count",
|
|
82
|
+
"required": true,
|
|
83
|
+
"description": null,
|
|
84
|
+
"nullable": false,
|
|
85
|
+
"format": null,
|
|
86
|
+
"max_length": null,
|
|
87
|
+
"choices": null,
|
|
88
|
+
"default": null,
|
|
89
|
+
"validators": [],
|
|
90
|
+
"max_digits": null,
|
|
91
|
+
"decimal_places": null,
|
|
92
|
+
"read_only": false,
|
|
93
|
+
"ref": null
|
|
94
|
+
},
|
|
95
|
+
"execution_time_ms": {
|
|
96
|
+
"type": "integer",
|
|
97
|
+
"title": "Execution time ms",
|
|
98
|
+
"required": true,
|
|
99
|
+
"description": null,
|
|
100
|
+
"nullable": false,
|
|
101
|
+
"format": null,
|
|
102
|
+
"max_length": null,
|
|
103
|
+
"choices": null,
|
|
104
|
+
"default": null,
|
|
105
|
+
"validators": [],
|
|
106
|
+
"max_digits": null,
|
|
107
|
+
"decimal_places": null,
|
|
108
|
+
"read_only": false,
|
|
109
|
+
"ref": null
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"relationships": {},
|
|
113
|
+
"permissions": [
|
|
114
|
+
"HasValidApiKey"
|
|
115
|
+
],
|
|
116
|
+
"display": null
|
|
117
|
+
}
|