@statezero/core 0.2.36 ā 0.2.38
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/adaptors/vue/components/LayoutRenderer.js +166 -0
- package/dist/adaptors/vue/components/defaults/AlertElement.js +31 -0
- package/dist/adaptors/vue/components/defaults/DisplayElement.js +44 -0
- package/dist/adaptors/vue/components/defaults/DividerElement.js +10 -0
- package/dist/adaptors/vue/components/defaults/ErrorBlock.js +24 -0
- package/dist/adaptors/vue/components/defaults/GroupElement.js +41 -0
- package/dist/adaptors/vue/components/defaults/LabelElement.js +21 -0
- package/dist/adaptors/vue/components/defaults/TabsElement.js +38 -0
- package/package.json +7 -6
- 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/calculate-hash.schema.json +0 -148
- 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-current-username.schema.json +0 -47
- 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-server-status.schema.json +0 -93
- 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/get-user-info.schema.json +0 -127
- package/dist/actions/backend1/django_app/index.d.ts +0 -1
- 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/process-data.schema.json +0 -117
- 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/django_app/send-notification.schema.json +0 -175
- 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/calculate-hash.schema.json +0 -148
- 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-current-username.schema.json +0 -47
- 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-server-status.schema.json +0 -93
- 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/get-user-info.schema.json +0 -127
- package/dist/actions/default/django_app/index.d.ts +0 -1
- 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/process-data.schema.json +0 -117
- 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/django_app/send-notification.schema.json +0 -175
- 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/adaptors/react/composables.d.ts +0 -1
- package/dist/adaptors/react/composables.js +0 -4
- package/dist/adaptors/react/index.d.ts +0 -1
- package/dist/adaptors/react/index.js +0 -1
- package/dist/adaptors/vue/components/defaults/index.d.ts +0 -7
- package/dist/adaptors/vue/components/defaults/index.js +0 -31
- package/dist/adaptors/vue/components/index.d.ts +0 -1
- package/dist/adaptors/vue/components/index.js +0 -7
- package/dist/adaptors/vue/composables.d.ts +0 -2
- package/dist/adaptors/vue/composables.js +0 -44
- package/dist/adaptors/vue/index.d.ts +0 -3
- package/dist/adaptors/vue/index.js +0 -4
- package/dist/adaptors/vue/reactivity.d.ts +0 -18
- package/dist/adaptors/vue/reactivity.js +0 -132
- package/dist/cli/commands/sync.d.ts +0 -6
- package/dist/cli/commands/sync.js +0 -30
- package/dist/cli/commands/syncActions.d.ts +0 -46
- package/dist/cli/commands/syncActions.js +0 -717
- package/dist/cli/commands/syncModels.d.ts +0 -132
- package/dist/cli/commands/syncModels.js +0 -1120
- package/dist/cli/configFileLoader.d.ts +0 -10
- package/dist/cli/configFileLoader.js +0 -85
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +0 -22
- package/dist/config.d.ts +0 -57
- package/dist/config.js +0 -273
- package/dist/core/eventReceivers.d.ts +0 -185
- package/dist/core/eventReceivers.js +0 -266
- package/dist/core/utils.d.ts +0 -8
- package/dist/core/utils.js +0 -62
- package/dist/errorHandler.d.ts +0 -21
- package/dist/errorHandler.js +0 -27
- package/dist/filtering/localFiltering.d.ts +0 -110
- package/dist/filtering/localFiltering.js +0 -1080
- package/dist/flavours/django/dates.d.ts +0 -34
- package/dist/flavours/django/dates.js +0 -113
- package/dist/flavours/django/errors.d.ts +0 -138
- package/dist/flavours/django/errors.js +0 -195
- package/dist/flavours/django/f.d.ts +0 -6
- package/dist/flavours/django/f.js +0 -91
- package/dist/flavours/django/files.d.ts +0 -62
- package/dist/flavours/django/files.js +0 -355
- package/dist/flavours/django/makeApiCall.d.ts +0 -36
- package/dist/flavours/django/makeApiCall.js +0 -169
- package/dist/flavours/django/manager.d.ts +0 -204
- package/dist/flavours/django/manager.js +0 -222
- package/dist/flavours/django/model.d.ts +0 -137
- package/dist/flavours/django/model.js +0 -366
- package/dist/flavours/django/operationFactory.d.ts +0 -73
- package/dist/flavours/django/operationFactory.js +0 -248
- package/dist/flavours/django/q.d.ts +0 -70
- package/dist/flavours/django/q.js +0 -43
- package/dist/flavours/django/queryExecutor.d.ts +0 -149
- package/dist/flavours/django/queryExecutor.js +0 -590
- package/dist/flavours/django/querySet.d.ts +0 -301
- package/dist/flavours/django/querySet.js +0 -736
- package/dist/flavours/django/serializers.d.ts +0 -39
- package/dist/flavours/django/serializers.js +0 -296
- package/dist/flavours/django/tempPk.d.ts +0 -31
- package/dist/flavours/django/tempPk.js +0 -92
- package/dist/flavours/django/utils.d.ts +0 -19
- package/dist/flavours/django/utils.js +0 -29
- package/dist/index.d.ts +0 -46
- package/dist/index.js +0 -48
- package/dist/models/backend1/django_app/comprehensivemodel.d.ts +0 -894
- package/dist/models/backend1/django_app/comprehensivemodel.js +0 -71
- package/dist/models/backend1/django_app/comprehensivemodel.schema.json +0 -870
- package/dist/models/backend1/django_app/custompkmodel.d.ts +0 -92
- package/dist/models/backend1/django_app/custompkmodel.js +0 -69
- package/dist/models/backend1/django_app/custompkmodel.schema.json +0 -71
- package/dist/models/backend1/django_app/dailyrate.d.ts +0 -230
- package/dist/models/backend1/django_app/dailyrate.js +0 -71
- package/dist/models/backend1/django_app/dailyrate.schema.json +0 -212
- package/dist/models/backend1/django_app/deepmodellevel1.d.ts +0 -140
- package/dist/models/backend1/django_app/deepmodellevel1.js +0 -72
- package/dist/models/backend1/django_app/deepmodellevel1.schema.json +0 -114
- package/dist/models/backend1/django_app/deepmodellevel2.d.ts +0 -118
- package/dist/models/backend1/django_app/deepmodellevel2.js +0 -71
- package/dist/models/backend1/django_app/deepmodellevel2.schema.json +0 -92
- package/dist/models/backend1/django_app/deepmodellevel3.d.ts +0 -92
- package/dist/models/backend1/django_app/deepmodellevel3.js +0 -69
- package/dist/models/backend1/django_app/deepmodellevel3.schema.json +0 -69
- package/dist/models/backend1/django_app/dummymodel.d.ts +0 -134
- package/dist/models/backend1/django_app/dummymodel.js +0 -71
- package/dist/models/backend1/django_app/dummymodel.schema.json +0 -109
- package/dist/models/backend1/django_app/dummyrelatedmodel.d.ts +0 -92
- package/dist/models/backend1/django_app/dummyrelatedmodel.js +0 -69
- package/dist/models/backend1/django_app/dummyrelatedmodel.schema.json +0 -69
- package/dist/models/backend1/django_app/filetest.d.ts +0 -140
- package/dist/models/backend1/django_app/filetest.js +0 -69
- package/dist/models/backend1/django_app/filetest.schema.json +0 -111
- package/dist/models/backend1/django_app/index.d.ts +0 -1
- package/dist/models/backend1/django_app/index.js +0 -21
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.d.ts +0 -118
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.js +0 -71
- package/dist/models/backend1/django_app/m2mdepthtestlevel1.schema.json +0 -94
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.d.ts +0 -118
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.js +0 -71
- package/dist/models/backend1/django_app/m2mdepthtestlevel2.schema.json +0 -94
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.d.ts +0 -134
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.js +0 -71
- package/dist/models/backend1/django_app/m2mdepthtestlevel3.schema.json +0 -112
- package/dist/models/backend1/django_app/modelwithcustompkrelation.d.ts +0 -118
- package/dist/models/backend1/django_app/modelwithcustompkrelation.js +0 -71
- package/dist/models/backend1/django_app/modelwithcustompkrelation.schema.json +0 -93
- package/dist/models/backend1/django_app/modelwithrestrictedfields.d.ts +0 -134
- package/dist/models/backend1/django_app/modelwithrestrictedfields.js +0 -71
- package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +0 -111
- package/dist/models/backend1/django_app/namefiltercustompkmodel.d.ts +0 -92
- package/dist/models/backend1/django_app/namefiltercustompkmodel.js +0 -69
- package/dist/models/backend1/django_app/namefiltercustompkmodel.schema.json +0 -71
- package/dist/models/backend1/django_app/order.d.ts +0 -220
- package/dist/models/backend1/django_app/order.js +0 -71
- package/dist/models/backend1/django_app/order.schema.json +0 -203
- package/dist/models/backend1/django_app/orderitem.d.ts +0 -172
- package/dist/models/backend1/django_app/orderitem.js +0 -72
- package/dist/models/backend1/django_app/orderitem.schema.json +0 -149
- package/dist/models/backend1/django_app/product.d.ts +0 -254
- package/dist/models/backend1/django_app/product.js +0 -71
- package/dist/models/backend1/django_app/product.schema.json +0 -277
- package/dist/models/backend1/django_app/productcategory.d.ts +0 -92
- package/dist/models/backend1/django_app/productcategory.js +0 -69
- package/dist/models/backend1/django_app/productcategory.schema.json +0 -70
- package/dist/models/backend1/django_app/rateplan.d.ts +0 -92
- package/dist/models/backend1/django_app/rateplan.js +0 -69
- package/dist/models/backend1/django_app/rateplan.schema.json +0 -70
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.d.ts +0 -108
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.js +0 -69
- package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +0 -87
- 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 -894
- package/dist/models/default/django_app/comprehensivemodel.js +0 -71
- package/dist/models/default/django_app/comprehensivemodel.schema.json +0 -870
- package/dist/models/default/django_app/custompkmodel.d.ts +0 -92
- package/dist/models/default/django_app/custompkmodel.js +0 -69
- package/dist/models/default/django_app/custompkmodel.schema.json +0 -71
- package/dist/models/default/django_app/dailyrate.d.ts +0 -230
- package/dist/models/default/django_app/dailyrate.js +0 -71
- package/dist/models/default/django_app/dailyrate.schema.json +0 -212
- package/dist/models/default/django_app/deepmodellevel1.d.ts +0 -128
- package/dist/models/default/django_app/deepmodellevel1.js +0 -72
- package/dist/models/default/django_app/deepmodellevel1.schema.json +0 -102
- package/dist/models/default/django_app/deepmodellevel2.d.ts +0 -106
- package/dist/models/default/django_app/deepmodellevel2.js +0 -71
- package/dist/models/default/django_app/deepmodellevel2.schema.json +0 -80
- package/dist/models/default/django_app/deepmodellevel3.d.ts +0 -80
- package/dist/models/default/django_app/deepmodellevel3.js +0 -69
- package/dist/models/default/django_app/deepmodellevel3.schema.json +0 -57
- package/dist/models/default/django_app/dummymodel.d.ts +0 -122
- package/dist/models/default/django_app/dummymodel.js +0 -71
- package/dist/models/default/django_app/dummymodel.schema.json +0 -97
- package/dist/models/default/django_app/dummyrelatedmodel.d.ts +0 -80
- package/dist/models/default/django_app/dummyrelatedmodel.js +0 -69
- package/dist/models/default/django_app/dummyrelatedmodel.schema.json +0 -57
- package/dist/models/default/django_app/filetest.d.ts +0 -128
- package/dist/models/default/django_app/filetest.js +0 -69
- package/dist/models/default/django_app/filetest.schema.json +0 -99
- package/dist/models/default/django_app/index.d.ts +0 -1
- package/dist/models/default/django_app/index.js +0 -21
- package/dist/models/default/django_app/m2mdepthtestlevel1.d.ts +0 -118
- package/dist/models/default/django_app/m2mdepthtestlevel1.js +0 -71
- package/dist/models/default/django_app/m2mdepthtestlevel1.schema.json +0 -94
- package/dist/models/default/django_app/m2mdepthtestlevel2.d.ts +0 -118
- package/dist/models/default/django_app/m2mdepthtestlevel2.js +0 -71
- package/dist/models/default/django_app/m2mdepthtestlevel2.schema.json +0 -94
- package/dist/models/default/django_app/m2mdepthtestlevel3.d.ts +0 -134
- package/dist/models/default/django_app/m2mdepthtestlevel3.js +0 -71
- package/dist/models/default/django_app/m2mdepthtestlevel3.schema.json +0 -112
- package/dist/models/default/django_app/modelwithcustompkrelation.d.ts +0 -118
- package/dist/models/default/django_app/modelwithcustompkrelation.js +0 -71
- package/dist/models/default/django_app/modelwithcustompkrelation.schema.json +0 -93
- package/dist/models/default/django_app/modelwithrestrictedfields.d.ts +0 -134
- package/dist/models/default/django_app/modelwithrestrictedfields.js +0 -71
- package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +0 -111
- package/dist/models/default/django_app/namefiltercustompkmodel.d.ts +0 -92
- package/dist/models/default/django_app/namefiltercustompkmodel.js +0 -69
- package/dist/models/default/django_app/namefiltercustompkmodel.schema.json +0 -71
- package/dist/models/default/django_app/order.d.ts +0 -220
- package/dist/models/default/django_app/order.js +0 -71
- package/dist/models/default/django_app/order.schema.json +0 -203
- package/dist/models/default/django_app/orderitem.d.ts +0 -172
- package/dist/models/default/django_app/orderitem.js +0 -72
- package/dist/models/default/django_app/orderitem.schema.json +0 -149
- package/dist/models/default/django_app/product.d.ts +0 -254
- package/dist/models/default/django_app/product.js +0 -71
- package/dist/models/default/django_app/product.schema.json +0 -277
- package/dist/models/default/django_app/productcategory.d.ts +0 -92
- package/dist/models/default/django_app/productcategory.js +0 -69
- package/dist/models/default/django_app/productcategory.schema.json +0 -70
- package/dist/models/default/django_app/rateplan.d.ts +0 -92
- package/dist/models/default/django_app/rateplan.js +0 -69
- package/dist/models/default/django_app/rateplan.schema.json +0 -70
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.d.ts +0 -108
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.js +0 -69
- package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +0 -87
- 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
- package/dist/react-entry.d.ts +0 -2
- package/dist/react-entry.js +0 -2
- package/dist/reactiveAdaptor.d.ts +0 -24
- package/dist/reactiveAdaptor.js +0 -38
- package/dist/reset.d.ts +0 -15
- package/dist/reset.js +0 -97
- package/dist/setup.d.ts +0 -15
- package/dist/setup.js +0 -33
- package/dist/syncEngine/cache/cache.d.ts +0 -75
- package/dist/syncEngine/cache/cache.js +0 -355
- package/dist/syncEngine/metrics/metricOptCalcs.d.ts +0 -79
- package/dist/syncEngine/metrics/metricOptCalcs.js +0 -284
- package/dist/syncEngine/registries/metricRegistry.d.ts +0 -58
- package/dist/syncEngine/registries/metricRegistry.js +0 -171
- package/dist/syncEngine/registries/modelStoreRegistry.d.ts +0 -11
- package/dist/syncEngine/registries/modelStoreRegistry.js +0 -63
- package/dist/syncEngine/registries/querysetStoreGraph.d.ts +0 -41
- package/dist/syncEngine/registries/querysetStoreGraph.js +0 -174
- package/dist/syncEngine/registries/querysetStoreRegistry.d.ts +0 -72
- package/dist/syncEngine/registries/querysetStoreRegistry.js +0 -335
- package/dist/syncEngine/stores/metricStore.d.ts +0 -55
- package/dist/syncEngine/stores/metricStore.js +0 -222
- package/dist/syncEngine/stores/modelStore.d.ts +0 -53
- package/dist/syncEngine/stores/modelStore.js +0 -565
- package/dist/syncEngine/stores/operation.d.ts +0 -139
- package/dist/syncEngine/stores/operation.js +0 -291
- package/dist/syncEngine/stores/operationEventHandlers.d.ts +0 -8
- package/dist/syncEngine/stores/operationEventHandlers.js +0 -322
- package/dist/syncEngine/stores/querysetStore.d.ts +0 -60
- package/dist/syncEngine/stores/querysetStore.js +0 -294
- package/dist/syncEngine/stores/reactivity.d.ts +0 -3
- package/dist/syncEngine/stores/reactivity.js +0 -4
- package/dist/syncEngine/stores/utils.d.ts +0 -14
- package/dist/syncEngine/stores/utils.js +0 -32
- package/dist/syncEngine/sync.d.ts +0 -46
- package/dist/syncEngine/sync.js +0 -389
- package/dist/testing.d.ts +0 -63
- package/dist/testing.js +0 -175
- package/dist/vue-entry.d.ts +0 -15
- package/dist/vue-entry.js +0 -7
- /package/{src ā dist}/adaptors/vue/components/layout.css +0 -0
- /package/{src ā dist}/adaptors/vue/components/layout.tailwind.css +0 -0
|
@@ -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 = ['ValidatedCanSendNotifications'];
|
|
81
|
-
sendNotification.configKey = 'default';
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"action_name": "send_notification",
|
|
3
|
-
"app": "django_app",
|
|
4
|
-
"title": "Send Notification",
|
|
5
|
-
"docstring": "Send notifications to multiple recipients",
|
|
6
|
-
"class_name": "SendNotification",
|
|
7
|
-
"input_properties": {
|
|
8
|
-
"message": {
|
|
9
|
-
"type": "string",
|
|
10
|
-
"title": "Message",
|
|
11
|
-
"required": true,
|
|
12
|
-
"description": "Notification message to send",
|
|
13
|
-
"nullable": false,
|
|
14
|
-
"format": null,
|
|
15
|
-
"max_length": 500,
|
|
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
|
-
"recipients": {
|
|
25
|
-
"type": "array",
|
|
26
|
-
"title": "Recipients",
|
|
27
|
-
"required": true,
|
|
28
|
-
"description": "List of email addresses to notify",
|
|
29
|
-
"nullable": false,
|
|
30
|
-
"format": null,
|
|
31
|
-
"max_length": null,
|
|
32
|
-
"choices": null,
|
|
33
|
-
"default": null,
|
|
34
|
-
"validators": [],
|
|
35
|
-
"max_digits": null,
|
|
36
|
-
"decimal_places": null,
|
|
37
|
-
"read_only": false,
|
|
38
|
-
"ref": null
|
|
39
|
-
},
|
|
40
|
-
"priority": {
|
|
41
|
-
"type": "string",
|
|
42
|
-
"title": "Priority",
|
|
43
|
-
"required": false,
|
|
44
|
-
"description": "Notification priority level",
|
|
45
|
-
"nullable": false,
|
|
46
|
-
"format": null,
|
|
47
|
-
"max_length": null,
|
|
48
|
-
"choices": {
|
|
49
|
-
"low": "Low",
|
|
50
|
-
"high": "High"
|
|
51
|
-
},
|
|
52
|
-
"default": "low",
|
|
53
|
-
"validators": [],
|
|
54
|
-
"max_digits": null,
|
|
55
|
-
"decimal_places": null,
|
|
56
|
-
"read_only": false,
|
|
57
|
-
"ref": null
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"response_properties": {
|
|
61
|
-
"success": {
|
|
62
|
-
"type": "boolean",
|
|
63
|
-
"title": "Success",
|
|
64
|
-
"required": true,
|
|
65
|
-
"description": null,
|
|
66
|
-
"nullable": false,
|
|
67
|
-
"format": null,
|
|
68
|
-
"max_length": null,
|
|
69
|
-
"choices": null,
|
|
70
|
-
"default": null,
|
|
71
|
-
"validators": [],
|
|
72
|
-
"max_digits": null,
|
|
73
|
-
"decimal_places": null,
|
|
74
|
-
"read_only": false,
|
|
75
|
-
"ref": null
|
|
76
|
-
},
|
|
77
|
-
"message_id": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"title": "Message id",
|
|
80
|
-
"required": true,
|
|
81
|
-
"description": null,
|
|
82
|
-
"nullable": false,
|
|
83
|
-
"format": null,
|
|
84
|
-
"max_length": null,
|
|
85
|
-
"choices": null,
|
|
86
|
-
"default": null,
|
|
87
|
-
"validators": [],
|
|
88
|
-
"max_digits": null,
|
|
89
|
-
"decimal_places": null,
|
|
90
|
-
"read_only": false,
|
|
91
|
-
"ref": null
|
|
92
|
-
},
|
|
93
|
-
"sent_to": {
|
|
94
|
-
"type": "integer",
|
|
95
|
-
"title": "Sent to",
|
|
96
|
-
"required": true,
|
|
97
|
-
"description": null,
|
|
98
|
-
"nullable": false,
|
|
99
|
-
"format": null,
|
|
100
|
-
"max_length": null,
|
|
101
|
-
"choices": null,
|
|
102
|
-
"default": null,
|
|
103
|
-
"validators": [],
|
|
104
|
-
"max_digits": null,
|
|
105
|
-
"decimal_places": null,
|
|
106
|
-
"read_only": false,
|
|
107
|
-
"ref": null
|
|
108
|
-
},
|
|
109
|
-
"queued_at": {
|
|
110
|
-
"type": "string",
|
|
111
|
-
"title": "Queued at",
|
|
112
|
-
"required": true,
|
|
113
|
-
"description": null,
|
|
114
|
-
"nullable": false,
|
|
115
|
-
"format": "date-time",
|
|
116
|
-
"max_length": null,
|
|
117
|
-
"choices": null,
|
|
118
|
-
"default": null,
|
|
119
|
-
"validators": [],
|
|
120
|
-
"max_digits": null,
|
|
121
|
-
"decimal_places": null,
|
|
122
|
-
"read_only": false,
|
|
123
|
-
"ref": null
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
"relationships": {},
|
|
127
|
-
"permissions": [
|
|
128
|
-
"ValidatedCanSendNotifications"
|
|
129
|
-
],
|
|
130
|
-
"display": {
|
|
131
|
-
"display_title": "Send Notifications",
|
|
132
|
-
"display_description": "Send notifications to multiple recipients with priority control",
|
|
133
|
-
"field_groups": [
|
|
134
|
-
{
|
|
135
|
-
"display_title": "Message Content",
|
|
136
|
-
"display_description": "The notification message and priority level",
|
|
137
|
-
"field_names": [
|
|
138
|
-
"message",
|
|
139
|
-
"priority"
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"display_title": "Recipients",
|
|
144
|
-
"display_description": "Email addresses to send notifications to",
|
|
145
|
-
"field_names": [
|
|
146
|
-
"recipients"
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
],
|
|
150
|
-
"field_display_configs": [
|
|
151
|
-
{
|
|
152
|
-
"field_name": "message",
|
|
153
|
-
"display_component": "TextArea",
|
|
154
|
-
"filter_queryset": null,
|
|
155
|
-
"display_help_text": "Enter your notification message here (max 500 characters)",
|
|
156
|
-
"extra": null
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"field_name": "priority",
|
|
160
|
-
"display_component": "RadioGroup",
|
|
161
|
-
"filter_queryset": null,
|
|
162
|
-
"display_help_text": "High priority notifications are processed first",
|
|
163
|
-
"extra": null
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
"field_name": "recipients",
|
|
167
|
-
"display_component": "EmailListInput",
|
|
168
|
-
"filter_queryset": null,
|
|
169
|
-
"display_help_text": "Add one or more email addresses",
|
|
170
|
-
"extra": null
|
|
171
|
-
}
|
|
172
|
-
],
|
|
173
|
-
"extra": null
|
|
174
|
-
}
|
|
175
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./django_app/index.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './django_app/index.js';
|
package/dist/actions/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./default/index.js";
|
package/dist/actions/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function useQueryset(querysetFactory: any): any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useQueryset } from "./composables.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { useQueryset } from './composables.js';
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create a default components registry (without Control - user must provide)
|
|
3
|
-
*
|
|
4
|
-
* @param {Object} options - Override specific components
|
|
5
|
-
* @returns {Object} Components registry for LayoutRenderer
|
|
6
|
-
*/
|
|
7
|
-
export function createDefaultComponents(options?: Object): Object;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default component implementations for LayoutRenderer
|
|
3
|
-
*
|
|
4
|
-
* These are minimal, unstyled implementations that follow the contracts.
|
|
5
|
-
* Users can use these as-is or as reference for custom implementations.
|
|
6
|
-
*/
|
|
7
|
-
export { default as AlertElement } from './AlertElement.vue';
|
|
8
|
-
export { default as LabelElement } from './LabelElement.vue';
|
|
9
|
-
export { default as DividerElement } from './DividerElement.vue';
|
|
10
|
-
export { default as DisplayElement } from './DisplayElement.vue';
|
|
11
|
-
export { default as GroupElement } from './GroupElement.vue';
|
|
12
|
-
export { default as TabsElement } from './TabsElement.vue';
|
|
13
|
-
export { default as ErrorBlock } from './ErrorBlock.vue';
|
|
14
|
-
/**
|
|
15
|
-
* Create a default components registry (without Control - user must provide)
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} options - Override specific components
|
|
18
|
-
* @returns {Object} Components registry for LayoutRenderer
|
|
19
|
-
*/
|
|
20
|
-
export function createDefaultComponents(options = {}) {
|
|
21
|
-
return {
|
|
22
|
-
Alert: AlertElement,
|
|
23
|
-
Label: LabelElement,
|
|
24
|
-
Divider: DividerElement,
|
|
25
|
-
Display: DisplayElement,
|
|
26
|
-
Group: GroupElement,
|
|
27
|
-
Tabs: TabsElement,
|
|
28
|
-
ErrorBlock: ErrorBlock,
|
|
29
|
-
...options
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AlertElement, LabelElement, DividerElement, DisplayElement, GroupElement, TabsElement, ErrorBlock, createDefaultComponents } from "./defaults/index.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Vue components for StateZero
|
|
3
|
-
*/
|
|
4
|
-
// Main layout renderer
|
|
5
|
-
export { default as LayoutRenderer } from './LayoutRenderer.vue';
|
|
6
|
-
// Default component implementations
|
|
7
|
-
export { AlertElement, LabelElement, DividerElement, DisplayElement, GroupElement, TabsElement, ErrorBlock, createDefaultComponents } from './defaults/index.js';
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { computed, getCurrentInstance, onBeforeUnmount } from 'vue';
|
|
2
|
-
import { querysetStoreRegistry } from '../../syncEngine/registries/querysetStoreRegistry.js';
|
|
3
|
-
import { metricRegistry } from '../../syncEngine/registries/metricRegistry.js';
|
|
4
|
-
import { syncManager } from '../../syncEngine/sync.js';
|
|
5
|
-
import { registerAdapterReset } from '../../reset.js';
|
|
6
|
-
import { v7 } from 'uuid';
|
|
7
|
-
syncManager.followAllQuerysets = false;
|
|
8
|
-
export const querysets = new Map(); // Map of composableId -> queryset
|
|
9
|
-
function updateSyncManager() {
|
|
10
|
-
// Get unique querysets from all active composables
|
|
11
|
-
const uniqueQuerysets = new Set(querysets.values());
|
|
12
|
-
syncManager.followedQuerysets = uniqueQuerysets;
|
|
13
|
-
}
|
|
14
|
-
export function useQueryset(querysetFactory) {
|
|
15
|
-
const instance = getCurrentInstance();
|
|
16
|
-
if (!instance) {
|
|
17
|
-
throw new Error('useQueryset must be called within a component setup function');
|
|
18
|
-
}
|
|
19
|
-
const composableId = v7();
|
|
20
|
-
let lastQueryset = null;
|
|
21
|
-
onBeforeUnmount(() => {
|
|
22
|
-
querysets.delete(composableId);
|
|
23
|
-
updateSyncManager();
|
|
24
|
-
});
|
|
25
|
-
return computed(() => {
|
|
26
|
-
const result = querysetFactory();
|
|
27
|
-
const original = result?.original || result;
|
|
28
|
-
const queryset = original?.queryset || original;
|
|
29
|
-
// Only update if queryset actually changed
|
|
30
|
-
if (lastQueryset !== queryset) {
|
|
31
|
-
querysets.set(composableId, queryset);
|
|
32
|
-
updateSyncManager();
|
|
33
|
-
lastQueryset = queryset;
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
registerAdapterReset(() => {
|
|
39
|
-
querysets.clear();
|
|
40
|
-
// Reset syncManager back to following all querysets since no composables are active
|
|
41
|
-
syncManager.followAllQuerysets = true;
|
|
42
|
-
syncManager.followedQuerysets.clear();
|
|
43
|
-
console.log("Vue composables state cleared");
|
|
44
|
-
});
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export { useQueryset, querysets } from "./composables.js";
|
|
2
|
-
export { ModelAdaptor, QuerySetAdaptor, MetricAdaptor } from "./reactivity.js";
|
|
3
|
-
export { LayoutRenderer, AlertElement, LabelElement, DividerElement, DisplayElement, GroupElement, TabsElement, ErrorBlock, createDefaultComponents } from "./components/index.js";
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export { useQueryset, querysets } from './composables.js';
|
|
2
|
-
export { ModelAdaptor, QuerySetAdaptor, MetricAdaptor } from './reactivity.js';
|
|
3
|
-
// Layout components
|
|
4
|
-
export { LayoutRenderer, AlertElement, LabelElement, DividerElement, DisplayElement, GroupElement, TabsElement, ErrorBlock, createDefaultComponents } from './components/index.js';
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adapts a model instance to a Vue reactive object by directly wrapping
|
|
3
|
-
* the instance and incrementing an internal version on relevant events.
|
|
4
|
-
*
|
|
5
|
-
* @param {Object} modelInstance - An instance of a model class with static modelName and primaryKeyField
|
|
6
|
-
* @param {Function} [reactivityFn=reactive] - Which Vue reactivity function to use (reactive or ref)
|
|
7
|
-
* @returns {import('vue').Reactive|import('vue').Ref} The reactive model instance, augmented with __version
|
|
8
|
-
*/
|
|
9
|
-
export function ModelAdaptor(modelInstance: Object, reactivityFn?: Function): any | import("vue").Ref;
|
|
10
|
-
/**
|
|
11
|
-
* Adapts a queryset to a Vue reactive object and sets up event handling for queryset updates
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} liveQuerySet - A LiveQueryset instance
|
|
14
|
-
* @param {Function} [reactivityFn=reactive] - Which Vue reactivity function to use (reactive or ref)
|
|
15
|
-
* @returns {import('vue').Reactive|import('vue').Ref} The reactive queryset
|
|
16
|
-
*/
|
|
17
|
-
export function QuerySetAdaptor(liveQuerySet: Object, reactivityFn?: Function): any | import("vue").Ref;
|
|
18
|
-
export function MetricAdaptor(metric: any): any;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import { reactive, ref, nextTick } from "vue";
|
|
2
|
-
import { modelEventEmitter, querysetEventEmitter, metricEventEmitter } from "../../syncEngine/stores/reactivity.js";
|
|
3
|
-
import { initEventHandler } from "../../syncEngine/stores/operationEventHandlers.js";
|
|
4
|
-
import { isEqual, isNil } from 'lodash-es';
|
|
5
|
-
import hash from 'object-hash';
|
|
6
|
-
import { registerAdapterReset } from "../../reset.js";
|
|
7
|
-
initEventHandler();
|
|
8
|
-
const wrappedQuerysetCache = new Map();
|
|
9
|
-
const wrappedMetricCache = new Map();
|
|
10
|
-
/**
|
|
11
|
-
* Adapts a model instance to a Vue reactive object by directly wrapping
|
|
12
|
-
* the instance and incrementing an internal version on relevant events.
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} modelInstance - An instance of a model class with static modelName and primaryKeyField
|
|
15
|
-
* @param {Function} [reactivityFn=reactive] - Which Vue reactivity function to use (reactive or ref)
|
|
16
|
-
* @returns {import('vue').Reactive|import('vue').Ref} The reactive model instance, augmented with __version
|
|
17
|
-
*/
|
|
18
|
-
export function ModelAdaptor(modelInstance, reactivityFn = reactive) {
|
|
19
|
-
const modelClass = modelInstance.constructor;
|
|
20
|
-
const modelName = modelClass.modelName;
|
|
21
|
-
const configKey = modelClass.configKey;
|
|
22
|
-
const pkField = modelClass.primaryKeyField;
|
|
23
|
-
// Make the model instance reactive using the specified function
|
|
24
|
-
const wrapper = reactivityFn(modelInstance);
|
|
25
|
-
const eventName = `${configKey}::${modelName}::render`;
|
|
26
|
-
// Handler bumps version to trigger Vue reactivity when this instance updates
|
|
27
|
-
const renderHandler = (eventData) => {
|
|
28
|
-
const isRef = reactivityFn === ref;
|
|
29
|
-
const model = isRef ? wrapper.value : wrapper;
|
|
30
|
-
const modelPk = model[pkField];
|
|
31
|
-
// Check if this model's pk is in the event's pks array
|
|
32
|
-
if (eventData.pks && eventData.pks.includes(modelPk)) {
|
|
33
|
-
if (isRef) {
|
|
34
|
-
wrapper.value.touch();
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
wrapper.touch();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
// Subscribe to model events indefinitely
|
|
42
|
-
modelEventEmitter.on(eventName, renderHandler);
|
|
43
|
-
return wrapper;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Adapts a queryset to a Vue reactive object and sets up event handling for queryset updates
|
|
47
|
-
*
|
|
48
|
-
* @param {Object} liveQuerySet - A LiveQueryset instance
|
|
49
|
-
* @param {Function} [reactivityFn=reactive] - Which Vue reactivity function to use (reactive or ref)
|
|
50
|
-
* @returns {import('vue').Reactive|import('vue').Ref} The reactive queryset
|
|
51
|
-
*/
|
|
52
|
-
export function QuerySetAdaptor(liveQuerySet, reactivityFn = reactive) {
|
|
53
|
-
const queryset = liveQuerySet?.queryset;
|
|
54
|
-
const modelName = queryset?.ModelClass?.modelName;
|
|
55
|
-
const configKey = queryset?.ModelClass?.configKey;
|
|
56
|
-
if (isNil(queryset) || isNil(modelName)) {
|
|
57
|
-
throw new Error(`liveQuerySet ${JSON.stringify(liveQuerySet)} had null qs: ${queryset} or model: ${modelName}`);
|
|
58
|
-
}
|
|
59
|
-
// Use the semantic key if available
|
|
60
|
-
const cacheKey = queryset.semanticKey;
|
|
61
|
-
// Check the cache first
|
|
62
|
-
if (cacheKey && wrappedQuerysetCache.has(cacheKey)) {
|
|
63
|
-
return wrappedQuerysetCache.get(cacheKey);
|
|
64
|
-
}
|
|
65
|
-
const querysetAst = queryset.build();
|
|
66
|
-
// Make the queryset reactive using the specified function
|
|
67
|
-
const wrapper = reactivityFn([...liveQuerySet]);
|
|
68
|
-
wrapper.original = liveQuerySet;
|
|
69
|
-
const eventName = `${configKey}::${modelName}::queryset::render`;
|
|
70
|
-
// Handler bumps version to trigger Vue reactivity when this queryset updates
|
|
71
|
-
const renderHandler = (eventData) => {
|
|
72
|
-
if (eventData && eventData.ast && isEqual(querysetAst, eventData.ast)) {
|
|
73
|
-
if (reactivityFn === ref) {
|
|
74
|
-
wrapper.value = [...liveQuerySet];
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
wrapper.splice(0, wrapper.length);
|
|
78
|
-
wrapper.push(...liveQuerySet);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
// Subscribe to queryset events indefinitely
|
|
83
|
-
querysetEventEmitter.on(eventName, renderHandler);
|
|
84
|
-
/* Dont delete the innocuous looking queryset.length check. There is some weird interaction
|
|
85
|
-
with vue, where when we load an empty queryset from the cache, the reactivity completely breaks.
|
|
86
|
-
I wasted over 2 days on this bug, and it won't show up in the e2e tests because it just impacts the
|
|
87
|
-
vue reactivity. If this causes performance issues, and needs to be refactored. Make sure you understand
|
|
88
|
-
the vue reactivity interaction correctly and find a different way to fix the broken reactivity for empty querysets */
|
|
89
|
-
if (cacheKey && liveQuerySet && liveQuerySet.length > 0) {
|
|
90
|
-
wrappedQuerysetCache.set(cacheKey, wrapper);
|
|
91
|
-
}
|
|
92
|
-
return wrapper;
|
|
93
|
-
}
|
|
94
|
-
export function MetricAdaptor(metric) {
|
|
95
|
-
const queryset = metric.queryset;
|
|
96
|
-
const modelName = queryset?.ModelClass?.modelName;
|
|
97
|
-
const configKey = queryset?.ModelClass?.configKey;
|
|
98
|
-
const querysetAst = queryset.build();
|
|
99
|
-
// Create a cache key based on metric properties
|
|
100
|
-
// This combines model, metric type, field, and the queryset AST hash to ensure uniqueness
|
|
101
|
-
const cacheKey = `${configKey}::${modelName}::${metric.metricType}::${metric.field}::${hash(querysetAst)}`;
|
|
102
|
-
// Check the cache first
|
|
103
|
-
if (cacheKey && wrappedMetricCache.has(cacheKey)) {
|
|
104
|
-
return wrappedMetricCache.get(cacheKey);
|
|
105
|
-
}
|
|
106
|
-
// Create a reactive reference with the initial value
|
|
107
|
-
const wrapper = ref(metric.value);
|
|
108
|
-
wrapper.original = metric;
|
|
109
|
-
// Single handler for metric render events
|
|
110
|
-
const metricRenderHandler = (eventData) => {
|
|
111
|
-
// Only update if this event is for our metric
|
|
112
|
-
if (eventData.metricType === metric.metricType &&
|
|
113
|
-
eventData.ModelClass === metric.queryset.ModelClass &&
|
|
114
|
-
eventData.field === metric.field &&
|
|
115
|
-
eventData.ast === hash(querysetAst) &&
|
|
116
|
-
eventData.valueChanged === true) {
|
|
117
|
-
// Update the wrapper value with the latest metric value
|
|
118
|
-
wrapper.value = metric.value;
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
// Only listen for metric render events
|
|
122
|
-
metricEventEmitter.on('metric::render', metricRenderHandler);
|
|
123
|
-
// Store in cache
|
|
124
|
-
if (cacheKey) {
|
|
125
|
-
wrappedMetricCache.set(cacheKey, wrapper);
|
|
126
|
-
}
|
|
127
|
-
return wrapper;
|
|
128
|
-
}
|
|
129
|
-
registerAdapterReset(() => {
|
|
130
|
-
wrappedQuerysetCache.clear();
|
|
131
|
-
wrappedMetricCache.clear();
|
|
132
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { generateSchema } from "./syncModels.js";
|
|
2
|
-
import { generateActions } from "./syncActions.js";
|
|
3
|
-
/**
|
|
4
|
-
* Executes a full synchronization, running sync-models first,
|
|
5
|
-
* followed by sync-actions.
|
|
6
|
-
* @param {object} args - Command-line arguments, passed from yargs.
|
|
7
|
-
*/
|
|
8
|
-
export async function sync(args = {}) {
|
|
9
|
-
try {
|
|
10
|
-
console.log("š Starting full synchronization...");
|
|
11
|
-
// --- Step 1: Synchronize Models ---
|
|
12
|
-
console.log("\n----- Running Model Synchronization -----");
|
|
13
|
-
// Pass args down, as generateSchema expects an object
|
|
14
|
-
await generateSchema(args);
|
|
15
|
-
console.log("----- Model Synchronization Complete -----\n");
|
|
16
|
-
// --- Step 2: Synchronize Actions ---
|
|
17
|
-
console.log("----- Running Action Synchronization -----");
|
|
18
|
-
// generateActions does not require args based on its definition
|
|
19
|
-
await generateActions();
|
|
20
|
-
console.log("----- Action Synchronization Complete -----\n");
|
|
21
|
-
console.log("ā
Full synchronization finished successfully!");
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error("\nā A critical error occurred during full synchronization:", error.message);
|
|
25
|
-
if (process.env.DEBUG) {
|
|
26
|
-
console.error("Stack trace:", error.stack);
|
|
27
|
-
}
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
}
|