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,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const assert_1 = tslib_1.__importDefault(require("assert"));
4
+ const assert_1 = require("../utils/assert");
5
5
  const ts = tslib_1.__importStar(require("typescript"));
6
6
  const { factory } = ts;
7
7
  const path_1 = require("path");
@@ -82,20 +82,6 @@ function collectOakPackages(nodeModulesPath) {
82
82
  oakPackageCache.set(normalizedNodeModulesPath, packages);
83
83
  return packages;
84
84
  }
85
- /**
86
- * 将一个object展开编译为一棵语法树,只有string和object两种键值对象
87
- * @param data
88
- */
89
- function transferObjectToObjectLiteral(data) {
90
- return factory.createObjectLiteralExpression(Object.keys(data).map((k) => {
91
- const type = typeof data[k];
92
- if (type === 'string') {
93
- return factory.createPropertyAssignment(factory.createStringLiteral(k), factory.createStringLiteral(data[k]));
94
- }
95
- (0, assert_1.default)(type === 'object');
96
- return factory.createPropertyAssignment(factory.createStringLiteral(k), transferObjectToObjectLiteral(data[k]));
97
- }), true);
98
- }
99
85
  /**
100
86
  * 这个类的作用是把项目和所有相关的模块下的locales编译成为src/data/i18n中的数据
101
87
  */
