@statezero/core 0.2.37 → 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.
Files changed (307) hide show
  1. package/dist/adaptors/vue/components/LayoutRenderer.js +166 -0
  2. package/dist/adaptors/vue/components/defaults/AlertElement.js +31 -0
  3. package/dist/adaptors/vue/components/defaults/DisplayElement.js +44 -0
  4. package/dist/adaptors/vue/components/defaults/DividerElement.js +10 -0
  5. package/dist/adaptors/vue/components/defaults/ErrorBlock.js +24 -0
  6. package/dist/adaptors/vue/components/defaults/GroupElement.js +41 -0
  7. package/dist/adaptors/vue/components/defaults/LabelElement.js +21 -0
  8. package/dist/adaptors/vue/components/defaults/TabsElement.js +38 -0
  9. package/package.json +6 -4
  10. package/dist/actions/backend1/django_app/calculate-hash.d.ts +0 -57
  11. package/dist/actions/backend1/django_app/calculate-hash.js +0 -80
  12. package/dist/actions/backend1/django_app/calculate-hash.schema.json +0 -148
  13. package/dist/actions/backend1/django_app/get-current-username.d.ts +0 -29
  14. package/dist/actions/backend1/django_app/get-current-username.js +0 -65
  15. package/dist/actions/backend1/django_app/get-current-username.schema.json +0 -47
  16. package/dist/actions/backend1/django_app/get-server-status.d.ts +0 -38
  17. package/dist/actions/backend1/django_app/get-server-status.js +0 -68
  18. package/dist/actions/backend1/django_app/get-server-status.schema.json +0 -93
  19. package/dist/actions/backend1/django_app/get-user-info.d.ts +0 -44
  20. package/dist/actions/backend1/django_app/get-user-info.js +0 -70
  21. package/dist/actions/backend1/django_app/get-user-info.schema.json +0 -127
  22. package/dist/actions/backend1/django_app/index.d.ts +0 -1
  23. package/dist/actions/backend1/django_app/index.js +0 -6
  24. package/dist/actions/backend1/django_app/process-data.d.ts +0 -51
  25. package/dist/actions/backend1/django_app/process-data.js +0 -78
  26. package/dist/actions/backend1/django_app/process-data.schema.json +0 -117
  27. package/dist/actions/backend1/django_app/send-notification.d.ts +0 -55
  28. package/dist/actions/backend1/django_app/send-notification.js +0 -81
  29. package/dist/actions/backend1/django_app/send-notification.schema.json +0 -175
  30. package/dist/actions/backend1/index.d.ts +0 -1
  31. package/dist/actions/backend1/index.js +0 -1
  32. package/dist/actions/default/django_app/calculate-hash.d.ts +0 -57
  33. package/dist/actions/default/django_app/calculate-hash.js +0 -80
  34. package/dist/actions/default/django_app/calculate-hash.schema.json +0 -148
  35. package/dist/actions/default/django_app/get-current-username.d.ts +0 -29
  36. package/dist/actions/default/django_app/get-current-username.js +0 -65
  37. package/dist/actions/default/django_app/get-current-username.schema.json +0 -47
  38. package/dist/actions/default/django_app/get-server-status.d.ts +0 -38
  39. package/dist/actions/default/django_app/get-server-status.js +0 -68
  40. package/dist/actions/default/django_app/get-server-status.schema.json +0 -93
  41. package/dist/actions/default/django_app/get-user-info.d.ts +0 -44
  42. package/dist/actions/default/django_app/get-user-info.js +0 -70
  43. package/dist/actions/default/django_app/get-user-info.schema.json +0 -127
  44. package/dist/actions/default/django_app/index.d.ts +0 -1
  45. package/dist/actions/default/django_app/index.js +0 -6
  46. package/dist/actions/default/django_app/process-data.d.ts +0 -51
  47. package/dist/actions/default/django_app/process-data.js +0 -78
  48. package/dist/actions/default/django_app/process-data.schema.json +0 -117
  49. package/dist/actions/default/django_app/send-notification.d.ts +0 -55
  50. package/dist/actions/default/django_app/send-notification.js +0 -81
  51. package/dist/actions/default/django_app/send-notification.schema.json +0 -175
  52. package/dist/actions/default/index.d.ts +0 -1
  53. package/dist/actions/default/index.js +0 -1
  54. package/dist/actions/index.d.ts +0 -1
  55. package/dist/actions/index.js +0 -5
  56. package/dist/adaptors/react/composables.d.ts +0 -1
  57. package/dist/adaptors/react/composables.js +0 -4
  58. package/dist/adaptors/react/index.d.ts +0 -1
  59. package/dist/adaptors/react/index.js +0 -1
  60. package/dist/adaptors/vue/components/LayoutRenderer.vue +0 -361
  61. package/dist/adaptors/vue/components/defaults/AlertElement.vue +0 -38
  62. package/dist/adaptors/vue/components/defaults/DisplayElement.vue +0 -57
  63. package/dist/adaptors/vue/components/defaults/DividerElement.vue +0 -13
  64. package/dist/adaptors/vue/components/defaults/ErrorBlock.vue +0 -28
  65. package/dist/adaptors/vue/components/defaults/GroupElement.vue +0 -53
  66. package/dist/adaptors/vue/components/defaults/LabelElement.vue +0 -25
  67. package/dist/adaptors/vue/components/defaults/TabsElement.vue +0 -54
  68. package/dist/adaptors/vue/components/defaults/index.d.ts +0 -7
  69. package/dist/adaptors/vue/components/defaults/index.js +0 -31
  70. package/dist/adaptors/vue/components/index.d.ts +0 -1
  71. package/dist/adaptors/vue/components/index.js +0 -7
  72. package/dist/adaptors/vue/composables.d.ts +0 -2
  73. package/dist/adaptors/vue/composables.js +0 -44
  74. package/dist/adaptors/vue/index.d.ts +0 -3
  75. package/dist/adaptors/vue/index.js +0 -4
  76. package/dist/adaptors/vue/reactivity.d.ts +0 -18
  77. package/dist/adaptors/vue/reactivity.js +0 -132
  78. package/dist/cli/commands/sync.d.ts +0 -6
  79. package/dist/cli/commands/sync.js +0 -30
  80. package/dist/cli/commands/syncActions.d.ts +0 -46
  81. package/dist/cli/commands/syncActions.js +0 -717
  82. package/dist/cli/commands/syncModels.d.ts +0 -132
  83. package/dist/cli/commands/syncModels.js +0 -1120
  84. package/dist/cli/configFileLoader.d.ts +0 -10
  85. package/dist/cli/configFileLoader.js +0 -85
  86. package/dist/cli/index.d.ts +0 -2
  87. package/dist/cli/index.js +0 -22
  88. package/dist/config.d.ts +0 -57
  89. package/dist/config.js +0 -273
  90. package/dist/core/eventReceivers.d.ts +0 -185
  91. package/dist/core/eventReceivers.js +0 -266
  92. package/dist/core/utils.d.ts +0 -8
  93. package/dist/core/utils.js +0 -62
  94. package/dist/errorHandler.d.ts +0 -21
  95. package/dist/errorHandler.js +0 -27
  96. package/dist/filtering/localFiltering.d.ts +0 -110
  97. package/dist/filtering/localFiltering.js +0 -1080
  98. package/dist/flavours/django/dates.d.ts +0 -34
  99. package/dist/flavours/django/dates.js +0 -113
  100. package/dist/flavours/django/errors.d.ts +0 -138
  101. package/dist/flavours/django/errors.js +0 -195
  102. package/dist/flavours/django/f.d.ts +0 -6
  103. package/dist/flavours/django/f.js +0 -91
  104. package/dist/flavours/django/files.d.ts +0 -62
  105. package/dist/flavours/django/files.js +0 -355
  106. package/dist/flavours/django/makeApiCall.d.ts +0 -36
  107. package/dist/flavours/django/makeApiCall.js +0 -169
  108. package/dist/flavours/django/manager.d.ts +0 -204
  109. package/dist/flavours/django/manager.js +0 -222
  110. package/dist/flavours/django/model.d.ts +0 -137
  111. package/dist/flavours/django/model.js +0 -366
  112. package/dist/flavours/django/operationFactory.d.ts +0 -73
  113. package/dist/flavours/django/operationFactory.js +0 -248
  114. package/dist/flavours/django/q.d.ts +0 -70
  115. package/dist/flavours/django/q.js +0 -43
  116. package/dist/flavours/django/queryExecutor.d.ts +0 -149
  117. package/dist/flavours/django/queryExecutor.js +0 -590
  118. package/dist/flavours/django/querySet.d.ts +0 -301
  119. package/dist/flavours/django/querySet.js +0 -736
  120. package/dist/flavours/django/serializers.d.ts +0 -39
  121. package/dist/flavours/django/serializers.js +0 -296
  122. package/dist/flavours/django/tempPk.d.ts +0 -31
  123. package/dist/flavours/django/tempPk.js +0 -92
  124. package/dist/flavours/django/utils.d.ts +0 -19
  125. package/dist/flavours/django/utils.js +0 -29
  126. package/dist/index.d.ts +0 -46
  127. package/dist/index.js +0 -48
  128. package/dist/models/backend1/django_app/comprehensivemodel.d.ts +0 -894
  129. package/dist/models/backend1/django_app/comprehensivemodel.js +0 -71
  130. package/dist/models/backend1/django_app/comprehensivemodel.schema.json +0 -870
  131. package/dist/models/backend1/django_app/custompkmodel.d.ts +0 -92
  132. package/dist/models/backend1/django_app/custompkmodel.js +0 -69
  133. package/dist/models/backend1/django_app/custompkmodel.schema.json +0 -71
  134. package/dist/models/backend1/django_app/dailyrate.d.ts +0 -230
  135. package/dist/models/backend1/django_app/dailyrate.js +0 -71
  136. package/dist/models/backend1/django_app/dailyrate.schema.json +0 -212
  137. package/dist/models/backend1/django_app/deepmodellevel1.d.ts +0 -140
  138. package/dist/models/backend1/django_app/deepmodellevel1.js +0 -72
  139. package/dist/models/backend1/django_app/deepmodellevel1.schema.json +0 -114
  140. package/dist/models/backend1/django_app/deepmodellevel2.d.ts +0 -118
  141. package/dist/models/backend1/django_app/deepmodellevel2.js +0 -71
  142. package/dist/models/backend1/django_app/deepmodellevel2.schema.json +0 -92
  143. package/dist/models/backend1/django_app/deepmodellevel3.d.ts +0 -92
  144. package/dist/models/backend1/django_app/deepmodellevel3.js +0 -69
  145. package/dist/models/backend1/django_app/deepmodellevel3.schema.json +0 -69
  146. package/dist/models/backend1/django_app/dummymodel.d.ts +0 -134
  147. package/dist/models/backend1/django_app/dummymodel.js +0 -71
  148. package/dist/models/backend1/django_app/dummymodel.schema.json +0 -109
  149. package/dist/models/backend1/django_app/dummyrelatedmodel.d.ts +0 -92
  150. package/dist/models/backend1/django_app/dummyrelatedmodel.js +0 -69
  151. package/dist/models/backend1/django_app/dummyrelatedmodel.schema.json +0 -69
  152. package/dist/models/backend1/django_app/filetest.d.ts +0 -140
  153. package/dist/models/backend1/django_app/filetest.js +0 -69
  154. package/dist/models/backend1/django_app/filetest.schema.json +0 -111
  155. package/dist/models/backend1/django_app/index.d.ts +0 -1
  156. package/dist/models/backend1/django_app/index.js +0 -21
  157. package/dist/models/backend1/django_app/m2mdepthtestlevel1.d.ts +0 -118
  158. package/dist/models/backend1/django_app/m2mdepthtestlevel1.js +0 -71
  159. package/dist/models/backend1/django_app/m2mdepthtestlevel1.schema.json +0 -94
  160. package/dist/models/backend1/django_app/m2mdepthtestlevel2.d.ts +0 -118
  161. package/dist/models/backend1/django_app/m2mdepthtestlevel2.js +0 -71
  162. package/dist/models/backend1/django_app/m2mdepthtestlevel2.schema.json +0 -94
  163. package/dist/models/backend1/django_app/m2mdepthtestlevel3.d.ts +0 -134
  164. package/dist/models/backend1/django_app/m2mdepthtestlevel3.js +0 -71
  165. package/dist/models/backend1/django_app/m2mdepthtestlevel3.schema.json +0 -112
  166. package/dist/models/backend1/django_app/modelwithcustompkrelation.d.ts +0 -118
  167. package/dist/models/backend1/django_app/modelwithcustompkrelation.js +0 -71
  168. package/dist/models/backend1/django_app/modelwithcustompkrelation.schema.json +0 -93
  169. package/dist/models/backend1/django_app/modelwithrestrictedfields.d.ts +0 -134
  170. package/dist/models/backend1/django_app/modelwithrestrictedfields.js +0 -71
  171. package/dist/models/backend1/django_app/modelwithrestrictedfields.schema.json +0 -111
  172. package/dist/models/backend1/django_app/namefiltercustompkmodel.d.ts +0 -92
  173. package/dist/models/backend1/django_app/namefiltercustompkmodel.js +0 -69
  174. package/dist/models/backend1/django_app/namefiltercustompkmodel.schema.json +0 -71
  175. package/dist/models/backend1/django_app/order.d.ts +0 -220
  176. package/dist/models/backend1/django_app/order.js +0 -71
  177. package/dist/models/backend1/django_app/order.schema.json +0 -203
  178. package/dist/models/backend1/django_app/orderitem.d.ts +0 -172
  179. package/dist/models/backend1/django_app/orderitem.js +0 -72
  180. package/dist/models/backend1/django_app/orderitem.schema.json +0 -149
  181. package/dist/models/backend1/django_app/product.d.ts +0 -254
  182. package/dist/models/backend1/django_app/product.js +0 -71
  183. package/dist/models/backend1/django_app/product.schema.json +0 -277
  184. package/dist/models/backend1/django_app/productcategory.d.ts +0 -92
  185. package/dist/models/backend1/django_app/productcategory.js +0 -69
  186. package/dist/models/backend1/django_app/productcategory.schema.json +0 -70
  187. package/dist/models/backend1/django_app/rateplan.d.ts +0 -92
  188. package/dist/models/backend1/django_app/rateplan.js +0 -69
  189. package/dist/models/backend1/django_app/rateplan.schema.json +0 -70
  190. package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.d.ts +0 -108
  191. package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.js +0 -69
  192. package/dist/models/backend1/django_app/restrictedfieldrelatedmodel.schema.json +0 -87
  193. package/dist/models/backend1/fileobject.d.ts +0 -4
  194. package/dist/models/backend1/fileobject.js +0 -9
  195. package/dist/models/backend1/index.d.ts +0 -2
  196. package/dist/models/backend1/index.js +0 -2
  197. package/dist/models/default/django_app/comprehensivemodel.d.ts +0 -894
  198. package/dist/models/default/django_app/comprehensivemodel.js +0 -71
  199. package/dist/models/default/django_app/comprehensivemodel.schema.json +0 -870
  200. package/dist/models/default/django_app/custompkmodel.d.ts +0 -92
  201. package/dist/models/default/django_app/custompkmodel.js +0 -69
  202. package/dist/models/default/django_app/custompkmodel.schema.json +0 -71
  203. package/dist/models/default/django_app/dailyrate.d.ts +0 -230
  204. package/dist/models/default/django_app/dailyrate.js +0 -71
  205. package/dist/models/default/django_app/dailyrate.schema.json +0 -212
  206. package/dist/models/default/django_app/deepmodellevel1.d.ts +0 -128
  207. package/dist/models/default/django_app/deepmodellevel1.js +0 -72
  208. package/dist/models/default/django_app/deepmodellevel1.schema.json +0 -102
  209. package/dist/models/default/django_app/deepmodellevel2.d.ts +0 -106
  210. package/dist/models/default/django_app/deepmodellevel2.js +0 -71
  211. package/dist/models/default/django_app/deepmodellevel2.schema.json +0 -80
  212. package/dist/models/default/django_app/deepmodellevel3.d.ts +0 -80
  213. package/dist/models/default/django_app/deepmodellevel3.js +0 -69
  214. package/dist/models/default/django_app/deepmodellevel3.schema.json +0 -57
  215. package/dist/models/default/django_app/dummymodel.d.ts +0 -122
  216. package/dist/models/default/django_app/dummymodel.js +0 -71
  217. package/dist/models/default/django_app/dummymodel.schema.json +0 -97
  218. package/dist/models/default/django_app/dummyrelatedmodel.d.ts +0 -80
  219. package/dist/models/default/django_app/dummyrelatedmodel.js +0 -69
  220. package/dist/models/default/django_app/dummyrelatedmodel.schema.json +0 -57
  221. package/dist/models/default/django_app/filetest.d.ts +0 -128
  222. package/dist/models/default/django_app/filetest.js +0 -69
  223. package/dist/models/default/django_app/filetest.schema.json +0 -99
  224. package/dist/models/default/django_app/index.d.ts +0 -1
  225. package/dist/models/default/django_app/index.js +0 -21
  226. package/dist/models/default/django_app/m2mdepthtestlevel1.d.ts +0 -118
  227. package/dist/models/default/django_app/m2mdepthtestlevel1.js +0 -71
  228. package/dist/models/default/django_app/m2mdepthtestlevel1.schema.json +0 -94
  229. package/dist/models/default/django_app/m2mdepthtestlevel2.d.ts +0 -118
  230. package/dist/models/default/django_app/m2mdepthtestlevel2.js +0 -71
  231. package/dist/models/default/django_app/m2mdepthtestlevel2.schema.json +0 -94
  232. package/dist/models/default/django_app/m2mdepthtestlevel3.d.ts +0 -134
  233. package/dist/models/default/django_app/m2mdepthtestlevel3.js +0 -71
  234. package/dist/models/default/django_app/m2mdepthtestlevel3.schema.json +0 -112
  235. package/dist/models/default/django_app/modelwithcustompkrelation.d.ts +0 -118
  236. package/dist/models/default/django_app/modelwithcustompkrelation.js +0 -71
  237. package/dist/models/default/django_app/modelwithcustompkrelation.schema.json +0 -93
  238. package/dist/models/default/django_app/modelwithrestrictedfields.d.ts +0 -134
  239. package/dist/models/default/django_app/modelwithrestrictedfields.js +0 -71
  240. package/dist/models/default/django_app/modelwithrestrictedfields.schema.json +0 -111
  241. package/dist/models/default/django_app/namefiltercustompkmodel.d.ts +0 -92
  242. package/dist/models/default/django_app/namefiltercustompkmodel.js +0 -69
  243. package/dist/models/default/django_app/namefiltercustompkmodel.schema.json +0 -71
  244. package/dist/models/default/django_app/order.d.ts +0 -220
  245. package/dist/models/default/django_app/order.js +0 -71
  246. package/dist/models/default/django_app/order.schema.json +0 -203
  247. package/dist/models/default/django_app/orderitem.d.ts +0 -172
  248. package/dist/models/default/django_app/orderitem.js +0 -72
  249. package/dist/models/default/django_app/orderitem.schema.json +0 -149
  250. package/dist/models/default/django_app/product.d.ts +0 -254
  251. package/dist/models/default/django_app/product.js +0 -71
  252. package/dist/models/default/django_app/product.schema.json +0 -277
  253. package/dist/models/default/django_app/productcategory.d.ts +0 -92
  254. package/dist/models/default/django_app/productcategory.js +0 -69
  255. package/dist/models/default/django_app/productcategory.schema.json +0 -70
  256. package/dist/models/default/django_app/rateplan.d.ts +0 -92
  257. package/dist/models/default/django_app/rateplan.js +0 -69
  258. package/dist/models/default/django_app/rateplan.schema.json +0 -70
  259. package/dist/models/default/django_app/restrictedfieldrelatedmodel.d.ts +0 -108
  260. package/dist/models/default/django_app/restrictedfieldrelatedmodel.js +0 -69
  261. package/dist/models/default/django_app/restrictedfieldrelatedmodel.schema.json +0 -87
  262. package/dist/models/default/fileobject.d.ts +0 -4
  263. package/dist/models/default/fileobject.js +0 -9
  264. package/dist/models/default/index.d.ts +0 -2
  265. package/dist/models/default/index.js +0 -2
  266. package/dist/models/index.d.ts +0 -1
  267. package/dist/models/index.js +0 -5
  268. package/dist/react-entry.d.ts +0 -2
  269. package/dist/react-entry.js +0 -2
  270. package/dist/reactiveAdaptor.d.ts +0 -24
  271. package/dist/reactiveAdaptor.js +0 -38
  272. package/dist/reset.d.ts +0 -15
  273. package/dist/reset.js +0 -97
  274. package/dist/setup.d.ts +0 -15
  275. package/dist/setup.js +0 -33
  276. package/dist/syncEngine/cache/cache.d.ts +0 -75
  277. package/dist/syncEngine/cache/cache.js +0 -355
  278. package/dist/syncEngine/metrics/metricOptCalcs.d.ts +0 -79
  279. package/dist/syncEngine/metrics/metricOptCalcs.js +0 -284
  280. package/dist/syncEngine/registries/metricRegistry.d.ts +0 -58
  281. package/dist/syncEngine/registries/metricRegistry.js +0 -171
  282. package/dist/syncEngine/registries/modelStoreRegistry.d.ts +0 -11
  283. package/dist/syncEngine/registries/modelStoreRegistry.js +0 -63
  284. package/dist/syncEngine/registries/querysetStoreGraph.d.ts +0 -41
  285. package/dist/syncEngine/registries/querysetStoreGraph.js +0 -174
  286. package/dist/syncEngine/registries/querysetStoreRegistry.d.ts +0 -72
  287. package/dist/syncEngine/registries/querysetStoreRegistry.js +0 -335
  288. package/dist/syncEngine/stores/metricStore.d.ts +0 -55
  289. package/dist/syncEngine/stores/metricStore.js +0 -222
  290. package/dist/syncEngine/stores/modelStore.d.ts +0 -53
  291. package/dist/syncEngine/stores/modelStore.js +0 -565
  292. package/dist/syncEngine/stores/operation.d.ts +0 -139
  293. package/dist/syncEngine/stores/operation.js +0 -291
  294. package/dist/syncEngine/stores/operationEventHandlers.d.ts +0 -8
  295. package/dist/syncEngine/stores/operationEventHandlers.js +0 -322
  296. package/dist/syncEngine/stores/querysetStore.d.ts +0 -60
  297. package/dist/syncEngine/stores/querysetStore.js +0 -294
  298. package/dist/syncEngine/stores/reactivity.d.ts +0 -3
  299. package/dist/syncEngine/stores/reactivity.js +0 -4
  300. package/dist/syncEngine/stores/utils.d.ts +0 -14
  301. package/dist/syncEngine/stores/utils.js +0 -32
  302. package/dist/syncEngine/sync.d.ts +0 -46
  303. package/dist/syncEngine/sync.js +0 -389
  304. package/dist/testing.d.ts +0 -63
  305. package/dist/testing.js +0 -175
  306. package/dist/vue-entry.d.ts +0 -15
  307. package/dist/vue-entry.js +0 -7
