oak-domain 6.0.0 → 6.1.0

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 (400) hide show
  1. package/README.md +5 -1
  2. package/es/actions/action.d.ts +1 -1
  3. package/es/base-app-domain/EntityDict.d.ts +27 -0
  4. package/es/base-app-domain/LocalizedContent/Schema.d.ts +19 -0
  5. package/es/base-app-domain/LocalizedContent/Schema.js +1 -0
  6. package/es/base-app-domain/LocalizedContent/Storage.d.ts +3 -0
  7. package/es/base-app-domain/LocalizedContent/Storage.js +75 -0
  8. package/es/base-app-domain/LocalizedContent/Style.d.ts +3 -0
  9. package/es/base-app-domain/LocalizedContent/Style.js +12 -0
  10. package/es/base-app-domain/LocalizedContent/_baseSchema.d.ts +58 -0
  11. package/es/base-app-domain/Storage.js +2 -0
  12. package/es/base-app-domain/StyleDict.js +2 -0
  13. package/es/compiler/customChecks/i18n.js +4 -1
  14. package/es/compiler/customChecks/runner.d.ts +1 -1
  15. package/es/compiler/customChecks/runner.js +1 -1
  16. package/es/compiler/customChecks/types.d.ts +2 -1
  17. package/es/compiler/dependencyBuilder.d.ts +11 -2
  18. package/es/compiler/dependencyBuilder.js +188 -199
  19. package/es/compiler/entityDescEnum.d.ts +5 -0
  20. package/es/compiler/entityDescEnum.js +443 -0
  21. package/es/compiler/entitySource.d.ts +28 -0
  22. package/es/compiler/entitySource.js +521 -0
  23. package/es/compiler/localeBuilder.d.ts +7 -2
  24. package/es/compiler/localeBuilder.js +52 -56
  25. package/es/compiler/routerBuilder.d.ts +32 -3
  26. package/es/compiler/routerBuilder.js +157 -45
  27. package/es/compiler/schemaBuilder.d.ts +12 -2
  28. package/es/compiler/schemaBuilder.js +653 -148
  29. package/es/compiler/tscBuilder.d.ts +20 -2
  30. package/es/compiler/tscBuilder.js +231 -45
  31. package/es/context/BackendRuntimeContext.d.ts +6 -4
  32. package/es/context/BackendRuntimeContext.js +9 -1
  33. package/es/context/ContextComposer.d.ts +93 -0
  34. package/es/context/ContextComposer.js +353 -0
  35. package/es/context/SerializedData.d.ts +2 -1
  36. package/es/data/i18n.d.ts +1 -1
  37. package/es/data/i18n.js +1 -86
  38. package/es/data/i18n.json +86 -0
  39. package/es/entities/ActionAuth.d.ts +3 -3
  40. package/es/entities/I18n.d.ts +2 -2
  41. package/es/entities/LocalizedContent.d.ts +22 -0
  42. package/es/entities/LocalizedContent.js +101 -0
  43. package/es/entities/Log.d.ts +3 -3
  44. package/es/entities/Modi.d.ts +2 -2
  45. package/es/entities/ModiEntity.d.ts +3 -3
  46. package/es/entities/Oper.d.ts +5 -5
  47. package/es/entities/OperEntity.d.ts +3 -3
  48. package/es/entities/Path.d.ts +2 -2
  49. package/es/entities/Relation.d.ts +2 -2
  50. package/es/entities/RelationAuth.d.ts +3 -3
  51. package/es/entities/User.d.ts +4 -4
  52. package/es/entities/UserEntityClaim.d.ts +6 -6
  53. package/es/entities/UserEntityGrant.d.ts +2 -2
  54. package/es/entities/UserRelation.d.ts +4 -4
  55. package/es/store/AsyncRowStore.d.ts +2 -2
  56. package/es/store/AsyncRowStore.js +2 -2
  57. package/es/store/CascadeStore.d.ts +5 -3
  58. package/es/store/CascadeStore.js +56 -24
  59. package/es/store/IntrinsicCheckers.d.ts +1 -1
  60. package/es/store/IntrinsicCheckers.js +2 -2
  61. package/es/store/IntrinsicLogics.d.ts +1 -1
  62. package/es/store/RelationAuth.js +3 -3
  63. package/es/store/SyncRowStore.d.ts +1 -1
  64. package/es/store/SyncRowStore.js +1 -1
  65. package/es/store/TriggerExecutor.d.ts +6 -4
  66. package/es/store/TriggerExecutor.js +16 -4
  67. package/es/store/checker.d.ts +2 -2
  68. package/es/store/checker.js +45 -9
  69. package/es/store/filter.d.ts +3 -3
  70. package/es/store/filter.js +4 -4
  71. package/es/store/modi.d.ts +5 -5
  72. package/es/store/modi.js +4 -4
  73. package/es/store/projection.d.ts +1 -1
  74. package/es/store/relation.js +1 -1
  75. package/es/store/triggers.d.ts +4 -4
  76. package/es/store/triggers.js +2 -2
  77. package/es/timers/oper.d.ts +3 -3
  78. package/es/timers/oper.js +1 -1
  79. package/es/timers/vaccum.d.ts +3 -3
  80. package/es/types/Action.d.ts +1 -1
  81. package/es/types/AppLoader.d.ts +1 -1
  82. package/es/types/Aspect.d.ts +1 -1
  83. package/es/types/Auth.d.ts +2 -2
  84. package/es/types/Configuration.d.ts +7 -6
  85. package/es/types/Connector.d.ts +47 -1
  86. package/es/types/DataType.d.ts +2 -2
  87. package/es/types/Demand.d.ts +40 -6
  88. package/es/types/Endpoint.d.ts +17 -1
  89. package/es/types/Entity.d.ts +21 -4
  90. package/es/types/Entity.js +23 -0
  91. package/es/types/EntityDesc.d.ts +9 -8
  92. package/es/types/Environment.d.ts +17 -0
  93. package/es/types/Exception.d.ts +1 -1
  94. package/es/types/Exception.js +1 -1
  95. package/es/types/Expression.d.ts +13 -2
  96. package/es/types/Expression.js +36 -1
  97. package/es/types/Locale.d.ts +14 -1
  98. package/es/types/Locale.js +13 -1
  99. package/es/types/OakPackage.d.ts +29 -0
  100. package/es/types/OakPackage.js +30 -0
  101. package/es/types/Port.d.ts +1 -1
  102. package/es/types/RowStore.d.ts +9 -7
  103. package/es/types/Storage.d.ts +11 -3
  104. package/es/types/Storage.js +12 -1
  105. package/es/types/Style.d.ts +2 -2
  106. package/es/types/Sync.d.ts +3 -3
  107. package/es/types/Timer.d.ts +14 -2
  108. package/es/types/Trigger.d.ts +1 -1
  109. package/es/types/Watcher.d.ts +1 -1
  110. package/es/types/index.d.ts +1 -0
  111. package/es/types/index.js +1 -0
  112. package/es/utils/SimpleConnector.d.ts +30 -4
  113. package/es/utils/SimpleConnector.js +294 -21
  114. package/es/utils/concurrent.js +1 -1
  115. package/es/utils/decimal.d.ts +26 -0
  116. package/es/utils/decimal.js +87 -0
  117. package/es/utils/fetch/index.d.ts +1 -0
  118. package/es/utils/fetch/index.js +3 -0
  119. package/es/utils/fetch/index.mp.d.ts +3 -0
  120. package/es/utils/fetch/index.mp.js +280 -0
  121. package/es/utils/fetch/index.native.d.ts +1 -0
  122. package/es/utils/fetch/index.native.js +3 -0
  123. package/es/utils/fetch/index.web.d.ts +1 -0
  124. package/es/utils/fetch/index.web.js +3 -0
  125. package/es/utils/fetch/shared.d.ts +6 -0
  126. package/es/utils/fetch/shared.js +23 -0
  127. package/es/utils/localizedContent.d.ts +11 -0
  128. package/es/utils/localizedContent.js +346 -0
  129. package/es/utils/lodash.d.ts +1 -35
  130. package/es/utils/lodash.js +1 -52
  131. package/es/utils/module/combine.common.d.ts +3 -3
  132. package/es/utils/module/combine.common.js +2 -2
  133. package/es/utils/module/combine.dev.d.ts +2 -2
  134. package/es/utils/module/combine.dev.js +2 -2
  135. package/es/utils/module/combine.prod.d.ts +1 -1
  136. package/es/utils/module/combine.server.d.ts +2 -2
  137. package/es/utils/module/combine.server.js +2 -2
  138. package/es/utils/money.d.ts +2 -2
  139. package/es/utils/money.js +2 -2
  140. package/es/utils/operationResult.js +1 -1
  141. package/es/utils/projection.d.ts +3 -3
  142. package/es/utils/projection.js +1 -1
  143. package/es/utils/relationPath.d.ts +1 -1
  144. package/es/utils/relationPath.js +1 -1
  145. package/es/utils/row.d.ts +3 -3
  146. package/es/utils/row.js +2 -2
  147. package/es/utils/sseEndpoint.d.ts +41 -0
  148. package/es/utils/sseEndpoint.js +151 -0
  149. package/es/utils/toolkit.d.ts +28 -0
  150. package/es/utils/toolkit.js +220 -0
  151. package/es/utils/url/index.d.ts +1 -3
  152. package/es/utils/url/index.js +1 -1
  153. package/es/utils/url/index.mp.d.ts +16 -3
  154. package/es/utils/url/index.mp.js +2 -2
  155. package/es/utils/url/index.native.d.ts +13 -1
  156. package/es/utils/url/index.native.js +3 -1
  157. package/es/utils/url/index.web.d.ts +13 -1
  158. package/es/utils/url/index.web.js +3 -1
  159. package/es/utils/url/lightweight.d.ts +65 -0
  160. package/es/utils/url/lightweight.js +530 -0
  161. package/es/utils/url/urlObject.d.ts +16 -0
  162. package/es/utils/validate/id.d.ts +5 -0
  163. package/es/utils/validate/id.js +28 -0
  164. package/es/utils/validate/index.d.ts +4 -0
  165. package/es/utils/validate/index.js +4 -0
  166. package/es/utils/validate/mobile.d.ts +6 -0
  167. package/es/utils/validate/mobile.js +49 -0
  168. package/es/utils/validate/nationality.d.ts +14 -0
  169. package/es/utils/validate/nationality.data.d.ts +9 -0
  170. package/es/utils/validate/nationality.data.js +257 -0
  171. package/es/utils/validate/nationality.js +64 -0
  172. package/es/utils/validate/passport.d.ts +3 -0
  173. package/es/utils/validate/passport.js +19 -0
  174. package/es/utils/validator.d.ts +10 -8
  175. package/es/utils/validator.js +24 -40
  176. package/lib/actions/action.d.ts +1 -1
  177. package/lib/base-app-domain/EntityDict.d.ts +27 -0
  178. package/lib/base-app-domain/LocalizedContent/Schema.d.ts +19 -0
  179. package/lib/base-app-domain/LocalizedContent/Schema.js +4 -0
  180. package/lib/base-app-domain/LocalizedContent/Storage.d.ts +3 -0
  181. package/lib/base-app-domain/LocalizedContent/Storage.js +78 -0
  182. package/lib/base-app-domain/LocalizedContent/Style.d.ts +3 -0
  183. package/lib/base-app-domain/LocalizedContent/Style.js +15 -0
  184. package/lib/base-app-domain/LocalizedContent/_baseSchema.d.ts +58 -0
  185. package/lib/base-app-domain/Storage.js +26 -24
  186. package/lib/base-app-domain/StyleDict.js +10 -8
  187. package/lib/compiler/customChecks/i18n.js +5 -2
  188. package/lib/compiler/customChecks/runner.d.ts +1 -1
  189. package/lib/compiler/customChecks/types.d.ts +2 -1
  190. package/lib/compiler/dependencyBuilder.d.ts +11 -2
  191. package/lib/compiler/dependencyBuilder.js +237 -243
  192. package/lib/compiler/entityDescEnum.d.ts +5 -0
  193. package/lib/compiler/entityDescEnum.js +450 -0
  194. package/lib/compiler/entitySource.d.ts +28 -0
  195. package/lib/compiler/entitySource.js +529 -0
  196. package/lib/compiler/localeBuilder.d.ts +7 -2
  197. package/lib/compiler/localeBuilder.js +52 -56
  198. package/lib/compiler/routerBuilder.d.ts +32 -3
  199. package/lib/compiler/routerBuilder.js +160 -48
  200. package/lib/compiler/schemaBuilder.d.ts +12 -2
  201. package/lib/compiler/schemaBuilder.js +855 -350
  202. package/lib/compiler/tscBuilder.d.ts +20 -2
  203. package/lib/compiler/tscBuilder.js +217 -37
  204. package/lib/context/BackendRuntimeContext.d.ts +6 -4
  205. package/lib/context/BackendRuntimeContext.js +10 -3
  206. package/lib/context/ContextComposer.d.ts +93 -0
  207. package/lib/context/ContextComposer.js +361 -0
  208. package/lib/context/SerializedData.d.ts +2 -1
  209. package/lib/data/i18n.d.ts +1 -1
  210. package/lib/data/i18n.js +1 -86
  211. package/lib/data/i18n.json +86 -0
  212. package/lib/entities/ActionAuth.d.ts +3 -3
  213. package/lib/entities/I18n.d.ts +2 -2
  214. package/lib/entities/LocalizedContent.d.ts +22 -0
  215. package/lib/entities/LocalizedContent.js +104 -0
  216. package/lib/entities/Log.d.ts +3 -3
  217. package/lib/entities/Modi.d.ts +2 -2
  218. package/lib/entities/ModiEntity.d.ts +3 -3
  219. package/lib/entities/Oper.d.ts +5 -5
  220. package/lib/entities/OperEntity.d.ts +3 -3
  221. package/lib/entities/Path.d.ts +2 -2
  222. package/lib/entities/Relation.d.ts +2 -2
  223. package/lib/entities/RelationAuth.d.ts +3 -3
  224. package/lib/entities/User.d.ts +4 -4
  225. package/lib/entities/UserEntityClaim.d.ts +6 -6
  226. package/lib/entities/UserEntityGrant.d.ts +2 -2
  227. package/lib/entities/UserRelation.d.ts +4 -4
  228. package/lib/store/AsyncRowStore.d.ts +2 -2
  229. package/lib/store/AsyncRowStore.js +6 -7
  230. package/lib/store/CascadeStore.d.ts +5 -3
  231. package/lib/store/CascadeStore.js +101 -70
  232. package/lib/store/IntrinsicCheckers.d.ts +1 -1
  233. package/lib/store/IntrinsicCheckers.js +12 -13
  234. package/lib/store/IntrinsicLogics.d.ts +1 -1
  235. package/lib/store/RelationAuth.js +42 -43
  236. package/lib/store/SyncRowStore.d.ts +1 -1
  237. package/lib/store/SyncRowStore.js +4 -5
  238. package/lib/store/TriggerExecutor.d.ts +6 -4
  239. package/lib/store/TriggerExecutor.js +39 -28
  240. package/lib/store/checker.d.ts +2 -2
  241. package/lib/store/checker.js +55 -20
  242. package/lib/store/filter.d.ts +3 -3
  243. package/lib/store/filter.js +47 -48
  244. package/lib/store/modi.d.ts +5 -5
  245. package/lib/store/modi.js +5 -6
  246. package/lib/store/projection.d.ts +1 -1
  247. package/lib/store/relation.js +4 -5
  248. package/lib/store/triggers.d.ts +4 -4
  249. package/lib/store/triggers.js +13 -14
  250. package/lib/timers/oper.d.ts +3 -3
  251. package/lib/timers/vaccum.d.ts +3 -3
  252. package/lib/types/Action.d.ts +1 -1
  253. package/lib/types/AppLoader.d.ts +1 -1
  254. package/lib/types/Aspect.d.ts +1 -1
  255. package/lib/types/Auth.d.ts +2 -2
  256. package/lib/types/Configuration.d.ts +7 -6
  257. package/lib/types/Connector.d.ts +47 -1
  258. package/lib/types/DataType.d.ts +2 -2
  259. package/lib/types/Demand.d.ts +40 -6
  260. package/lib/types/Endpoint.d.ts +17 -1
  261. package/lib/types/Entity.d.ts +21 -4
  262. package/lib/types/Entity.js +27 -0
  263. package/lib/types/EntityDesc.d.ts +9 -8
  264. package/lib/types/Environment.d.ts +17 -0
  265. package/lib/types/Exception.d.ts +1 -1
  266. package/lib/types/Exception.js +2 -2
  267. package/lib/types/Expression.d.ts +13 -2
  268. package/lib/types/Expression.js +40 -5
  269. package/lib/types/Locale.d.ts +14 -1
  270. package/lib/types/Locale.js +14 -0
  271. package/lib/types/OakPackage.d.ts +29 -0
  272. package/lib/types/OakPackage.js +36 -0
  273. package/lib/types/Port.d.ts +1 -1
  274. package/lib/types/RowStore.d.ts +9 -7
  275. package/lib/types/Storage.d.ts +11 -3
  276. package/lib/types/Storage.js +13 -0
  277. package/lib/types/Style.d.ts +2 -2
  278. package/lib/types/Sync.d.ts +3 -3
  279. package/lib/types/Timer.d.ts +14 -2
  280. package/lib/types/Trigger.d.ts +1 -1
  281. package/lib/types/Watcher.d.ts +1 -1
  282. package/lib/types/index.d.ts +1 -0
  283. package/lib/types/index.js +1 -0
  284. package/lib/utils/SimpleConnector.d.ts +30 -4
  285. package/lib/utils/SimpleConnector.js +297 -24
  286. package/lib/utils/concurrent.js +4 -5
  287. package/lib/utils/decimal.d.ts +26 -0
  288. package/lib/utils/decimal.js +112 -0
  289. package/lib/utils/fetch/index.d.ts +1 -0
  290. package/lib/utils/fetch/index.js +6 -0
  291. package/lib/utils/fetch/index.mp.d.ts +3 -0
  292. package/lib/utils/fetch/index.mp.js +285 -0
  293. package/lib/utils/fetch/index.native.d.ts +1 -0
  294. package/lib/utils/fetch/index.native.js +6 -0
  295. package/lib/utils/fetch/index.web.d.ts +1 -0
  296. package/lib/utils/fetch/index.web.js +6 -0
  297. package/lib/utils/fetch/shared.d.ts +6 -0
  298. package/lib/utils/fetch/shared.js +28 -0
  299. package/lib/utils/localizedContent.d.ts +11 -0
  300. package/lib/utils/localizedContent.js +352 -0
  301. package/lib/utils/lodash.d.ts +1 -35
  302. package/lib/utils/lodash.js +1 -76
  303. package/lib/utils/module/combine.common.d.ts +3 -3
  304. package/lib/utils/module/combine.common.js +6 -7
  305. package/lib/utils/module/combine.dev.d.ts +2 -2
  306. package/lib/utils/module/combine.dev.js +19 -19
  307. package/lib/utils/module/combine.prod.d.ts +1 -1
  308. package/lib/utils/module/combine.server.d.ts +2 -2
  309. package/lib/utils/module/combine.server.js +19 -19
  310. package/lib/utils/money.d.ts +2 -2
  311. package/lib/utils/money.js +2 -2
  312. package/lib/utils/operationResult.js +4 -4
  313. package/lib/utils/projection.d.ts +3 -3
  314. package/lib/utils/relationPath.d.ts +1 -1
  315. package/lib/utils/relationPath.js +10 -11
  316. package/lib/utils/row.d.ts +3 -3
  317. package/lib/utils/row.js +4 -5
  318. package/lib/utils/sseEndpoint.d.ts +41 -0
  319. package/lib/utils/sseEndpoint.js +156 -0
  320. package/lib/utils/toolkit.d.ts +28 -0
  321. package/lib/utils/toolkit.js +253 -0
  322. package/lib/utils/url/index.d.ts +1 -3
  323. package/lib/utils/url/index.js +3 -1
  324. package/lib/utils/url/index.mp.d.ts +16 -3
  325. package/lib/utils/url/index.mp.js +6 -4
  326. package/lib/utils/url/index.native.d.ts +13 -1
  327. package/lib/utils/url/index.native.js +5 -1
  328. package/lib/utils/url/index.web.d.ts +13 -1
  329. package/lib/utils/url/index.web.js +5 -1
  330. package/lib/utils/url/lightweight.d.ts +65 -0
  331. package/lib/utils/url/lightweight.js +535 -0
  332. package/lib/utils/url/urlObject.d.ts +16 -0
  333. package/lib/utils/url/urlObject.js +2 -0
  334. package/lib/utils/url/whatwg-url/lib/URL-impl.d.ts +8 -15
  335. package/lib/utils/url/whatwg-url/lib/infra.js +5 -4
  336. package/lib/utils/url/whatwg-url/lib/urlencoded.d.ts +3 -1
  337. package/lib/utils/url/whatwg-url/lib/utils.d.ts +1 -1
  338. package/lib/utils/validate/id.d.ts +5 -0
  339. package/lib/utils/validate/id.js +35 -0
  340. package/lib/utils/validate/index.d.ts +4 -0
  341. package/lib/utils/validate/index.js +7 -0
  342. package/lib/utils/validate/mobile.d.ts +6 -0
  343. package/lib/utils/validate/mobile.js +57 -0
  344. package/lib/utils/validate/nationality.d.ts +14 -0
  345. package/lib/utils/validate/nationality.data.d.ts +9 -0
  346. package/lib/utils/validate/nationality.data.js +260 -0
  347. package/lib/utils/validate/nationality.js +76 -0
  348. package/lib/utils/validate/passport.d.ts +3 -0
  349. package/lib/utils/validate/passport.js +24 -0
  350. package/lib/utils/validator.d.ts +10 -8
  351. package/lib/utils/validator.js +38 -42
  352. package/package.json +19 -9
  353. package/es/utils/url/whatwg-url/index.d.ts +0 -3
  354. package/es/utils/url/whatwg-url/index.js +0 -12
  355. package/es/utils/url/whatwg-url/lib/URL-impl.d.ts +0 -27
  356. package/es/utils/url/whatwg-url/lib/URL-impl.js +0 -172
  357. package/es/utils/url/whatwg-url/lib/URL.js +0 -295
  358. package/es/utils/url/whatwg-url/lib/URLSearchParams-impl.d.ts +0 -19
  359. package/es/utils/url/whatwg-url/lib/URLSearchParams-impl.js +0 -123
  360. package/es/utils/url/whatwg-url/lib/URLSearchParams.js +0 -423
  361. package/es/utils/url/whatwg-url/lib/infra.d.ts +0 -12
  362. package/es/utils/url/whatwg-url/lib/infra.js +0 -19
  363. package/es/utils/url/whatwg-url/lib/url-state-machine.d.ts +0 -24
  364. package/es/utils/url/whatwg-url/lib/url-state-machine.js +0 -1228
  365. package/es/utils/url/whatwg-url/lib/urlencoded.d.ts +0 -14
  366. package/es/utils/url/whatwg-url/lib/urlencoded.js +0 -160
  367. package/es/utils/url/whatwg-url/lib/utils.d.ts +0 -37
  368. package/es/utils/url/whatwg-url/lib/utils.js +0 -99
  369. package/lib/store/diffSchema.d.ts +0 -1
  370. package/lib/utils/url/whatwg-url/index.d.ts +0 -3
  371. package/lib/utils/url/whatwg-url/index.js +0 -16
  372. package/lib/utils/url/whatwg-url/lib/URL-impl.js +0 -175
  373. package/lib/utils/url/whatwg-url/lib/URL.d.ts +0 -1
  374. package/lib/utils/url/whatwg-url/lib/URL.js +0 -298
  375. package/lib/utils/url/whatwg-url/lib/URLSearchParams-impl.d.ts +0 -19
  376. package/lib/utils/url/whatwg-url/lib/URLSearchParams-impl.js +0 -126
  377. package/lib/utils/url/whatwg-url/lib/URLSearchParams.d.ts +0 -1
  378. package/lib/utils/url/whatwg-url/lib/URLSearchParams.js +0 -426
  379. package/lib/utils/url/whatwg-url/lib/infra.d.ts +0 -12
  380. package/lib/utils/url/whatwg-url/lib/url-state-machine.d.ts +0 -24
  381. package/lib/utils/url/whatwg-url/lib/url-state-machine.js +0 -1238
  382. package/lib/utils/url/whatwg-url/lib/urlencoded.js +0 -162
  383. package/lib/utils/url/whatwg-url/lib/utils.js +0 -101
  384. package/src/entities/ActionAuth.ts +0 -50
  385. package/src/entities/I18n.ts +0 -53
  386. package/src/entities/Log.ts +0 -62
  387. package/src/entities/Modi.ts +0 -107
  388. package/src/entities/ModiEntity.ts +0 -35
  389. package/src/entities/Oper.ts +0 -115
  390. package/src/entities/OperEntity.ts +0 -36
  391. package/src/entities/Path.ts +0 -56
  392. package/src/entities/Relation.ts +0 -53
  393. package/src/entities/RelationAuth.ts +0 -53
  394. package/src/entities/User.ts +0 -85
  395. package/src/entities/UserEntityClaim.ts +0 -41
  396. package/src/entities/UserEntityGrant.ts +0 -33
  397. package/src/entities/UserRelation.ts +0 -60
  398. /package/es/{utils/url/whatwg-url/lib/URL.d.ts → base-app-domain/LocalizedContent/_baseSchema.js} +0 -0
  399. /package/es/utils/url/{whatwg-url/lib/URLSearchParams.d.ts → urlObject.js} +0 -0
  400. /package/lib/{store/diffSchema.js → base-app-domain/LocalizedContent/_baseSchema.js} +0 -0
