@statezero/core 0.2.16 → 0.2.18
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/LICENSE +116 -116
- package/dist/adaptors/vue/composables.js +4 -4
- package/dist/cli/commands/syncActions.js +189 -189
- package/dist/cli/commands/syncModels.js +391 -391
- package/dist/core/eventReceivers.d.ts +1 -2
- package/dist/core/eventReceivers.js +16 -16
- package/dist/filtering/localFiltering.js +2 -1
- package/dist/flavours/django/f.js +1 -1
- package/dist/flavours/django/model.js +1 -1
- package/dist/flavours/django/operationFactory.d.ts +1 -1
- package/dist/flavours/django/operationFactory.js +1 -1
- package/dist/syncEngine/metrics/metricOptCalcs.js +1 -1
- package/dist/syncEngine/registries/metricRegistry.d.ts +1 -1
- package/dist/syncEngine/registries/metricRegistry.js +3 -3
- package/dist/syncEngine/stores/metricStore.d.ts +1 -1
- package/dist/syncEngine/stores/metricStore.js +1 -1
- package/dist/syncEngine/stores/operation.d.ts +1 -1
- package/dist/syncEngine/stores/operation.js +1 -1
- package/dist/syncEngine/stores/reactivity.d.ts +3 -3
- package/dist/syncEngine/stores/utils.js +1 -1
- package/dist/syncEngine/sync.d.ts +2 -1
- package/dist/syncEngine/sync.js +10 -9
- package/package.json +128 -126
- package/readme.md +210 -210
- package/dist/actions/backend1/django_app/calculate-hash.d.ts +0 -57
- package/dist/actions/backend1/django_app/calculate-hash.js +0 -80
- package/dist/actions/backend1/django_app/get-current-username.d.ts +0 -29
- package/dist/actions/backend1/django_app/get-current-username.js +0 -65
- package/dist/actions/backend1/django_app/get-server-status.d.ts +0 -38
- package/dist/actions/backend1/django_app/get-server-status.js +0 -68
- package/dist/actions/backend1/django_app/get-user-info.d.ts +0 -44
- package/dist/actions/backend1/django_app/get-user-info.js +0 -70
- package/dist/actions/backend1/django_app/index.d.ts +0 -6
- package/dist/actions/backend1/django_app/index.js +0 -6
- package/dist/actions/backend1/django_app/process-data.d.ts +0 -51
- package/dist/actions/backend1/django_app/process-data.js +0 -78
- package/dist/actions/backend1/django_app/send-notification.d.ts +0 -55
- package/dist/actions/backend1/django_app/send-notification.js +0 -81
- package/dist/actions/backend1/index.d.ts +0 -1
- package/dist/actions/backend1/index.js +0 -1
- package/dist/actions/default/django_app/calculate-hash.d.ts +0 -57
- package/dist/actions/default/django_app/calculate-hash.js +0 -80
- package/dist/actions/default/django_app/get-current-username.d.ts +0 -29
- package/dist/actions/default/django_app/get-current-username.js +0 -65
- package/dist/actions/default/django_app/get-server-status.d.ts +0 -38
- package/dist/actions/default/django_app/get-server-status.js +0 -68
- package/dist/actions/default/django_app/get-user-info.d.ts +0 -44
- package/dist/actions/default/django_app/get-user-info.js +0 -70
- package/dist/actions/default/django_app/index.d.ts +0 -6
- package/dist/actions/default/django_app/index.js +0 -6
- package/dist/actions/default/django_app/process-data.d.ts +0 -51
- package/dist/actions/default/django_app/process-data.js +0 -78
- package/dist/actions/default/django_app/send-notification.d.ts +0 -55
- package/dist/actions/default/django_app/send-notification.js +0 -81
- package/dist/actions/default/index.d.ts +0 -1
- package/dist/actions/default/index.js +0 -1
- package/dist/actions/index.d.ts +0 -1
- package/dist/actions/index.js +0 -5
- package/dist/models/backend1/django_app/comprehensivemodel.d.ts +0 -47
- package/dist/models/backend1/django_app/comprehensivemodel.js +0 -71
- package/dist/models/backend1/django_app/custompkmodel.d.ts +0 -44
- package/dist/models/backend1/django_app/custompkmodel.js +0 -69
- package/dist/models/backend1/django_app/dailyrate.d.ts +0 -47
- package/dist/models/backend1/django_app/dailyrate.js +0 -71
- package/dist/models/backend1/django_app/deepmodellevel1.d.ts +0 -47
- package/dist/models/backend1/django_app/deepmodellevel1.js +0 -72
- package/dist/models/backend1/django_app/deepmodellevel2.d.ts +0 -47
- package/dist/models/backend1/django_app/deepmodellevel2.js +0 -71
- package/dist/models/backend1/django_app/deepmodellevel3.d.ts +0 -44
- package/dist/models/backend1/django_app/deepmodellevel3.js +0 -69
- package/dist/models/backend1/django_app/dummymodel.d.ts +0 -47
- package/dist/models/backend1/django_app/dummymodel.js +0 -71
- package/dist/models/backend1/django_app/dummyrelatedmodel.d.ts +0 -44
- package/dist/models/backend1/django_app/dummyrelatedmodel.js +0 -69
- package/dist/models/backend1/django_app/filetest.d.ts +0 -44
- package/dist/models/backend1/django_app/filetest.js +0 -69
- package/dist/models/backend1/django_app/index.d.ts +0 -16
- package/dist/models/backend1/django_app/index.js +0 -16
- package/dist/models/backend1/django_app/modelwithcustompkrelation.d.ts +0 -47
- package/dist/models/backend1/django_app/modelwithcustompkrelation.js +0 -71
- package/dist/models/backend1/django_app/namefiltercustompkmodel.d.ts +0 -44
- package/dist/models/backend1/django_app/namefiltercustompkmodel.js +0 -69
- package/dist/models/backend1/django_app/order.d.ts +0 -47
- package/dist/models/backend1/django_app/order.js +0 -71
- package/dist/models/backend1/django_app/orderitem.d.ts +0 -47
- package/dist/models/backend1/django_app/orderitem.js +0 -72
- package/dist/models/backend1/django_app/product.d.ts +0 -47
- package/dist/models/backend1/django_app/product.js +0 -71
- package/dist/models/backend1/django_app/productcategory.d.ts +0 -44
- package/dist/models/backend1/django_app/productcategory.js +0 -69
- package/dist/models/backend1/django_app/rateplan.d.ts +0 -44
- package/dist/models/backend1/django_app/rateplan.js +0 -69
- package/dist/models/backend1/fileobject.d.ts +0 -4
- package/dist/models/backend1/fileobject.js +0 -9
- package/dist/models/backend1/index.d.ts +0 -2
- package/dist/models/backend1/index.js +0 -2
- package/dist/models/default/django_app/comprehensivemodel.d.ts +0 -47
- package/dist/models/default/django_app/comprehensivemodel.js +0 -71
- package/dist/models/default/django_app/custompkmodel.d.ts +0 -44
- package/dist/models/default/django_app/custompkmodel.js +0 -69
- package/dist/models/default/django_app/dailyrate.d.ts +0 -47
- package/dist/models/default/django_app/dailyrate.js +0 -71
- package/dist/models/default/django_app/deepmodellevel1.d.ts +0 -47
- package/dist/models/default/django_app/deepmodellevel1.js +0 -72
- package/dist/models/default/django_app/deepmodellevel2.d.ts +0 -47
- package/dist/models/default/django_app/deepmodellevel2.js +0 -71
- package/dist/models/default/django_app/deepmodellevel3.d.ts +0 -44
- package/dist/models/default/django_app/deepmodellevel3.js +0 -69
- package/dist/models/default/django_app/dummymodel.d.ts +0 -47
- package/dist/models/default/django_app/dummymodel.js +0 -71
- package/dist/models/default/django_app/dummyrelatedmodel.d.ts +0 -44
- package/dist/models/default/django_app/dummyrelatedmodel.js +0 -69
- package/dist/models/default/django_app/filetest.d.ts +0 -44
- package/dist/models/default/django_app/filetest.js +0 -69
- package/dist/models/default/django_app/index.d.ts +0 -16
- package/dist/models/default/django_app/index.js +0 -16
- package/dist/models/default/django_app/modelwithcustompkrelation.d.ts +0 -47
- package/dist/models/default/django_app/modelwithcustompkrelation.js +0 -71
- package/dist/models/default/django_app/namefiltercustompkmodel.d.ts +0 -44
- package/dist/models/default/django_app/namefiltercustompkmodel.js +0 -69
- package/dist/models/default/django_app/order.d.ts +0 -47
- package/dist/models/default/django_app/order.js +0 -71
- package/dist/models/default/django_app/orderitem.d.ts +0 -47
- package/dist/models/default/django_app/orderitem.js +0 -72
- package/dist/models/default/django_app/product.d.ts +0 -47
- package/dist/models/default/django_app/product.js +0 -71
- package/dist/models/default/django_app/productcategory.d.ts +0 -44
- package/dist/models/default/django_app/productcategory.js +0 -69
- package/dist/models/default/django_app/rateplan.d.ts +0 -44
- package/dist/models/default/django_app/rateplan.js +0 -69
- package/dist/models/default/fileobject.d.ts +0 -4
- package/dist/models/default/fileobject.js +0 -9
- package/dist/models/default/index.d.ts +0 -2
- package/dist/models/default/index.js +0 -2
- package/dist/models/index.d.ts +0 -1
- package/dist/models/index.js +0 -5
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated. Do not make direct changes to the file.
|
|
3
|
-
* Action: Get Current Username
|
|
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-current-username.schema.json' assert { type: 'json' };
|
|
10
|
-
/**
|
|
11
|
-
* Zod schema for the response of getCurrentUsername.
|
|
12
|
-
*/
|
|
13
|
-
export const getCurrentUsernameResponseSchema = z.object({ username: z.string(),
|
|
14
|
-
retrieved_at: z.string().datetime({ message: "Invalid ISO 8601 datetime string" }) });
|
|
15
|
-
/**
|
|
16
|
-
* Get current user's username - simple focused action
|
|
17
|
-
*
|
|
18
|
-
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
19
|
-
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
20
|
-
*/
|
|
21
|
-
export async function getCurrentUsername(axiosOverrides = {}) {
|
|
22
|
-
// Construct the data payload from the function arguments
|
|
23
|
-
const rawPayload = {};
|
|
24
|
-
// Serialize payload - handles model instances (extracts PK), files, dates, etc.
|
|
25
|
-
const payload = serializeActionPayload(rawPayload, actionSchema.input_properties);
|
|
26
|
-
const config = configInstance.getConfig();
|
|
27
|
-
const backend = config.backendConfigs['default'];
|
|
28
|
-
if (!backend) {
|
|
29
|
-
throw new Error(`No backend configuration found for key: default`);
|
|
30
|
-
}
|
|
31
|
-
const baseUrl = backend.API_URL.replace(/\/+$/, '');
|
|
32
|
-
const actionUrl = `${baseUrl}/actions/get_current_username/`;
|
|
33
|
-
const headers = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
|
|
34
|
-
try {
|
|
35
|
-
const response = await axios.post(actionUrl, payload, {
|
|
36
|
-
headers: { 'Content-Type': 'application/json', ...headers },
|
|
37
|
-
...axiosOverrides,
|
|
38
|
-
});
|
|
39
|
-
return getCurrentUsernameResponseSchema.parse(response.data);
|
|
40
|
-
}
|
|
41
|
-
catch (error) {
|
|
42
|
-
if (error instanceof z.ZodError) {
|
|
43
|
-
throw new Error(`Get Current Username failed: Invalid response from server. Details: ${error.message}`);
|
|
44
|
-
}
|
|
45
|
-
if (error.response && error.response.data) {
|
|
46
|
-
const parsedError = parseStateZeroError(error.response.data);
|
|
47
|
-
if (Error.captureStackTrace) {
|
|
48
|
-
Error.captureStackTrace(parsedError, getCurrentUsername);
|
|
49
|
-
}
|
|
50
|
-
throw parsedError;
|
|
51
|
-
}
|
|
52
|
-
else if (error.request) {
|
|
53
|
-
throw new Error(`Get Current Username failed: No response received from server.`);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
throw new Error(`Get Current Username failed: ${error.message}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export default getCurrentUsername;
|
|
61
|
-
getCurrentUsername.actionName = 'get_current_username';
|
|
62
|
-
getCurrentUsername.title = 'Get Current Username';
|
|
63
|
-
getCurrentUsername.app = 'django_app';
|
|
64
|
-
getCurrentUsername.permissions = ['IsAuthenticated'];
|
|
65
|
-
getCurrentUsername.configKey = 'default';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get server status and random data (no authentication required)
|
|
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 getServerStatus(axiosOverrides?: Object): Promise<Object>;
|
|
8
|
-
export namespace getServerStatus {
|
|
9
|
-
let actionName: string;
|
|
10
|
-
let title: string;
|
|
11
|
-
let app: string;
|
|
12
|
-
let permissions: any[];
|
|
13
|
-
let configKey: string;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Zod schema for the response of getServerStatus.
|
|
17
|
-
*/
|
|
18
|
-
export const getServerStatusResponseSchema: z.ZodObject<{
|
|
19
|
-
status: z.ZodString;
|
|
20
|
-
timestamp: z.ZodString;
|
|
21
|
-
random_number: z.ZodNumber;
|
|
22
|
-
server_info: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
23
|
-
demo_data: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
status: string;
|
|
26
|
-
timestamp: string;
|
|
27
|
-
random_number: number;
|
|
28
|
-
server_info: Record<string, any>;
|
|
29
|
-
demo_data: Record<string, any>;
|
|
30
|
-
}, {
|
|
31
|
-
status: string;
|
|
32
|
-
timestamp: string;
|
|
33
|
-
random_number: number;
|
|
34
|
-
server_info: Record<string, any>;
|
|
35
|
-
demo_data: Record<string, any>;
|
|
36
|
-
}>;
|
|
37
|
-
export default getServerStatus;
|
|
38
|
-
import { z } from 'zod';
|
|
@@ -1,68 +0,0 @@
|
|
|
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';
|
|
@@ -1,44 +0,0 @@
|
|
|
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';
|
|
@@ -1,70 +0,0 @@
|
|
|
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';
|
|
@@ -1,51 +0,0 @@
|
|
|
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';
|
|
@@ -1,78 +0,0 @@
|
|
|
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';
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Send notifications to multiple recipients
|
|
3
|
-
*
|
|
4
|
-
* @param string message - Notification message to send
|
|
5
|
-
* @param any[] recipients - List of email addresses to notify
|
|
6
|
-
* @param 'low' | 'high' priority - Notification priority level
|
|
7
|
-
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
8
|
-
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
9
|
-
*/
|
|
10
|
-
export function sendNotification(message: any, recipients: any, priority?: string, axiosOverrides?: Object): Promise<Object>;
|
|
11
|
-
export namespace sendNotification {
|
|
12
|
-
let actionName: string;
|
|
13
|
-
let title: string;
|
|
14
|
-
let app: string;
|
|
15
|
-
let permissions: string[];
|
|
16
|
-
let configKey: string;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Zod schema for the input of sendNotification.
|
|
20
|
-
* NOTE: This is an object schema for validating the data payload.
|
|
21
|
-
*/
|
|
22
|
-
export const sendNotificationInputSchema: z.ZodObject<{
|
|
23
|
-
message: z.ZodString;
|
|
24
|
-
recipients: z.ZodArray<z.ZodAny, "many">;
|
|
25
|
-
priority: z.ZodDefault<z.ZodOptional<z.ZodEnum<["low", "high"]>>>;
|
|
26
|
-
}, "strip", z.ZodTypeAny, {
|
|
27
|
-
message: string;
|
|
28
|
-
priority: "low" | "high";
|
|
29
|
-
recipients: any[];
|
|
30
|
-
}, {
|
|
31
|
-
message: string;
|
|
32
|
-
recipients: any[];
|
|
33
|
-
priority?: "low" | "high" | undefined;
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* Zod schema for the response of sendNotification.
|
|
37
|
-
*/
|
|
38
|
-
export const sendNotificationResponseSchema: z.ZodObject<{
|
|
39
|
-
success: z.ZodBoolean;
|
|
40
|
-
message_id: z.ZodString;
|
|
41
|
-
sent_to: z.ZodNumber;
|
|
42
|
-
queued_at: z.ZodString;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
success: boolean;
|
|
45
|
-
message_id: string;
|
|
46
|
-
sent_to: number;
|
|
47
|
-
queued_at: string;
|
|
48
|
-
}, {
|
|
49
|
-
success: boolean;
|
|
50
|
-
message_id: string;
|
|
51
|
-
sent_to: number;
|
|
52
|
-
queued_at: string;
|
|
53
|
-
}>;
|
|
54
|
-
export default sendNotification;
|
|
55
|
-
import { z } from 'zod';
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was auto-generated. Do not make direct changes to the file.
|
|
3
|
-
* Action: Send Notification
|
|
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 './send-notification.schema.json' assert { type: 'json' };
|
|
10
|
-
/**
|
|
11
|
-
* Zod schema for the input of sendNotification.
|
|
12
|
-
* NOTE: This is an object schema for validating the data payload.
|
|
13
|
-
*/
|
|
14
|
-
export const sendNotificationInputSchema = z.object({ message: z.string().max(500),
|
|
15
|
-
recipients: z.array(z.any()),
|
|
16
|
-
priority: z.enum(["low", "high"]).optional().default("low") });
|
|
17
|
-
/**
|
|
18
|
-
* Zod schema for the response of sendNotification.
|
|
19
|
-
*/
|
|
20
|
-
export const sendNotificationResponseSchema = z.object({ success: z.boolean(),
|
|
21
|
-
message_id: z.string(),
|
|
22
|
-
sent_to: z.number().int(),
|
|
23
|
-
queued_at: z.string().datetime({ message: "Invalid ISO 8601 datetime string" }) });
|
|
24
|
-
/**
|
|
25
|
-
* Send notifications to multiple recipients
|
|
26
|
-
*
|
|
27
|
-
* @param string message - Notification message to send
|
|
28
|
-
* @param any[] recipients - List of email addresses to notify
|
|
29
|
-
* @param 'low' | 'high' priority - Notification priority level
|
|
30
|
-
* @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
|
|
31
|
-
* @returns {Promise<Object>} A promise that resolves with the action's result.
|
|
32
|
-
*/
|
|
33
|
-
export async function sendNotification(message, recipients, priority = "low", axiosOverrides = {}) {
|
|
34
|
-
// Construct the data payload from the function arguments
|
|
35
|
-
const rawPayload = {
|
|
36
|
-
message,
|
|
37
|
-
recipients,
|
|
38
|
-
priority
|
|
39
|
-
};
|
|
40
|
-
// Serialize payload - handles model instances (extracts PK), files, dates, etc.
|
|
41
|
-
const payload = serializeActionPayload(rawPayload, actionSchema.input_properties);
|
|
42
|
-
const config = configInstance.getConfig();
|
|
43
|
-
const backend = config.backendConfigs['default'];
|
|
44
|
-
if (!backend) {
|
|
45
|
-
throw new Error(`No backend configuration found for key: default`);
|
|
46
|
-
}
|
|
47
|
-
const baseUrl = backend.API_URL.replace(/\/+$/, '');
|
|
48
|
-
const actionUrl = `${baseUrl}/actions/send_notification/`;
|
|
49
|
-
const headers = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
|
|
50
|
-
try {
|
|
51
|
-
const response = await axios.post(actionUrl, payload, {
|
|
52
|
-
headers: { 'Content-Type': 'application/json', ...headers },
|
|
53
|
-
...axiosOverrides,
|
|
54
|
-
});
|
|
55
|
-
return sendNotificationResponseSchema.parse(response.data);
|
|
56
|
-
}
|
|
57
|
-
catch (error) {
|
|
58
|
-
if (error instanceof z.ZodError) {
|
|
59
|
-
throw new Error(`Send Notification failed: Invalid response from server. Details: ${error.message}`);
|
|
60
|
-
}
|
|
61
|
-
if (error.response && error.response.data) {
|
|
62
|
-
const parsedError = parseStateZeroError(error.response.data);
|
|
63
|
-
if (Error.captureStackTrace) {
|
|
64
|
-
Error.captureStackTrace(parsedError, sendNotification);
|
|
65
|
-
}
|
|
66
|
-
throw parsedError;
|
|
67
|
-
}
|
|
68
|
-
else if (error.request) {
|
|
69
|
-
throw new Error(`Send Notification failed: No response received from server.`);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
throw new Error(`Send Notification failed: ${error.message}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
export default sendNotification;
|
|
77
|
-
sendNotification.actionName = 'send_notification';
|
|
78
|
-
sendNotification.title = 'Send Notification';
|
|
79
|
-
sendNotification.app = 'django_app';
|
|
80
|
-
sendNotification.permissions = ['CanSendNotifications'];
|
|
81
|
-
sendNotification.configKey = 'default';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./django_app";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './django_app';
|
package/dist/actions/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./default/index";
|
package/dist/actions/index.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Model-specific QuerySet implementation
|
|
3
|
-
*/
|
|
4
|
-
export class ComprehensiveModelQuerySet extends QuerySet<any> {
|
|
5
|
-
constructor(ModelClass: ModelConstructor, config?: {
|
|
6
|
-
nodes?: QueryNode[] | undefined;
|
|
7
|
-
orderBy?: {
|
|
8
|
-
field: string;
|
|
9
|
-
direction: "asc" | "desc";
|
|
10
|
-
}[] | undefined;
|
|
11
|
-
fields?: Set<string> | undefined;
|
|
12
|
-
aggregations?: Aggregation[] | undefined;
|
|
13
|
-
initialQueryset?: string | undefined;
|
|
14
|
-
serializerOptions?: SerializerOptions;
|
|
15
|
-
materialized?: boolean | undefined;
|
|
16
|
-
} | undefined, parent?: null);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Model-specific Manager implementation
|
|
20
|
-
*/
|
|
21
|
-
export class ComprehensiveModelManager extends Manager {
|
|
22
|
-
constructor(ModelClass: any);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Implementation of the ComprehensiveModel model
|
|
26
|
-
*/
|
|
27
|
-
export class ComprehensiveModel extends Model {
|
|
28
|
-
static configKey: string;
|
|
29
|
-
static modelName: string;
|
|
30
|
-
static primaryKeyField: string;
|
|
31
|
-
static objects: ComprehensiveModelManager;
|
|
32
|
-
static fields: string[];
|
|
33
|
-
static schema: any;
|
|
34
|
-
static relationshipFields: Map<string, {
|
|
35
|
-
ModelClass: () => Function | null;
|
|
36
|
-
relationshipType: string;
|
|
37
|
-
}>;
|
|
38
|
-
constructor(data: any);
|
|
39
|
-
/**
|
|
40
|
-
* Define property getters and setters for all model fields
|
|
41
|
-
* @private
|
|
42
|
-
*/
|
|
43
|
-
private _defineProperties;
|
|
44
|
-
}
|
|
45
|
-
import { QuerySet } from '../../../../src';
|
|
46
|
-
import { Manager } from '../../../../src';
|
|
47
|
-
import { Model } from '../../../../src';
|