@@ -1,34 +0,0 @@
1
- /**
2
- * Date parsing utilities for handling Django style date formats
3
- */
4
- export class DateParsingHelpers {
5
- static SUPPORTED_FORMATS: {
6
- 'iso-8601': null;
7
- '%Y-%m-%d': string;
8
- '%Y-%m-%d %H:%M:%S': string;
9
- '%d/%m/%Y': string;
10
- '%m/%d/%Y': string;
11
- '%Y/%m/%d': string;
12
- '%d-%m-%Y': string;
13
- '%m-%d-%Y': string;
14
- '%B %d, %Y': string;
15
- '%d %B %Y': string;
16
- };
17
- /**
18
- * Parse a date value using Django's format settings
19
- * @param {string|Date} value - The date value to parse
20
- * @param {string} fieldName - Name of the field (for schema lookup)
21
- * @param {Object} schema - The model schema containing format info
22
- * @param {string} timezone - The backend timezone (defaults to 'UTC')
23
- * @returns {Date|null} - Parsed Date object or null if invalid
24
- */
25
- static parseDate(value: string | Date, fieldName: string, schema: Object, timezone?: string): Date | null;
26
- /**
27
- * Serialize a date using the field's configured format
28
- * @param {Date} date - The date to serialize
29
- * @param {string} fieldName - Name of the field (for schema lookup)
30
- * @param {Object} schema - The model schema containing format info
31
- * @returns {string|null} - Formatted date string or null if invalid
32
- */
33
- static serializeDate(date: Date, fieldName: string, schema: Object): string | null;
34
- }
@@ -1,113 +0,0 @@
1
- import { format, parse, parseISO } from 'date-fns';
2
- import { DateTime } from 'luxon';
3
- /**
4
- * Date parsing utilities for handling Django style date formats
5
- */
6
- export class DateParsingHelpers {
7
- /**
8
- * Parse a date value using Django's format settings
9
- * @param {string|Date} value - The date value to parse
10
- * @param {string} fieldName - Name of the field (for schema lookup)
11
- * @param {Object} schema - The model schema containing format info
12
- * @param {string} timezone - The backend timezone (defaults to 'UTC')
13
- * @returns {Date|null} - Parsed Date object or null if invalid
14
- */
15
- static parseDate(value, fieldName, schema, timezone = 'UTC') {
16
- if (!value)
17
- return null;
18
- // If already a Date object, return as-is (it's already a specific instant in time)
19
- if (value instanceof Date)
20
- return value;
21
- const fieldFormat = schema.properties[fieldName].format;
22
- if (!["date", "date-time"].includes(fieldFormat)) {
23
- throw new Error(`Only date and date-time fields can be processed to JS date objects. ${fieldName} has format ${fieldFormat}`);
24
- }
25
- // Get field-specific format from schema
26
- const formatStrings = {
27
- 'date': schema.date_format,
28
- 'date-time': schema.datetime_format
29
- };
30
- const dateFormat = formatStrings[fieldFormat];
31
- // Check if format is supported
32
- if (dateFormat && !this.SUPPORTED_FORMATS.hasOwnProperty(dateFormat)) {
33
- throw new Error(`Unsupported date format "${dateFormat}" for field ${fieldName}. Supported formats: ${Object.keys(this.SUPPORTED_FORMATS).join(', ')}`);
34
- }
35
- try {
36
- // Handle ISO format (Django's default)
37
- if (!dateFormat || dateFormat === 'iso-8601') {
38
- // Parse the string in the server timezone using Luxon
39
- // This ensures '2022-03-15' is interpreted as midnight in the server TZ, not browser TZ
40
- const luxonDate = DateTime.fromISO(value, { zone: timezone });
41
- if (!luxonDate.isValid) {
42
- console.error(`Failed to parse ISO date "${value}":`, luxonDate.invalidReason);
43
- return null;
44
- }
45
- return luxonDate.toJSDate();
46
- }
47
- // Handle supported Django formats
48
- const dateFnsFormat = this.SUPPORTED_FORMATS[dateFormat];
49
- // For non-ISO formats, use date-fns but we should still consider timezone
50
- // For now, parse with date-fns and assume it's in the server timezone
51
- return parse(value, dateFnsFormat, new Date());
52
- }
53
- catch (error) {
54
- console.error(`Failed to parse date "${value}" with format "${dateFormat}"`, error);
55
- return null;
56
- }
57
- }
58
- /**
59
- * Serialize a date using the field's configured format
60
- * @param {Date} date - The date to serialize
61
- * @param {string} fieldName - Name of the field (for schema lookup)
62
- * @param {Object} schema - The model schema containing format info
63
- * @returns {string|null} - Formatted date string or null if invalid
64
- */
65
- static serializeDate(date, fieldName, schema) {
66
- if (!date || !(date instanceof Date) || isNaN(date.getTime())) {
67
- return date;
68
- }
69
- const fieldFormat = schema.properties[fieldName].format;
70
- if (!["date", "date-time"].includes(fieldFormat)) {
71
- throw new Error(`Only date and date-time fields can be processed to JS date objects. ${fieldName} has format ${fieldFormat}`);
72
- }
73
- // Get field-specific format from schema
74
- const formatStrings = {
75
- 'date': schema.date_format,
76
- 'date-time': schema.datetime_format
77
- };
78
- const dateFormat = formatStrings[fieldFormat];
79
- // Check if format is supported
80
- if (dateFormat && !this.SUPPORTED_FORMATS.hasOwnProperty(dateFormat)) {
81
- throw new Error(`Unsupported date format "${dateFormat}" for field ${fieldName}. Supported formats: ${Object.keys(this.SUPPORTED_FORMATS).join(', ')}`);
82
- }
83
- try {
84
- // Handle ISO format (Django's default)
85
- if (!dateFormat || dateFormat === 'iso-8601') {
86
- // For date-only fields, return just the date portion
87
- return fieldFormat === 'date'
88
- ? date.toISOString().slice(0, 10)
89
- : date.toISOString();
90
- }
91
- // Handle supported Django formats
92
- const dateFnsFormat = this.SUPPORTED_FORMATS[dateFormat];
93
- return format(date, dateFnsFormat);
94
- }
95
- catch (error) {
96
- console.error(`Failed to format date with format "${dateFormat}"`, error);
97
- return date.toISOString(); // Fallback to ISO format
98
- }
99
- }
100
- }
101
- // Supported Django strftime formats and their date-fns equivalents
102
- DateParsingHelpers.SUPPORTED_FORMATS = {
103
- 'iso-8601': null, // Special case - use parseISO/toISOString
104
- '%Y-%m-%d': 'yyyy-MM-dd', // 2024-12-31
105
- '%Y-%m-%d %H:%M:%S': 'yyyy-MM-dd HH:mm:ss', // 2024-12-31 14:30:45
106
- '%d/%m/%Y': 'dd/MM/yyyy', // 31/12/2024
107
- '%m/%d/%Y': 'MM/dd/yyyy', // 12/31/2024
108
- '%Y/%m/%d': 'yyyy/MM/dd', // 2024/12/31
109
- '%d-%m-%Y': 'dd-MM-yyyy', // 31-12-2024
110
- '%m-%d-%Y': 'MM-dd-yyyy', // 12-31-2024
111
- '%B %d, %Y': 'MMMM dd, yyyy', // December 31, 2024
112
- '%d %B %Y': 'dd MMMM yyyy', // 31 December 2024
113
- };
@@ -1,138 +0,0 @@
1
- /**
2
- * Parses a JSON error response from the backend and returns an instance
3
- * of the corresponding custom error.
4
- *
5
- * @param {IErrorResponse} errorResponse - The error response JSON.
6
- * @returns {StateZeroError} An instance of a StateZeroError subclass.
7
- */
8
- export function parseStateZeroError(errorResponse: IErrorResponse): StateZeroError;
9
- /**
10
- * @typedef {Object} IErrorResponse
11
- * @property {number} status - The HTTP status code.
12
- * @property {string} type - The error type.
13
- * @property {*} detail - The error details.
14
- */
15
- /**
16
- * @typedef {Object} IErrorDetail
17
- * @property {string} message - The error message.
18
- * @property {string} code - The error code.
19
- */
20
- /**
21
- * Base error class for StateZero errors.
22
- */
23
- export class StateZeroError extends Error {
24
- /**
25
- * Creates a new StateZeroError.
26
- *
27
- * @param {string} message - The error message.
28
- * @param {string} code - The error code.
29
- * @param {IErrorDetail|Object|string} detail - The error details.
30
- * @param {number} status - The HTTP status code.
31
- */
32
- constructor(message: string, code: string, detail: IErrorDetail | Object | string, status: number);
33
- code: string;
34
- detail: string | Object | IErrorDetail;
35
- status: number;
36
- /**
37
- * Returns a full error message including the detail.
38
- *
39
- * @returns {string} The full error message with details
40
- */
41
- getFullMessage(): string;
42
- }
43
- /**
44
- * Error class for validation errors.
45
- */
46
- export class ValidationError extends StateZeroError {
47
- /**
48
- * Creates a new ValidationError.
49
- *
50
- * @param {IErrorDetail|Object|string} detail - The error details.
51
- * @param {number} [status=400] - The HTTP status code.
52
- */
53
- constructor(detail: IErrorDetail | Object | string, status?: number);
54
- }
55
- /**
56
- * Error class for "Does Not Exist" errors (renamed from NotFound).
57
- */
58
- export class DoesNotExist extends StateZeroError {
59
- /**
60
- * Creates a new DoesNotExist error.
61
- *
62
- * @param {IErrorDetail|Object|string} [detail="Does not exist"] - The error details.
63
- * @param {number} [status=404] - The HTTP status code.
64
- */
65
- constructor(detail?: IErrorDetail | Object | string, status?: number);
66
- }
67
- /**
68
- * Error class for permission denied errors.
69
- */
70
- export class PermissionDenied extends StateZeroError {
71
- /**
72
- * Creates a new PermissionDenied error.
73
- *
74
- * @param {IErrorDetail|Object|string} [detail="Permission denied"] - The error details.
75
- * @param {number} [status=403] - The HTTP status code.
76
- */
77
- constructor(detail?: IErrorDetail | Object | string, status?: number);
78
- }
79
- /**
80
- * Error class for multiple objects returned errors.
81
- */
82
- export class MultipleObjectsReturned extends StateZeroError {
83
- /**
84
- * Creates a new MultipleObjectsReturned error.
85
- *
86
- * @param {IErrorDetail|Object|string} [detail="Multiple objects returned"] - The error details.
87
- * @param {number} [status=500] - The HTTP status code.
88
- */
89
- constructor(detail?: IErrorDetail | Object | string, status?: number);
90
- }
91
- /**
92
- * Error class for AST validation errors.
93
- */
94
- export class ASTValidationError extends StateZeroError {
95
- /**
96
- * Creates a new ASTValidationError.
97
- *
98
- * @param {IErrorDetail|Object|string} detail - The error details.
99
- * @param {number} [status=400] - The HTTP status code.
100
- */
101
- constructor(detail: IErrorDetail | Object | string, status?: number);
102
- }
103
- /**
104
- * Error class for configuration errors.
105
- */
106
- export class ConfigError extends StateZeroError {
107
- /**
108
- * Creates a new ConfigError.
109
- *
110
- * @param {IErrorDetail|Object|string} detail - The error details.
111
- * @param {number} [status=500] - The HTTP status code.
112
- */
113
- constructor(detail: IErrorDetail | Object | string, status?: number);
114
- }
115
- export type IErrorResponse = {
116
- /**
117
- * - The HTTP status code.
118
- */
119
- status: number;
120
- /**
121
- * - The error type.
122
- */
123
- type: string;
124
- /**
125
- * - The error details.
126
- */
127
- detail: any;
128
- };
129
- export type IErrorDetail = {
130
- /**
131
- * - The error message.
132
- */
133
- message: string;
134
- /**
135
- * - The error code.
136
- */
137
- code: string;
138
- };
@@ -1,195 +0,0 @@
1
- import { emitError } from '../../errorHandler.js';
2
- /**
3
- * @typedef {Object} IErrorResponse
4
- * @property {number} status - The HTTP status code.
5
- * @property {string} type - The error type.
6
- * @property {*} detail - The error details.
7
- */
8
- /**
9
- * @typedef {Object} IErrorDetail
10
- * @property {string} message - The error message.
11
- * @property {string} code - The error code.
12
- */
13
- /**
14
- * Base error class for StateZero errors.
15
- */
16
- export class StateZeroError extends Error {
17
- /**
18
- * Creates a new StateZeroError.
19
- *
20
- * @param {string} message - The error message.
21
- * @param {string} code - The error code.
22
- * @param {IErrorDetail|Object|string} detail - The error details.
23
- * @param {number} status - The HTTP status code.
24
- */
25
- constructor(message, code, detail, status) {
26
- super(message);
27
- this.name = "StateZeroError";
28
- this.code = code;
29
- this.detail = detail;
30
- this.status = status;
31
- Object.setPrototypeOf(this, new.target.prototype);
32
- emitError(this);
33
- }
34
- /**
35
- * Returns a full error message including the detail.
36
- *
37
- * @returns {string} The full error message with details
38
- */
39
- getFullMessage() {
40
- if (typeof this.detail === 'string') {
41
- return `${this.message}: ${this.detail}`;
42
- }
43
- else if (this.detail && typeof this.detail === 'object') {
44
- if (this.detail.message) {
45
- return `${this.message}: ${this.detail.message}`;
46
- }
47
- else {
48
- try {
49
- return `${this.message}: ${JSON.stringify(this.detail)}`;
50
- }
51
- catch (e) {
52
- return `${this.message}: [Complex detail object]`;
53
- }
54
- }
55
- }
56
- return this.message;
57
- }
58
- }
59
- /**
60
- * Error class for validation errors.
61
- */
62
- export class ValidationError extends StateZeroError {
63
- /**
64
- * Creates a new ValidationError.
65
- *
66
- * @param {IErrorDetail|Object|string} detail - The error details.
67
- * @param {number} [status=400] - The HTTP status code.
68
- */
69
- constructor(detail, status = 400) {
70
- super("Validation error", "validation_error", detail, status);
71
- this.name = "ValidationError";
72
- }
73
- }
74
- /**
75
- * Error class for "Does Not Exist" errors (renamed from NotFound).
76
- */
77
- export class DoesNotExist extends StateZeroError {
78
- /**
79
- * Creates a new DoesNotExist error.
80
- *
81
- * @param {IErrorDetail|Object|string} [detail="Does not exist"] - The error details.
82
- * @param {number} [status=404] - The HTTP status code.
83
- */
84
- constructor(detail = "Does not exist", status = 404) {
85
- super("DoesNotExist", "does_not_exist", detail, status);
86
- this.name = "DoesNotExist";
87
- }
88
- }
89
- /**
90
- * Error class for permission denied errors.
91
- */
92
- export class PermissionDenied extends StateZeroError {
93
- /**
94
- * Creates a new PermissionDenied error.
95
- *
96
- * @param {IErrorDetail|Object|string} [detail="Permission denied"] - The error details.
97
- * @param {number} [status=403] - The HTTP status code.
98
- */
99
- constructor(detail = "Permission denied", status = 403) {
100
- super("Permission denied", "permission_denied", detail, status);
101
- this.name = "PermissionDenied";
102
- }
103
- }
104
- /**
105
- * Error class for multiple objects returned errors.
106
- */
107
- export class MultipleObjectsReturned extends StateZeroError {
108
- /**
109
- * Creates a new MultipleObjectsReturned error.
110
- *
111
- * @param {IErrorDetail|Object|string} [detail="Multiple objects returned"] - The error details.
112
- * @param {number} [status=500] - The HTTP status code.
113
- */
114
- constructor(detail = "Multiple objects returned", status = 500) {
115
- super("Multiple objects returned", "multiple_objects_returned", detail, status);
116
- this.name = "MultipleObjectsReturned";
117
- }
118
- }
119
- /**
120
- * Error class for AST validation errors.
121
- */
122
- export class ASTValidationError extends StateZeroError {
123
- /**
124
- * Creates a new ASTValidationError.
125
- *
126
- * @param {IErrorDetail|Object|string} detail - The error details.
127
- * @param {number} [status=400] - The HTTP status code.
128
- */
129
- constructor(detail, status = 400) {
130
- super("Query syntax error", "ast_validation_error", detail, status);
131
- this.name = "ASTValidationError";
132
- }
133
- }
134
- /**
135
- * Error class for configuration errors.
136
- */
137
- export class ConfigError extends StateZeroError {
138
- /**
139
- * Creates a new ConfigError.
140
- *
141
- * @param {IErrorDetail|Object|string} detail - The error details.
142
- * @param {number} [status=500] - The HTTP status code.
143
- */
144
- constructor(detail, status = 500) {
145
- super("Configuration error", "config_error", detail, status);
146
- this.name = "ConfigError";
147
- }
148
- }
149
- /**
150
- * Parses a JSON error response from the backend and returns an instance
151
- * of the corresponding custom error.
152
- *
153
- * @param {IErrorResponse} errorResponse - The error response JSON.
154
- * @returns {StateZeroError} An instance of a StateZeroError subclass.
155
- */
156
- export function parseStateZeroError(errorResponse) {
157
- console.log(JSON.stringify(errorResponse));
158
- const { status, type, detail } = errorResponse;
159
- // Handle undefined type/status case (like in permission denied)
160
- if (type === undefined && detail === 'Invalid token.') {
161
- return new PermissionDenied(detail, 403);
162
- }
163
- switch (type) {
164
- // Direct mappings
165
- case "ValidationError":
166
- return new ValidationError(detail, status);
167
- case "NotFound":
168
- return new DoesNotExist(detail, status);
169
- case "MultipleObjectsReturned":
170
- return new MultipleObjectsReturned(detail, status);
171
- case "PermissionDenied":
172
- return new PermissionDenied(detail, status);
173
- case "ASTValidationError":
174
- return new ASTValidationError(detail, status);
175
- case "ConfigError":
176
- return new ConfigError(detail, status);
177
- // Django error types that map to our error classes
178
- case "FieldError":
179
- return new ValidationError(detail, status);
180
- case "ValueError":
181
- return new ValidationError(detail, status);
182
- default:
183
- // Fallback to status code based mapping
184
- if (status === 400) {
185
- return new ValidationError(detail, status);
186
- }
187
- else if (status === 403) {
188
- return new PermissionDenied(detail, status);
189
- }
190
- else if (status === 404) {
191
- return new DoesNotExist(detail, status);
192
- }
193
- return new StateZeroError("Unknown error", "unknown", detail, status);
194
- }
195
- }
@@ -1,6 +0,0 @@
1
- export function F(expression: any): {
2
- __f_expr: boolean;
3
- original_expr: string;
4
- ast: any;
5
- };
6
- export function evaluateExpression(expr: any, data: any): any;
@@ -1,91 +0,0 @@
1
- import { ValidationError } from './errors.js';
2
- import * as math from 'mathjs';
3
- // Create a math instance
4
- const mathInstance = math.create();
5
- // Define the allowed functions that we want to keep
6
- const allowedFunctions = ['abs', 'round', 'floor', 'ceil', 'min', 'max'];
7
- // Define allowed operators
8
- const ALLOWED_OPERATORS = ['+', '-', '*', '/', '%', '^'];
9
- export function F(expression) {
10
- if (typeof expression !== 'string' || !expression) {
11
- throw new ValidationError('F expression requires a non-empty string');
12
- }
13
- try {
14
- const node = math.parse(expression);
15
- validateExpression(node);
16
- return {
17
- __f_expr: true,
18
- original_expr: expression,
19
- ast: node.toJSON()
20
- };
21
- }
22
- catch (err) {
23
- throw new ValidationError(`Invalid F expression: ${err.message}`);
24
- }
25
- }
26
- function validateExpression(node) {
27
- if (!node)
28
- return;
29
- if (node.type === 'OperatorNode') {
30
- if (!ALLOWED_OPERATORS.includes(node.op)) {
31
- throw new ValidationError(`Unsupported operator: ${node.op}`);
32
- }
33
- node.args.forEach(validateExpression);
34
- }
35
- else if (node.type === 'FunctionNode') {
36
- if (!allowedFunctions.includes(node.name)) {
37
- throw new ValidationError(`Function not allowed: ${node.name}`);
38
- }
39
- node.args.forEach(validateExpression);
40
- }
41
- else if (node.type === 'SymbolNode') {
42
- if (!/^[a-zA-Z][a-zA-Z0-9_]*$/.test(node.name)) {
43
- throw new ValidationError(`Invalid field name: ${node.name}`);
44
- }
45
- }
46
- else if (node.type === 'ConstantNode') {
47
- // Constants are fine
48
- }
49
- else if (node.type === 'ParenthesisNode') {
50
- validateExpression(node.content);
51
- }
52
- else if (node.type === 'ConditionalNode') {
53
- throw new ValidationError('Conditional expressions are not supported in F expressions');
54
- }
55
- else if (node.type === 'AssignmentNode') {
56
- throw new ValidationError('Assignment expressions are not supported in F expressions');
57
- }
58
- else if (node.type === 'BlockNode') {
59
- throw new ValidationError('Block expressions are not supported in F expressions');
60
- }
61
- else if (node.type === 'AccessorNode') {
62
- throw new ValidationError('Accessor expressions are not supported in F expressions');
63
- }
64
- else if (node.type === 'IndexNode') {
65
- throw new ValidationError('Index expressions are not supported in F expressions');
66
- }
67
- else if (node.type === 'RangeNode') {
68
- throw new ValidationError('Range expressions are not supported in F expressions');
69
- }
70
- else if (node.type === 'ArrayNode') {
71
- throw new ValidationError('Array expressions are not supported in F expressions');
72
- }
73
- else if (node.type === 'ObjectNode') {
74
- throw new ValidationError('Object expressions are not supported in F expressions');
75
- }
76
- else {
77
- throw new ValidationError(`Unsupported node type: ${node.type}`);
78
- }
79
- }
80
- export function evaluateExpression(expr, data) {
81
- if (!expr || !expr.__f_expr) {
82
- return expr;
83
- }
84
- try {
85
- return math.evaluate(expr.original_expr, data);
86
- }
87
- catch (err) {
88
- console.warn(`Error evaluating F expression: ${err.message}`);
89
- return null;
90
- }
91
- }
@@ -1,62 +0,0 @@
1
- /**
2
- * FileObject - A file wrapper that handles uploads to StateZero backend
3
- */
4
- export class FileObject {
5
- static configKey: string;
6
- static MIN_CHUNK_SIZE: number;
7
- constructor(file: any, options?: {});
8
- name: any;
9
- size: any;
10
- type: any;
11
- lastModified: number | null;
12
- uploaded: boolean;
13
- uploading: boolean;
14
- uploadResult: any;
15
- uploadError: any;
16
- fileData: any;
17
- uploadType: string | null;
18
- uploadId: any;
19
- totalChunks: number;
20
- completedChunks: number;
21
- chunkSize: any;
22
- maxConcurrency: any;
23
- uploadPromise: any;
24
- get isStoredFile(): any;
25
- get status(): "failed" | "uploading" | "uploaded" | "pending";
26
- get filePath(): any;
27
- get fileUrl(): any;
28
- _initializeAndStartUpload(file: any, options: any): any;
29
- /**
30
- * Fast upload using S3 presigned URLs with multipart support
31
- */
32
- _fastUpload(file: any, options?: {}): any;
33
- /**
34
- * Handle single file upload
35
- */
36
- _singleUpload(file: any, uploadData: any, options: any): Promise<any>;
37
- /**
38
- * Handle multipart upload with concurrency using p-queue
39
- */
40
- _multipartUpload(file: any, uploadData: any, options: any): Promise<any>;
41
- /**
42
- * Create file chunks for multipart upload
43
- */
44
- _createFileChunks(file: any): any[];
45
- /**
46
- * Complete the upload (both single and multipart)
47
- */
48
- _completeUpload(filePath: any, originalName: any, uploadId?: null, parts?: null): Promise<any>;
49
- /**
50
- * Direct upload to Django backend (original method)
51
- */
52
- _directUpload(options?: {}): Promise<any>;
53
- /**
54
- * Reads the file content into an ArrayBuffer (for direct uploads only)
55
- */
56
- _readFileData(file: any): Promise<void>;
57
- /**
58
- * Gets the file data as a Blob (for direct uploads only)
59
- */
60
- getBlob(): Blob;
61
- waitForUpload(): Promise<any>;
62
- }