@@ -4,12 +4,11 @@ exports.translateCheckerInAsyncContext = translateCheckerInAsyncContext;
4
4
  exports.translateCheckerInSyncContext = translateCheckerInSyncContext;
5
5
  exports.createRemoveCheckers = createRemoveCheckers;
6
6
  exports.createCreateCheckers = createCreateCheckers;
7
- const tslib_1 = require("tslib");
8
- const assert_1 = tslib_1.__importDefault(require("assert"));
7
+ const assert_1 = require("../utils/assert");
9
8
  const filter_1 = require("../store/filter");
10
9
  const Exception_1 = require("../types/Exception");
11
10
  const types_1 = require("../types");
12
- const lodash_1 = require("../utils/lodash");
11
+ const toolkit_1 = require("../utils/toolkit");
13
12
  const action_1 = require("../actions/action");
14
13
  function getFullProjection(entity, schema) {
15
14
  const { attributes } = schema[entity];
@@ -92,7 +91,7 @@ function translateCheckerInAsyncContext(checker, schema) {
92
91
  let operationFilter2 = operationFilter;
93
92
  if (action === 'create') {
94
93
  // 后台进行创建检查时,以传入的data为准
95
- (0, assert_1.default)(data);
94
+ (0, assert_1.assert)(data);
96
95
  if (data instanceof Array) {
97
96
  for (const d of data) {
98
97
  await checkSingle((0, filter_1.translateCreateDataToFilter)(schema, entity, d, !!bornAt));
@@ -103,7 +102,7 @@ function translateCheckerInAsyncContext(checker, schema) {
103
102
  }
104
103
  return;
105
104
  }
106
- (0, assert_1.default)(operationFilter2, 'row类型的checker遇到了操作的filter未定义');
105
+ (0, assert_1.assert)(operationFilter2, 'row类型的checker遇到了操作的filter未定义');
107
106
  await checkSingle(operationFilter2);
108
107
  return 0;
109
108
  }
@@ -126,7 +125,7 @@ function translateCheckerInAsyncContext(checker, schema) {
126
125
  };
127
126
  }
128
127
  default: {
129
- (0, assert_1.default)(false);
128
+ (0, assert_1.assert)(false);
130
129
  }
131
130
  }
132
131
  }
