interaqt 0.1.0 → 0.2.1

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 (329) hide show
  1. package/agent/.claude/agents/code-generation-handler.md +598 -0
  2. package/agent/.claude/agents/computation-generation-handler.md +290 -0
  3. package/agent/.claude/agents/implement-design-handler.md +179 -0
  4. package/agent/.claude/agents/permission-generation-handler.md +202 -0
  5. package/agent/.claude/agents/requirements-analysis-handler-bak.md +530 -0
  6. package/agent/.claude/agents/requirements-analysis-handler.md +720 -0
  7. package/agent/.claude/settings.local.json +46 -0
  8. package/agent/CLAUDE.md +72 -0
  9. package/dist/index.js +10508 -4
  10. package/dist/index.js.map +1 -1
  11. package/dist/runtime/ComputationSourceMap.d.ts +117 -0
  12. package/dist/runtime/ComputationSourceMap.d.ts.map +1 -0
  13. package/dist/runtime/Controller.d.ts +37 -26
  14. package/dist/runtime/Controller.d.ts.map +1 -1
  15. package/dist/runtime/ExternalSynchronizer.d.ts +6 -0
  16. package/dist/runtime/ExternalSynchronizer.d.ts.map +1 -0
  17. package/dist/runtime/MonoSystem.d.ts +29 -17
  18. package/dist/runtime/MonoSystem.d.ts.map +1 -1
  19. package/dist/runtime/Mysql.d.ts +2 -2
  20. package/dist/runtime/PGLite.d.ts +35 -0
  21. package/dist/runtime/PGLite.d.ts.map +1 -0
  22. package/dist/runtime/PostgreSQL.d.ts +2 -2
  23. package/dist/runtime/SQLite.d.ts +3 -3
  24. package/dist/runtime/SQLite.d.ts.map +1 -1
  25. package/dist/runtime/Scheduler.d.ts +28 -61
  26. package/dist/runtime/Scheduler.d.ts.map +1 -1
  27. package/dist/runtime/System.d.ts +18 -224
  28. package/dist/runtime/System.d.ts.map +1 -1
  29. package/dist/runtime/{ActivityCall.d.ts → activity/ActivityCall.d.ts} +6 -7
  30. package/dist/runtime/activity/ActivityCall.d.ts.map +1 -0
  31. package/dist/runtime/activity/ActivityManager.d.ts +44 -0
  32. package/dist/runtime/activity/ActivityManager.d.ts.map +1 -0
  33. package/dist/runtime/{InteractionCall.d.ts → activity/InteractionCall.d.ts} +28 -41
  34. package/dist/runtime/activity/InteractionCall.d.ts.map +1 -0
  35. package/dist/runtime/computations/Any.d.ts +71 -0
  36. package/dist/runtime/computations/Any.d.ts.map +1 -0
  37. package/dist/runtime/computations/Average.d.ts +69 -0
  38. package/dist/runtime/computations/Average.d.ts.map +1 -0
  39. package/dist/runtime/computations/Computation.d.ts +138 -0
  40. package/dist/runtime/computations/Computation.d.ts.map +1 -0
  41. package/dist/runtime/computations/Count.d.ts +73 -0
  42. package/dist/runtime/computations/Count.d.ts.map +1 -0
  43. package/dist/runtime/computations/Custom.d.ts +45 -0
  44. package/dist/runtime/computations/Custom.d.ts.map +1 -0
  45. package/dist/runtime/computations/Every.d.ts +74 -0
  46. package/dist/runtime/computations/Every.d.ts.map +1 -0
  47. package/dist/runtime/computations/MathResolver.d.ts +60 -0
  48. package/dist/runtime/computations/MathResolver.d.ts.map +1 -0
  49. package/dist/runtime/computations/RealTime.d.ts +66 -0
  50. package/dist/runtime/computations/RealTime.d.ts.map +1 -0
  51. package/dist/runtime/{computedDataHandles → computations}/StateMachine.d.ts +31 -22
  52. package/dist/runtime/computations/StateMachine.d.ts.map +1 -0
  53. package/dist/runtime/computations/Summation.d.ts +66 -0
  54. package/dist/runtime/computations/Summation.d.ts.map +1 -0
  55. package/dist/runtime/computations/Transform.d.ts +29 -0
  56. package/dist/runtime/computations/Transform.d.ts.map +1 -0
  57. package/dist/runtime/computations/TransitionFinder.d.ts +11 -0
  58. package/dist/runtime/computations/TransitionFinder.d.ts.map +1 -0
  59. package/dist/runtime/computations/WeightedSummation.d.ts +71 -0
  60. package/dist/runtime/computations/WeightedSummation.d.ts.map +1 -0
  61. package/dist/runtime/computations/index.d.ts +22 -0
  62. package/dist/runtime/computations/index.d.ts.map +1 -0
  63. package/dist/runtime/errors/ActivityErrors.d.ts +40 -0
  64. package/dist/runtime/errors/ActivityErrors.d.ts.map +1 -0
  65. package/dist/runtime/errors/ComputationErrors.d.ts +61 -0
  66. package/dist/runtime/errors/ComputationErrors.d.ts.map +1 -0
  67. package/dist/runtime/errors/ConditionErrors.d.ts +33 -0
  68. package/dist/runtime/errors/ConditionErrors.d.ts.map +1 -0
  69. package/dist/runtime/errors/FrameworkError.d.ts +77 -0
  70. package/dist/runtime/errors/FrameworkError.d.ts.map +1 -0
  71. package/dist/runtime/errors/InteractionErrors.d.ts +21 -0
  72. package/dist/runtime/errors/InteractionErrors.d.ts.map +1 -0
  73. package/dist/runtime/errors/SystemErrors.d.ts +16 -0
  74. package/dist/runtime/errors/SystemErrors.d.ts.map +1 -0
  75. package/dist/runtime/errors/index.d.ts +37 -0
  76. package/dist/runtime/errors/index.d.ts.map +1 -0
  77. package/dist/runtime/index.d.ts +9 -7
  78. package/dist/runtime/index.d.ts.map +1 -1
  79. package/dist/shared/Action.d.ts +38 -0
  80. package/dist/shared/Action.d.ts.map +1 -0
  81. package/dist/shared/Activity.d.ts +178 -0
  82. package/dist/shared/Activity.d.ts.map +1 -0
  83. package/dist/shared/Any.d.ts +82 -0
  84. package/dist/shared/Any.d.ts.map +1 -0
  85. package/dist/shared/Attributive.d.ts +92 -0
  86. package/dist/shared/Attributive.d.ts.map +1 -0
  87. package/dist/shared/Average.d.ts +59 -0
  88. package/dist/shared/Average.d.ts.map +1 -0
  89. package/dist/shared/BoolExp.d.ts +139 -63
  90. package/dist/shared/BoolExp.d.ts.map +1 -1
  91. package/dist/shared/Computation.d.ts +23 -0
  92. package/dist/shared/Computation.d.ts.map +1 -0
  93. package/dist/shared/Condition.d.ts +43 -0
  94. package/dist/shared/Condition.d.ts.map +1 -0
  95. package/dist/shared/Conditions.d.ts +38 -0
  96. package/dist/shared/Conditions.d.ts.map +1 -0
  97. package/dist/shared/Count.d.ts +77 -0
  98. package/dist/shared/Count.d.ts.map +1 -0
  99. package/dist/shared/Custom.d.ts +108 -0
  100. package/dist/shared/Custom.d.ts.map +1 -0
  101. package/dist/shared/Data.d.ts +121 -0
  102. package/dist/shared/Data.d.ts.map +1 -0
  103. package/dist/shared/DataAttributives.d.ts +38 -0
  104. package/dist/shared/DataAttributives.d.ts.map +1 -0
  105. package/dist/shared/Entity.d.ts +96 -0
  106. package/dist/shared/Entity.d.ts.map +1 -0
  107. package/dist/shared/Event.d.ts +36 -0
  108. package/dist/shared/Event.d.ts.map +1 -0
  109. package/dist/shared/Every.d.ts +85 -0
  110. package/dist/shared/Every.d.ts.map +1 -0
  111. package/dist/shared/Gateway.d.ts +36 -0
  112. package/dist/shared/Gateway.d.ts.map +1 -0
  113. package/dist/shared/Interaction.d.ts +108 -0
  114. package/dist/shared/Interaction.d.ts.map +1 -0
  115. package/dist/shared/Payload.d.ts +39 -0
  116. package/dist/shared/Payload.d.ts.map +1 -0
  117. package/dist/shared/PayloadItem.d.ts +85 -0
  118. package/dist/shared/PayloadItem.d.ts.map +1 -0
  119. package/dist/shared/Property.d.ts +83 -0
  120. package/dist/shared/Property.d.ts.map +1 -0
  121. package/dist/shared/RealDictionary.d.ts +94 -0
  122. package/dist/shared/RealDictionary.d.ts.map +1 -0
  123. package/dist/shared/RealTime.d.ts +66 -0
  124. package/dist/shared/RealTime.d.ts.map +1 -0
  125. package/dist/shared/RefContainer.d.ts +89 -0
  126. package/dist/shared/RefContainer.d.ts.map +1 -0
  127. package/dist/shared/Relation.d.ts +140 -0
  128. package/dist/shared/Relation.d.ts.map +1 -0
  129. package/dist/shared/SideEffect.d.ts +45 -0
  130. package/dist/shared/SideEffect.d.ts.map +1 -0
  131. package/dist/shared/StateMachine.d.ts +55 -0
  132. package/dist/shared/StateMachine.d.ts.map +1 -0
  133. package/dist/shared/StateNode.d.ts +45 -0
  134. package/dist/shared/StateNode.d.ts.map +1 -0
  135. package/dist/shared/StateTransfer.d.ts +63 -0
  136. package/dist/shared/StateTransfer.d.ts.map +1 -0
  137. package/dist/shared/Summation.d.ts +59 -0
  138. package/dist/shared/Summation.d.ts.map +1 -0
  139. package/dist/shared/Transform.d.ts +54 -0
  140. package/dist/shared/Transform.d.ts.map +1 -0
  141. package/dist/shared/User.d.ts +10 -0
  142. package/dist/shared/User.d.ts.map +1 -0
  143. package/dist/shared/WeightedSummation.d.ts +82 -0
  144. package/dist/shared/WeightedSummation.d.ts.map +1 -0
  145. package/dist/shared/index.d.ts +35 -9
  146. package/dist/shared/index.d.ts.map +1 -1
  147. package/dist/shared/init.d.ts +3 -0
  148. package/dist/shared/init.d.ts.map +1 -0
  149. package/dist/shared/interfaces.d.ts +72 -0
  150. package/dist/shared/interfaces.d.ts.map +1 -0
  151. package/dist/shared/types.d.ts +77 -0
  152. package/dist/shared/types.d.ts.map +1 -0
  153. package/dist/shared/utils.d.ts +16 -10
  154. package/dist/shared/utils.d.ts.map +1 -1
  155. package/dist/storage/erstorage/AttributeInfo.d.ts +8 -3
  156. package/dist/storage/erstorage/AttributeInfo.d.ts.map +1 -1
  157. package/dist/storage/erstorage/AttributeQuery.d.ts +4 -3
  158. package/dist/storage/erstorage/AttributeQuery.d.ts.map +1 -1
  159. package/dist/storage/erstorage/EntityQueryHandle.d.ts +18 -17
  160. package/dist/storage/erstorage/EntityQueryHandle.d.ts.map +1 -1
  161. package/dist/storage/erstorage/EntityToTableMap.d.ts +27 -5
  162. package/dist/storage/erstorage/EntityToTableMap.d.ts.map +1 -1
  163. package/dist/storage/erstorage/FilteredEntityManager.d.ts +70 -0
  164. package/dist/storage/erstorage/FilteredEntityManager.d.ts.map +1 -0
  165. package/dist/storage/erstorage/LinkInfo.d.ts +10 -3
  166. package/dist/storage/erstorage/LinkInfo.d.ts.map +1 -1
  167. package/dist/storage/erstorage/MatchExp.d.ts +19 -9
  168. package/dist/storage/erstorage/MatchExp.d.ts.map +1 -1
  169. package/dist/storage/erstorage/MergedItemProcessor.d.ts +25 -0
  170. package/dist/storage/erstorage/MergedItemProcessor.d.ts.map +1 -0
  171. package/dist/storage/erstorage/Modifier.d.ts +1 -1
  172. package/dist/storage/erstorage/NewRecordData.d.ts +16 -9
  173. package/dist/storage/erstorage/NewRecordData.d.ts.map +1 -1
  174. package/dist/storage/erstorage/RecordInfo.d.ts +11 -2
  175. package/dist/storage/erstorage/RecordInfo.d.ts.map +1 -1
  176. package/dist/storage/erstorage/RecordQuery.d.ts +9 -8
  177. package/dist/storage/erstorage/RecordQuery.d.ts.map +1 -1
  178. package/dist/storage/erstorage/RecordQueryAgent.d.ts +26 -13
  179. package/dist/storage/erstorage/RecordQueryAgent.d.ts.map +1 -1
  180. package/dist/storage/erstorage/Setup.d.ts +49 -11
  181. package/dist/storage/erstorage/Setup.d.ts.map +1 -1
  182. package/dist/storage/erstorage/util.d.ts.map +1 -1
  183. package/package.json +44 -20
  184. package/README.md +0 -53
  185. package/dist/runtime/ActivityCall.d.ts.map +0 -1
  186. package/dist/runtime/ActivityCall.js +0 -379
  187. package/dist/runtime/ActivityCall.js.map +0 -1
  188. package/dist/runtime/Controller.js +0 -225
  189. package/dist/runtime/Controller.js.map +0 -1
  190. package/dist/runtime/InteractionCall.d.ts.map +0 -1
  191. package/dist/runtime/InteractionCall.js +0 -385
  192. package/dist/runtime/InteractionCall.js.map +0 -1
  193. package/dist/runtime/MonoSystem.js +0 -331
  194. package/dist/runtime/MonoSystem.js.map +0 -1
  195. package/dist/runtime/Mysql.js +0 -171
  196. package/dist/runtime/Mysql.js.map +0 -1
  197. package/dist/runtime/PostgreSQL.js +0 -172
  198. package/dist/runtime/PostgreSQL.js.map +0 -1
  199. package/dist/runtime/SQLite.js +0 -146
  200. package/dist/runtime/SQLite.js.map +0 -1
  201. package/dist/runtime/Scheduler.js +0 -457
  202. package/dist/runtime/Scheduler.js.map +0 -1
  203. package/dist/runtime/System.js +0 -90
  204. package/dist/runtime/System.js.map +0 -1
  205. package/dist/runtime/asyncInteractionContext.js +0 -3
  206. package/dist/runtime/asyncInteractionContext.js.map +0 -1
  207. package/dist/runtime/boolExpression.js +0 -43
  208. package/dist/runtime/boolExpression.js.map +0 -1
  209. package/dist/runtime/computedDataHandles/Any.d.ts +0 -52
  210. package/dist/runtime/computedDataHandles/Any.d.ts.map +0 -1
  211. package/dist/runtime/computedDataHandles/Any.js +0 -152
  212. package/dist/runtime/computedDataHandles/Any.js.map +0 -1
  213. package/dist/runtime/computedDataHandles/Computation.d.ts +0 -108
  214. package/dist/runtime/computedDataHandles/Computation.d.ts.map +0 -1
  215. package/dist/runtime/computedDataHandles/Computation.js +0 -49
  216. package/dist/runtime/computedDataHandles/Computation.js.map +0 -1
  217. package/dist/runtime/computedDataHandles/ComputedDataHandle.d.ts +0 -42
  218. package/dist/runtime/computedDataHandles/ComputedDataHandle.d.ts.map +0 -1
  219. package/dist/runtime/computedDataHandles/ComputedDataHandle.js +0 -4
  220. package/dist/runtime/computedDataHandles/ComputedDataHandle.js.map +0 -1
  221. package/dist/runtime/computedDataHandles/Count.d.ts +0 -45
  222. package/dist/runtime/computedDataHandles/Count.d.ts.map +0 -1
  223. package/dist/runtime/computedDataHandles/Count.js +0 -85
  224. package/dist/runtime/computedDataHandles/Count.js.map +0 -1
  225. package/dist/runtime/computedDataHandles/Every.d.ts +0 -56
  226. package/dist/runtime/computedDataHandles/Every.d.ts.map +0 -1
  227. package/dist/runtime/computedDataHandles/Every.js +0 -178
  228. package/dist/runtime/computedDataHandles/Every.js.map +0 -1
  229. package/dist/runtime/computedDataHandles/StateMachine.d.ts.map +0 -1
  230. package/dist/runtime/computedDataHandles/StateMachine.js +0 -180
  231. package/dist/runtime/computedDataHandles/StateMachine.js.map +0 -1
  232. package/dist/runtime/computedDataHandles/Transform.d.ts +0 -26
  233. package/dist/runtime/computedDataHandles/Transform.d.ts.map +0 -1
  234. package/dist/runtime/computedDataHandles/Transform.js +0 -106
  235. package/dist/runtime/computedDataHandles/Transform.js.map +0 -1
  236. package/dist/runtime/computedDataHandles/TransitionFinder.d.ts +0 -57
  237. package/dist/runtime/computedDataHandles/TransitionFinder.d.ts.map +0 -1
  238. package/dist/runtime/computedDataHandles/TransitionFinder.js +0 -40
  239. package/dist/runtime/computedDataHandles/TransitionFinder.js.map +0 -1
  240. package/dist/runtime/computedDataHandles/WeightedSummation.d.ts +0 -57
  241. package/dist/runtime/computedDataHandles/WeightedSummation.d.ts.map +0 -1
  242. package/dist/runtime/computedDataHandles/WeightedSummation.js +0 -146
  243. package/dist/runtime/computedDataHandles/WeightedSummation.js.map +0 -1
  244. package/dist/runtime/computedDataHandles/index.d.ts +0 -7
  245. package/dist/runtime/computedDataHandles/index.d.ts.map +0 -1
  246. package/dist/runtime/computedDataHandles/index.js +0 -7
  247. package/dist/runtime/computedDataHandles/index.js.map +0 -1
  248. package/dist/runtime/index.js +0 -15
  249. package/dist/runtime/index.js.map +0 -1
  250. package/dist/runtime/server.d.ts +0 -35
  251. package/dist/runtime/server.d.ts.map +0 -1
  252. package/dist/runtime/server.js +0 -171
  253. package/dist/runtime/server.js.map +0 -1
  254. package/dist/runtime/types/boolExpression.js +0 -6
  255. package/dist/runtime/types/boolExpression.js.map +0 -1
  256. package/dist/runtime/util.js +0 -39
  257. package/dist/runtime/util.js.map +0 -1
  258. package/dist/shared/BoolExp.js +0 -252
  259. package/dist/shared/BoolExp.js.map +0 -1
  260. package/dist/shared/activity/Activity.d.ts +0 -465
  261. package/dist/shared/activity/Activity.d.ts.map +0 -1
  262. package/dist/shared/activity/Activity.js +0 -264
  263. package/dist/shared/activity/Activity.js.map +0 -1
  264. package/dist/shared/activity/Condition.d.ts +0 -75
  265. package/dist/shared/activity/Condition.d.ts.map +0 -1
  266. package/dist/shared/activity/Condition.js +0 -51
  267. package/dist/shared/activity/Condition.js.map +0 -1
  268. package/dist/shared/activity/Data.d.ts +0 -115
  269. package/dist/shared/activity/Data.d.ts.map +0 -1
  270. package/dist/shared/activity/Data.js +0 -89
  271. package/dist/shared/activity/Data.js.map +0 -1
  272. package/dist/shared/attributive.d.ts +0 -93
  273. package/dist/shared/attributive.d.ts.map +0 -1
  274. package/dist/shared/attributive.js +0 -59
  275. package/dist/shared/attributive.js.map +0 -1
  276. package/dist/shared/computed.d.ts +0 -607
  277. package/dist/shared/computed.d.ts.map +0 -1
  278. package/dist/shared/computed.js +0 -202
  279. package/dist/shared/computed.js.map +0 -1
  280. package/dist/shared/createClass.d.ts +0 -102
  281. package/dist/shared/createClass.d.ts.map +0 -1
  282. package/dist/shared/createClass.js +0 -276
  283. package/dist/shared/createClass.js.map +0 -1
  284. package/dist/shared/dictionary/Dictionary.d.ts +0 -40
  285. package/dist/shared/dictionary/Dictionary.d.ts.map +0 -1
  286. package/dist/shared/dictionary/Dictionary.js +0 -51
  287. package/dist/shared/dictionary/Dictionary.js.map +0 -1
  288. package/dist/shared/entity/Entity.d.ts +0 -149
  289. package/dist/shared/entity/Entity.d.ts.map +0 -1
  290. package/dist/shared/entity/Entity.js +0 -226
  291. package/dist/shared/entity/Entity.js.map +0 -1
  292. package/dist/shared/index.js +0 -11
  293. package/dist/shared/index.js.map +0 -1
  294. package/dist/shared/user/User.d.ts +0 -21
  295. package/dist/shared/user/User.d.ts.map +0 -1
  296. package/dist/shared/user/User.js +0 -11
  297. package/dist/shared/user/User.js.map +0 -1
  298. package/dist/shared/utils.js +0 -19
  299. package/dist/shared/utils.js.map +0 -1
  300. package/dist/storage/erstorage/AttributeInfo.js +0 -147
  301. package/dist/storage/erstorage/AttributeInfo.js.map +0 -1
  302. package/dist/storage/erstorage/AttributeQuery.js +0 -190
  303. package/dist/storage/erstorage/AttributeQuery.js.map +0 -1
  304. package/dist/storage/erstorage/EntityQueryHandle.js +0 -78
  305. package/dist/storage/erstorage/EntityQueryHandle.js.map +0 -1
  306. package/dist/storage/erstorage/EntityToTableMap.js +0 -262
  307. package/dist/storage/erstorage/EntityToTableMap.js.map +0 -1
  308. package/dist/storage/erstorage/LinkInfo.js +0 -89
  309. package/dist/storage/erstorage/LinkInfo.js.map +0 -1
  310. package/dist/storage/erstorage/MatchExp.js +0 -211
  311. package/dist/storage/erstorage/MatchExp.js.map +0 -1
  312. package/dist/storage/erstorage/Modifier.js +0 -24
  313. package/dist/storage/erstorage/Modifier.js.map +0 -1
  314. package/dist/storage/erstorage/NewRecordData.js +0 -178
  315. package/dist/storage/erstorage/NewRecordData.js.map +0 -1
  316. package/dist/storage/erstorage/RecordInfo.js +0 -111
  317. package/dist/storage/erstorage/RecordInfo.js.map +0 -1
  318. package/dist/storage/erstorage/RecordQuery.js +0 -158
  319. package/dist/storage/erstorage/RecordQuery.js.map +0 -1
  320. package/dist/storage/erstorage/RecordQueryAgent.js +0 -1130
  321. package/dist/storage/erstorage/RecordQueryAgent.js.map +0 -1
  322. package/dist/storage/erstorage/Setup.js +0 -400
  323. package/dist/storage/erstorage/Setup.js.map +0 -1
  324. package/dist/storage/erstorage/util.js +0 -25
  325. package/dist/storage/erstorage/util.js.map +0 -1
  326. package/dist/storage/index.js +0 -13
  327. package/dist/storage/index.js.map +0 -1
  328. package/dist/storage/utils.js +0 -48
  329. package/dist/storage/utils.js.map +0 -1
