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
@@ -1,12 +1,30 @@
1
1
  import * as ts from 'typescript';
2
- import { type CustomDiagnostic, type ExtendedTsConfig, OAK_IGNORE_TAGS, performCustomChecks } from './customChecks';
2
+ import { CustomDiagnostic, ExtendedTsConfig, OAK_IGNORE_TAGS, performCustomChecks } from './customChecks';
3
3
  export type CompileOptions = {
4
+ compilerPlugins?: readonly TscCompilerPlugin[];
4
5
  project?: string;
5
6
  noEmit?: boolean;
6
7
  skipExtraCheck?: boolean;
7
8
  skipEmitDiagnostics?: boolean;
8
9
  watch?: boolean;
9
10
  };
11
+ export interface TscCompilerPluginContext {
12
+ compilerOptions: ts.CompilerOptions;
13
+ host: ts.CompilerHost;
14
+ oldProgram?: ts.Program;
15
+ projectReferences?: readonly ts.ProjectReference[];
16
+ rootNames: readonly string[];
17
+ typescript: typeof ts;
18
+ watch: boolean;
19
+ }
20
+ export interface TscCompilerPluginEnvironment {
21
+ host?: ts.CompilerHost;
22
+ mapDiagnostic?: (diagnostic: ts.Diagnostic) => ts.Diagnostic | undefined;
23
+ rootNames?: readonly string[];
24
+ }
25
+ export interface TscCompilerPlugin {
26
+ prepareProgram: (context: TscCompilerPluginContext) => TscCompilerPluginEnvironment;
27
+ }
10
28
  type PathAliasImportRule = {
11
29
  aliasKey: string;
12
30
  preferredSpecifier: string;
@@ -25,5 +43,5 @@ export declare function createPathAliasEmitRewriter(configPath: string): {
25
43
  createWriteFile: (baseWriteFile?: ts.WriteFileCallback) => ts.WriteFileCallback;
26
44
  };
27
45
  declare function collectPathAliasImportDiagnostics(program: ts.Program, rules: PathAliasImportRule[], changedFiles?: Set<string>): CustomDiagnostic[];
28
- export declare const build: (pwd: string, args: any[]) => void;
46
+ export declare const build: (pwd: string, args: any[], compilerPlugins?: readonly TscCompilerPlugin[]) => void;
29
47
  export { performCustomChecks, OAK_IGNORE_TAGS, buildPathAliasImportRules, collectPathAliasImportDiagnostics, type CustomDiagnostic, type ExtendedTsConfig, };
@@ -1,7 +1,7 @@
1
1
  import * as fs from 'fs';
2
2
  import * as path from 'path';
3
3
  import * as ts from 'typescript';
4
- import { CustomCheckState, OAK_IGNORE_TAGS, performCustomChecks, } from './customChecks';
4
+ import { CustomCheckState, OAK_IGNORE_TAGS, performCustomChecks } from './customChecks';
5
5
  const colors = {
6
6
  reset: '\x1b[0m',
7
7
  cyan: '\x1b[36m',
@@ -10,6 +10,9 @@ const colors = {
10
10
  gray: '\x1b[90m',
11
11
  green: '\x1b[92m',
12
12
  };
13
+ function normalizeConfigPath(configPath) {
14
+ return path.resolve(configPath).replace(/\\/g, '/');
15
+ }
13
16
  const PATH_ALIAS_IMPORT_WARNING_CODE = 9400;
14
17
  function sendWatchIpcMessage(message) {
15
18
  if (typeof process.send === 'function') {
@@ -100,6 +103,47 @@ function normalizeModulePathSegment(value) {
100
103
  function stripKnownModuleExtension(value) {
101
104
  return value.replace(/(\.d)?\.[cm]?[jt]sx?$/i, '');
102
105
  }
106
+ function isRelativeModuleSpecifier(value) {
107
+ return value.startsWith('./') || value.startsWith('../');
108
+ }
109
+ function isJsonModuleSpecifier(value) {
110
+ return /\.json$/i.test(value);
111
+ }
112
+ function isDeclarationSourceFile(sourceFile) {
113
+ return /\.d\.[cm]?ts$/i.test(sourceFile.fileName);
114
+ }
115
+ function getCommonDirectory(fileNames) {
116
+ if (fileNames.length === 0) {
117
+ return;
118
+ }
119
+ const normalizedDirectories = fileNames.map((fileName) => path.resolve(path.dirname(fileName)));
120
+ const [firstDirectory, ...restDirectories] = normalizedDirectories;
121
+ const root = path.parse(firstDirectory).root;
122
+ let commonParts = firstDirectory.slice(root.length).split(path.sep).filter(Boolean);
123
+ restDirectories.forEach((directory) => {
124
+ if (path.parse(directory).root.toLowerCase() !== root.toLowerCase()) {
125
+ commonParts = [];
126
+ return;
127
+ }
128
+ const parts = directory.slice(root.length).split(path.sep).filter(Boolean);
129
+ let index = 0;
130
+ while (index < commonParts.length &&
131
+ index < parts.length &&
132
+ commonParts[index].toLowerCase() === parts[index].toLowerCase()) {
133
+ index++;
134
+ }
135
+ commonParts = commonParts.slice(0, index);
136
+ });
137
+ return path.join(root, ...commonParts);
138
+ }
139
+ function getCommonSourceDirectory(program) {
140
+ return getCommonDirectory(program
141
+ .getSourceFiles()
142
+ .filter((sourceFile) => (!sourceFile.isDeclarationFile &&
143
+ !isDeclarationSourceFile(sourceFile) &&
144
+ !normalizeModulePathSegment(sourceFile.fileName).includes('/node_modules/')))
145
+ .map((sourceFile) => sourceFile.fileName));
146
+ }
103
147
  function stripTrailingWildcard(value) {
104
148
  if (value.endsWith('/*')) {
105
149
  return {
@@ -127,6 +171,75 @@ function extractPackageSpecifierFromPathAliasTarget(target) {
127
171
  }
128
172
  return normalizedTarget.slice(markerIndex + marker.length);
129
173
  }
174
+ function resolveOutputFileForSourceAsset(program, parsedConfig, sourceFileName) {
175
+ const { outDir } = parsedConfig.options;
176
+ const rootDir = parsedConfig.options.rootDir || getCommonSourceDirectory(program);
177
+ if (!rootDir || !outDir) {
178
+ return;
179
+ }
180
+ const absoluteSourceFileName = path.resolve(sourceFileName);
181
+ const relativePath = path.relative(path.resolve(rootDir), absoluteSourceFileName);
182
+ if (!relativePath ||
183
+ relativePath.startsWith('..') ||
184
+ path.isAbsolute(relativePath)) {
185
+ return;
186
+ }
187
+ return path.resolve(outDir, relativePath);
188
+ }
189
+ function collectRuntimeJsonAssets(program, parsedConfig) {
190
+ const assets = new Map();
191
+ const addAsset = (containingSourceFile, specifier) => {
192
+ if (!isRelativeModuleSpecifier(specifier) || !isJsonModuleSpecifier(specifier)) {
193
+ return;
194
+ }
195
+ const sourceFileName = path.resolve(path.dirname(containingSourceFile.fileName), specifier);
196
+ if (!fs.existsSync(sourceFileName) || !fs.statSync(sourceFileName).isFile()) {
197
+ return;
198
+ }
199
+ const outputFileName = resolveOutputFileForSourceAsset(program, parsedConfig, sourceFileName);
200
+ if (!outputFileName) {
201
+ return;
202
+ }
203
+ assets.set(path.normalize(sourceFileName), {
204
+ sourceFileName,
205
+ outputFileName,
206
+ });
207
+ };
208
+ program.getSourceFiles().forEach((sourceFile) => {
209
+ if (sourceFile.isDeclarationFile || isDeclarationSourceFile(sourceFile)) {
210
+ return;
211
+ }
212
+ const visit = (node) => {
213
+ if (ts.isImportDeclaration(node) && ts.isStringLiteral(node.moduleSpecifier)) {
214
+ addAsset(sourceFile, node.moduleSpecifier.text);
215
+ }
216
+ else if (ts.isExportDeclaration(node) &&
217
+ node.moduleSpecifier &&
218
+ ts.isStringLiteral(node.moduleSpecifier)) {
219
+ addAsset(sourceFile, node.moduleSpecifier.text);
220
+ }
221
+ else if (ts.isCallExpression(node) &&
222
+ node.arguments.length > 0 &&
223
+ ts.isStringLiteral(node.arguments[0]) &&
224
+ ((ts.isIdentifier(node.expression) && node.expression.text === 'require') ||
225
+ node.expression.kind === ts.SyntaxKind.ImportKeyword)) {
226
+ addAsset(sourceFile, node.arguments[0].text);
227
+ }
228
+ ts.forEachChild(node, visit);
229
+ };
230
+ visit(sourceFile);
231
+ });
232
+ return Array.from(assets.values());
233
+ }
234
+ function copyRuntimeJsonAssets(program, parsedConfig, options) {
235
+ if (options.noEmit || parsedConfig.options.noEmit) {
236
+ return;
237
+ }
238
+ collectRuntimeJsonAssets(program, parsedConfig).forEach(({ sourceFileName, outputFileName }) => {
239
+ fs.mkdirSync(path.dirname(outputFileName), { recursive: true });
240
+ fs.copyFileSync(sourceFileName, outputFileName);
241
+ });
242
+ }
130
243
  function buildPathAliasImportRules(paths) {
131
244
  if (!paths) {
132
245
  return [];
@@ -413,7 +526,7 @@ function createPathAliasEmitRewriterCore(parsedConfig, configPath) {
413
526
  if (directPackageSpecifier) {
414
527
  return directPackageSpecifier;
415
528
  }
416
- if (!matchesPathAliasImport(importPath, matchers)) {
529
+ if (!containingFile || !matchesPathAliasImport(importPath, matchers)) {
417
530
  return;
418
531
  }
419
532
  const resolutionKey = `${path.normalize(containingFile)}::${importPath}`;
@@ -446,9 +559,6 @@ function createPathAliasEmitRewriterCore(parsedConfig, configPath) {
446
559
  return fileContents;
447
560
  }
448
561
  const containingFile = sourceFilePaths?.find((sourceFilePath) => !sourceFilePath.endsWith('.d.ts')) || sourceFilePaths?.[0] || emittedFileToSourceFile.get(canonicalFileName(path.resolve(fileName)));
449
- if (!containingFile) {
450
- return fileContents;
451
- }
452
562
  const sourceFile = ts.createSourceFile(fileName, fileContents, ts.ScriptTarget.Latest, true, getScriptKindForEmittedFile(fileName));
453
563
  const replacements = [];
454
564
  const addReplacement = (literal) => {
@@ -534,15 +644,16 @@ function createPathAliasEmitRewriterCore(parsedConfig, configPath) {
534
644
  };
535
645
  }
536
646
  export function createPathAliasEmitRewriter(configPath) {
537
- const configFile = ts.readConfigFile(configPath, ts.sys.readFile);
647
+ const normalizedConfigPath = normalizeConfigPath(configPath);
648
+ const configFile = ts.readConfigFile(normalizedConfigPath, ts.sys.readFile);
538
649
  if (configFile.error) {
539
650
  throw new Error(ts.formatDiagnostic(configFile.error, createDiagnosticsFormatHost()));
540
651
  }
541
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(configPath));
652
+ const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(normalizedConfigPath), undefined, normalizedConfigPath);
542
653
  if (parsedConfig.errors.length > 0) {
543
654
  throw new Error(parsedConfig.errors.map((diagnostic) => ts.formatDiagnostic(diagnostic, createDiagnosticsFormatHost())).join('\n'));
544
655
  }
545
- return createPathAliasEmitRewriterCore(parsedConfig, configPath);
656
+ return createPathAliasEmitRewriterCore(parsedConfig, normalizedConfigPath);
546
657
  }
547
658
  function createPathAliasImportDiagnostic(sourceFile, moduleSpecifier, importPath, rule, preferredSpecifier) {
548
659
  return {
@@ -642,7 +753,9 @@ function printDiagnostic(pwd, diagnostic, index) {
642
753
  console.log(`${colors.cyan}│${colors.reset} ${categoryColor}${category}${colors.reset} ${colors.gray}TS${diagnostic.code}${colors.reset}: ${message}`);
643
754
  const sourceFile = diagnostic.file;
644
755
  const lineStart = sourceFile.getPositionOfLineAndCharacter(line, 0);
645
- const lineEnd = sourceFile.getPositionOfLineAndCharacter(line + 1, 0);
756
+ const lineEnd = line + 1 < sourceFile.getLineStarts().length
757
+ ? sourceFile.getPositionOfLineAndCharacter(line + 1, 0)
758
+ : sourceFile.text.length;
646
759
  let lineText = sourceFile.text.substring(lineStart, lineEnd).trimEnd();
647
760
  const newlineIndex = lineText.indexOf('\n');
648
761
  if (newlineIndex !== -1) {
@@ -703,7 +816,41 @@ function printDiagnostic(pwd, diagnostic, index) {
703
816
  const categoryColor = isError ? colors.red : colors.yellow;
704
817
  console.log(`\n${index + 1}. ${categoryColor}${category}${colors.reset} ${colors.gray}TS${diagnostic.code}${colors.reset}: ${ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`);
705
818
  }
706
- function performChecksAndReport(pwd, program, customConfig, pathAliasImportRules, options, state, changedFiles, standardDiagnostics) {
819
+ function prepareCompilerPlugins(options, context) {
820
+ let host = context.host;
821
+ let rootNames = context.rootNames;
822
+ const diagnosticMappers = [];
823
+ for (const plugin of options.compilerPlugins || []) {
824
+ const environment = plugin.prepareProgram({
825
+ ...context,
826
+ host,
827
+ rootNames,
828
+ });
829
+ host = environment.host || host;
830
+ rootNames = environment.rootNames || rootNames;
831
+ if (environment.mapDiagnostic) {
832
+ diagnosticMappers.push(environment.mapDiagnostic);
833
+ }
834
+ }
835
+ return {
836
+ diagnosticMappers,
837
+ host,
838
+ rootNames,
839
+ };
840
+ }
841
+ function mapCompilerDiagnostics(diagnostics, mappers) {
842
+ return diagnostics.flatMap((diagnostic) => {
843
+ let current = diagnostic;
844
+ for (const mapper of mappers) {
845
+ if (!current) {
846
+ break;
847
+ }
848
+ current = mapper(current);
849
+ }
850
+ return current ? [current] : [];
851
+ });
852
+ }
853
+ function performChecksAndReport(pwd, program, customConfig, pathAliasImportRules, options, state, changedFiles, standardDiagnostics, diagnosticMappers = []) {
707
854
  const overallStartTime = Date.now();
708
855
  const fileInfo = changedFiles?.size ? `${changedFiles.size} file(s)` : 'all files';
709
856
  const shouldRunExtraChecks = !options.skipExtraCheck;
@@ -733,7 +880,7 @@ function performChecksAndReport(pwd, program, customConfig, pathAliasImportRules
733
880
  let index = 0;
734
881
  if (!options.skipEmitDiagnostics) {
735
882
  const diagnosticsStartTime = Date.now();
736
- const allDiagnostics = standardDiagnostics
883
+ const rawDiagnostics = standardDiagnostics
737
884
  ? [...standardDiagnostics]
738
885
  : state
739
886
  ? ts.getPreEmitDiagnostics(program)
@@ -741,6 +888,7 @@ function performChecksAndReport(pwd, program, customConfig, pathAliasImportRules
741
888
  ...ts.getPreEmitDiagnostics(program),
742
889
  ...(options.noEmit ? [] : program.emit().diagnostics),
743
890
  ];
891
+ const allDiagnostics = mapCompilerDiagnostics(rawDiagnostics, diagnosticMappers);
744
892
  allDiagnostics.forEach(diagnostic => {
745
893
  const level = getDiagnosticLevel(diagnostic);
746
894
  if (level === 'error') {
@@ -774,13 +922,14 @@ function performChecksAndReport(pwd, program, customConfig, pathAliasImportRules
774
922
  };
775
923
  }
776
924
  const compile = (pwd, options) => {
777
- const configFile = ts.readConfigFile(options.project, ts.sys.readFile);
925
+ const projectConfigPath = normalizeConfigPath(options.project);
926
+ const configFile = ts.readConfigFile(projectConfigPath, ts.sys.readFile);
778
927
  if (configFile.error) {
779
928
  console.error(ts.formatDiagnostic(configFile.error, createDiagnosticsFormatHost()));
780
929
  process.exit(1);
781
930
  }
782
931
  const customConfig = configFile.config.oakBuildChecks || {};
783
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(options.project));
932
+ const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(projectConfigPath), undefined, projectConfigPath);
784
933
  const pathAliasImportRules = buildPathAliasImportRules(parsedConfig.options.paths);
785
934
  if (parsedConfig.errors.length > 0) {
786
935
  parsedConfig.errors.forEach(diagnostic => {
@@ -788,46 +937,55 @@ const compile = (pwd, options) => {
788
937
  });
789
938
  process.exit(1);
790
939
  }
791
- const emitAliasRewriter = createPathAliasEmitRewriterCore(parsedConfig, options.project);
792
- const program = parsedConfig.options.incremental || parsedConfig.options.composite
793
- ? (() => {
794
- const host = ts.createIncrementalCompilerHost(parsedConfig.options);
795
- host.writeFile = emitAliasRewriter.createWriteFile(host.writeFile);
796
- return ts.createIncrementalProgram({
797
- rootNames: parsedConfig.fileNames,
798
- options: parsedConfig.options,
799
- host,
800
- configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(parsedConfig),
801
- }).getProgram();
802
- })()
803
- : (() => {
804
- const host = ts.createCompilerHost(parsedConfig.options);
805
- host.writeFile = emitAliasRewriter.createWriteFile(host.writeFile);
806
- return ts.createProgram({
807
- rootNames: parsedConfig.fileNames,
808
- options: parsedConfig.options,
809
- host,
810
- });
811
- })();
812
- const result = performChecksAndReport(pwd, program, customConfig, pathAliasImportRules, options);
940
+ const emitAliasRewriter = createPathAliasEmitRewriterCore(parsedConfig, projectConfigPath);
941
+ const incremental = Boolean(parsedConfig.options.incremental || parsedConfig.options.composite);
942
+ const baseHost = incremental
943
+ ? ts.createIncrementalCompilerHost(parsedConfig.options)
944
+ : ts.createCompilerHost(parsedConfig.options);
945
+ baseHost.writeFile = emitAliasRewriter.createWriteFile(baseHost.writeFile);
946
+ const prepared = prepareCompilerPlugins(options, {
947
+ compilerOptions: parsedConfig.options,
948
+ host: baseHost,
949
+ projectReferences: parsedConfig.projectReferences,
950
+ rootNames: parsedConfig.fileNames,
951
+ typescript: ts,
952
+ watch: false,
953
+ });
954
+ const program = incremental
955
+ ? ts.createIncrementalProgram({
956
+ rootNames: prepared.rootNames,
957
+ options: parsedConfig.options,
958
+ host: prepared.host,
959
+ projectReferences: parsedConfig.projectReferences,
960
+ configFileParsingDiagnostics: ts.getConfigFileParsingDiagnostics(parsedConfig),
961
+ }).getProgram()
962
+ : ts.createProgram({
963
+ rootNames: prepared.rootNames,
964
+ options: parsedConfig.options,
965
+ host: prepared.host,
966
+ projectReferences: parsedConfig.projectReferences,
967
+ });
968
+ const result = performChecksAndReport(pwd, program, customConfig, pathAliasImportRules, options, undefined, undefined, undefined, prepared.diagnosticMappers);
813
969
  if (result.hasErrors) {
814
970
  console.log(`${colors.red}Compilation failed due to errors.${colors.reset}`);
815
971
  process.exit(1);
816
972
  }
973
+ copyRuntimeJsonAssets(program, parsedConfig, options);
817
974
  console.log(`${colors.green}Compilation completed successfully.${colors.reset}`);
818
975
  };
819
976
  const compileWithWatch = (pwd, options) => {
820
- const configFile = ts.readConfigFile(options.project, ts.sys.readFile);
977
+ const projectConfigPath = normalizeConfigPath(options.project);
978
+ const configFile = ts.readConfigFile(projectConfigPath, ts.sys.readFile);
821
979
  if (configFile.error) {
822
980
  console.error(ts.formatDiagnostic(configFile.error, createDiagnosticsFormatHost()));
823
981
  process.exit(1);
824
982
  }
825
983
  const customConfig = configFile.config.oakBuildChecks || {};
826
- const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(options.project));
984
+ const parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, path.dirname(projectConfigPath), undefined, projectConfigPath);
827
985
  const pathAliasImportRules = buildPathAliasImportRules(parsedConfig.options.paths);
828
986
  if (parsedConfig.options.incremental === undefined) {
829
987
  parsedConfig.options.incremental = true;
830
- parsedConfig.options.tsBuildInfoFile = path.join(path.dirname(options.project), '.tsbuildinfo');
988
+ parsedConfig.options.tsBuildInfoFile = normalizeConfigPath(path.join(path.dirname(projectConfigPath), '.tsbuildinfo'));
831
989
  }
832
990
  // Watch 模式优先保证运行时产物持续可用,即使存在类型错误也继续 emit。
833
991
  if (!options.noEmit) {
@@ -839,14 +997,40 @@ const compileWithWatch = (pwd, options) => {
839
997
  });
840
998
  process.exit(1);
841
999
  }
842
- const emitAliasRewriter = createPathAliasEmitRewriterCore(parsedConfig, options.project);
1000
+ const emitAliasRewriter = createPathAliasEmitRewriterCore(parsedConfig, projectConfigPath);
1001
+ let activeDiagnosticMappers = [];
843
1002
  const createBuilderProgramWithAliasRewrite = (rootNames, compilerOptions, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences) => {
844
- if (compilerHost) {
845
- compilerHost.writeFile = emitAliasRewriter.createWriteFile(compilerHost.writeFile);
1003
+ const resolvedCompilerOptions = compilerOptions || parsedConfig.options;
1004
+ const resolvedRootNames = rootNames || parsedConfig.fileNames;
1005
+ const baseCompilerHost = compilerHost
1006
+ || ts.createCompilerHost(resolvedCompilerOptions);
1007
+ baseCompilerHost.writeFile = emitAliasRewriter.createWriteFile(baseCompilerHost.writeFile);
1008
+ let oldTypeScriptProgram;
1009
+ if (!options.compilerPlugins?.length) {
1010
+ try {
1011
+ oldTypeScriptProgram = oldProgram?.getProgram?.();
1012
+ }
1013
+ catch {
1014
+ // TypeScript supplies a placeholder builder on the initial watch pass.
1015
+ oldTypeScriptProgram = undefined;
1016
+ }
846
1017
  }
1018
+ const prepared = prepareCompilerPlugins(options, {
1019
+ compilerOptions: resolvedCompilerOptions,
1020
+ host: baseCompilerHost,
1021
+ oldProgram: oldTypeScriptProgram,
1022
+ projectReferences,
1023
+ rootNames: resolvedRootNames,
1024
+ typescript: ts,
1025
+ watch: true,
1026
+ });
1027
+ activeDiagnosticMappers = prepared.diagnosticMappers;
1028
+ const reusableOldProgram = options.compilerPlugins?.length
1029
+ ? undefined
1030
+ : oldProgram;
847
1031
  return options.noEmit
848
- ? ts.createSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences)
849
- : ts.createEmitAndSemanticDiagnosticsBuilderProgram(rootNames, compilerOptions, compilerHost, oldProgram, configFileParsingDiagnostics, projectReferences);
1032
+ ? ts.createSemanticDiagnosticsBuilderProgram(prepared.rootNames, resolvedCompilerOptions, prepared.host, reusableOldProgram, configFileParsingDiagnostics, projectReferences)
1033
+ : ts.createEmitAndSemanticDiagnosticsBuilderProgram(prepared.rootNames, resolvedCompilerOptions, prepared.host, reusableOldProgram, configFileParsingDiagnostics, projectReferences);
850
1034
  };
851
1035
  console.log(`${colors.cyan}Starting compilation in watch mode...${colors.reset}\n`);
852
1036
  const checkState = new CustomCheckState();
@@ -916,9 +1100,10 @@ const compileWithWatch = (pwd, options) => {
916
1100
  console.log(`${colors.cyan}Detected ${changedFiles.size} changed file(s) from watch events${colors.reset}`);
917
1101
  }
918
1102
  const customChecksStartTime = Date.now();
919
- const result = performChecksAndReport(pwd, currentProgram, customConfig, pathAliasImportRules, options, checkState, changedFiles, watchDiagnostics);
1103
+ const result = performChecksAndReport(pwd, currentProgram, customConfig, pathAliasImportRules, options, checkState, changedFiles, watchDiagnostics, activeDiagnosticMappers);
920
1104
  const customChecksTime = Date.now() - customChecksStartTime;
921
1105
  watchDiagnostics = [];
1106
+ copyRuntimeJsonAssets(currentProgram, parsedConfig, options);
922
1107
  const timestamp = new Date().toLocaleTimeString();
923
1108
  const totalPhaseTime = Date.now() - wholePhaseStartTime;
924
1109
  const unaccountedTime = totalPhaseTime - tsCallbackTime - customChecksTime;
@@ -948,8 +1133,9 @@ const compileWithWatch = (pwd, options) => {
948
1133
  };
949
1134
  ts.createWatchProgram(host);
950
1135
  };
951
- export const build = (pwd, args) => {
1136
+ export const build = (pwd, args, compilerPlugins = []) => {
952
1137
  const options = parseArgs(args);
1138
+ options.compilerPlugins = compilerPlugins;
953
1139
  let configPath;
954
1140
  if (fs.existsSync(options.project)) {
955
1141
  const stat = fs.statSync(options.project);
@@ -1,11 +1,12 @@
1
- import { EntityDict } from '../base-app-domain';
2
- import { BriefEnv } from '../types/Environment';
3
- import { EntityDict as BaseEntityDict } from '../types/Entity';
1
+ import { EntityDict } from "../base-app-domain";
2
+ import { BriefEnv } from "../types/Environment";
3
+ import { EntityDict as BaseEntityDict } from "../types/Entity";
4
4
  import { AsyncContext } from '../store/AsyncRowStore';
5
- import { SerializedData } from './SerializedData';
5
+ import { SerializedData } from "./SerializedData";
6
6
  export declare abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDict> extends AsyncContext<ED> {
7
7
  private subscriberId?;
8
8
  private be?;
9
+ private locale?;
9
10
  private ns?;
10
11
  eventOperationMap: Record<string, string[]>;
11
12
  getNavigatorState(): {
@@ -14,6 +15,7 @@ export declare abstract class BackendRuntimeContext<ED extends EntityDict & Base
14
15
  } | undefined;
15
16
  getSubscriberId(): string | undefined;
16
17
  getBriefEnvironment(): BriefEnv | undefined;
18
+ getLocale(): string | undefined;
17
19
  protected getSerializedData(): Promise<SerializedData>;
18
20
  initialize(data?: SerializedData): Promise<void>;
19
21
  /**
@@ -1,8 +1,9 @@
1
- import assert from 'assert';
1
+ import { assert } from '../utils/assert';
2
2
  import { AsyncContext } from '../store/AsyncRowStore';
3
3
  export class BackendRuntimeContext extends AsyncContext {
4
4
  subscriberId;
5
5
  be;
6
+ locale;
6
7
  ns;
7
8
  // 本 map 中记录了要求推送 event 到客户端的 operation
8
9
  eventOperationMap = {};
@@ -15,11 +16,15 @@ export class BackendRuntimeContext extends AsyncContext {
15
16
  getBriefEnvironment() {
16
17
  return this.be;
17
18
  }
19
+ getLocale() {
20
+ return this.locale;
21
+ }
18
22
  async getSerializedData() {
19
23
  return {
20
24
  // 在后台事务 restart 时,subscriberId 不能跟随,此时是在完全后台异步的环境里执行
21
25
  // sid: this.subscriberId,
22
26
  be: this.be,
27
+ locale: this.locale,
23
28
  ns: this.ns,
24
29
  };
25
30
  }
@@ -30,6 +35,9 @@ export class BackendRuntimeContext extends AsyncContext {
30
35
  if (data?.be) {
31
36
  this.be = data.be;
32
37
  }
38
+ if (data?.locale) {
39
+ this.locale = data.locale;
40
+ }
33
41
  if (data?.ns) {
34
42
  this.ns = data.ns;
35
43
  }
@@ -0,0 +1,93 @@
1
+ export type ContextConstructor<Instance extends object = object> = abstract new (...args: never[]) => Instance;
2
+ export type ContextMemberKind = 'field' | 'method';
3
+ export type ContextMemberPolicy = 'unique' | 'replace' | 'final' | 'series' | 'reduce';
4
+ export type ContextHookOrder = 'forward' | 'reverse';
5
+ export type ContextHookPhase = 'before' | 'after';
6
+ export type ContextMemberDeclaration = {
7
+ kind: ContextMemberKind;
8
+ policy?: ContextMemberPolicy;
9
+ };
10
+ export type ContextSeriesHook<Context extends object> = {
11
+ handler: (this: Context, ...args: never[]) => unknown;
12
+ order?: ContextHookOrder;
13
+ phase?: ContextHookPhase;
14
+ };
15
+ export type ContextReducer<Context extends object> = {
16
+ handler: (this: Context, value: never, ...args: never[]) => unknown;
17
+ order?: ContextHookOrder;
18
+ };
19
+ type RuntimeHandler = (this: object, ...args: never[]) => unknown;
20
+ type RuntimeReducer = (this: object, value: never, ...args: never[]) => unknown;
21
+ type RuntimeContextLayer = {
22
+ apply?: (Base: ContextConstructor) => ContextConstructor;
23
+ base?: ContextConstructor;
24
+ hooks?: Record<string, {
25
+ handler: RuntimeHandler;
26
+ order?: ContextHookOrder;
27
+ phase?: ContextHookPhase;
28
+ }>;
29
+ members?: Record<string, ContextMemberDeclaration>;
30
+ reducers?: Record<string, {
31
+ handler: RuntimeReducer;
32
+ order?: ContextHookOrder;
33
+ }>;
34
+ };
35
+ declare const contextLayerRequires: unique symbol;
36
+ declare const contextLayerProvides: unique symbol;
37
+ declare const contextModuleContract: unique symbol;
38
+ export type ContextLayer<Requires extends object, Provides extends object> = RuntimeContextLayer & {
39
+ readonly [contextLayerRequires]?: Requires;
40
+ readonly [contextLayerProvides]?: Provides;
41
+ };
42
+ export type ContextLayerDefinition<Requires extends object, Provides extends object> = {
43
+ apply?: (Base: ContextConstructor<Requires>) => ContextConstructor<Requires & Provides>;
44
+ base?: ContextConstructor<Requires & Provides>;
45
+ hooks?: Record<string, ContextSeriesHook<Requires & Provides>>;
46
+ members?: Record<string, ContextMemberDeclaration>;
47
+ reducers?: Record<string, ContextReducer<Requires & Provides>>;
48
+ };
49
+ export declare function defineContextLayer<Requires extends object, Provides extends object = object>(definition: ContextLayerDefinition<Requires, Provides>): ContextLayer<Requires, Provides>;
50
+ export type ContextModule<Contract extends object = object> = {
51
+ dependencies?: readonly ContextModule[];
52
+ id: string;
53
+ layer?: RuntimeContextLayer;
54
+ version: string;
55
+ readonly [contextModuleContract]?: Contract;
56
+ };
57
+ export type ContextModuleDefinition<Contract extends object> = {
58
+ dependencies?: readonly ContextModule[];
59
+ id: string;
60
+ layer?: RuntimeContextLayer;
61
+ version: string;
62
+ };
63
+ export declare function defineContextModule<Contract extends object = object>(definition: ContextModuleDefinition<Contract>): ContextModule<Contract>;
64
+ type CompatibleMember<Left, Right> = [Left] extends [Right] ? true : [Right] extends [Left] ? true : false;
65
+ export type ContextConflictKeys<Left extends object, Right extends object> = {
66
+ [Key in keyof Left & keyof Right]: CompatibleMember<Left[Key], Right[Key]> extends true ? never : Key;
67
+ }[keyof Left & keyof Right];
68
+ export type MergeContextContract<Left extends object, Right extends object> = Left & Right;
69
+ export type MergeContextContracts<Contracts extends readonly object[], Accumulator extends object = object> = Contracts extends readonly [
70
+ infer Head extends object,
71
+ ...infer Tail extends readonly object[]
72
+ ] ? MergeContextContracts<Tail, MergeContextContract<Accumulator, Head>> : Accumulator;
73
+ export type ContextCompositionScope = 'backend' | 'frontend' | string;
74
+ export declare class OakContextCompositionException extends Error {
75
+ readonly leftModule: string;
76
+ readonly rightModule: string;
77
+ readonly scope: ContextCompositionScope;
78
+ constructor(scope: ContextCompositionScope, leftModule: string, rightModule: string, detail: string);
79
+ }
80
+ export type ContextCompositionOptions = {
81
+ scope?: ContextCompositionScope;
82
+ };
83
+ export declare const CONTEXT_COMPOSITION: unique symbol;
84
+ export type ContextCompositionInfo = {
85
+ modules: readonly {
86
+ id: string;
87
+ version: string;
88
+ }[];
89
+ scope: ContextCompositionScope;
90
+ };
91
+ export declare function composeContextModules<Base extends ContextConstructor, Roots extends readonly ContextModule[]>(BaseContext: Base, roots: Roots, options?: ContextCompositionOptions): Base;
92
+ export declare function getContextComposition(ContextClass: ContextConstructor): ContextCompositionInfo | undefined;
93
+ export {};