@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,736 +0,0 @@
1
- import { MultipleObjectsReturned, DoesNotExist, parseStateZeroError, } from "./errors.js";
2
- import { Model } from "./model.js";
3
- import { ModelSerializer, relationshipFieldSerializer, dateFieldSerializer } from "./serializers.js";
4
- import axios from "axios";
5
- import { QueryExecutor } from "./queryExecutor.js";
6
- import { v7 } from "uuid";
7
- import hash from "object-hash";
8
- import rfdc from "rfdc";
9
- const clone = rfdc();
10
- /**
11
- * A QuerySet provides a fluent API for constructing and executing queries.
12
- *
13
- * @template T
14
- */
15
- export class QuerySet {
16
- /**
17
- * Creates a new QuerySet.
18
- *
19
- * @param {ModelConstructor} ModelClass - The model constructor.
20
- * @param {Object} [config={}] - The configuration for the QuerySet.
21
- * @param {QueryNode[]} [config.nodes] - Array of query nodes.
22
- * @param {Array<{ field: string, direction: 'asc'|'desc' }>} [config.orderBy] - Ordering configuration.
23
- * @param {Set<string>} [config.fields] - Set of fields to retrieve.
24
- * @param {Aggregation[]} [config.aggregations] - Aggregation operations.
25
- * @param {string} [config.initialQueryset] - The initial queryset identifier.
26
- * @param {SerializerOptions} [config.serializerOptions] - Serializer options.
27
- * @param {boolean} [config.materialized] - Whether the queryset is materialized.
28
- */
29
- constructor(ModelClass, config = {}, parent = null) {
30
- this.ModelClass = ModelClass;
31
- this.nodes = config.nodes || [];
32
- this._orderBy = config.orderBy;
33
- this._fields = config.fields || new Set();
34
- this._aggregations = config.aggregations || [];
35
- this._initialQueryset = config.initialQueryset;
36
- this._serializerOptions = config.serializerOptions || {};
37
- this._materialized = config.materialized || false;
38
- this._optimisticOnly = config.optimisticOnly || false;
39
- this._remoteOnly = config.remoteOnly || false;
40
- this.__uuid = v7();
41
- this.__parent = parent;
42
- this.__reactivityId = parent?.__reactivityId;
43
- // Initialize the serializer for this model
44
- this._serializer = new ModelSerializer(this.ModelClass);
45
- }
46
- /**
47
- * Clones this QuerySet, creating a new instance with the same configuration.
48
- *
49
- * @returns {QuerySet} A new QuerySet instance.
50
- */
51
- clone() {
52
- return new QuerySet(this.ModelClass, {
53
- nodes: [...this.nodes],
54
- orderBy: this._orderBy ? [...this._orderBy] : undefined,
55
- fields: new Set(this._fields),
56
- aggregations: [...this._aggregations],
57
- initialQueryset: this._initialQueryset,
58
- serializerOptions: { ...this._serializerOptions },
59
- materialized: this._materialized,
60
- optimisticOnly: this._optimisticOnly,
61
- remoteOnly: this._remoteOnly,
62
- }, this);
63
- }
64
- get semanticKey() {
65
- return JSON.stringify({
66
- ModelClass: {
67
- configKey: this.ModelClass.configKey,
68
- modelName: this.ModelClass.modelName,
69
- },
70
- ast: this.build(),
71
- });
72
- }
73
- get key() {
74
- return this.__uuid;
75
- }
76
- /**
77
- * Ensures the QuerySet is still lazy (not materialized).
78
- *
79
- * @private
80
- * @throws {Error} If the QuerySet is already materialized.
81
- */
82
- ensureNotMaterialized() {
83
- if (this._materialized) {
84
- throw new Error("Cannot chain further operations on a materialized QuerySet.");
85
- }
86
- }
87
- /**
88
- * Returns the model constructor for this QuerySet.
89
- *
90
- * @returns {ModelConstructor} The model constructor.
91
- */
92
- get modelClass() {
93
- return this.ModelClass;
94
- }
95
- /**
96
- * Sets serializer options for the QuerySet.
97
- *
98
- * @param {SerializerOptions} options - The serializer options to set.
99
- * @returns {QuerySet} This QuerySet instance for chaining.
100
- */
101
- setSerializerOptions(options) {
102
- this._serializerOptions = { ...this._serializerOptions, ...options };
103
- return this;
104
- }
105
- /**
106
- * Serializes filter conditions using the model serializer.
107
- *
108
- * @private
109
- * @param {Object} conditions - The filter conditions to serialize.
110
- * @returns {Object} The serialized conditions.
111
- */
112
- _serializeConditions(conditions) {
113
- if (!conditions || typeof conditions !== "object") {
114
- return conditions;
115
- }
116
- const serializedConditions = {};
117
- for (const [fieldPath, value] of Object.entries(conditions)) {
118
- serializedConditions[fieldPath] = this._serializeValue(value);
119
- }
120
- return serializedConditions;
121
- }
122
- /**
123
- * Serializes a value based on its type (handles arrays, Model instances, Dates, primitives)
124
- *
125
- * @private
126
- * @param {any} value - The value to serialize
127
- * @returns {any} The serialized value
128
- */
129
- _serializeValue(value) {
130
- // Handle arrays (for __in lookups)
131
- if (Array.isArray(value)) {
132
- return value.map(item => this._serializeValue(item));
133
- }
134
- // Handle Model instances (objects with pk, serialize method, and constructor with configKey/modelName)
135
- // Note: Model instances are objects, not classes (typeof instance === 'object')
136
- if (value &&
137
- typeof value === 'object' &&
138
- !(value instanceof Date) && // Exclude Date objects
139
- 'pk' in value &&
140
- 'serialize' in value &&
141
- typeof value.serialize === 'function' &&
142
- value.constructor &&
143
- 'configKey' in value.constructor &&
144
- 'modelName' in value.constructor) {
145
- return relationshipFieldSerializer.toInternal(value);
146
- }
147
- // Handle Date objects
148
- // Without field context, we default to datetime format (ISO string with time)
149
- // Unless it's exactly midnight in UTC, which likely indicates a date-only field
150
- if (value instanceof Date) {
151
- // Check if it's midnight UTC (likely a date-only value)
152
- const hours = value.getUTCHours();
153
- const minutes = value.getUTCMinutes();
154
- const seconds = value.getUTCSeconds();
155
- const milliseconds = value.getUTCMilliseconds();
156
- if (hours === 0 && minutes === 0 && seconds === 0 && milliseconds === 0) {
157
- // It's midnight UTC - serialize as date-only (YYYY-MM-DD)
158
- return value.toISOString().split('T')[0];
159
- }
160
- else {
161
- // Has time component - serialize as full datetime
162
- return value.toISOString();
163
- }
164
- }
165
- // Everything else (strings, numbers, booleans, null) - return as-is
166
- return value;
167
- }
168
- /**
169
- * Filters the QuerySet with the provided conditions.
170
- *
171
- * @param {Object} conditions - The filter conditions.
172
- * @returns {QuerySet} A new QuerySet with the filter applied.
173
- */
174
- filter(conditions) {
175
- this.ensureNotMaterialized();
176
- const { Q: qConditions, ...filters } = conditions;
177
- const newNodes = [...this.nodes];
178
- if (Object.keys(filters).length > 0) {
179
- // Serialize the filter conditions before adding to the node
180
- const serializedFilters = this._serializeConditions(filters);
181
- newNodes.push({
182
- type: "filter",
183
- conditions: serializedFilters,
184
- });
185
- }
186
- if (qConditions && qConditions.length) {
187
- newNodes.push({
188
- type: "and",
189
- children: qConditions.map((q) => this.processQObject(q)),
190
- });
191
- }
192
- return new QuerySet(this.ModelClass, {
193
- ...this._getConfig(),
194
- nodes: newNodes,
195
- }, this);
196
- }
197
- /**
198
- * Excludes the specified conditions from the QuerySet.
199
- *
200
- * @param {Object} conditions - The conditions to exclude.
201
- * @returns {QuerySet} A new QuerySet with the exclusion applied.
202
- */
203
- exclude(conditions) {
204
- this.ensureNotMaterialized();
205
- const { Q: qConditions, ...filters } = conditions;
206
- const newNodes = [...this.nodes];
207
- let childNode = null;
208
- if (Object.keys(filters).length > 0 && qConditions && qConditions.length) {
209
- // Serialize the filter conditions
210
- const serializedFilters = this._serializeConditions(filters);
211
- childNode = {
212
- type: "and",
213
- children: [
214
- { type: "filter", conditions: serializedFilters },
215
- {
216
- type: "and",
217
- children: qConditions.map((q) => this.processQObject(q)),
218
- },
219
- ],
220
- };
221
- }
222
- else if (Object.keys(filters).length > 0) {
223
- // Serialize the filter conditions
224
- const serializedFilters = this._serializeConditions(filters);
225
- childNode = {
226
- type: "filter",
227
- conditions: serializedFilters,
228
- };
229
- }
230
- else if (qConditions && qConditions.length) {
231
- childNode = {
232
- type: "and",
233
- children: qConditions.map((q) => this.processQObject(q)),
234
- };
235
- }
236
- const excludeNode = {
237
- type: "exclude",
238
- child: childNode,
239
- };
240
- newNodes.push(excludeNode);
241
- return new QuerySet(this.ModelClass, {
242
- ...this._getConfig(),
243
- nodes: newNodes,
244
- }, this);
245
- }
246
- /**
247
- * Orders the QuerySet by the specified fields.
248
- *
249
- * @param {...string} fields - Fields to order by.
250
- * @returns {QuerySet} A new QuerySet with ordering applied.
251
- */
252
- orderBy(...fields) {
253
- this.ensureNotMaterialized();
254
- return new QuerySet(this.ModelClass, {
255
- ...this._getConfig(),
256
- orderBy: fields,
257
- }, this);
258
- }
259
- /**
260
- * Applies a search to the QuerySet using the specified search query and fields.
261
- *
262
- * @param {string} searchQuery - The search query.
263
- * @param {string[]} [searchFields] - The fields to search.
264
- * @returns {QuerySet} A new QuerySet with the search applied.
265
- */
266
- search(searchQuery, searchFields) {
267
- this.ensureNotMaterialized();
268
- const newNodes = [...this.nodes];
269
- newNodes.push({
270
- type: "search",
271
- searchQuery,
272
- searchFields: searchFields,
273
- });
274
- return new QuerySet(this.ModelClass, {
275
- ...this._getConfig(),
276
- nodes: newNodes,
277
- }, this);
278
- }
279
- /**
280
- * Processes a Q object or condition into a QueryNode.
281
- *
282
- * @private
283
- * @param {QObject|QCondition} q - The query object or condition.
284
- * @returns {QueryNode} The processed QueryNode.
285
- */
286
- processQObject(q) {
287
- if ("operator" in q && "conditions" in q) {
288
- return {
289
- type: q.operator === "AND" ? "and" : "or",
290
- children: Array.isArray(q.conditions)
291
- ? q.conditions.map((c) => this.processQObject(c))
292
- : [],
293
- };
294
- }
295
- else {
296
- // Serialize the conditions in Q objects as well
297
- const serializedConditions = this._serializeConditions(q);
298
- return {
299
- type: "filter",
300
- conditions: serializedConditions,
301
- };
302
- }
303
- }
304
- /**
305
- * Aggregates the QuerySet using the specified function.
306
- *
307
- * @param {AggregateFunction} fn - The aggregation function.
308
- * @param {string} field - The field to aggregate.
309
- * @param {string} [alias] - An optional alias for the aggregated field.
310
- * @returns {QuerySet} A new QuerySet with the aggregation applied.
311
- */
312
- aggregate(fn, field, alias) {
313
- this.ensureNotMaterialized();
314
- return new QuerySet(this.ModelClass, {
315
- ...this._getConfig(),
316
- aggregations: [
317
- ...this._aggregations,
318
- {
319
- function: fn,
320
- field: field,
321
- alias,
322
- },
323
- ],
324
- }, this);
325
- }
326
- /**
327
- * Executes a count query on the QuerySet.
328
- *
329
- * @param {string} [field] - The field to count.
330
- * @returns {Promise<number>} A promise that resolves to the count.
331
- */
332
- count(field) {
333
- this.ensureNotMaterialized();
334
- const newQs = new QuerySet(this.ModelClass, {
335
- ...this._getConfig(),
336
- materialized: true,
337
- }, this);
338
- return QueryExecutor.execute(newQs, "count", {
339
- field: field || this.ModelClass.primaryKeyField,
340
- });
341
- }
342
- /**
343
- * Executes a sum aggregation on the QuerySet.
344
- *
345
- * @param {string} field - The field to sum.
346
- * @returns {Promise<number>} A promise that resolves to the sum.
347
- */
348
- sum(field) {
349
- this.ensureNotMaterialized();
350
- const newQs = new QuerySet(this.ModelClass, {
351
- ...this._getConfig(),
352
- materialized: true,
353
- }, this);
354
- return QueryExecutor.execute(newQs, "sum", { field });
355
- }
356
- /**
357
- * Executes an average aggregation on the QuerySet.
358
- *
359
- * @param {string} field - The field to average.
360
- * @returns {Promise<number>} A promise that resolves to the average.
361
- */
362
- avg(field) {
363
- this.ensureNotMaterialized();
364
- const newQs = new QuerySet(this.ModelClass, {
365
- ...this._getConfig(),
366
- materialized: true,
367
- }, this);
368
- return QueryExecutor.execute(newQs, "avg", { field });
369
- }
370
- /**
371
- * Executes a min aggregation on the QuerySet.
372
- *
373
- * @param {string} field - The field to find the minimum value for.
374
- * @returns {Promise<any>} A promise that resolves to the minimum value.
375
- */
376
- min(field) {
377
- this.ensureNotMaterialized();
378
- const newQs = new QuerySet(this.ModelClass, {
379
- ...this._getConfig(),
380
- materialized: true,
381
- }, this);
382
- return QueryExecutor.execute(newQs, "min", { field });
383
- }
384
- /**
385
- * Executes a max aggregation on the QuerySet.
386
- *
387
- * @param {string} field - The field to find the maximum value for.
388
- * @returns {Promise<any>} A promise that resolves to the maximum value.
389
- */
390
- max(field) {
391
- this.ensureNotMaterialized();
392
- const newQs = new QuerySet(this.ModelClass, {
393
- ...this._getConfig(),
394
- materialized: true,
395
- }, this);
396
- return QueryExecutor.execute(newQs, "max", { field });
397
- }
398
- /**
399
- * Retrieves the first record of the QuerySet.
400
- *
401
- * @param {SerializerOptions} [serializerOptions] - Optional serializer options.
402
- * @returns {Promise<T|null>} A promise that resolves to the first record or null.
403
- */
404
- first(serializerOptions) {
405
- this.ensureNotMaterialized();
406
- const newQs = new QuerySet(this.ModelClass, {
407
- ...this._getConfig(),
408
- serializerOptions: serializerOptions
409
- ? { ...this._serializerOptions, ...serializerOptions }
410
- : this._serializerOptions,
411
- materialized: true,
412
- }, this);
413
- return QueryExecutor.execute(newQs, "first");
414
- }
415
- /**
416
- * Retrieves the last record of the QuerySet.
417
- *
418
- * @param {SerializerOptions} [serializerOptions] - Optional serializer options.
419
- * @returns {Promise<T|null>} A promise that resolves to the last record or null.
420
- */
421
- last(serializerOptions) {
422
- this.ensureNotMaterialized();
423
- const newQs = new QuerySet(this.ModelClass, {
424
- ...this._getConfig(),
425
- serializerOptions: serializerOptions
426
- ? { ...this._serializerOptions, ...serializerOptions }
427
- : this._serializerOptions,
428
- materialized: true,
429
- }, this);
430
- return QueryExecutor.execute(newQs, "last");
431
- }
432
- /**
433
- * Checks if any records exist in the QuerySet.
434
- *
435
- * @returns {Promise<boolean>} A promise that resolves to true if records exist, otherwise false.
436
- */
437
- exists() {
438
- this.ensureNotMaterialized();
439
- const newQs = new QuerySet(this.ModelClass, {
440
- ...this._getConfig(),
441
- materialized: true,
442
- }, this);
443
- return QueryExecutor.execute(newQs, "exists");
444
- }
445
- /**
446
- * Applies serializer options to the QuerySet.
447
- *
448
- * @param {SerializerOptions} [serializerOptions] - Optional serializer options.
449
- * @returns {QuerySet} A new QuerySet with the serializer options applied.
450
- */
451
- all(serializerOptions) {
452
- this.ensureNotMaterialized();
453
- if (serializerOptions) {
454
- return new QuerySet(this.ModelClass, {
455
- ...this._getConfig(),
456
- serializerOptions: {
457
- ...this._serializerOptions,
458
- ...serializerOptions,
459
- },
460
- }, this);
461
- }
462
- return this;
463
- }
464
- /**
465
- * Internal method to create an optimistic-only QuerySet.
466
- * @private
467
- * @returns {QuerySet} A new QuerySet with optimistic-only mode enabled.
468
- */
469
- _optimistic() {
470
- this.ensureNotMaterialized();
471
- return new QuerySet(this.ModelClass, {
472
- ...this._getConfig(),
473
- optimisticOnly: true,
474
- }, this);
475
- }
476
- /**
477
- * Returns a QuerySet marked as optimistic-only, meaning operations will only
478
- * update local state without making backend API calls.
479
- *
480
- * @returns {QuerySet} A new QuerySet with optimistic-only mode enabled.
481
- */
482
- get optimistic() {
483
- return this._optimistic();
484
- }
485
- /**
486
- * Returns a QuerySet marked as remote-only, meaning operations will
487
- * hit the backend but skip local store updates and live thenables.
488
- *
489
- * @returns {QuerySet} A new QuerySet with remote-only mode enabled.
490
- */
491
- remote() {
492
- return new QuerySet(this.ModelClass, {
493
- ...this._getConfig(),
494
- remoteOnly: true,
495
- }, this);
496
- }
497
- /**
498
- * Creates a new record in the QuerySet.
499
- * @param {Object} data - The fields and values for the new record.
500
- * @returns {Promise<any>} The created model instance.
501
- */
502
- async create(data) {
503
- this.ensureNotMaterialized();
504
- // Serialize the data before sending to backend
505
- const serializedData = this._serializer.toInternal(data);
506
- // Materialize for create
507
- const newQs = new QuerySet(this.ModelClass, {
508
- ...this._getConfig(),
509
- materialized: true,
510
- }, this);
511
- return QueryExecutor.execute(newQs, "create", { data: serializedData });
512
- }
513
- /**
514
- * Creates multiple model instances using the provided model instances.
515
- *
516
- * @param {Array<Model>} modelInstances - Array of unsaved model instances to create.
517
- * @returns {Promise<Array<any>>} A promise that resolves to an array of newly created model instances.
518
- */
519
- async bulkCreate(modelInstances) {
520
- this.ensureNotMaterialized();
521
- if (!Array.isArray(modelInstances)) {
522
- throw new Error("bulkCreate expects an array of model instances");
523
- }
524
- // Serialize each model instance using model.serialize()
525
- const serializedDataList = modelInstances.map(instance => {
526
- if (!instance || typeof instance.serialize !== 'function') {
527
- throw new Error("bulkCreate requires model instances. Did you pass a plain object instead?");
528
- }
529
- return instance.serialize();
530
- });
531
- // Materialize for bulk create
532
- const newQs = new QuerySet(this.ModelClass, {
533
- ...this._getConfig(),
534
- materialized: true,
535
- }, this);
536
- return QueryExecutor.execute(newQs, "bulk_create", { data: serializedDataList });
537
- }
538
- /**
539
- * Updates records in the QuerySet.
540
- *
541
- * @param {Object} updates - The fields to update.
542
- * @returns {Promise<[number, Object]>} A promise that resolves to a tuple with the number of updated records and a mapping of model names to counts.
543
- */
544
- update(updates) {
545
- if (arguments.length > 1) {
546
- throw new Error("Update accepts only accepts an object of the updates to apply. Use filter() before calling update() to select elements.");
547
- }
548
- this.ensureNotMaterialized();
549
- // Serialize the updates before sending to backend
550
- const serializedUpdates = this._serializer.toInternal(updates);
551
- const newQs = new QuerySet(this.ModelClass, {
552
- ...this._getConfig(),
553
- materialized: true,
554
- });
555
- return QueryExecutor.execute(newQs, "update", { data: serializedUpdates });
556
- }
557
- /**
558
- * Deletes records in the QuerySet.
559
- *
560
- * @returns {Promise<[number, Object]>} A promise that resolves to a tuple with the number of deleted records and a mapping of model names to counts.
561
- */
562
- delete() {
563
- if (arguments.length > 0) {
564
- throw new Error("delete() does not accept arguments and will delete the entire queryset. Use filter() before calling delete() to select elements.");
565
- }
566
- this.ensureNotMaterialized();
567
- const newQs = new QuerySet(this.ModelClass, {
568
- ...this._getConfig(),
569
- materialized: true,
570
- }, this);
571
- return QueryExecutor.execute(newQs, "delete");
572
- }
573
- /**
574
- * Retrieves a single record from the QuerySet.
575
- *
576
- * @param {Object} [filters] - Optional filters to apply.
577
- * @param {SerializerOptions} [serializerOptions] - Optional serializer options.
578
- * @returns {Promise<T>} A promise that resolves to the retrieved record.
579
- * @throws {MultipleObjectsReturned} If more than one record is found.
580
- * @throws {DoesNotExist} If no records are found.
581
- */
582
- get(filters, serializerOptions) {
583
- this.ensureNotMaterialized();
584
- let newQs = this;
585
- if (filters) {
586
- newQs = this.filter(filters);
587
- }
588
- if (serializerOptions) {
589
- newQs = new QuerySet(this.ModelClass, {
590
- ...newQs._getConfig(),
591
- serializerOptions: {
592
- ...newQs._serializerOptions,
593
- ...serializerOptions,
594
- },
595
- }, this);
596
- }
597
- const materializedQs = new QuerySet(this.ModelClass, {
598
- ...newQs._getConfig(),
599
- materialized: true,
600
- }, this);
601
- const result = QueryExecutor.execute(materializedQs, "get");
602
- if (result === null) {
603
- throw new DoesNotExist();
604
- }
605
- return result;
606
- }
607
- /**
608
- * Gets or creates a record based on the provided lookup parameters.
609
- *
610
- * @param {Object} lookupParams - The lookup parameters to find the record.
611
- * @param {Object} [defaults={}] - Default values to use when creating a new record.
612
- * @returns {Promise<[T, boolean]>} A promise that resolves to a tuple of [instance, created].
613
- */
614
- async getOrCreate(lookupParams, defaults = {}) {
615
- this.ensureNotMaterialized();
616
- // Serialize both lookup params and defaults
617
- const serializedLookup = this._serializer.toInternal(lookupParams);
618
- const serializedDefaults = this._serializer.toInternal(defaults);
619
- const newQs = new QuerySet(this.ModelClass, {
620
- ...this._getConfig(),
621
- materialized: true,
622
- }, this);
623
- return QueryExecutor.execute(newQs, "get_or_create", {
624
- lookup: serializedLookup,
625
- defaults: serializedDefaults,
626
- });
627
- }
628
- /**
629
- * Updates or creates a record based on the provided lookup parameters.
630
- *
631
- * @param {Object} lookupParams - The lookup parameters to find the record.
632
- * @param {Object} [defaults={}] - Default values to use when creating or updating.
633
- * @returns {Promise<[T, boolean]>} A promise that resolves to a tuple of [instance, created].
634
- */
635
- async updateOrCreate(lookupParams, defaults = {}) {
636
- this.ensureNotMaterialized();
637
- // Serialize both lookup params and defaults
638
- const serializedLookup = this._serializer.toInternal(lookupParams);
639
- const serializedDefaults = this._serializer.toInternal(defaults);
640
- const newQs = new QuerySet(this.ModelClass, {
641
- ...this._getConfig(),
642
- materialized: true,
643
- }, this);
644
- return QueryExecutor.execute(newQs, "update_or_create", {
645
- lookup: serializedLookup,
646
- defaults: serializedDefaults,
647
- });
648
- }
649
- /**
650
- * Builds the final query object to be sent to the backend (simple jsonable object format).
651
- *
652
- * @returns {Object} The final query object.
653
- */
654
- build() {
655
- let searchData = null;
656
- const nonSearchNodes = [];
657
- for (const node of this.nodes) {
658
- if (node.type === "search") {
659
- searchData = {
660
- searchQuery: node.searchQuery || "",
661
- searchFields: node.searchFields || this.ModelClass.schema.searchable_fields
662
- };
663
- }
664
- else {
665
- nonSearchNodes.push(node);
666
- }
667
- }
668
- const filterNode = nonSearchNodes.length === 0
669
- ? null
670
- : nonSearchNodes.length === 1
671
- ? nonSearchNodes[0]
672
- : {
673
- type: "and",
674
- children: nonSearchNodes,
675
- };
676
- return clone({
677
- filter: filterNode,
678
- search: searchData,
679
- aggregations: this._aggregations,
680
- orderBy: this._orderBy,
681
- serializerOptions: this._serializerOptions,
682
- });
683
- }
684
- /**
685
- * Returns the current configuration of the QuerySet.
686
- *
687
- * @private
688
- * @returns {Object} The current QuerySet configuration.
689
- */
690
- _getConfig() {
691
- return {
692
- nodes: this.nodes,
693
- orderBy: this._orderBy,
694
- fields: this._fields,
695
- aggregations: this._aggregations,
696
- initialQueryset: this._initialQueryset,
697
- serializerOptions: this._serializerOptions,
698
- optimisticOnly: this._optimisticOnly,
699
- remoteOnly: this._remoteOnly,
700
- };
701
- }
702
- /**
703
- * Materializes the QuerySet into an array of model instances.
704
- *
705
- * @param {SerializerOptions} [serializerOptions] - Optional serializer options.
706
- * @returns {Promise<T[]>} A promise that resolves to an array of model instances.
707
- */
708
- fetch(serializerOptions) {
709
- let querySet = this;
710
- if (serializerOptions) {
711
- querySet = new QuerySet(this.ModelClass, {
712
- ...this._getConfig(),
713
- serializerOptions: {
714
- ...this._serializerOptions,
715
- ...serializerOptions,
716
- },
717
- }, this);
718
- }
719
- const materializedQs = new QuerySet(this.ModelClass, {
720
- ...querySet._getConfig(),
721
- materialized: true,
722
- }, this);
723
- return QueryExecutor.execute(materializedQs, "list");
724
- }
725
- /**
726
- * Implements the async iterator protocol so that you can iterate over the QuerySet.
727
- *
728
- * @returns {AsyncIterator<T>} An async iterator over the model instances.
729
- */
730
- async *[Symbol.asyncIterator]() {
731
- const items = await this.fetch();
732
- for (const item of items) {
733
- yield item;
734
- }
735
- }
736
- }