@@ -155,12 +154,12 @@ function translateCheckerInSyncContext(checker, schema) {
155
154
  if (data) {
156
155
  // 前端的策略是,有data用data,无data用filter
157
156
  // 目前前端应该不可能制造出来createMultiple
158
- (0, assert_1.default)(!(data instanceof Array));
157
+ (0, assert_1.assert)(!(data instanceof Array));
159
158
  operationFilter2 = (0, filter_1.translateCreateDataToFilter)(schema, entity, data, !!bornAt);
160
159
  }
161
160
  }
162
- (0, assert_1.default)(!(filter2 instanceof Promise));
163
- (0, assert_1.default)(operationFilter2, '定义了row类型的checker但却进行了无filter操作');
161
+ (0, assert_1.assert)(!(filter2 instanceof Promise));
162
+ (0, assert_1.assert)(operationFilter2, '定义了row类型的checker但却进行了无filter操作');
164
163
  // @oak-ignore
165
164
  if ((0, filter_1.checkFilterContains)(entity, context, filter2, operationFilter2, true)) {
166
165
  return;
@@ -185,7 +184,7 @@ function translateCheckerInSyncContext(checker, schema) {
185
184
  };
186
185
  }
187
186
  default: {
188
- (0, assert_1.default)(false);
187
+ (0, assert_1.assert)(false);
189
188
  }