@@ -1,52 +0,0 @@
1
- import { DataContext, PropertyDataContext } from "./ComputedDataHandle.js";
2
- import { Any, KlassInstance, Relation } from "@shared";
3
- import { Controller } from "../Controller.js";
4
- import { DataDep, GlobalBoundState, RecordBoundState, RelationBoundState } from "./Computation.js";
5
- import { DataBasedComputation } from "./Computation.js";
6
- import { EtityMutationEvent } from "../Scheduler.js";
7
- import { AttributeQueryData } from "@storage";
8
- export declare class GlobalAnyHandle implements DataBasedComputation {
9
- controller: Controller;
10
- dataContext: DataContext;
11
- callback: (this: Controller, item: any) => boolean;
12
- state: ReturnType<typeof this.createState>;
13
- useLastValue: boolean;
14
- dataDeps: {
15
- [key: string]: DataDep;
16
- };
17
- constructor(controller: Controller, args: KlassInstance<typeof Any>, dataContext: DataContext);
18
- createState(): {
19
- matchCount: GlobalBoundState<number>;
20
- };
21
- getDefaultValue(): boolean;
22
- compute({ main: records }: {
23
- main: any[];
24
- }): Promise<boolean>;
25
- incrementalCompute(lastValue: boolean, mutationEvent: EtityMutationEvent): Promise<boolean>;
26
- }
27
- export declare class PropertyAnyHandle implements DataBasedComputation {
28
- controller: Controller;
29
- dataContext: PropertyDataContext;
30
- callback: (this: Controller, item: any) => boolean;
31
- state: ReturnType<typeof this.createState>;
32
- useLastValue: boolean;
33
- dataDeps: {
34
- [key: string]: DataDep;
35
- };
36
- relationAttr: string;
37
- relatedRecordName: string;
38
- isSource: boolean;
39
- relation: KlassInstance<typeof Relation>;
40
- relationAttributeQuery: AttributeQueryData;
41
- constructor(controller: Controller, args: KlassInstance<typeof Any>, dataContext: PropertyDataContext);
42
- createState(): {
43
- matchCount: RecordBoundState<number>;
44
- isItemMatch: RelationBoundState<boolean>;
45
- };
46
- getDefaultValue(): boolean;
47
- compute({ _current }: {
48
- _current: any;
49
- }): Promise<boolean>;
50
- incrementalCompute(lastValue: boolean, mutationEvent: EtityMutationEvent): Promise<boolean>;
51
- }
52
- //# sourceMappingURL=Any.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Any.d.ts","sourceRoot":"","sources":["../../../src/runtime/computedDataHandles/Any.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAY,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAGxD,qBAAa,eAAgB,YAAW,oBAAoB;IAKrC,UAAU,EAAE,UAAU;IAA4C,WAAW,EAAE,WAAW;IAJ7G,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,EAA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X,eAAe;IAIT,OAAO,CAAC,EAAC,QAAQ,EAAC,EAAE;QAAC,QAAQ,EAAE,GAAG,CAAA;KAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAKtD,kBAAkB,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;CA2DpG"}
@@ -1,152 +0,0 @@
1
- import { ComputedDataHandle } from "./ComputedDataHandle.js";
2
- import { Any } from "@shared";
3
- import { GlobalBoundState, RecordBoundState, RelationBoundState } from "./Computation.js";
4
- import { MatchExp } from "@storage";
5
- export class GlobalAnyHandle {
6
- constructor(controller, args, dataContext) {
7
- this.controller = controller;
8
- this.dataContext = dataContext;
9
- this.useLastValue = true;
10
- this.dataDeps = {};
11
- this.callback = args.callback.bind(this);
12
- this.dataDeps = {
13
- main: {
14
- type: 'records',
15
- source: args.record,
16
- attributeQuery: args.attributeQuery
17
- }
18
- };
19
- }
20
- createState() {
21
- return {
22
- matchCount: new GlobalBoundState(0),
23
- };
24
- }
25
- getDefaultValue() {
26
- return false;
27
- }
28
- async compute({ main: records }) {
29
- // TODO deps
30
- const matchCount = await this.state.matchCount.set(records.filter(this.callback).length);
31
- return matchCount > 0;
32
- }
33
- async incrementalCompute(lastValue, mutationEvent) {
34
- let matchCount = await this.state.matchCount.get();
35
- if (mutationEvent.type === 'create') {
36
- const newItemMatch = !!this.callback.call(this.controller, mutationEvent.record);
37
- if (newItemMatch === true) {
38
- matchCount = await this.state.matchCount.set(matchCount + 1);
39
- }
40
- }
41
- else if (mutationEvent.type === 'delete') {
42
- const oldItemMatch = !!this.callback.call(this.controller, mutationEvent.record);
43
- if (oldItemMatch === true) {
44
- matchCount = await this.state.matchCount.set(matchCount - 1);
45
- }
46
- }
47
- else if (mutationEvent.type === 'update') {
48
- const oldItemMatch = !!this.callback.call(this.controller, mutationEvent.oldRecord);
49
- const newItemMatch = !!this.callback.call(this.controller, mutationEvent.record);
50
- if (oldItemMatch === true && newItemMatch === false) {
51
- matchCount = await this.state.matchCount.set(matchCount - 1);
52
- }
53
- else if (oldItemMatch === false && newItemMatch === true) {
54
- matchCount = await this.state.matchCount.set(matchCount + 1);
55
- }
56
- }
57
- return matchCount > 0;
58
- }
59
- }
60
- export class PropertyAnyHandle {
61
- constructor(controller, args, dataContext) {
62
- this.controller = controller;
63
- this.dataContext = dataContext;
64
- this.useLastValue = true;
65
- this.dataDeps = {};
66
- this.callback = args.callback.bind(this);
67
- const relation = args.record;
68
- this.relation = relation;
69
- this.isSource = args.direction ? args.direction === 'source' : relation.source.name === dataContext.host.name;
70
- this.relationAttr = this.isSource ? relation.sourceProperty : relation.targetProperty;
71
- this.relatedRecordName = this.isSource ? relation.target.name : relation.source.name;
72
- this.relationAttributeQuery = args.attributeQuery || [];
73
- this.dataDeps = {
74
- _current: {
75
- type: 'property',
76
- attributeQuery: [[this.relationAttr, { attributeQuery: [['&', { attributeQuery: this.relationAttributeQuery }]] }]]
77
- }
78
- };
79
- }
80
- createState() {
81
- return {
82
- matchCount: new RecordBoundState(0),
83
- isItemMatch: new RelationBoundState(false, this.relation.name)
84
- };
85
- }
86
- getDefaultValue() {
87
- return false;
88
- }
89
- async compute({ _current }) {
90
- const matchCount = await this.state.matchCount.set(_current, _current[this.relationAttr].filter(this.callback).length);
91
- return matchCount > 0;
92
- }
93
- async incrementalCompute(lastValue, mutationEvent) {
94
- // TODO 如果未来支持用户可以自定义 dataDeps,那么这里也要支持如果发现是其他 dataDeps 变化,这里要直接返回重算的信号。
95
- let matchCount = await this.state.matchCount.get(mutationEvent.record);
96
- const relatedMutationEvent = mutationEvent.relatedMutationEvent;
97
- if (relatedMutationEvent.type === 'create') {
98
- // 关联关系的新建
99
- const relationRecord = relatedMutationEvent.record;
100
- const newRelationWithEntity = await this.controller.system.storage.findOne(this.relation.name, MatchExp.atom({
101
- key: 'id',
102
- value: ['=', relationRecord.id]
103
- }), undefined, this.relationAttributeQuery);
104
- const newItemMatch = !!this.callback.call(this.controller, newRelationWithEntity);
105
- if (newItemMatch === true) {
106
- matchCount = await this.state.matchCount.set(mutationEvent.record, matchCount + 1);
107
- await this.state.isItemMatch.set(relationRecord, true);
108
- }
109
- }
110
- else if (relatedMutationEvent.type === 'delete') {
111
- // 关联关系的删除
112
- const relationRecord = relatedMutationEvent.record;
113
- const oldItemMatch = !!await this.state.isItemMatch.get(relationRecord);
114
- if (oldItemMatch === true) {
115
- matchCount = await this.state.matchCount.set(mutationEvent.record, matchCount - 1);
116
- }
117
- }
118
- else if (relatedMutationEvent.type === 'update') {
119
- // 关联实体或者关联关系上的字段的更新
120
- const currentRecord = mutationEvent.oldRecord;
121
- const isRelationUpdate = mutationEvent.relatedMutationEvent?.recordName === this.relation.name;
122
- const relationMatch = isRelationUpdate ?
123
- MatchExp.atom({
124
- key: 'id',
125
- value: ['=', mutationEvent.relatedMutationEvent.oldRecord.id]
126
- }) :
127
- MatchExp.atom({
128
- key: 'source.id',
129
- value: ['=', this.isSource ? currentRecord.id : mutationEvent.relatedMutationEvent.oldRecord.id]
130
- }).and({
131
- key: 'target.id',
132
- value: ['=', this.isSource ? mutationEvent.relatedMutationEvent.oldRecord.id : currentRecord.id]
133
- });
134
- const relationRecord = await this.controller.system.storage.findOne(this.relation.name, relationMatch, undefined, this.relationAttributeQuery);
135
- const oldItemMatch = !!await this.state.isItemMatch.get(relationRecord);
136
- const newItemMatch = !!this.callback.call(this.controller, relationRecord);
137
- if (oldItemMatch === true && newItemMatch === false) {
138
- matchCount = await this.state.matchCount.set(currentRecord, matchCount - 1);
139
- }
140
- else if (oldItemMatch === false && newItemMatch === true) {
141
- matchCount = await this.state.matchCount.set(currentRecord, matchCount + 1);
142
- }
143
- await this.state.isItemMatch.set(relationRecord, newItemMatch);
144
- }
145
- return matchCount > 0;
146
- }
147
- }
148
- ComputedDataHandle.Handles.set(Any, {
149
- global: GlobalAnyHandle,
150
- property: PropertyAnyHandle
151
- });
152
- //# sourceMappingURL=Any.js.map
@@ -1 +0,0 @@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C,KAAM,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,EAAE,UAAU,GAAG,CAAC,CAAC,CAAA;YAChF,CAAC;iBAAM,IAAI,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;gBACzD,UAAU,GAAG,MAAM,IAAI,CAAC,KAAM,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,EAAE,UAAU,GAAG,CAAC,CAAC,CAAA;YAChF,CAAC;YACD,MAAM,IAAI,CAAC,KAAM,CAAC,WAAW,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;QACnE,CAAC;QAED,OAAO,UAAU,GAAC,CAAC,CAAA;IACvB,CAAC;CACJ;AAGD,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE;IAChC,MAAM,EAAE,eAAe;IACvB,QAAQ,EAAE,iBAAiB;CAC9B,CAAC,CAAA"}
@@ -1,108 +0,0 @@
1
- import { Activity, Interaction, Relation } from "@shared";
2
- import { KlassInstance } from "@shared";
3
- import { Entity } from "@shared";
4
- import { Controller } from "../Controller";
5
- import { DataContext } from "./ComputedDataHandle";
6
- import { AttributeQueryData, MatchExpressionData, ModifierData } from "@storage";
7
- import { Dictionary } from "@shared";
8
- import { SKIP_RESULT } from "../Scheduler";
9
- export type ComputeResult = any;
10
- export type ComputeResultPatch = {
11
- type: 'insert' | 'update' | 'delete';
12
- data?: any;
13
- affectedId?: any;
14
- };
15
- export declare class RecordBoundState<T> {
16
- defaultValue: any;
17
- record: string;
18
- key: string;
19
- controller: Controller;
20
- constructor(defaultValue: any);
21
- set(record: any, value: any): Promise<T>;
22
- get(record: any): Promise<T>;
23
- }
24
- export declare class RelationBoundState<T> {
25
- defaultValue: any;
26
- record: string;
27
- key: string;
28
- controller: Controller;
29
- constructor(defaultValue: any, record: string);
30
- set(record: any, value: any): Promise<T>;
31
- get(record: any): Promise<T>;
32
- }
33
- export declare class GlobalBoundState<T> {
34
- defaultValue?: any | undefined;
35
- key: string;
36
- controller: Controller;
37
- constructor(defaultValue?: any | undefined);
38
- set(value: any): Promise<T>;
39
- get(): Promise<T>;
40
- }
41
- export type RecordsDataDep = {
42
- type: 'records';
43
- source: KlassInstance<typeof Entity> | KlassInstance<typeof Relation> | KlassInstance<typeof Activity> | KlassInstance<typeof Interaction>;
44
- match?: MatchExpressionData;
45
- modifier?: ModifierData;
46
- attributeQuery?: AttributeQueryData;
47
- };
48
- export type GlobalDataDep = {
49
- type: 'global';
50
- source: KlassInstance<typeof Dictionary>;
51
- };
52
- export type PropertyDataDep = {
53
- type: 'property';
54
- attributeQuery?: AttributeQueryData;
55
- };
56
- export type DictionaryDataDep = {
57
- type: 'dict';
58
- source: KlassInstance<typeof Dictionary>;
59
- keys: string[];
60
- };
61
- export type DataDep = RecordsDataDep | PropertyDataDep | GlobalDataDep | DictionaryDataDep;
62
- export interface DataBasedComputation {
63
- dataContext: DataContext;
64
- state: {
65
- [key: string]: RecordBoundState<any> | GlobalBoundState<any> | RelationBoundState<any>;
66
- };
67
- compute: (...args: any[]) => ComputeResult;
68
- incrementalCompute?: (...args: any[]) => Promise<ComputeResult | typeof SKIP_RESULT>;
69
- incrementalPatchCompute?: (...args: any[]) => Promise<ComputeResultPatch | ComputeResultPatch[] | undefined | typeof SKIP_RESULT>;
70
- createState?: (...args: any[]) => {
71
- [key: string]: RecordBoundState<any> | GlobalBoundState<any>;
72
- };
73
- dataDeps?: {
74
- [key: string]: any;
75
- };
76
- getDefaultValue?: (...args: any[]) => any;
77
- useLastValue?: boolean;
78
- }
79
- export type InteractionEventDep = {
80
- type: 'interaction';
81
- interaction: KlassInstance<typeof Interaction>;
82
- };
83
- export type DataEventDep = {
84
- type: 'data';
85
- eventType?: 'create' | 'delete' | 'update';
86
- dataDep: DataDep;
87
- };
88
- export type EventDep = InteractionEventDep | DataEventDep;
89
- export interface EventBasedComputation {
90
- dataContext: DataContext;
91
- state: {
92
- [key: string]: RecordBoundState<any> | GlobalBoundState<any> | RelationBoundState<any>;
93
- };
94
- incrementalCompute?: (...args: any[]) => Promise<ComputeResult | typeof SKIP_RESULT>;
95
- incrementalPatchCompute?: (...args: any[]) => Promise<ComputeResultPatch | ComputeResultPatch[] | undefined | typeof SKIP_RESULT>;
96
- createState?: (...args: any[]) => {
97
- [key: string]: RecordBoundState<any> | GlobalBoundState<any>;
98
- };
99
- eventDeps?: {
100
- [key: string]: EventDep;
101
- };
102
- useLastValue?: boolean;
103
- getDefaultValue?: (...args: any[]) => any;
104
- computeDirtyRecords?: (...args: any[]) => Promise<any[] | undefined>;
105
- }
106
- export type Computation = DataBasedComputation | EventBasedComputation;
107
- export type ComputationClass = new (...args: any[]) => Computation;
108
- //# sourceMappingURL=Computation.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Computation.d.ts","sourceRoot":"","sources":["../../../src/runtime/computedDataHandles/Computation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAChF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE1C,MAAM,MAAM,aAAa,GAAG,GAAG,CAAA;AAE/B,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACpC,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,UAAU,CAAC,EAAE,GAAG,CAAA;CACnB,CAAA;AAED,qBA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BAAgB,CAAC,GAAG,CAAC,GAAC,gBAAgB,CAAC,GAAG,CAAC,CAAA;KAAC,CAAA;IAC9F,SAAS,CAAC,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAA;KAAC,CAAA;IACrC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,eAAe,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACzC,mBAAmB,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,EAAE,GAAC,SAAS,CAAC,CAAA;CACrE;AAED,MAAM,MAAM,WAAW,GAAG,oBAAoB,GAAC,qBAAqB,CAAA;AAEpE,MAAM,MAAM,gBAAgB,GAAG,KAAI,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,WAAW,CAAA"}
@@ -1,49 +0,0 @@
1
- import { BoolExp } from "@shared";
2
- export class RecordBoundState {
3
- constructor(defaultValue) {
4
- this.defaultValue = defaultValue;
5
- }
6
- async set(record, value) {
7
- await this.controller.system.storage.update(this.record, BoolExp.atom({ key: 'id', value: ['=', record.id] }), { [this.key]: value });
8
- return value;
9
- }
10
- async get(record) {
11
- // TODO 如果 record 上不存在就重新查询
12
- if (record[this.key] === undefined) {
13
- const fullRecord = await this.controller.system.storage.findOne(this.record, BoolExp.atom({ key: 'id', value: ['=', record.id] }), undefined, [this.key]);
14
- return fullRecord[this.key];
15
- }
16
- return record[this.key];
17
- }
18
- }
19
- export class RelationBoundState {
20
- constructor(defaultValue, record) {
21
- this.defaultValue = defaultValue;
22
- this.record = record;
23
- }
24
- async set(record, value) {
25
- await this.controller.system.storage.update(this.record, BoolExp.atom({ key: 'id', value: ['=', record.id] }), { [this.key]: value });
26
- return value;
27
- }
28
- async get(record) {
29
- // TODO 如果 record 上不存在就重新查询
30
- if (record[this.key] === undefined) {
31
- const fullRecord = await this.controller.system.storage.findOne(this.record, BoolExp.atom({ key: 'id', value: ['=', record.id] }), undefined, [this.key]);
32
- return fullRecord[this.key];
33
- }
34
- return record[this.key];
35
- }
36
- }
37
- export class GlobalBoundState {
38
- constructor(defaultValue) {
39
- this.defaultValue = defaultValue;
40
- }
41
- async set(value) {
42
- await this.controller.system.storage.set('state', this.key, value);
43
- return value;
44
- }
45
- async get() {
46
- return await this.controller.system.storage.get('state', this.key);
47
- }
48
- }
49
- //# sourceMappingURL=Computation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Computation.js","sourceRoot":"","sources":["../../../src/runtime/computedDataHandles/Computation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAejC,MAAM,OAAO,gBAAgB;IAIzB,YAAmB,YAAgB;QAAhB,iBAAY,GAAZ,YAAY,CAAI;IAEnC,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,MAAU,EAAE,KAAU;QAC5B,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CAAC,EAAC,CAAC,EAAE,EAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAC,CAAC,CAAA;QACjI,OAAO,KAAK,CAAA;IAChB,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,MAAU;QAChB,2BAA2B;QAC3B,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;YACjC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CA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AAI,CAAC,GAAG,CAAM,CAAA;IAChC,CAAC;CACJ;AAED,MAAM,OAAO,gBAAgB;IAGzB,YAAmB,YAAkB;QAAlB,iBAAY,GAAZ,YAAY,CAAM;IAErC,CAAC;IACD,KAAK,CAAC,GAAG,CAAC,KAAU;QAChB,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAClE,OAAO,KAAK,CAAA;IAChB,CAAC;IACD,KAAK,CAAC,GAAG;QACL,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;IACtE,CAAC;CACJ"}
@@ -1,42 +0,0 @@
1
- import { KlassInstance, Klass } from "@shared";
2
- import { Entity, Relation } from "@shared";
3
- import { Computation } from "./Computation.js";
4
- export type GlobalDataContext = {
5
- type: 'global';
6
- id: string;
7
- };
8
- export type EntityDataContext = {
9
- type: 'entity';
10
- id: KlassInstance<typeof Entity>;
11
- };
12
- export type RelationDataContext = {
13
- type: 'relation';
14
- id: KlassInstance<typeof Relation>;
15
- };
16
- export type PropertyDataContext = {
17
- type: 'property';
18
- host: KlassInstance<typeof Entity> | KlassInstance<typeof Relation>;
19
- id: string;
20
- };
21
- export type DataContext = GlobalDataContext | EntityDataContext | RelationDataContext | PropertyDataContext;
22
- export type ComputedEffect = any;
23
- export type ComputeEffectResult = ComputedEffect | ComputedEffect[] | undefined;
24
- type HandlesForType = {
25
- global?: {
26
- new (...args: any[]): Computation;
27
- };
28
- entity?: {
29
- new (...args: any[]): Computation;
30
- };
31
- relation?: {
32
- new (...args: any[]): Computation;
33
- };
34
- property?: {
35
- new (...args: any[]): Computation;
36
- };
37
- };
38
- export declare class ComputedDataHandle {
39
- static Handles: Map<Klass<any>, HandlesForType>;
40
- }
41
- export {};
42
- //# sourceMappingURL=Comput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AAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW,CAAA;KAAE,CAAC;IAC9C,QAAQ,CAAC,EAAE;QAAE,KAAI,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW,CAAA;KAAE,CAAC;IAChD,QAAQ,CAAC,EAAE;QAAE,KAAI,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW,CAAA;KAAE,CAAC;CACnD,CAAA;AAED,qBAAa,kBAAkB;IAC3B,OAAe,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAG,cAAc,CAAC,CAAY;CACvE"}
@@ -1,4 +0,0 @@
1
- export class ComputedDataHandle {
2
- static { this.Handles = new Map(); }
3
- }
4
- //# sourceMappingURL=ComputedDataHandle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComputedDataHandle.js","sourceRoot":"","sources":["../../../src/runtime/computedDataHandles/ComputedDataHandle.ts"],"names":[],"mappings":"AAyCA,MAAM,OAAO,kBAAkB;aACZ,YAAO,GAAqC,IAAI,GAAG,EAAE,CAAA"}
@@ -1,45 +0,0 @@
1
- import { DataContext, PropertyDataContext } from "./ComputedDataHandle.js";
2
- import { Count, KlassInstance, Relation, Entity } from "@shared";
3
- import { Controller } from "../Controller.js";
4
- import { DataDep } from "./Computation.js";
5
- import { DataBasedComputation } from "./Computation.js";
6
- import { EtityMutationEvent } from "../Scheduler.js";
7
- export declare class GlobalCountHandle implements DataBasedComputation {
8
- controller: Controller;
9
- dataContext: DataContext;
10
- state: ReturnType<typeof this.createState>;
11
- useLastValue: boolean;
12
- dataDeps: {
13
- [key: string]: DataDep;
14
- };
15
- record: KlassInstance<typeof Entity | typeof Relation>;
16
- constructor(controller: Controller, args: KlassInstance<typeof Count>, dataContext: DataContext);
17
- createState(): {};
18
- getDefaultValue(): number;
19
- compute({ main: records }: {
20
- main: any[];
21
- }): Promise<number>;
22
- incrementalCompute(lastValue: number, mutationEvent: EtityMutationEvent): Promise<number>;
23
- }
24
- export declare class PropertyCountHandle implements DataBasedComputation {
25
- controller: Controller;
26
- args: KlassInstance<typeof Count>;
27
- dataContext: PropertyDataContext;
28
- state: ReturnType<typeof this.createState>;
29
- useLastValue: boolean;
30
- dataDeps: {
31
- [key: string]: DataDep;
32
- };
33
- relationAttr: string;
34
- relatedRecordName: string;
35
- isSource: boolean;
36
- relation: KlassInstance<typeof Relation>;
37
- constructor(controller: Controller, args: KlassInstance<typeof Count>, dataContext: PropertyDataContext);
38
- createState(): {};
39
- getDefaultValue(): number;
40
- compute({ _current }: {
41
- _current: any;
42
- }): Promise<number>;
43
- incrementalCompute(lastValue: number, mutationEvent: EtityMutationEvent): Promise<number>;
44
- }
45
- //# sourceMappingURL=Count.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Count.d.ts","sourceRoot":"","sources":["../../../src/runtime/computedDataHandles/Count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAsC,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,qBAAa,iBAAkB,YAAW,oBAAoB;IAMvC,UAAU,EAAE,UAAU;IAA4C,WAAW,EAAE,WAAW;IAL7G,KAAK,EAAG,UAAU,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,CAAA;IAC3C,YAAY,EAAE,OAAO,CAAO;IAC5B,QAAQ,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,CAAK;IACvC,MAAM,EAAE,aAAa,CAAC,OAAO,MAAM,GAA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ataHandle.js";
2
- import { Count } from "@shared";
3
- export class GlobalCountHandle {
4
- constructor(controller, args, dataContext) {
5
- this.controller = controller;
6
- this.dataContext = dataContext;
7
- this.useLastValue = true;
8
- this.dataDeps = {};
9
- this.record = args.record;
10
- this.dataDeps = {
11
- main: {
12
- type: 'records',
13
- source: this.record
14
- }
15
- };
16
- }
17
- createState() {
18
- return {};
19
- }
20
- getDefaultValue() {
21
- return 0;
22
- }
23
- async compute({ main: records }) {
24
- return records.length;
25
- }
26
- async incrementalCompute(lastValue, mutationEvent) {
27
- debugger;
28
- let count = lastValue || 0;
29
- if (mutationEvent.type === 'create') {
30
- count = lastValue + 1;
31
- }
32
- else if (mutationEvent.type === 'delete') {
33
- count = lastValue - 1;
34
- }
35
- return count;
36
- }
37
- }
38
- export class PropertyCountHandle {
39
- constructor(controller, args, dataContext) {
40
- this.controller = controller;
41
- this.args = args;
42
- this.dataContext = dataContext;
43
- this.useLastValue = true;
44
- this.dataDeps = {};
45
- // We assume in PropertyCountHandle, the records array's first element is a Relation
46
- this.relation = args.record;
47
- this.relationAttr = this.relation.source.name === dataContext.host.name ? this.relation.sourceProperty : this.relation.targetProperty;
48
- this.isSource = this.relation.source.name === dataContext.host.name;
49
- this.relatedRecordName = this.isSource ? this.relation.target.name : this.relation.source.name;
50
- this.dataDeps = {
51
- _current: {
52
- type: 'property',
53
- attributeQuery: [[this.relationAttr, { attributeQuery: ['id'] }]]
54
- }
55
- };
56
- }
57
- createState() {
58
- return {};
59
- }
60
- getDefaultValue() {
61
- return 0;
62
- }
63
- async compute({ _current }) {
64
- const count = _current[this.relationAttr]?.length || 0;
65
- return count;
66
- }
67
- async incrementalCompute(lastValue, mutationEvent) {
68
- let count = lastValue || 0;
69
- const relatedMutationEvent = mutationEvent.relatedMutationEvent;
70
- if (relatedMutationEvent.type === 'create') {
71
- // Relation creation
72
- count = lastValue + 1;
73
- }
74
- else if (relatedMutationEvent.type === 'delete') {
75
- // Relation deletion
76
- count = lastValue - 1;
77
- }
78
- return count;
79
- }
80
- }
81
- ComputedDataHandle.Handles.set(Count, {
82
- global: GlobalCountHandle,
83
- property: PropertyCountHandle
84
- });
85
- //# sourceMappingURL=Count.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Count.js","sourceRoot":"","sources":["../../../src/runtime/computedDataHandles/Count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAoC,MAAM,yBAAyB,CAAC;AAC/F,OAAO,EAAE,KAAK,EAAmC,MAAM,SAAS,CAAC;AAOjE,MAAM,OAAO,iBAAiB;IAM1B,YAAmB,UAAsB,EAAE,IAAiC,EAAS,WAAwB;QAA1F,eAAU,GAAV,UAAU,CAAY;QAA4C,gBAAW,GAAX,WAAW,CAAa;QAJ7G,iBAAY,GAAY,IAAI,CAAA;QAC5B,aAAQ,GAA6B,EAAE,CAAA;QAInC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAA;QAEzB,IAAI,CAAC,QAAQ,GAAG;YACZ,IAAI,EAAE;gBACF,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;aACtB;SACJ,CAAA;IACL,CAAC;IAED,WAAW;QACP,OAAO,EACN,CAAA;IACL,CAAC;IAED,eAAe;QACX,OAAO,CAAC,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAC,IAAI,EAAE,OAAO,EAAgB;QACxC,OAAO,OAAO,CAAC,MAAM,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,SAAiB,EAAE,aAAiC;QACzE,QAAQ,CAAA;QACR,IAAI,KAAK,GAAG,SAAS,IAAI,CAAC,CAAC;QAE3B,IAAI,aAAa,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YAClC,KAAK,GAAG,SAAS,GAAG,CAAC,CAAC;QAC1B,CAAC;aAAM,IAAI,aAAa,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACzC,KAAK,GAAG,SAAS,GA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