@@ -107,21 +93,17 @@ class LocaleBuilder {
107
93
  locales; // key: namespace+language, value: [namespace, module, position, language, data]
108
94
  hash;
109
95
  projectName;
110
- constructor(asLib) {
96
+ localeWorkspaces;
97
+ constructor(asLib, localeWorkspaces) {
111
98
  const pwd = process.cwd();
112
99
  this.pwd = pwd;
113
100
  this.asLib = !!asLib;
114
- const dependencyConfigureFile = (0, path_1.join)(pwd, 'src', 'configuration', 'dependency.ts');
115
- if (fs_1.default.existsSync(dependencyConfigureFile)) {
116
- const depGraph = (0, dependencyBuilder_1.analyzeDepedency)(pwd);
117
- this.dependencies = depGraph.ascOrder;
118
- }
119
- else {
120
- this.dependencies = [];
121
- }
101
+ const depGraph = (0, dependencyBuilder_1.analyzeDepedency)(pwd);
102
+ this.dependencies = depGraph.ascOrder;
122
103
  this.oakPackages = collectOakPackages((0, path_1.join)(pwd, 'node_modules'));
123
104
  this.locales = {};
124
105
  this.hash = (0, crypto_1.createHash)('md5');
106
+ this.localeWorkspaces = localeWorkspaces;
125
107
  }
126
108
  /**
127
109
  * 将locales输出成为data/i18n.ts中的数据
@@ -129,28 +111,34 @@ class LocaleBuilder {
129
111
  */
130
112
  outputDataFile() {
131
113
  const appDomainDir = this.projectName === 'oak-domain' ? 'base-app-domain' : 'oak-app-domain';
114
+ const rows = Object.keys(this.locales).map((k) => {
115
+ const [namespace, module, position, language, data] = this.locales[k];
116
+ // 用哈希计算来保证id唯一性
117
+ const h = this.hash.copy();
118
+ h.update(`${namespace}-${language}`);
119
+ const id = h.digest('hex');
120
+ (0, assert_1.assert)(id.length <= 36);
121
+ return {
122
+ id,
123
+ namespace,
124
+ language,
125
+ module,
126
+ position,
127
+ data,
128
+ };
129
+ });
132
130
  const statements = [
133
- factory.createImportDeclaration(undefined, factory.createImportClause(false, undefined, factory.createNamedImports([
131
+ factory.createImportDeclaration(undefined, factory.createImportClause(true, undefined, factory.createNamedImports([
134
132
  factory.createImportSpecifier(false, factory.createIdentifier('CreateOperationData'), factory.createIdentifier('I18n')),
135
133
  ])), factory.createStringLiteral(`../${appDomainDir}/I18n/Schema`), undefined),
134
+ factory.createVariableStatement([factory.createModifier(ts.SyntaxKind.DeclareKeyword)], factory.createVariableDeclarationList([
135
+ factory.createVariableDeclaration(factory.createIdentifier('require'), undefined, factory.createFunctionTypeNode(undefined, [
136
+ factory.createParameterDeclaration(undefined, undefined, factory.createIdentifier('path'), undefined, factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), undefined),
137
+ ], factory.createKeywordTypeNode(ts.SyntaxKind.UnknownKeyword)), undefined),
138
+ ], ts.NodeFlags.Const)),
136
139
  ];
137
140
  statements.push(factory.createVariableStatement(undefined, factory.createVariableDeclarationList([
138
- factory.createVariableDeclaration(factory.createIdentifier('i18ns'), undefined, factory.createArrayTypeNode(factory.createTypeReferenceNode(factory.createIdentifier('I18n'), undefined)), factory.createArrayLiteralExpression(Object.keys(this.locales).map((k) => {
139
- const [namespace, module, position, language, data] = this.locales[k];
140
- // 用哈希计算来保证id唯一性
141
- const h = this.hash.copy();
142
- h.update(`${namespace}-${language}`);
143
- const id = h.digest('hex');
144
- (0, assert_1.default)(id.length <= 36);
145
- return factory.createObjectLiteralExpression([
146
- factory.createPropertyAssignment(factory.createIdentifier('id'), factory.createStringLiteral(id)),
147
- factory.createPropertyAssignment(factory.createIdentifier('namespace'), factory.createStringLiteral(namespace)),
148
- factory.createPropertyAssignment(factory.createIdentifier('language'), factory.createStringLiteral(language)),
149
- factory.createPropertyAssignment(factory.createIdentifier('module'), factory.createStringLiteral(module)),
150
- factory.createPropertyAssignment(factory.createIdentifier('position'), factory.createStringLiteral(position)),
151
- factory.createPropertyAssignment(factory.createIdentifier('data'), transferObjectToObjectLiteral(data)),
152
- ], true);
153
- }), true)),
141
+ factory.createVariableDeclaration(factory.createIdentifier('i18ns'), undefined, undefined, factory.createAsExpression(factory.createCallExpression(factory.createIdentifier('require'), undefined, [factory.createStringLiteral('./i18n.json')]), factory.createArrayTypeNode(factory.createTypeReferenceNode(factory.createIdentifier('I18n'), undefined)))),
154
142
  ], ts.NodeFlags.Const)));
155
143
  statements.push(factory.createExportAssignment(undefined, undefined, factory.createIdentifier('i18ns')));
156
144
  const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed });
@@ -160,15 +148,18 @@ class LocaleBuilder {
160
148
  fs_1.default.mkdirSync(dataDir);
161
149
  }
162
150
  const filename = (0, path_1.join)(dataDir, 'i18n.ts');
151
+ const jsonFilename = (0, path_1.join)(dataDir, 'i18n.json');
163
152
  const result2 = (0, string_1.unescapeUnicode)(`// 本文件为自动编译产生,请勿直接修改\n\n${result}`);
153
+ const jsonResult = (0, string_1.unescapeUnicode)(`${JSON.stringify(rows, null, 4)}\n`);
164
154
  fs_1.default.writeFileSync(filename, result2, { flag: 'w' });
155
+ fs_1.default.writeFileSync(jsonFilename, jsonResult, { flag: 'w' });
165
156
  }
166
157
  /**
167
158
  * 这里不能直接用require, webpack貌似有缓存
168
159
  * @param filepath
169
160
  */
170
161
  readLocaleFileContent(filepath) {
171
- (0, assert_1.default)(filepath.endsWith('.json'));
162
+ (0, assert_1.assert)(filepath.endsWith('.json'));
172
163
  const content = fs_1.default.readFileSync(filepath, {
173
164
  encoding: 'utf-8',
174
165
  });
@@ -248,23 +239,28 @@ class LocaleBuilder {
248
239
  if (fs_1.default.existsSync(domainPath)) {
249
240
  this.traverse('', '', 'oak-app-domain', domainPath, false, 'locales', watch);
250
241
  }
251
- // 还有web和wechatMp的目录
252
- const webSrcPath = (0, path_1.join)('web', 'src');
253
- this.traverse(name, 'w', webSrcPath, (0, path_1.join)(root, webSrcPath), false, 'locales', watch);
254
- // 小程序可能有多于一个,按规范用wechatMp, wechatMp2这样命名
255
- const wechatMpSrcPath = (0, path_1.join)('wechatMp', 'src');
256
- this.traverse(name, 'wmp', wechatMpSrcPath, (0, path_1.join)(root, webSrcPath), false, 'locales', watch);
257
- let iter = 1;
258
- while (true) {
259
- const mpSrcPath = `${wechatMpSrcPath}${iter}`;
260
- if (fs_1.default.existsSync((0, path_1.join)(root, mpSrcPath))) {
261
- this.traverse(name, `wmp${iter}`, mpSrcPath, (0, path_1.join)(root, mpSrcPath), false, 'locales', watch);
242
+ const localeWorkspaces = this.localeWorkspaces || (() => {
243
+ const legacyWorkspaces = [
244
+ { namespacePrefix: 'w', relativePath: 'web' },
245
+ { namespacePrefix: 'wmp', relativePath: 'wechatMp' },
246
+ ];
247
+ let iter = 1;
248
+ while (fs_1.default.existsSync((0, path_1.join)(root, `wechatMp${iter}`, 'src'))) {
249
+ legacyWorkspaces.push({
250
+ namespacePrefix: `wmp${iter}`,
251
+ relativePath: `wechatMp${iter}`,
252
+ });
262
253
  iter++;
263
254
  }
264
- else {
265
- break;
255
+ return legacyWorkspaces;
256
+ })();
257
+ localeWorkspaces.forEach(({ namespacePrefix, relativePath }) => {
258
+ const workspaceSrcPath = (0, path_1.join)(relativePath, 'src');
259
+ const workspaceSrcAbsolutePath = (0, path_1.join)(root, workspaceSrcPath);
260
+ if (fs_1.default.existsSync(workspaceSrcAbsolutePath)) {
261
+ this.traverse(name, namespacePrefix, workspaceSrcPath, workspaceSrcAbsolutePath, false, 'locales', watch);
266
262
  }
267
- }
263
+ });
268
264
  }
269
265
  }
270
266
  build(watch) {
@@ -1,8 +1,37 @@
1
- declare function closeCurrentWatchSession(): void;
2
- export declare function buildRouter(projectDir: string, startupDir: string, watch?: boolean, options?: {
1
+ type PageConfig = {
2
+ enablePullDownRefresh?: boolean;
3
+ route?: {
4
+ path?: string;
5
+ /** Web document title literal. */
6
+ title?: string;
7
+ /** Web document title i18n key. Defaults to the page locale pageTitle key. */
8
+ titleI18nKey?: string;
9
+ /** Web route pull-down refresh behavior. Falls back to top-level enablePullDownRefresh. */
10
+ enablePullDownRefresh?: boolean;
11
+ access?: unknown;
12
+ };
13
+ menu?: unknown;
14
+ mp?: {
15
+ /** Mini-program page pull-down refresh behavior; not used by web router generation. */
16
+ enablePullDownRefresh?: boolean;
17
+ };
18
+ };
19
+ type NamespaceConfig = {
20
+ route?: {
21
+ path?: string;
22
+ notFound?: string;
23
+ first?: string;
24
+ params?: Record<string, string>;
25
+ };
26
+ };
27
+ type BuildRouterOptions = {
3
28
  useOutlet?: boolean;
4
29
  onWarning?: (message: string) => void;
5
- }): {
30
+ getPageConfig?: (pageDirectoryPath: string) => PageConfig | undefined;
31
+ getNamespaceConfig?: (namespaceDirectoryPath: string, namespace: string) => NamespaceConfig | undefined;
32
+ };
33
+ declare function closeCurrentWatchSession(): void;
34
+ export declare function buildRouter(projectDir: string, startupDir: string, watch?: boolean, options?: BuildRouterOptions): {
6
35
  close: typeof closeCurrentWatchSession;
7
36
  } | undefined;
8
37
  export {};
@@ -4,15 +4,29 @@ exports.buildRouter = buildRouter;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = require("path");
6
6
  const fs_extra_1 = require("fs-extra");
7
- const assert_1 = tslib_1.__importDefault(require("assert"));
7
+ const assert_1 = require("../utils/assert");
8
8
  const ts = tslib_1.__importStar(require("typescript"));
9
9
  const node_watch_1 = tslib_1.__importDefault(require("node-watch"));
10
10
  const env_1 = require("./env");
11
11
  const { factory } = ts;
12
12
  const NameSpaceDescDict = {};
13
- const PAGE_RENDER_FILES = ['web.tsx', 'web.pc.tsx', 'render.native.tsx', 'render.ios.tsx', 'render.android.tsx', 'index.xml'];
14
- const PAGE_WATCH_FILTER = /(?:^|[\\/])(?:web\.tsx|web\.pc\.tsx|index\.json|index\.xml|render\.(?:native|ios|android)\.tsx)$/;
15
- const NAMESPACE_WATCH_FILTER = /(?:^|[\\/])index\.json$/;
13
+ const WEB_PAGE_RENDER_FILES = ['web.tsx', 'web.pc.tsx', 'web.mobile.tsx'];
14
+ const DESKTOP_PAGE_RENDER_FILES = [
15
+ 'render.desktop.tsx',
16
+ 'render.windows.tsx',
17
+ 'render.macos.tsx',
18
+ 'render.linux.tsx',
19
+ ];
20
+ const PAGE_RENDER_FILES = [
21
+ ...WEB_PAGE_RENDER_FILES,
22
+ ...DESKTOP_PAGE_RENDER_FILES,
23
+ 'render.native.tsx',
24
+ 'render.ios.tsx',
25
+ 'render.android.tsx',
26
+ 'index.xml',
27
+ ];
28
+ const PAGE_WATCH_FILTER = /(?:^|[\\/])(?:web\.tsx|web\.pc\.tsx|web\.mobile\.tsx|index\.json|index\.config\.(?:ts|mts|cts|js|mjs|cjs)|index\.xml|render\.(?:desktop|windows|macos|linux|native|ios|android)\.tsx)$/;
29
+ const NAMESPACE_WATCH_FILTER = /(?:^|[\\/])(?:index\.json|index\.config\.(?:ts|mts|cts|js|mjs|cjs))$/;
16
30
  const VALID_PAGE_DIR_NAME = /^[A-Za-z0-9_-]+$/;
17
31
  function normalizePath(path) {
18
32
  return path.replace(/\\/g, '/');
@@ -31,6 +45,13 @@ function normalizeRoutePath(path) {
31
45
  function isValidPageDirName(name) {
32
46
  return VALID_PAGE_DIR_NAME.test(name);
33
47
  }
48
+ function isDesktopRenderProfile() {
49
+ return process.env.OAK_RENDER === 'tauri'
50
+ || process.env.OAK_RENDER === 'electron';
51
+ }
52
+ function isWebStartupDir(startupDir) {
53
+ return startupDir.startsWith('web') || isDesktopRenderProfile();
54
+ }
34
55
  function getInvalidPageDirPath(relativePath) {
35
56
  const segments = normalizeRelativePath(relativePath).split('/').filter(Boolean);
36
57
  const validSegments = [];
@@ -44,16 +65,28 @@ function getInvalidPageDirPath(relativePath) {
44
65
  function readJsonFresh(filename) {
45
66
  return JSON.parse((0, fs_extra_1.readFileSync)(filename, 'utf-8'));
46
67
  }
68
+ function getProjectPackageName(projectDir) {
69
+ const packageJson = readJsonFresh((0, path_1.join)(projectDir, 'package.json'));
70
+ (0, assert_1.assert)(typeof packageJson.name === 'string' && packageJson.name, `${projectDir}下的package.json缺少name字段`);
71
+ return packageJson.name;
72
+ }
73
+ function createPageTitleI18nKey(packageName, namespaceKey, fullPath) {
74
+ const pagePath = normalizeRoutePath(fullPath).replace(/\//g, '-');
75
+ return `${packageName}-p-${namespaceKey}-${pagePath}.pageTitle`;
76
+ }
47
77
  function hasPageDescChanged(prev, next) {
48
78
  if (!prev || !next) {
49
79
  return prev !== next;
50
80
  }
51
81
  return prev.path !== next.path
52
82
  || prev.routePath !== next.routePath
83
+ || prev.routeTitle !== next.routeTitle
84
+ || prev.routeTitleI18nKey !== next.routeTitleI18nKey
53
85
  || prev.oakDisablePulldownRefresh !== next.oakDisablePulldownRefresh
54
86
  || prev.hasWeb !== next.hasWeb
55
87
  || prev.hasNative !== next.hasNative
56
- || prev.hasWechatMp !== next.hasWechatMp;
88
+ || prev.hasWechatMp !== next.hasWechatMp
89
+ || JSON.stringify(prev.access) !== JSON.stringify(next.access);
57
90
  }
58
91
  function getNamespaceFromFilepath(rootDir, filepath) {
59
92
  const normalizedRelativePath = normalizeRelativePath((0, path_1.relative)(rootDir, filepath));
@@ -91,7 +124,9 @@ function checkPageDir(dir, relativePath, ns, type) {
91
124
  if (['render.native.tsx', 'render.ios.tsx', 'render.android.tsx'].includes(file)) {
92
125
  hasNative = true;
93
126
  }
94
- else if (['web.tsx', 'web.pc.tsx'].includes(file)) {
127
+ else if (WEB_PAGE_RENDER_FILES.includes(file)
128
+ || (isDesktopRenderProfile()
129
+ && DESKTOP_PAGE_RENDER_FILES.includes(file))) {
95
130
  hasWeb = true;
96
131
  }
97
132
  else if (file === 'index.xml') {
@@ -112,20 +147,37 @@ function checkPageDir(dir, relativePath, ns, type) {
112
147
  const indexJsonFile = (0, path_1.join)(dir, 'index.json');
113
148
  let oakDisablePulldownRefresh = false;
114
149
  let routePath;
150
+ let routeTitle;
151
+ let routeTitleI18nKey;
152
+ let access;
153
+ let indexJson = {};
115
154
  if ((0, fs_extra_1.existsSync)(indexJsonFile)) {
116
- const { enablePullDownRefresh = true, path: routePath2, } = readJsonFresh(indexJsonFile);
117
- oakDisablePulldownRefresh = !enablePullDownRefresh;
118
- if (typeof routePath2 === 'string') {
119
- routePath = normalizeRoutePath(routePath2);
120
- }
155
+ indexJson = readJsonFresh(indexJsonFile);
156
+ }
157
+ const pageConfig = BuildRouterContext.options?.getPageConfig?.(dir);
158
+ const enablePullDownRefresh = pageConfig?.route?.enablePullDownRefresh ?? pageConfig?.enablePullDownRefresh ?? indexJson.enablePullDownRefresh ?? true;
159
+ const routePath2 = pageConfig?.route?.path ?? indexJson.path;
160
+ oakDisablePulldownRefresh = !enablePullDownRefresh;
161
+ if (typeof routePath2 === 'string') {
162
+ routePath = normalizeRoutePath(routePath2);
163
+ }
164
+ if (typeof pageConfig?.route?.title === 'string') {
165
+ routeTitle = pageConfig.route.title;
166
+ }
167
+ if (typeof pageConfig?.route?.titleI18nKey === 'string') {
168
+ routeTitleI18nKey = pageConfig.route.titleI18nKey;
121
169
  }
170
+ access = pageConfig?.route?.access;
122
171
  nextPageDesc = {
123
172
  path: normalizeRelativePath(relativePath),
124
173
  routePath,
174
+ routeTitle,
175
+ routeTitleI18nKey,
125
176
  oakDisablePulldownRefresh,
126
177
  hasNative,
127
178
  hasWeb,
128
179
  hasWechatMp,
180
+ access,
129
181
  };
130
182
  }
131
183
  if (hasPageDescChanged(pages[dir], nextPageDesc)) {
@@ -205,6 +257,44 @@ function createLazyImportExpression(importPath) {
205
257
  factory.createStringLiteral(importPath)
206
258
  ]))]);
207
259
  }
260
+ function createLiteralExpressionFromValue(value) {
261
+ if (value === null) {
262
+ return factory.createNull();
263
+ }
264
+ if (typeof value === 'string') {
265
+ return factory.createStringLiteral(value);
266
+ }
267
+ if (typeof value === 'number') {
268
+ return factory.createNumericLiteral(value);
269
+ }
270
+ if (typeof value === 'boolean') {
271
+ return value ? factory.createTrue() : factory.createFalse();
272
+ }
273
+ if (Array.isArray(value)) {
274
+ return factory.createArrayLiteralExpression(value.map((item) => createLiteralExpressionFromValue(item)));
275
+ }
276
+ if (value && typeof value === 'object') {
277
+ return factory.createObjectLiteralExpression(Object.entries(value)
278
+ .filter(([, currentValue]) => currentValue !== undefined)
279
+ .map(([key, currentValue]) => factory.createPropertyAssignment(/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key)
280
+ ? factory.createIdentifier(key)
281
+ : factory.createStringLiteral(key), createLiteralExpressionFromValue(currentValue))), true);
282
+ }
283
+ return factory.createIdentifier('undefined');
284
+ }
285
+ function createWebRouteMetaExpression(page, titleI18nKey) {
286
+ const properties = [
287
+ factory.createPropertyAssignment('oakDisablePulldownRefresh', page.oakDisablePulldownRefresh ? factory.createTrue() : factory.createFalse())
288
+ ];
289
+ if (page.routeTitle !== undefined) {
290
+ properties.push(factory.createPropertyAssignment('title', factory.createStringLiteral(page.routeTitle)));
291
+ }
292
+ properties.push(factory.createPropertyAssignment('titleI18nKey', factory.createStringLiteral(page.routeTitleI18nKey || titleI18nKey)));
293
+ if (page.access !== undefined) {
294
+ properties.push(factory.createPropertyAssignment('access', createLiteralExpressionFromValue(page.access)));
295
+ }
296
+ return factory.createObjectLiteralExpression(properties, true);
297
+ }
208
298
  function appendRouteParam(path, paramName) {
209
299
  if (!paramName) {
210
300
  return path;
@@ -342,15 +432,13 @@ function getValidWebRouteChildren(parentNode, ns, params) {
342
432
  });
343
433
  return candidates.filter((candidate) => !ignoredNodePaths.has(candidate.node.fullPath)).map((candidate) => candidate.node);
344
434
  }
345
- function createWebPageRouteExpression(ns, page, projectDir, routerFileDir, path, fullPath, options) {
435
+ function createWebPageRouteExpression(ns, namespacePath, packageName, page, projectDir, routerFileDir, path, fullPath, options) {
346
436
  const properties = [];
347
437
  properties.push(factory.createPropertyAssignment('path', factory.createStringLiteral(options?.isFirst ? '' : path)), factory.createPropertyAssignment('fullPath', factory.createStringLiteral(fullPath)));
348
438
  if (options?.isFirst) {
349
439
  properties.push(factory.createPropertyAssignment('isFirst', factory.createTrue()));
350
440
  }
351
- properties.push(factory.createPropertyAssignment('namespace', factory.createStringLiteral(ns)), factory.createPropertyAssignment('meta', factory.createObjectLiteralExpression([
352
- factory.createPropertyAssignment('oakDisablePulldownRefresh', page.oakDisablePulldownRefresh ? factory.createTrue() : factory.createFalse())
353
- ])), factory.createPropertyAssignment(factory.createIdentifier('Component'), createLazyImportExpression(normalizePath((0, path_1.relative)(routerFileDir, (0, path_1.join)(projectDir, 'src', 'pages', ns, page.path))))));
441
+ properties.push(factory.createPropertyAssignment('namespace', factory.createStringLiteral(ns)), factory.createPropertyAssignment('namespaceKey', factory.createStringLiteral(ns)), factory.createPropertyAssignment('namespacePath', factory.createStringLiteral(namespacePath)), factory.createPropertyAssignment('meta', createWebRouteMetaExpression(page, createPageTitleI18nKey(packageName, ns, fullPath))), factory.createPropertyAssignment(factory.createIdentifier('Component'), createLazyImportExpression(normalizePath((0, path_1.relative)(routerFileDir, (0, path_1.join)(projectDir, 'src', 'pages', ns, page.path))))));
354
442
  if (options?.children?.length) {
355
443
  properties.push(factory.createPropertyAssignment('children', factory.createArrayLiteralExpression(options.children)));
356
444
  }
@@ -362,22 +450,22 @@ function createWebGroupRouteExpression(path, children) {
362
450
  factory.createPropertyAssignment('children', factory.createArrayLiteralExpression(children))
363
451
  ], true);
364
452
  }
365
- function makeWebRoutesFromTreeNode(node, ns, params, projectDir, routerFileDir, useOutlet) {
366
- const children = getValidWebRouteChildren(node, ns, params).map((child) => makeWebRoutesFromTreeNode(child, ns, params, projectDir, routerFileDir, useOutlet));
453
+ function makeWebRoutesFromTreeNode(node, ns, namespacePath, packageName, params, projectDir, routerFileDir, useOutlet) {
454
+ const children = getValidWebRouteChildren(node, ns, params).map((child) => makeWebRoutesFromTreeNode(child, ns, namespacePath, packageName, params, projectDir, routerFileDir, useOutlet));
367
455
  const groupPath = getGroupRoutePath(node, params);
368
456
  if (node.page) {
369
457
  const path = getPageRoutePath(node, node.page, params);
370
458
  const fullPath = node.page.path;
371
459
  if (children.length === 0) {
372
- return createWebPageRouteExpression(ns, node.page, projectDir, routerFileDir, path, fullPath);
460
+ return createWebPageRouteExpression(ns, namespacePath, packageName, node.page, projectDir, routerFileDir, path, fullPath);
373
461
  }
374
462
  if (useOutlet) {
375
- return createWebPageRouteExpression(ns, node.page, projectDir, routerFileDir, path, fullPath, {
463
+ return createWebPageRouteExpression(ns, namespacePath, packageName, node.page, projectDir, routerFileDir, path, fullPath, {
376
464
  children,
377
465
  });
378
466
  }
379
467
  return createWebGroupRouteExpression(path, [
380
- createWebPageRouteExpression(ns, node.page, projectDir, routerFileDir, path, fullPath, {
468
+ createWebPageRouteExpression(ns, namespacePath, packageName, node.page, projectDir, routerFileDir, path, fullPath, {
381
469
  isFirst: true,
382
470
  }),
383
471
  ...children,
@@ -386,7 +474,11 @@ function makeWebRoutesFromTreeNode(node, ns, params, projectDir, routerFileDir,
386
474
  return createWebGroupRouteExpression(groupPath, children);
387
475
  }
388
476
  function makeWebAllRouters(namespaceDir, projectDir, routerFileDir, options) {
477
+ const packageName = getProjectPackageName(projectDir);
389
478
  const nss = (0, fs_extra_1.readdirSync)(namespaceDir).filter((ns) => {
479
+ if (!(0, fs_extra_1.statSync)((0, path_1.join)(namespaceDir, ns)).isDirectory()) {
480
+ return false;
481
+ }
390
482
  if (isValidPageDirName(ns)) {
391
483
  return true;
392
484
  }
@@ -394,69 +486,89 @@ function makeWebAllRouters(namespaceDir, projectDir, routerFileDir, options) {
394
486
  return false;
395
487
  });
396
488
  return factory.createArrayLiteralExpression(nss.map((ns) => {
397
- (0, assert_1.default)(NameSpaceDescDict[ns], `${ns}在pages下没有对应的目录`);
489
+ (0, assert_1.assert)(NameSpaceDescDict[ns], `${ns}在pages下没有对应的目录`);
398
490
  const { pages } = NameSpaceDescDict[ns];
399
- const nsIndexJsonFile = (0, path_1.join)(namespaceDir, ns, 'index.json');
491
+ const nsDirectory = (0, path_1.join)(namespaceDir, ns);
492
+ const nsIndexJsonFile = (0, path_1.join)(nsDirectory, 'index.json');
400
493
  let path2 = `/${ns}`;
401
494
  let notFound2 = '', first2 = '';
402
495
  let params2 = {};
496
+ let namespaceIndexJson = {};
403
497
  if ((0, fs_extra_1.existsSync)(nsIndexJsonFile)) {
404
- const { path, notFound, first, params } = readJsonFresh(nsIndexJsonFile);
405
- if (path) {
406
- path2 = normalizePath(path);
407
- }
408
- if (notFound) {
409
- notFound2 = normalizePath(notFound);
410
- }
411
- if (first) {
412
- first2 = normalizePath(first);
413
- if (first2.startsWith('/')) {
414
- first2 = first2.slice(1);
415
- }
416
- }
417
- if (params) {
418
- params2 = params;
498
+ namespaceIndexJson = readJsonFresh(nsIndexJsonFile);
499
+ }
500
+ const namespaceRouteConfig = BuildRouterContext.options?.getNamespaceConfig?.(nsDirectory, ns)?.route;
501
+ const namespacePath = namespaceRouteConfig?.path ?? namespaceIndexJson.path;
502
+ const notFound = namespaceRouteConfig?.notFound ?? namespaceIndexJson.notFound;
503
+ const first = namespaceRouteConfig?.first ?? namespaceIndexJson.first;
504
+ const params = namespaceRouteConfig?.params ?? namespaceIndexJson.params;
505
+ if (typeof namespacePath === 'string' && namespacePath) {
506
+ path2 = normalizePath(namespacePath);
507
+ }
508
+ if (typeof notFound === 'string' && notFound) {
509
+ notFound2 = normalizePath(notFound);
510
+ }
511
+ if (typeof first === 'string' && first) {
512
+ first2 = normalizePath(first);
513
+ if (first2.startsWith('/')) {
514
+ first2 = first2.slice(1);
419
515
  }
420
516
  }
517
+ if (params) {
518
+ params2 = params;
519
+ }
421
520
  const routeTree = buildWebRouteTree(pages);
422
- const pageChildren = getValidWebRouteChildren(routeTree, ns, params2).map((child) => makeWebRoutesFromTreeNode(child, ns, params2, projectDir, routerFileDir, options?.useOutlet));
521
+ const pageChildren = getValidWebRouteChildren(routeTree, ns, params2).map((child) => makeWebRoutesFromTreeNode(child, ns, path2, packageName, params2, projectDir, routerFileDir, options?.useOutlet));
423
522
  const children = [...pageChildren];
424
523
  if (routeTree.page) {
425
524
  const rootPagePath = getPageRoutePath(routeTree, routeTree.page, params2);
426
525
  const rootFullPath = routeTree.page.path;
427
526
  if (options?.useOutlet && pageChildren.length > 0) {
428
527
  children.length = 0;
429
- children.push(createWebPageRouteExpression(ns, routeTree.page, projectDir, routerFileDir, rootPagePath, rootFullPath, {
528
+ children.push(createWebPageRouteExpression(ns, path2, packageName, routeTree.page, projectDir, routerFileDir, rootPagePath, rootFullPath, {
430
529
  children: pageChildren,
431
530
  }));
432
531
  }
433
532
  else if (!rootPagePath) {
434
- children.unshift(createWebPageRouteExpression(ns, routeTree.page, projectDir, routerFileDir, rootPagePath, rootFullPath, {
533
+ children.unshift(createWebPageRouteExpression(ns, path2, packageName, routeTree.page, projectDir, routerFileDir, rootPagePath, rootFullPath, {
435
534
  isFirst: true,
436
535
  }));
437
536
  }
438
537
  else {
439
- children.unshift(createWebPageRouteExpression(ns, routeTree.page, projectDir, routerFileDir, rootPagePath, rootFullPath));
538
+ children.unshift(createWebPageRouteExpression(ns, path2, packageName, routeTree.page, projectDir, routerFileDir, rootPagePath, rootFullPath));
440
539
  }
441
540
  }
442
541
  const firstPage = Object.values(pages).find((page) => page.hasWeb && page.path === first2);
443
542
  if (firstPage) {
444
- children.push(createWebPageRouteExpression(ns, firstPage, projectDir, routerFileDir, '', firstPage.path, {
543
+ children.push(createWebPageRouteExpression(ns, path2, packageName, firstPage, projectDir, routerFileDir, '', firstPage.path, {
445
544
  isFirst: true,
446
545
  }));
447
546
  }
448
547
  if (notFound2) {
548
+ const notFoundPage = pages[notFound2];
549
+ const notFoundMetaPage = notFoundPage || {
550
+ path: notFound2,
551
+ oakDisablePulldownRefresh: false,
552
+ hasWeb: true,
553
+ hasNative: false,
554
+ hasWechatMp: false,
555
+ };
449
556
  children.push(factory.createObjectLiteralExpression([
450
557
  factory.createPropertyAssignment('path', factory.createStringLiteral('*')),
451
558
  factory.createPropertyAssignment('namespace', factory.createStringLiteral(ns)),
559
+ factory.createPropertyAssignment('namespaceKey', factory.createStringLiteral(ns)),
560
+ factory.createPropertyAssignment('namespacePath', factory.createStringLiteral(path2)),
452
561
  factory.createPropertyAssignment('fullPath', factory.createStringLiteral(notFound2)),
562
+ factory.createPropertyAssignment('meta', createWebRouteMetaExpression(notFoundMetaPage, createPageTitleI18nKey(packageName, ns, notFound2))),
453
563
  factory.createPropertyAssignment(factory.createIdentifier("Component"), createLazyImportExpression(normalizePath((0, path_1.relative)(routerFileDir, (0, path_1.join)(projectDir, 'src', 'pages', ns, notFound2)))))
454
564
  ], true));
455
565
  }
456
566
  return factory.createObjectLiteralExpression([
457
567
  factory.createPropertyAssignment('path', factory.createStringLiteral(path2)),
458
568
  factory.createPropertyAssignment('namespace', factory.createStringLiteral(path2)),
459
- factory.createPropertyAssignment(factory.createIdentifier("Component"), createLazyImportExpression(normalizePath((0, path_1.relative)(routerFileDir, (0, path_1.join)(namespaceDir, ns))))),
569
+ factory.createPropertyAssignment('namespaceKey', factory.createStringLiteral(ns)),
570
+ factory.createPropertyAssignment('namespacePath', factory.createStringLiteral(path2)),
571
+ factory.createPropertyAssignment(factory.createIdentifier("Component"), createLazyImportExpression(normalizePath((0, path_1.relative)(routerFileDir, nsDirectory)))),
460
572
  factory.createPropertyAssignment('children', factory.createArrayLiteralExpression(children))
461
573
  ], true);
462
574
  }), true);
@@ -605,7 +717,7 @@ function outputInWebAppDir(appDir) {
605
717
  removeComments: false,
606
718
  });
607
719
  const routerFile = program.getSourceFile(templateFileName);
608
- (0, assert_1.default)(routerFile);
720
+ (0, assert_1.assert)(routerFile);
609
721
  const namespaceDir = (0, path_1.join)(appDir, 'namespaces');
610
722
  const { statements } = routerFile;
611
723
  if (judgeUseOakRouterBuilder(statements)) {
@@ -636,7 +748,7 @@ function watchDir(projectDir, startupDir, type) {
636
748
  BuildRouterContext.watchHandles.push(handle);
637
749
  }
638
750
  };
639
- if (startupDir.startsWith('web')) {
751
+ if (isWebStartupDir(startupDir)) {
640
752
  const srcAppDir = (0, path_1.join)(projectDir, startupDir, 'src', 'app');
641
753
  const namespaceDir = (0, path_1.join)(srcAppDir, 'namespaces');
642
754
  const tryOutputAppDir = (ns) => {
@@ -719,11 +831,11 @@ function buildRouter(projectDir, startupDir, watch, options) {
719
831
  BuildRouterContext.options = options;
720
832
  BuildRouterContext.warnedInvalidDirs = new Set();
721
833
  BuildRouterContext.warnedRouteConflicts = new Set();
722
- const type = startupDir.startsWith('web') ? 'web' : (startupDir.startsWith('native') ? 'native' : 'wechatMp');
834
+ const type = isWebStartupDir(startupDir) ? 'web' : (startupDir.startsWith('native') ? 'native' : 'wechatMp');
723
835
  traversePageDir(projectDir, type);
724
836
  const subDir = (0, fs_extra_1.readdirSync)(projectDir);
725
- (0, assert_1.default)(subDir.includes(startupDir));
726
- if (startupDir.startsWith('web')) {
837
+ (0, assert_1.assert)(subDir.includes(startupDir));
838
+ if (isWebStartupDir(startupDir)) {
727
839
  outputInWebDir((0, path_1.join)(projectDir, startupDir));
728
840
  }
729
841
  // todo native
@@ -1,5 +1,9 @@
1
1
  import * as ts from 'typescript';
2
- import { CompilerOutputOptions } from './env';
2
+ import { CompilerOutputOptions } from "./env";
3
+ export type SchemaBuilderProjectOptions = {
4
+ pwd: string;
5
+ configFile?: string;
6
+ };
3
7
  declare const Schema: Record<string, {
4
8
  schemaAttrs: Array<ts.PropertySignature>;
5
9
  fulltextIndex?: true;
@@ -13,6 +17,7 @@ declare const Schema: Record<string, {
13
17
  static: boolean;
14
18
  recursiveDepth?: number;
15
19
  style?: StaticLiteralObject;
20
+ localizedContent?: ParsedLocalizedContentConfig;
16
21
  inModi: boolean;
17
22
  relations: false | string[];
18
23
  extendsFrom: string[];
@@ -43,6 +48,7 @@ type ParsedIndexConfig = {
43
48
  parser?: string;
44
49
  tsConfig?: string | string[];
45
50
  chineseParser?: string;
51
+ include?: string[];
46
52
  };
47
53
  type ParsedIndex = {
48
54
  name: string;
@@ -53,6 +59,10 @@ type ParsedIndex = {
53
59
  attributeKey: string;
54
60
  origin: MetadataOrigin;
55
61
  };
62
+ type ParsedLocalizedContentConfig = {
63
+ attributes: string[];
64
+ sourceLanguage?: string;
65
+ };
56
66
  export declare function constructAttributes(entity: string): ts.PropertyAssignment[];
57
67
  export declare function translateLocaleObject(locale: ts.ObjectLiteralExpression): LocaleObject;
58
68
  /**
@@ -81,7 +91,7 @@ export declare function registerFixedDestinationPathMap(map: Record<string, stri
81
91
  */
82
92
  export declare function registerDeducedRelationMap(map: Record<string, string>): void;
83
93
  export declare const getAnalizedSchema: () => typeof Schema;
84
- export declare function analyzeEntities(inputDir: string, relativePath?: string, options?: CompilerOutputOptions): void;
94
+ export declare function analyzeEntities(inputDir: string, relativePath?: string, options?: CompilerOutputOptions, projectOptions?: SchemaBuilderProjectOptions): void;
85
95
  export declare function getProjectionKeys(entity: string): string[];
86
96
  export declare function buildSchema(outputDir: string, options?: CompilerOutputOptions): void;
87
97
  export {};