190
189
  }
191
190
  }
@@ -238,7 +237,7 @@ function createRemoveCheckers(schema) {
238
237
  }
239
238
  }
240
239
  // 当删除一时,要确认多上面没有指向一的数据
241
- const entities = (0, lodash_1.union)(Object.keys(OneToManyMatrix), Object.keys(OneToManyOnEntityMatrix));
240
+ const entities = (0, toolkit_1.union)(Object.keys(OneToManyMatrix), Object.keys(OneToManyOnEntityMatrix));
242
241
  for (const entity of entities) {
243
242
  checkers.push({
244
243
  entity: entity,
@@ -333,7 +332,7 @@ function createRemoveCheckers(schema) {
333
332
  }
334
333
  return checkers;
335
334
  }
336
- function checkAttributeLegal(schema, entity, data) {
335
+ function checkAttributeLegal(schema, entity, data, allowExpressionValue) {
337
336
  const { attributes } = schema[entity];
338
337
  for (const attr in data) {
339
338
  if (attributes[attr]) {
@@ -349,6 +348,16 @@ function checkAttributeLegal(schema, entity, data) {
349
348
  }
350
349
  continue;
351
350
  }
351
+ if ((0, types_1.isUpdateExpressionValue)(data[attr]) && !(0, types_1.isJsonLiteralAttributeType)(type)) {
352
+ const expr = data[attr].$expr;
353
+ if (!(0, types_1.shouldTreatAsUpdateExpressionValue)(type, data[attr]) || !allowExpressionValue || (!(0, types_1.isExpression)(expr) && !(0, types_1.isRefAttrNode)(expr))) {
354
+ throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesFormatError', 'oak-domain', {
355
+ attribtues: attr,
356
+ format: 'expression',
357
+ });
358
+ }
359
+ continue;
360
+ }
352
361
  switch (type) {
353
362
  case 'char':
354
363
  case 'varchar': {
@@ -371,22 +380,48 @@ function checkAttributeLegal(schema, entity, data) {
371
380
  case 'smallint':
372
381
  case 'tinyint':
373
382
  case 'bigint':
374
- case 'decimal':
375
383
  case 'money': {
376
- if (typeof data[attr] !== 'number') {
384
+ const value = data[attr];
385
+ if (typeof value !== 'number') {
377
386
  throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesFormatError', 'oak-domain', {
378
387
  attribtues: attr,
379
388
  format: 'number',
380
389
  });
381
390
  }
382
391
  const { min, max } = params || {};
383
- if (typeof min === 'number' && data[attr] < min) {
392
+ if (typeof min === 'number' && value < min) {
393
+ throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesUnderMin', 'oak-domain', {
394
+ attributes: attr,
395
+ threshold: `${min}`,
396
+ });
397
+ }
398
+ if (typeof max === 'number' && value > max) {
399
+ throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesOverMax', 'oak-domain', {
400
+ attributes: attr,
401
+ threshold: `${max}`,
402
+ });
403
+ }
404
+ break;
405
+ }
406
+ case 'decimal': {
407
+ const value = data[attr];
408
+ const isDecimalString = typeof value === 'string'
409
+ && /^-?(?:\d+|\d*\.\d+)$/.test(value);
410
+ if (!isDecimalString) {
411
+ throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesFormatError', 'oak-domain', {
412
+ attribtues: attr,
413
+ format: allowExpressionValue ? 'string | expression' : 'string',
414
+ });
415
+ }
416
+ const { min, max } = params || {};
417
+ const numericValue = Number(value);
418
+ if (typeof min === 'number' && numericValue < min) {
384
419
  throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesUnderMin', 'oak-domain', {
385
420
  attributes: attr,
386
421
  threshold: `${min}`,
387
422
  });
