@statezero/core 0.2.27 → 0.2.29
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.js +1 -1
- package/dist/actions/backend1/django_app/calculate-hash.schema.json +1 -1
- package/dist/actions/backend1/django_app/get-current-username.js +1 -1
- package/dist/actions/backend1/django_app/get-current-username.schema.json +1 -1
- package/dist/actions/backend1/django_app/get-user-info.js +1 -1
- package/dist/actions/backend1/django_app/get-user-info.schema.json +1 -1
- package/dist/actions/backend1/django_app/process-data.js +1 -1
- package/dist/actions/backend1/django_app/process-data.schema.json +1 -1
- package/dist/actions/backend1/django_app/send-notification.js +1 -1
- package/dist/actions/backend1/django_app/send-notification.schema.json +1 -1
- package/dist/actions/default/django_app/calculate-hash.js +1 -1
- package/dist/actions/default/django_app/calculate-hash.schema.json +1 -1
- package/dist/actions/default/django_app/get-current-username.js +1 -1
- package/dist/actions/default/django_app/get-current-username.schema.json +1 -1
- package/dist/actions/default/django_app/get-user-info.js +1 -1
- package/dist/actions/default/django_app/get-user-info.schema.json +1 -1
- package/dist/actions/default/django_app/process-data.js +1 -1
- package/dist/actions/default/django_app/process-data.schema.json +1 -1
- package/dist/actions/default/django_app/send-notification.js +1 -1
- package/dist/actions/default/django_app/send-notification.schema.json +1 -1
- package/dist/errorHandler.d.ts +21 -0
- package/dist/errorHandler.js +27 -0
- package/dist/flavours/django/errors.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -1
- package/dist/models/backend1/django_app/comprehensivemodel.schema.json +1 -1
- package/dist/models/backend1/django_app/custompkmodel.schema.json +4 -4
- package/dist/models/backend1/django_app/dailyrate.schema.json +8 -8
- package/dist/models/backend1/django_app/dummymodel.schema.json +2 -2
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.schema.json +2 -2
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.schema.json +1 -1
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.schema.json +5 -5
- package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +1 -1
- package/dist/models/backend1/django_app/namefiltercustompkmodel.schema.json +4 -4
- package/dist/models/backend1/django_app/order.schema.json +8 -8
- package/dist/models/backend1/django_app/orderitem.schema.json +1 -1
- package/dist/models/backend1/django_app/product.schema.json +9 -9
- package/dist/models/backend1/django_app/productcategory.schema.json +2 -2
- package/dist/models/backend1/django_app/rateplan.schema.json +2 -2
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +2 -2
- package/dist/models/default/django_app/comprehensivemodel.schema.json +1 -1
- package/dist/models/default/django_app/custompkmodel.schema.json +4 -4
- package/dist/models/default/django_app/dailyrate.schema.json +8 -8
- package/dist/models/default/django_app/dummymodel.schema.json +2 -2
- package/dist/models/default/django_app/m2mdepthtestlevel1.schema.json +2 -2
- package/dist/models/default/django_app/m2mdepthtestlevel2.schema.json +1 -1
- package/dist/models/default/django_app/m2mdepthtestlevel3.schema.json +5 -5
- package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +1 -1
- package/dist/models/default/django_app/namefiltercustompkmodel.schema.json +4 -4
- package/dist/models/default/django_app/order.schema.json +8 -8
- package/dist/models/default/django_app/orderitem.schema.json +1 -1
- package/dist/models/default/django_app/product.schema.json +9 -9
- package/dist/models/default/django_app/productcategory.schema.json +2 -2
- package/dist/models/default/django_app/rateplan.schema.json +2 -2
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +2 -2
- package/dist/syncEngine/registries/querysetStoreGraph.d.ts +15 -5
- package/dist/syncEngine/registries/querysetStoreGraph.js +64 -22
- package/dist/syncEngine/registries/querysetStoreRegistry.d.ts +14 -10
- package/dist/syncEngine/registries/querysetStoreRegistry.js +64 -39
- package/dist/syncEngine/stores/operationEventHandlers.js +12 -20
- package/dist/syncEngine/stores/querysetStore.d.ts +9 -11
- package/dist/syncEngine/stores/querysetStore.js +34 -100
- package/dist/syncEngine/sync.js +18 -10
- package/package.json +1 -1
|
@@ -76,5 +76,5 @@ export default calculateHash;
|
|
|
76
76
|
calculateHash.actionName = 'calculate_hash';
|
|
77
77
|
calculateHash.title = 'Calculate Hash';
|
|
78
78
|
calculateHash.app = 'django_app';
|
|
79
|
-
calculateHash.permissions = ['
|
|
79
|
+
calculateHash.permissions = ['ValidatedIsAuthenticated'];
|
|
80
80
|
calculateHash.configKey = 'backend1';
|
|
@@ -61,5 +61,5 @@ export default getCurrentUsername;
|
|
|
61
61
|
getCurrentUsername.actionName = 'get_current_username';
|
|
62
62
|
getCurrentUsername.title = 'Get Current Username';
|
|
63
63
|
getCurrentUsername.app = 'django_app';
|
|
64
|
-
getCurrentUsername.permissions = ['
|
|
64
|
+
getCurrentUsername.permissions = ['ValidatedIsAuthenticated'];
|
|
65
65
|
getCurrentUsername.configKey = 'backend1';
|
|
@@ -66,5 +66,5 @@ export default getUserInfo;
|
|
|
66
66
|
getUserInfo.actionName = 'get_user_info';
|
|
67
67
|
getUserInfo.title = 'Get User Info';
|
|
68
68
|
getUserInfo.app = 'django_app';
|
|
69
|
-
getUserInfo.permissions = ['
|
|
69
|
+
getUserInfo.permissions = ['ValidatedIsAuthenticated'];
|
|
70
70
|
getUserInfo.configKey = 'backend1';
|
|
@@ -74,5 +74,5 @@ export default processData;
|
|
|
74
74
|
processData.actionName = 'process_data';
|
|
75
75
|
processData.title = 'Process Data';
|
|
76
76
|
processData.app = 'django_app';
|
|
77
|
-
processData.permissions = ['
|
|
77
|
+
processData.permissions = ['ValidatedHasValidApiKey'];
|
|
78
78
|
processData.configKey = 'backend1';
|
|
@@ -77,5 +77,5 @@ export default sendNotification;
|
|
|
77
77
|
sendNotification.actionName = 'send_notification';
|
|
78
78
|
sendNotification.title = 'Send Notification';
|
|
79
79
|
sendNotification.app = 'django_app';
|
|
80
|
-
sendNotification.permissions = ['
|
|
80
|
+
sendNotification.permissions = ['ValidatedCanSendNotifications'];
|
|
81
81
|
sendNotification.configKey = 'backend1';
|
|
@@ -76,5 +76,5 @@ export default calculateHash;
|
|
|
76
76
|
calculateHash.actionName = 'calculate_hash';
|
|
77
77
|
calculateHash.title = 'Calculate Hash';
|
|
78
78
|
calculateHash.app = 'django_app';
|
|
79
|
-
calculateHash.permissions = ['
|
|
79
|
+
calculateHash.permissions = ['ValidatedIsAuthenticated'];
|
|
80
80
|
calculateHash.configKey = 'default';
|
|
@@ -61,5 +61,5 @@ export default getCurrentUsername;
|
|
|
61
61
|
getCurrentUsername.actionName = 'get_current_username';
|
|
62
62
|
getCurrentUsername.title = 'Get Current Username';
|
|
63
63
|
getCurrentUsername.app = 'django_app';
|
|
64
|
-
getCurrentUsername.permissions = ['
|
|
64
|
+
getCurrentUsername.permissions = ['ValidatedIsAuthenticated'];
|
|
65
65
|
getCurrentUsername.configKey = 'default';
|
|
@@ -66,5 +66,5 @@ export default getUserInfo;
|
|
|
66
66
|
getUserInfo.actionName = 'get_user_info';
|
|
67
67
|
getUserInfo.title = 'Get User Info';
|
|
68
68
|
getUserInfo.app = 'django_app';
|
|
69
|
-
getUserInfo.permissions = ['
|
|
69
|
+
getUserInfo.permissions = ['ValidatedIsAuthenticated'];
|
|
70
70
|
getUserInfo.configKey = 'default';
|
|
@@ -74,5 +74,5 @@ export default processData;
|
|
|
74
74
|
processData.actionName = 'process_data';
|
|
75
75
|
processData.title = 'Process Data';
|
|
76
76
|
processData.app = 'django_app';
|
|
77
|
-
processData.permissions = ['
|
|
77
|
+
processData.permissions = ['ValidatedHasValidApiKey'];
|
|
78
78
|
processData.configKey = 'default';
|
|
@@ -77,5 +77,5 @@ export default sendNotification;
|
|
|
77
77
|
sendNotification.actionName = 'send_notification';
|
|
78
78
|
sendNotification.title = 'Send Notification';
|
|
79
79
|
sendNotification.app = 'django_app';
|
|
80
|
-
sendNotification.permissions = ['
|
|
80
|
+
sendNotification.permissions = ['ValidatedCanSendNotifications'];
|
|
81
81
|
sendNotification.configKey = 'default';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register a global error handler for StateZero errors.
|
|
3
|
+
* Errors still propagate to call sites - this is for side effects like toasts.
|
|
4
|
+
*
|
|
5
|
+
* @param {Function} handler - Callback receiving the error
|
|
6
|
+
* @returns {Function} Unsubscribe function
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // In a Vue component with access to toast
|
|
10
|
+
* const unsubscribe = onStateZeroError((error) => {
|
|
11
|
+
* toast.error(error.message)
|
|
12
|
+
* })
|
|
13
|
+
* onUnmounted(() => unsubscribe())
|
|
14
|
+
*/
|
|
15
|
+
export function onStateZeroError(handler: Function): Function;
|
|
16
|
+
/**
|
|
17
|
+
* Emit an error to all registered handlers.
|
|
18
|
+
* @param {Error} error - The error that occurred
|
|
19
|
+
*/
|
|
20
|
+
export function emitError(error: Error): void;
|
|
21
|
+
export const errorEmitter: any;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import mitt from 'mitt';
|
|
2
|
+
export const errorEmitter = mitt();
|
|
3
|
+
/**
|
|
4
|
+
* Register a global error handler for StateZero errors.
|
|
5
|
+
* Errors still propagate to call sites - this is for side effects like toasts.
|
|
6
|
+
*
|
|
7
|
+
* @param {Function} handler - Callback receiving the error
|
|
8
|
+
* @returns {Function} Unsubscribe function
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // In a Vue component with access to toast
|
|
12
|
+
* const unsubscribe = onStateZeroError((error) => {
|
|
13
|
+
* toast.error(error.message)
|
|
14
|
+
* })
|
|
15
|
+
* onUnmounted(() => unsubscribe())
|
|
16
|
+
*/
|
|
17
|
+
export function onStateZeroError(handler) {
|
|
18
|
+
errorEmitter.on('error', handler);
|
|
19
|
+
return () => errorEmitter.off('error', handler);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Emit an error to all registered handlers.
|
|
23
|
+
* @param {Error} error - The error that occurred
|
|
24
|
+
*/
|
|
25
|
+
export function emitError(error) {
|
|
26
|
+
errorEmitter.emit('error', error);
|
|
27
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { emitError } from '../../errorHandler.js';
|
|
1
2
|
/**
|
|
2
3
|
* @typedef {Object} IErrorResponse
|
|
3
4
|
* @property {number} status - The HTTP status code.
|
|
@@ -28,6 +29,7 @@ export class StateZeroError extends Error {
|
|
|
28
29
|
this.detail = detail;
|
|
29
30
|
this.status = status;
|
|
30
31
|
Object.setPrototypeOf(this, new.target.prototype);
|
|
32
|
+
emitError(this);
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Returns a full error message including the detail.
|
package/dist/index.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ import { setAdapters } from "./reactiveAdaptor.js";
|
|
|
37
37
|
import { wrapReactiveModel } from "./reactiveAdaptor.js";
|
|
38
38
|
import { wrapReactiveQuerySet } from "./reactiveAdaptor.js";
|
|
39
39
|
import { serializeActionPayload } from "./flavours/django/serializers.js";
|
|
40
|
-
|
|
40
|
+
import { onStateZeroError } from "./errorHandler.js";
|
|
41
|
+
export { EventType, PusherEventReceiver, setEventReceiver, getEventReceiver, setNamespaceResolver, setupStateZero, resetStateZero, FileObject, querysetStoreRegistry, modelStoreRegistry, metricRegistry, syncManager, Operation, operationRegistry, Q, StateZeroError, ValidationError, DoesNotExist, PermissionDenied, MultipleObjectsReturned, ASTValidationError, ConfigError, parseStateZeroError, QuerySet, Manager, ResultTuple, Model, setConfig, getConfig, setBackendConfig, initializeEventReceiver, configInstance, getModelClass, initEventHandler, cleanupEventHandler, setAdapters, wrapReactiveModel, wrapReactiveQuerySet, serializeActionPayload, onStateZeroError };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { setAdapters, wrapReactiveModel, wrapReactiveQuerySet, } from "./reactiv
|
|
|
20
20
|
import { syncManager } from "./syncEngine/sync.js";
|
|
21
21
|
import { initEventHandler, cleanupEventHandler, } from "./syncEngine/stores/operationEventHandlers.js";
|
|
22
22
|
import { resetStateZero } from "./reset.js";
|
|
23
|
+
import { onStateZeroError } from "./errorHandler.js";
|
|
23
24
|
// Explicitly export everything
|
|
24
25
|
export {
|
|
25
26
|
// Core event receivers
|
|
@@ -39,4 +40,6 @@ setConfig, getConfig, setBackendConfig, initializeEventReceiver, configInstance,
|
|
|
39
40
|
// Reactivity framework integration
|
|
40
41
|
initEventHandler, cleanupEventHandler, setAdapters, wrapReactiveModel, wrapReactiveQuerySet,
|
|
41
42
|
// Action utilities
|
|
42
|
-
serializeActionPayload,
|
|
43
|
+
serializeActionPayload,
|
|
44
|
+
// Error handling
|
|
45
|
+
onStateZeroError, };
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"plural_title": "Custom Pk Models",
|
|
6
6
|
"primary_key_field": "custom_pk",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"custom_pk",
|
|
9
|
+
"name"
|
|
10
10
|
],
|
|
11
11
|
"searchable_fields": [
|
|
12
12
|
"name"
|
|
13
13
|
],
|
|
14
14
|
"ordering_fields": [
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"custom_pk",
|
|
16
|
+
"name"
|
|
17
17
|
],
|
|
18
18
|
"properties": {
|
|
19
19
|
"custom_pk": {
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
"plural_title": "Daily Rates",
|
|
6
6
|
"primary_key_field": "id",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
-
"
|
|
9
|
-
"date",
|
|
10
|
-
"rate_plan",
|
|
8
|
+
"stop_sell",
|
|
11
9
|
"min_stay_arrival",
|
|
10
|
+
"id",
|
|
12
11
|
"price",
|
|
13
|
-
"max_stay",
|
|
14
12
|
"min_stay_through",
|
|
15
|
-
"
|
|
13
|
+
"rate_plan",
|
|
16
14
|
"closed_to_arrival",
|
|
17
|
-
"
|
|
15
|
+
"max_stay",
|
|
16
|
+
"closed_to_departure",
|
|
17
|
+
"date"
|
|
18
18
|
],
|
|
19
19
|
"searchable_fields": [],
|
|
20
20
|
"ordering_fields": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"date",
|
|
22
|
+
"rate_plan"
|
|
23
23
|
],
|
|
24
24
|
"properties": {
|
|
25
25
|
"id": {
|
|
@@ -5,17 +5,17 @@
|
|
|
5
5
|
"plural_title": "M2M Depth Test Level3S",
|
|
6
6
|
"primary_key_field": "id",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
-
"name",
|
|
9
8
|
"id",
|
|
10
|
-
"
|
|
11
|
-
"
|
|
9
|
+
"value",
|
|
10
|
+
"name",
|
|
11
|
+
"category"
|
|
12
12
|
],
|
|
13
13
|
"searchable_fields": [
|
|
14
14
|
"name"
|
|
15
15
|
],
|
|
16
16
|
"ordering_fields": [
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"value",
|
|
18
|
+
"name"
|
|
19
19
|
],
|
|
20
20
|
"properties": {
|
|
21
21
|
"id": {
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"plural_title": "Name Filter Custom Pk Models",
|
|
6
6
|
"primary_key_field": "custom_pk",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"custom_pk",
|
|
9
|
+
"name"
|
|
10
10
|
],
|
|
11
11
|
"searchable_fields": [
|
|
12
12
|
"name"
|
|
13
13
|
],
|
|
14
14
|
"ordering_fields": [
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"custom_pk",
|
|
16
|
+
"name"
|
|
17
17
|
],
|
|
18
18
|
"properties": {
|
|
19
19
|
"custom_pk": {
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
"plural_title": "Orders",
|
|
6
6
|
"primary_key_field": "id",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
+
"status",
|
|
9
|
+
"total",
|
|
8
10
|
"id",
|
|
9
|
-
"
|
|
11
|
+
"created_at",
|
|
10
12
|
"customer_name",
|
|
11
|
-
"
|
|
12
|
-
"order_number",
|
|
13
|
+
"customer_email",
|
|
13
14
|
"last_updated",
|
|
14
|
-
"
|
|
15
|
-
"total"
|
|
15
|
+
"order_number"
|
|
16
16
|
],
|
|
17
17
|
"searchable_fields": [
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"customer_name",
|
|
19
|
+
"order_number"
|
|
20
20
|
],
|
|
21
21
|
"ordering_fields": [
|
|
22
22
|
"created_at",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
"format": "date-time",
|
|
135
135
|
"max_length": null,
|
|
136
136
|
"choices": null,
|
|
137
|
-
"default": "2026-01-
|
|
137
|
+
"default": "2026-01-29T14:56:45.490306+00:00",
|
|
138
138
|
"validators": [],
|
|
139
139
|
"max_digits": null,
|
|
140
140
|
"decimal_places": null,
|
|
@@ -5,22 +5,22 @@
|
|
|
5
5
|
"plural_title": "Products",
|
|
6
6
|
"primary_key_field": "id",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
-
"id",
|
|
9
8
|
"name",
|
|
10
|
-
"
|
|
9
|
+
"id",
|
|
11
10
|
"price",
|
|
12
|
-
"category",
|
|
13
11
|
"created_at",
|
|
14
|
-
"
|
|
15
|
-
"in_stock"
|
|
12
|
+
"category",
|
|
13
|
+
"in_stock",
|
|
14
|
+
"description",
|
|
15
|
+
"created_by"
|
|
16
16
|
],
|
|
17
17
|
"searchable_fields": [
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"description",
|
|
19
|
+
"name"
|
|
20
20
|
],
|
|
21
21
|
"ordering_fields": [
|
|
22
|
-
"name",
|
|
23
22
|
"price",
|
|
23
|
+
"name",
|
|
24
24
|
"created_at"
|
|
25
25
|
],
|
|
26
26
|
"properties": {
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"format": "date-time",
|
|
130
130
|
"max_length": null,
|
|
131
131
|
"choices": null,
|
|
132
|
-
"default": "2026-01-
|
|
132
|
+
"default": "2026-01-29T14:56:45.488388+00:00",
|
|
133
133
|
"validators": [],
|
|
134
134
|
"max_digits": null,
|
|
135
135
|
"decimal_places": null,
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
"plural_title": "Custom Pk Models",
|
|
6
6
|
"primary_key_field": "custom_pk",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
-
"
|
|
9
|
-
"
|
|
8
|
+
"custom_pk",
|
|
9
|
+
"name"
|
|
10
10
|
],
|
|
11
11
|
"searchable_fields": [
|
|
12
12
|
"name"
|
|
13
13
|
],
|
|
14
14
|
"ordering_fields": [
|
|
15
|
-
"
|
|
16
|
-
"
|
|
15
|
+
"custom_pk",
|
|
16
|
+
"name"
|
|
17
17
|
],
|
|
18
18
|
"properties": {
|
|
19
19
|
"custom_pk": {
|
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
"plural_title": "Daily Rates",
|
|
6
6
|
"primary_key_field": "id",
|
|
7
7
|
"filterable_fields": [
|
|
8
|
-
"
|
|
9
|
-
"date",
|
|
10
|
-
"rate_plan",
|
|
8
|
+
"stop_sell",
|
|
11
9
|
"min_stay_arrival",
|
|
10
|
+
"id",
|
|
12
11
|
"price",
|
|
13
|
-
"max_stay",
|
|
14
12
|
"min_stay_through",
|
|
15
|
-
"
|
|
13
|
+
"rate_plan",
|
|
16
14
|
"closed_to_arrival",
|
|
17
|
-
"
|
|
15
|
+
"max_stay",
|
|
16
|
+
"closed_to_departure",
|
|
17
|
+
"date"
|
|
18
18
|
],
|
|
19
19
|
"searchable_fields": [],
|
|
20
20
|
"ordering_fields": [
|
|
21
|
-
"
|
|
22
|
-
"
|
|
21
|
+
"date",
|
|
22
|
+
"rate_plan"
|
|
23
23
|
],
|
|
24
24
|
"properties": {
|
|
25
25
|
"id": {
|