388
423
  }
389
- if (typeof max === 'number' && data[attr] > max) {
424
+ if (typeof max === 'number' && numericValue > max) {
390
425
  throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesOverMax', 'oak-domain', {
391
426
  attributes: attr,
392
427
  threshold: `${max}`,
@@ -395,7 +430,7 @@ function checkAttributeLegal(schema, entity, data) {
395
430
  break;
396
431
  }
397
432
  case 'enum': {
398
- (0, assert_1.default)(enumeration);
433
+ (0, assert_1.assert)(enumeration);
399
434
  if (!enumeration.includes(data[attr])) {
400
435
  throw new Exception_1.OakInputIllegalException(entity, [attr], 'error::attributesNotInEnumeration');
401
436
  }
@@ -416,14 +451,14 @@ function createCreateCheckers(schema) {
416
451
  for (const entity in schema) {
417
452
  const { attributes, actions } = schema[entity];
418
453
  const notNullAttrs = Object.keys(attributes).filter(ele => attributes[ele].notNull);
419
- const updateActions = (0, lodash_1.difference)(actions, action_1.excludeUpdateActions);
454
+ const updateActions = (0, toolkit_1.difference)(actions, action_1.excludeUpdateActions);
420
455
  checkers.push({
421
456
  entity,
422
457
  type: 'data',
423
458
  action: 'create',
424
459
  checker: (data) => {
425
460
  const checkData = (data2) => {
426
- const illegalNullAttrs = (0, lodash_1.difference)(notNullAttrs, Object.keys(data2).filter(ele => data2[ele] !== null));
461
+ const illegalNullAttrs = (0, toolkit_1.difference)(notNullAttrs, Object.keys(data2).filter(ele => data2[ele] !== null));
427
462
  if (illegalNullAttrs.length > 0) {
428
463
  const emtpyAttrs = [];
429
464
  // 要处理多对一的cascade create
@@ -473,7 +508,7 @@ function createCreateCheckers(schema) {
473
508
  type: 'data',
474
509
  action: updateActions,
475
510
  checker: (data) => {
476
- checkAttributeLegal(schema, entity, data);
511
+ checkAttributeLegal(schema, entity, data, true);
477
512
  }
478
513
  });
479
514
  }
@@ -1,7 +1,7 @@
1
- import { EntityDict as BaseEntityDict, StorageSchema } from '../types';
1
+ import { EntityDict as BaseEntityDict, StorageSchema } from "../types";
2
2
  import { EntityDict } from "../base-app-domain";
3
- import { AsyncContext } from './AsyncRowStore';
4
- import { SyncContext } from './SyncRowStore';
3
+ import { AsyncContext } from "./AsyncRowStore";
4
+ import { SyncContext } from "./SyncRowStore";
5
5
  export declare function translateCreateDataToFilter<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(schema: StorageSchema<ED>, entity: T, data: ED[T]['CreateOperationData'], allowUnrecoganized: boolean): ED[T]["Filter"];
6
6
  export declare function combineFilters<ED extends EntityDict & BaseEntityDict, T extends keyof ED>(entity: T, schema: StorageSchema<ED>, filters: Array<ED[T]['Filter']>, union?: true): ED[T]["Filter"] | undefined;
7
7
  type DeducedFilter<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
@@ -12,10 +12,9 @@ exports.makeTreeDescendantFilter = makeTreeDescendantFilter;
12
12
  exports.checkFilterContains = checkFilterContains;
13
13
  exports.checkFilterRepel = checkFilterRepel;
14
14
  exports.translateFilterToObjectPredicate = translateFilterToObjectPredicate;
15
- const tslib_1 = require("tslib");
16
- const assert_1 = tslib_1.__importDefault(require("assert"));
15
+ const assert_1 = require("../utils/assert");
17
16
  const types_1 = require("../types");
18
- const lodash_1 = require("../utils/lodash");
17
+ const toolkit_1 = require("../utils/toolkit");
19
18
  const relation_1 = require("./relation");
20
19
  function translateCreateDataToFilter(schema, entity, data, allowUnrecoganized) {
21
20
  const data2 = {};
@@ -57,7 +56,7 @@ function translateCreateDataToFilter(schema, entity, data, allowUnrecoganized) {
57
56
  function addFilterSegment(entity, schema, ...filters) {
58
57
  let filter;
59
58
  const addIntoAnd = (f) => {
60
- (0, assert_1.default)(filter);
59
+ (0, assert_1.assert)(filter);
61
60
  if (filter.$and) {
62
61
  filter.$and.push(f);
63
62
  }
@@ -68,7 +67,7 @@ function addFilterSegment(entity, schema, ...filters) {
68
67
  }
69
68
  };
70
69
  const addSingleAttr = (attr, value) => {
71
- (0, assert_1.default)(filter);
70
+ (0, assert_1.assert)(filter);
72
71
  if (!filter[attr]) {
73
72
  Object.assign(filter, {
74
73
  [attr]: value
@@ -138,7 +137,7 @@ function addFilterSegment(entity, schema, ...filters) {
138
137
  });
139
138
  }
140
139
  else if (attr.startsWith('#')) {
141
- (0, assert_1.default)(!filter[attr] || filter[attr] === f[attr]);
140
+ (0, assert_1.assert)(!filter[attr] || filter[attr] === f[attr]);
142
141
  filter[attr] = f[attr];
143
142
  }
144
143
  else {
@@ -153,7 +152,7 @@ function addFilterSegment(entity, schema, ...filters) {
153
152
  addManyToOneFilter(attr, rel, f[attr]);
154
153
  }
155
154
  else {
156
- (0, assert_1.default)(rel instanceof Array);
155
+ (0, assert_1.assert)(rel instanceof Array);
157
156
  addOneToManyFilter(attr, rel[0], f[attr]);
158
157
  }
159
158
  }
@@ -170,7 +169,7 @@ function addFilterSegment(entity, schema, ...filters) {
170
169
  const filters2 = oneToManyFilters[attr].map(ele => ele[1]);
171
170
  const sqpOps = filters2.map(ele => ele['#sqp'] || 'in');
172
171
  // 只有全部是同一个子查询算子才能实施合并,这里有进一步优化的余地,但是貌似没必要
173
- if ((0, lodash_1.uniq)(sqpOps).length > 1) {
172
+ if ((0, toolkit_1.uniq)(sqpOps).length > 1) {
174
173
  filters2.forEach(ele => {
175
174
  addIntoAnd({
176
175
  [attr]: ele,
@@ -236,7 +235,7 @@ function unionFilterSegment(entity, schema, ...filters) {
236
235
  if (pca1s.length > 1 || pca2s.length > 1) {
237
236
  return false;
238
237
  }
239
- (0, assert_1.default)(pca1s.length === 1 && pca2s.length === 1);
238
+ (0, assert_1.assert)(pca1s.length === 1 && pca2s.length === 1);
240
239
  if (pca1s[0] !== pca2s[0] && pca1s[0] !== '$or' && pca2s[0] !== '$or') {
241
240
  return false;
242
241
  }
@@ -386,7 +385,7 @@ function unionFilterSegment(entity, schema, ...filters) {
386
385
  }
387
386
  else if (pca1 === pca2) {
388
387
  if (pca1 === '$and') {
389
- (0, assert_1.default)(false, '只一个属性的时候不应该用$and');
388
+ (0, assert_1.assert)(false, '只一个属性的时候不应该用$and');
390
389
  }
391
390
  else if (pca1 === '$not') {
392
391
  // 先not后or 等于先and后not
@@ -426,7 +425,7 @@ function unionFilterSegment(entity, schema, ...filters) {
426
425
  return true;
427
426
  }
428
427
  else {
429
- (0, assert_1.default)(rel instanceof Array);
428
+ (0, assert_1.assert)(rel instanceof Array);
430
429
  // 一对多的子查询,只有子查询的语义算子一样才实施合并
431
430
  const sqpOp1 = f1[pca1]['#sqp'] || 'in';
432
431
  const sqpOp2 = f2[pca1]['#sqp'] || 'in';
@@ -446,7 +445,7 @@ function unionFilterSegment(entity, schema, ...filters) {
446
445
  }
447
446
  else {
448
447
  // not in情况子查询变成and
449
- (0, assert_1.default)(sqpOp1 === 'not in'); // all和not all暂时不支持
448
+ (0, assert_1.assert)(sqpOp1 === 'not in'); // all和not all暂时不支持
450
449
  Object.assign(f1, {
451
450
  [pca1]: Object.assign(addFilterSegment(rel[0], schema, f1[pca1], f2[pca2]), {
452
451
  ['#sqp']: sqpOp1,
@@ -460,7 +459,7 @@ function unionFilterSegment(entity, schema, ...filters) {
460
459
  return false;
461
460
  };
462
461
  const addIntoOr = (f) => {
463
- (0, assert_1.default)(filter);
462
+ (0, assert_1.assert)(filter);
464
463
  if (Object.keys(filter).length === 0) {
465
464
  Object.assign(filter, f);
466
465
  }
@@ -469,14 +468,14 @@ function unionFilterSegment(entity, schema, ...filters) {
469
468
  }
470
469
  else {
471
470
  filter = {
472
- $or: [(0, lodash_1.cloneDeep)(filter), f],
471
+ $or: [(0, toolkit_1.cloneDeep)(filter), f],
473
472
  };
474
473
  }
475
474
  };
476
475
  const addInner = (f) => {
477
476
  if (f) {
478
477
  if (!filter) {
479
- filter = (0, lodash_1.cloneDeep)(f);
478
+ filter = (0, toolkit_1.cloneDeep)(f);
480
479
  return;
481
480
  }
482
481
  if (tryMergeFilters(filter, f)) {
@@ -739,7 +738,7 @@ function judgeValueRelation(value1, value2, contained) {
739
738
  return false;
740
739
  }
741
740
  default: {
742
- (0, assert_1.default)(false, `不能处理的算子「${attr}」`);
741
+ (0, assert_1.assert)(false, `不能处理的算子「${attr}」`);
743
742
  }
744
743
  }
745
744
  }
@@ -764,9 +763,9 @@ function judgeValueRelation(value1, value2, contained) {
764
763
  else if (['$in', '$nin', '$between'].includes(attr)) {
765
764
  switch (attr) {
766
765
  case '$in': {
767
- (0, assert_1.default)(value1.$in instanceof Array);
766
+ (0, assert_1.assert)(value1.$in instanceof Array);
768
767
  const attr2 = (typeof value2 === 'object') && Object.keys(value2)[0];
769
- let c = (attr2 === '$in' && value2[attr2] instanceof Array && (0, lodash_1.difference)(value1.$in, value2[attr2]).length === 0) || (attr2 === '$nin' && value2[attr2] instanceof Array && (0, lodash_1.intersection)(value1.$in, value2[attr2]).length === 0) || (attr2 === '$exists' && value2[attr2] === true);
768
+ let c = (attr2 === '$in' && value2[attr2] instanceof Array && (0, toolkit_1.difference)(value1.$in, value2[attr2]).length === 0) || (attr2 === '$nin' && value2[attr2] instanceof Array && (0, toolkit_1.intersection)(value1.$in, value2[attr2]).length === 0) || (attr2 === '$exists' && value2[attr2] === true);
770
769
  if (!c && attr2 && ['$gt', '$gte', '$lt', '$lte', '$between'].includes(attr2)) {
771
770
  let min33, max33;
772
771
  value1.$in.forEach((ele) => {
@@ -781,7 +780,7 @@ function judgeValueRelation(value1, value2, contained) {
781
780
  || attr2 === '$lt' && value2[attr2] > max33 || attr2 === '$lte' && value2[attr2] >= max33
782
781
  || attr2 === '$between' && value2[attr2][0] < min33 && value2[attr2][1] > max33;
783
782
  }
784
- let r = (attr2 === '$in' && (0, lodash_1.intersection)(value2[attr2], value1.$in).length === 0) || (attr2 === '$eq' && !value1.$in.includes(value2[attr2])) || (attr2 === '$exists' && value2[attr2] === false) || (!value1.$in.includes(value2));
783
+ let r = (attr2 === '$in' && (0, toolkit_1.intersection)(value2[attr2], value1.$in).length === 0) || (attr2 === '$eq' && !value1.$in.includes(value2[attr2])) || (attr2 === '$exists' && value2[attr2] === false) || (!value1.$in.includes(value2));
785
784
  if (!r && attr2 && ['$gt', '$gte', '$lt', '$lte', '$between'].includes(attr2)) {
786
785
  let min44, max44;
787
786
  value1.$in.forEach((ele) => {
@@ -813,11 +812,11 @@ function judgeValueRelation(value1, value2, contained) {
813
812
  return false;
814
813
  }
815
814
  case '$nin': {
816
- (0, assert_1.default)(value1.$nin instanceof Array);
815
+ (0, assert_1.assert)(value1.$nin instanceof Array);
817
816
  const attr2 = (typeof value2 === 'object') && Object.keys(value2)[0];
818
- const c = attr2 && (attr2 === '$nin' && value2[attr2] instanceof Array && (0, lodash_1.intersection)(value2[attr2], value1.$nin).length === 0
817
+ const c = attr2 && (attr2 === '$nin' && value2[attr2] instanceof Array && (0, toolkit_1.intersection)(value2[attr2], value1.$nin).length === 0
819
818
  || attr2 === '$ne' && value1.$nin.includes(value2[attr2]));
820
- const r = attr2 && (attr2 === '$in' && value2[attr2] instanceof Array && (0, lodash_1.intersection)(value2[attr2], value1.$nin).length > 0) || value1.$nin.includes(value2);
819
+ const r = attr2 && (attr2 === '$in' && value2[attr2] instanceof Array && (0, toolkit_1.intersection)(value2[attr2], value1.$nin).length > 0) || value1.$nin.includes(value2);
821
820
  if (contained) {
822
821
  // 相容
823
822
  if (c) {
@@ -834,7 +833,7 @@ function judgeValueRelation(value1, value2, contained) {
834
833
  return false;
835
834
  }
836
835
  case '$between': {
837
- (0, assert_1.default)(value1.$between instanceof Array);
836
+ (0, assert_1.assert)(value1.$between instanceof Array);
838
837
  const attr2 = (typeof value2 === 'object') && Object.keys(value2)[0];
839
838
  const c = attr2 && (attr2 === '$between' && value2[attr2][0] <= value1.$between[0] && value2[attr2][1] >= value1.$between[1]
840
839
  || attr2 === '$gt' && value2[attr2] < value1.$between[0] || attr2 === '$gte' && value2[attr2] <= value1.$between[0]
@@ -862,7 +861,7 @@ function judgeValueRelation(value1, value2, contained) {
862
861
  return false;
863
862
  }
864
863
  default: {
865
- (0, assert_1.default)(false, `暂不支持的算子${attr}`);
864
+ (0, assert_1.assert)(false, `暂不支持的算子${attr}`);
866
865
  }
867
866
  }
868
867
  }
@@ -958,7 +957,7 @@ function judgeFilterSingleAttrRelation(entity, schema, attr, filter, compared, c
958
957
  orDeducedFilters.push(r);
959
958
  }
960
959
  else {
961
- (0, assert_1.default)(attr2 === '$or');
960
+ (0, assert_1.assert)(attr2 === '$or');
962
961
  andDeducedFilters.push(r);
963
962
  }
964
963
  }
@@ -988,7 +987,7 @@ function judgeFilterSingleAttrRelation(entity, schema, attr, filter, compared, c
988
987
  break;
989
988
  }
990
989
  default: {
991
- (0, assert_1.default)(false);
990
+ (0, assert_1.assert)(false);
992
991
  }
993
992
  }
994
993
  }
@@ -1136,7 +1135,7 @@ function analyzeFilterRelation(entity, schema, filter, compared, contained) {
1136
1135
  }
1137
1136
  }
1138
1137
  else {
1139
- (0, assert_1.default)(!contained);
1138
+ (0, assert_1.assert)(!contained);
1140
1139
  // 如果是相斥关系,只要和一个相斥就可以,有一个被证实就成功了
1141
1140
  if (r === true) {
1142
1141
  orDeducedFilters.splice(0, orDeducedFilters.length);
@@ -1179,7 +1178,7 @@ function analyzeFilterRelation(entity, schema, filter, compared, contained) {
1179
1178
  }
1180
1179
  }
1181
1180
  else {
1182
- (0, assert_1.default)(!contained);
1181
+ (0, assert_1.assert)(!contained);
1183
1182
  // 如果是相斥关系,必须和每一个都相斥
1184
1183
  if (r === false) {
1185
1184
  result = false;
@@ -1323,7 +1322,7 @@ function judgeFilterRelation(entity, schema, filter, compared, contained) {
1323
1322
  totalAndDeducedFilters.push({
1324
1323
  entity,
1325
1324
  filter: combineFilters(entity, schema, [filter, {
1326
- $not: (0, lodash_1.pick)(compared, uncertainAttributes),
1325
+ $not: (0, toolkit_1.pick)(compared, uncertainAttributes),
1327
1326
  }]),
1328
1327
  });
1329
1328
  }
@@ -1339,7 +1338,7 @@ function judgeFilterRelation(entity, schema, filter, compared, contained) {
1339
1338
  if (uncertainAttributes.length > 0) {
1340
1339
  totalOrDeducedFilters.push({
1341
1340
  entity,
1342
- filter: combineFilters(entity, schema, [filter, (0, lodash_1.pick)(compared, uncertainAttributes)]),
1341
+ filter: combineFilters(entity, schema, [filter, (0, toolkit_1.pick)(compared, uncertainAttributes)]),
1343
1342
  });
1344
1343
  }
1345
1344
  return {
@@ -1366,8 +1365,8 @@ function judgeFilterRelation(entity, schema, filter, compared, contained) {
1366
1365
  * @returns
1367
1366
  */
1368
1367
  function contains(entity, schema, filter, contained) {
1369
- (0, assert_1.default)(filter);
1370
- (0, assert_1.default)(contained);
1368
+ (0, assert_1.assert)(filter);
1369
+ (0, assert_1.assert)(contained);
1371
1370
  return judgeFilterRelation(entity, schema, filter, contained, true);
1372
1371
  // return false;
1373
1372
  }
@@ -1386,8 +1385,8 @@ function contains(entity, schema, filter, contained) {
1386
1385
  * @param conditionalFilter
1387
1386
  */
1388
1387
  function repel(entity, schema, filter1, filter2) {
1389
- (0, assert_1.default)(filter1);
1390
- (0, assert_1.default)(filter2);
1388
+ (0, assert_1.assert)(filter1);
1389
+ (0, assert_1.assert)(filter2);
1391
1390
  /**
1392
1391
  * 现在的算法检查相斥有一种情况,若filter1被filter2相容,可以判断出来是false,但如果filter2被filter1相容则检查不出来
1393
1392
  * filter1 = {
@@ -1422,7 +1421,7 @@ function getRelevantIds(filter) {
1422
1421
  }
1423
1422
  // 因为要准确判定id,如果有其它的过滤条件,可能会使实际处理的行数少于id指向的行数,只能返回空数组
1424
1423
  const attrs = Object.keys(filter);
1425
- if ((0, lodash_1.intersection)(attrs, ['id', '$and', '$or']).length > 3) {
1424
+ if ((0, toolkit_1.intersection)(attrs, ['id', '$and', '$or']).length > 3) {
1426
1425
  return [];
1427
1426
  }
1428
1427
  if (filter?.$and) {
@@ -1431,7 +1430,7 @@ function getRelevantIds(filter) {
1431
1430
  if (idss.find(ele => ele.length === 0)) {
1432
1431
  return [];
1433
1432
  }
1434
- idsAnd = (0, lodash_1.intersection)(...idss);
1433
+ idsAnd = (0, toolkit_1.intersection)(...idss);
1435
1434
  }
1436
1435
  if (filter?.$or) {
1437
1436
  const idss = filter.$or.map((ele) => getRelevantIds(ele));
@@ -1439,7 +1438,7 @@ function getRelevantIds(filter) {
1439
1438
  if (idss.find(ele => ele.length === 0)) {
1440
1439
  return [];
1441
1440
  }
1442
- idsOr = (0, lodash_1.union)(...idss);
1441
+ idsOr = (0, toolkit_1.union)(...idss);
1443
1442
  }
1444
1443
  if (filter?.id) {
1445
1444
  if (typeof filter.id === 'string') {
@@ -1461,13 +1460,13 @@ function getRelevantIds(filter) {
1461
1460
  }
1462
1461
  let result = (ids || idsAnd || idsOr);
1463
1462
  if (ids) {
1464
- result = (0, lodash_1.intersection)(result, ids);
1463
+ result = (0, toolkit_1.intersection)(result, ids);
1465
1464
  }
1466
1465
  if (idsAnd) {
1467
- result = (0, lodash_1.intersection)(result, idsAnd);
1466
+ result = (0, toolkit_1.intersection)(result, idsAnd);
1468
1467
  }
1469
1468
  if (idsOr) {
1470
- result = (0, lodash_1.intersection)(result, idsOr);
1469
+ result = (0, toolkit_1.intersection)(result, idsOr);
1471
1470
  }
1472
1471
  return result;
1473
1472
  }
@@ -1494,7 +1493,7 @@ function same(entity, schema, filter1, filter2) {
1494
1493
  * @param level
1495
1494
  */
1496
1495
  function makeTreeAncestorFilter(entity, parentKey, filter, level = 1, includeAll, includeSelf) {
1497
- (0, assert_1.default)(level >= 0);
1496
+ (0, assert_1.assert)(level >= 0);
1498
1497
  let idInFilters = [];
1499
1498
  if (includeSelf) {
1500
1499
  idInFilters.push(filter);
@@ -1534,8 +1533,8 @@ function makeTreeAncestorFilter(entity, parentKey, filter, level = 1, includeAll
1534
1533
  * @param level
1535
1534
  */
1536
1535
  function makeTreeDescendantFilter(entity, parentKey, filter, level = 1, includeAll, includeSelf) {
1537
- (0, assert_1.default)(level >= 0);
1538
- (0, assert_1.default)(parentKey.endsWith('Id'));
1536
+ (0, assert_1.assert)(level >= 0);
1537
+ (0, assert_1.assert)(parentKey.endsWith('Id'));
1539
1538
  const parentKeyRef = parentKey.slice(0, parentKey.length - 2);
1540
1539
  let idInFilters = [];
1541
1540
  if (includeSelf) {
@@ -1562,7 +1561,7 @@ function makeTreeDescendantFilter(entity, parentKey, filter, level = 1, includeA
1562
1561
  function checkDeduceFilters(dfc, context) {
1563
1562
  const { $and, $or } = dfc;
1564
1563
  if ($and) {
1565
- (0, assert_1.default)(!$or);
1564
+ (0, assert_1.assert)(!$or);
1566
1565
  const andResult = $and.map((ele) => {
1567
1566
  if (ele.hasOwnProperty('entity')) {
1568
1567
  const ele2 = ele;
@@ -1591,7 +1590,7 @@ function checkDeduceFilters(dfc, context) {
1591
1590
  }
1592
1591
  return true;
1593
1592
  }
1594
- (0, assert_1.default)($or);
1593
+ (0, assert_1.assert)($or);
1595
1594
  const orResult = $or.map((ele) => {
1596
1595
  if (ele.hasOwnProperty('entity')) {
1597
1596
  const ele2 = ele;
@@ -1630,7 +1629,7 @@ function checkDeduceFilters(dfc, context) {
1630
1629
  * @returns
1631
1630
  */
1632
1631
  function checkFilterContains(entity, context, contained, filter, dataCompare, warningOnDataCompare) {
1633
- (0, assert_1.default)(filter, `对${entity}的访问必须有filter`);
1632
+ (0, assert_1.assert)(filter, `对${entity}的访问必须有filter`);
1634
1633
  const schema = context.getSchema();
1635
1634
  const result = contains(entity, schema, filter, contained);
1636
1635
  if (typeof result === 'boolean') {
@@ -1645,7 +1644,7 @@ function checkFilterContains(entity, context, contained, filter, dataCompare, wa
1645
1644
  return false;
1646
1645
  }
1647
1646
  function checkFilterRepel(entity, context, filter1, filter2, dataCompare, warningOnDataCompare) {
1648
- (0, assert_1.default)(filter2);
1647
+ (0, assert_1.assert)(filter2);
1649
1648
  const schema = context.getSchema();
1650
1649
  const result = repel(entity, schema, filter2, filter1);
1651
1650
  if (typeof result === 'boolean') {
@@ -1704,4 +1703,4 @@ function translateFilterToObjectPredicate(filter) {
1704
1703
  if (filters.length > 0) {
1705
1704
  return combineFilters(filters);
1706
1705
  }
1707
- } */
1706
+ } */
@@ -1,8 +1,8 @@
1
- import { EntityDict as BaseEntityDict } from '../base-app-domain';
2
- import { OpSchema as Modi } from '../base-app-domain/Modi/Schema';
3
- import { Operation, StorageSchema, RowChecker, EntityDict, OperateOption, Trigger } from '../types';
4
- import { AsyncContext } from './AsyncRowStore';
5
- import { SyncContext } from './SyncRowStore';
1
+ import { EntityDict as BaseEntityDict } from "../base-app-domain";
2
+ import { OpSchema as Modi } from "../base-app-domain/Modi/Schema";
3
+ import { Operation, StorageSchema, RowChecker, EntityDict, OperateOption, Trigger } from "../types";
4
+ import { AsyncContext } from "./AsyncRowStore";
5
+ import { SyncContext } from "./SyncRowStore";
6
6
  export declare function createOperationsFromModies(modies: Modi[]): Array<{
7
7
  operation: Operation<string, Object, Object>;
8
8
  entity: string;
package/lib/store/modi.js CHANGED
@@ -5,12 +5,11 @@ exports.applyModis = applyModis;
5
5
  exports.abandonModis = abandonModis;
6
6
  exports.createModiRelatedCheckers = createModiRelatedCheckers;
7
7
  exports.createModiRelatedTriggers = createModiRelatedTriggers;
8
- const tslib_1 = require("tslib");
9
8
  const types_1 = require("../types");
10
9
  const action_1 = require("../actions/action");
11
- const lodash_1 = require("../utils/lodash");
10
+ const toolkit_1 = require("../utils/toolkit");
12
11
  const uuid_1 = require("../utils/uuid");
13
- const assert_1 = tslib_1.__importDefault(require("assert"));
12
+ const assert_1 = require("../utils/assert");
14
13
  function createOperationsFromModies(modies) {
15
14
  return modies.map((modi) => {
16
15
  return {
@@ -73,7 +72,7 @@ function createModiRelatedCheckers(schema) {
73
72
  if (!inModi || ['readOnly', 'appendOnly'].includes(actionType)) {
74
73
  continue;
75
74
  }
76
- const restActions = (0, lodash_1.difference)(actions, action_1.appendOnlyActions);
75
+ const restActions = (0, toolkit_1.difference)(actions, action_1.appendOnlyActions);
77
76
  if (!process.env.OAK_DISABLE_MODI_LOCK) {
78
77
  checkers.push({
79
78
  entity,
@@ -90,8 +89,8 @@ function createModiRelatedCheckers(schema) {
90
89
  */
91
90
  if (option.modiParentEntity) {
92
91
  const { modiParentEntity, modiParentId } = option;
93
- (0, assert_1.default)(modiParentEntity);
94
- (0, assert_1.default)(modiParentId);
92
+ (0, assert_1.assert)(modiParentEntity);
93
+ (0, assert_1.assert)(modiParentId);
95
94
  return {
96
95
  modiEntity$entity: {
97
96
  '#sqp': 'not in',
@@ -1,2 +1,2 @@
1
- import { Projection } from '../base-app-domain/Modi/Schema';
1
+ import { Projection } from "../base-app-domain/Modi/Schema";
2
2
  export declare const fullModi: Projection;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.judgeRelation = judgeRelation;
4
- const tslib_1 = require("tslib");
5
- const assert_1 = tslib_1.__importDefault(require("assert"));
4
+ const assert_1 = require("../utils/assert");
6
5
  const Demand_1 = require("../types/Demand");
7
6
  const Entity_1 = require("../types/Entity");
8
7
  /**
@@ -65,7 +64,7 @@ function judgeRelation(schema, entity, attr, allowUnrecognized) {
65
64
  if (attr.includes('$')) {
66
65
  const firstDelimiter = attr.indexOf('$');
67
66
  const entity2 = attr.slice(0, firstDelimiter);
68
- (0, assert_1.default)(schema.hasOwnProperty(entity2), `schema中不存在名为[${entity2}]的实体,无法解析属性[${attr}]`);
67
+ (0, assert_1.assert)(schema.hasOwnProperty(entity2), `schema中不存在名为[${entity2}]的实体,无法解析属性[${attr}]`);
69
68
  const secondDelimiter = attr.indexOf('$', firstDelimiter + 1);
70
69
  const foreignKey = attr.slice(firstDelimiter + 1, secondDelimiter > 0 ? secondDelimiter : attr.length);
71
70
  const { [entity2]: { attributes: attributes2 } } = schema;
@@ -81,7 +80,7 @@ function judgeRelation(schema, entity, attr, allowUnrecognized) {
81
80
  }
82
81
  else {
83
82
  // 这种情况应该不会跑到
84
- (0, assert_1.default)(false, `实体 [${entity2}] 中不存在外键 [${foreignKey}Id] 或该外键未指向 [${String(entity)}],无法解析属性 [${attr}]`);
83
+ (0, assert_1.assert)(false, `实体 [${entity2}] 中不存在外键 [${foreignKey}Id] 或该外键未指向 [${String(entity)}],无法解析属性 [${attr}]`);
85
84
  }
86
85
  }
87
86
  else if ((attributes.hasOwnProperty(`${attr}Id`))) {
@@ -94,7 +93,7 @@ function judgeRelation(schema, entity, attr, allowUnrecognized) {
94
93
  else if (attributes.hasOwnProperty('entity')
95
94
  && attributes.hasOwnProperty('entityId')
96
95
  && schema.hasOwnProperty(attr)) {
97
- (0, assert_1.default)(attributes.entity.ref.includes(attr), `实体 [${String(entity)}] 的 动态反指为 [${attributes.entity.ref}],但不包含 [${attr}]`);
96
+ (0, assert_1.assert)(attributes.entity.ref.includes(attr), `实体 [${String(entity)}] 的 动态反指为 [${attributes.entity.ref}],但不包含 [${attr}]`);
98
97
  // 反向指针的外键
99
98
  return 2;
100
99
  }