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,15 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const assert_1 = tslib_1.__importDefault(require("assert"));
3
+ exports.makeServerUrl = makeServerUrl;
4
+ const assert_1 = require("./assert");
5
5
  const types_1 = require("../types");
6
6
  const version_1 = require("./version");
7
+ const domain_1 = require("./domain");
8
+ const shared_1 = require("./fetch/shared");
7
9
  function isBufferResult(value) {
8
10
  return typeof Buffer !== 'undefined' && value instanceof Buffer;
9
11
  }
10
12
  function isStreamResult(value) {
11
13
  return !!value && typeof value === 'object' && typeof value.pipe === 'function';
12
14
  }
15
+ function makeServerUrl(configuration) {
16
+ const { ssl, hostname, port, path } = configuration.http;
17
+ const protocol = ssl ? 'https:' : 'http:';
18
+ let serverUrl = `${protocol}//${hostname}`;
19
+ if (typeof port === 'number') {
20
+ serverUrl += `:${port}`;
21
+ }
22
+ if (path) {
23
+ serverUrl += path.startsWith('/') ? path : `/${path}`;
24
+ }
25
+ return serverUrl;
26
+ }
13
27
  class SimpleConnector {
14
28
  static ASPECT_ROUTER = '/aspect';
15
29
  static BRIDGE_ROUTER = '/bridge';
@@ -28,24 +42,11 @@ class SimpleConnector {
28
42
  getVersion;
29
43
  constructor(configuration, makeException, getVersion) {
30
44
  this.configuration = configuration;
31
- const { routerPrefixes, http, timeout, clockDriftDuration } = configuration;
45
+ const { routerPrefixes, timeout, clockDriftDuration } = configuration;
32
46
  this.timeout = timeout || 5000;
33
47
  this.clockDriftDuration = clockDriftDuration || 10000;
34
- const { ssl, hostname, port, path } = http;
35
- const protocol = ssl ? 'https:' : 'http:';
36
- let serverUrl = `${protocol}//${hostname}`;
48
+ const serverUrl = makeServerUrl(configuration);
37
49
  this.serverUrl = serverUrl;
38
- if (typeof port === 'number') {
39
- serverUrl += `:${port}`;
40
- }
41
- if (path) {
42
- if (path.startsWith('/')) {
43
- serverUrl += path;
44
- }
45
- else {
46
- serverUrl += `/${path}`;
47
- }
48
- }
49
50
  this.serverAspectUrl = `${serverUrl}${routerPrefixes?.aspect || SimpleConnector.ASPECT_ROUTER}`;
50
51
  this.serverBridgeUrl = `${serverUrl}${routerPrefixes?.bridge || SimpleConnector.BRIDGE_ROUTER}`;
51
52
  this.serverSubscribePointUrl = `${serverUrl}${routerPrefixes?.getSubscribePoint ||
@@ -89,7 +90,9 @@ class SimpleConnector {
89
90
  ;
90
91
  async parseAspectResult(response) {
91
92
  if (response.status > 299) {
92
- throw new types_1.OakServerProxyException(`网络请求返回status是${response.status}`);
93
+ throw new types_1.OakServerProxyException('error::serverProxyException', 'oak-domain', {
94
+ status: response.status,
95
+ });
93
96
  }
94
97
  const rawMessage = response.headers.get('oak-message');
95
98
  const message = rawMessage ? decodeURIComponent(rawMessage) : undefined;
@@ -174,11 +177,12 @@ class SimpleConnector {
174
177
  const message = response.headers.get('oak-message');
175
178
  const contentType = response.headers.get('Content-Type') || response.headers.get('content-type');
176
179
  if (contentType?.toLocaleLowerCase().match(/application\/json/i)) {
177
- const { socketUrl, subscribeUrl, path } = await response.json();
180
+ const { socketUrl, subscribeUrl, path, scope } = await response.json();
178
181
  return {
179
182
  path,
180
183
  subscribeUrl,
181
184
  socketUrl,
185
+ scope,
182
186
  };
183
187
  }
184
188
  else {
@@ -190,10 +194,279 @@ class SimpleConnector {
190
194
  getEndpointRouter() {
191
195
  return this.configuration.routerPrefixes?.endpoint || SimpleConnector.ENDPOINT_ROUTER;
192
196
  }
197
+ makeEndpointUrl(path) {
198
+ return (0, domain_1.urlJoin)(this.serverUrl, this.getEndpointRouter(), path);
199
+ }
200
+ async makeEndpointHeadersAndBody(options, aspectName) {
201
+ const { method = 'get', body, context, headers: extraHeaders } = options || {};
202
+ const cxtStr = context ? await context.toString() : '{}';
203
+ const headers = {
204
+ 'oak-cxt': cxtStr,
205
+ 'oak-version': this.getVersion?.(),
206
+ 'oak-platform': process.env.OAK_PLATFORM || 'unknown',
207
+ ...extraHeaders,
208
+ };
209
+ if (aspectName) {
210
+ headers['oak-aspect'] = aspectName;
211
+ }
212
+ if (method === 'get' || method === 'delete') {
213
+ return {
214
+ headers,
215
+ body: undefined,
216
+ };
217
+ }
218
+ if (process.env.OAK_PLATFORM !== 'wechatMp' && body instanceof FormData) {
219
+ return {
220
+ headers,
221
+ body,
222
+ };
223
+ }
224
+ headers['Content-Type'] = headers['Content-Type'] || 'application/json';
225
+ return {
226
+ headers,
227
+ body: body === undefined ? undefined : JSON.stringify(body),
228
+ };
229
+ }
230
+ buildEndpointUrl(path, options) {
231
+ const url = this.makeEndpointUrl(path);
232
+ if (options?.params) {
233
+ return (0, domain_1.composeUrl)(url, options.params);
234
+ }
235
+ return url;
236
+ }
237
+ async makeSSEEndpointHeadersAndBody(path, options) {
238
+ const result = await this.makeEndpointHeadersAndBody({
239
+ method: 'post',
240
+ body: options?.body,
241
+ context: options?.context,
242
+ headers: options?.headers,
243
+ }, path);
244
+ return result;
245
+ }
246
+ createSSEClient(stream) {
247
+ const reader = stream.getReader();
248
+ const decoder = new TextDecoder();
249
+ const callbacks = new Map();
250
+ const errorCallbacks = new Set();
251
+ const doneCallbacks = new Set();
252
+ let buffer = '';
253
+ let closed = false;
254
+ const addCallback = (eventName, callback) => {
255
+ const set = callbacks.get(eventName) || new Set();
256
+ set.add(callback);
257
+ callbacks.set(eventName, set);
258
+ return () => set.delete(callback);
259
+ };
260
+ const dispatch = (event) => {
261
+ if (event.event === 'error') {
262
+ const exception = event.data?.exception;
263
+ const error = exception ? this.makeException(exception) : event.data;
264
+ errorCallbacks.forEach((callback) => callback(error));
265
+ return;
266
+ }
267
+ callbacks.get(event.event)?.forEach((callback) => callback(event.data, event));
268
+ if (event.event !== 'message') {
269
+ callbacks.get('message')?.forEach((callback) => callback(event.data, event));
270
+ }
271
+ };
272
+ const parsePacket = (packet) => {
273
+ const lines = packet.split(/\r?\n/);
274
+ let eventName = 'message';
275
+ let id;
276
+ const dataLines = [];
277
+ for (const line of lines) {
278
+ if (!line || line.startsWith(':')) {
279
+ continue;
280
+ }
281
+ const index = line.indexOf(':');
282
+ const field = index >= 0 ? line.slice(0, index) : line;
283
+ const value = index >= 0 ? line.slice(index + 1).replace(/^ /, '') : '';
284
+ if (field === 'event') {
285
+ eventName = value || 'message';
286
+ }
287
+ else if (field === 'data') {
288
+ dataLines.push(value);
289
+ }
290
+ else if (field === 'id') {
291
+ id = value;
292
+ }
293
+ }
294
+ if (dataLines.length === 0) {
295
+ return;
296
+ }
297
+ const rawData = dataLines.join('\n');
298
+ const data = JSON.parse(rawData);
299
+ dispatch({ event: eventName, data, id });
300
+ };
301
+ const pump = async () => {
302
+ try {
303
+ while (!closed) {
304
+ const { value, done } = await reader.read();
305
+ if (done) {
306
+ break;
307
+ }
308
+ buffer += decoder.decode(value, { stream: true });
309
+ const packets = buffer.split(/\r?\n\r?\n/);
310
+ buffer = packets.pop() || '';
311
+ packets.forEach(parsePacket);
312
+ }
313
+ if (buffer.trim()) {
314
+ parsePacket(buffer);
315
+ }
316
+ doneCallbacks.forEach((callback) => callback());
317
+ }
318
+ catch (err) {
319
+ errorCallbacks.forEach((callback) => callback(err));
320
+ }
321
+ };
322
+ pump();
323
+ return {
324
+ onMessage: (callback) => addCallback('message', callback),
325
+ on: addCallback,
326
+ onError: (callback) => {
327
+ errorCallbacks.add(callback);
328
+ return () => errorCallbacks.delete(callback);
329
+ },
330
+ onDone: (callback) => {
331
+ doneCallbacks.add(callback);
332
+ return () => doneCallbacks.delete(callback);
333
+ },
334
+ close: () => {
335
+ closed = true;
336
+ reader.cancel();
337
+ },
338
+ };
339
+ }
340
+ async parseEndpointResponse(response) {
341
+ if (response.status > 299) {
342
+ throw new types_1.OakServerProxyException('error::serverProxyException', 'oak-domain', {
343
+ status: response.status,
344
+ });
345
+ }
346
+ const rawMessage = response.headers.get('oak-message');
347
+ const message = rawMessage ? decodeURIComponent(rawMessage) : undefined;
348
+ const responseType = response.headers.get('Content-Type') || response.headers.get('content-type');
349
+ if (responseType?.toLocaleLowerCase().match(/application\/json/i)) {
350
+ const { exception, result, opRecords } = await response.json();
351
+ if (exception) {
352
+ throw this.makeException(exception);
353
+ }
354
+ return {
355
+ result,
356
+ opRecords,
357
+ message,
358
+ status: response.status,
359
+ headers: response.headers,
360
+ };
361
+ }
362
+ return {
363
+ result: response.body,
364
+ message,
365
+ status: response.status,
366
+ headers: response.headers,
367
+ };
368
+ }
369
+ async callEndpoint(path, options) {
370
+ const method = (options?.method || 'get').toUpperCase();
371
+ const url = this.buildEndpointUrl(path, options);
372
+ const { headers, body } = await this.makeEndpointHeadersAndBody(options, path);
373
+ let response;
374
+ try {
375
+ response = await this.fetchWithTimeout(url, {
376
+ method,
377
+ headers,
378
+ body,
379
+ }, this.timeout);
380
+ }
381
+ catch (err) {
382
+ if (err instanceof types_1.OakRequestTimeoutException) {
383
+ throw new types_1.OakNetworkException(`error::requestTimeout`, 'oak-domain');
384
+ }
385
+ throw new types_1.OakNetworkException(`error::networkException`, 'oak-domain');
386
+ }
387
+ const parsed = await this.parseEndpointResponse(response);
388
+ if (!(parsed.headers && parsed.result instanceof ReadableStream)) {
389
+ return parsed;
390
+ }
391
+ return parsed;
392
+ }
393
+ async openEndpointStream(path, options) {
394
+ const method = (options?.method || 'get').toUpperCase();
395
+ const url = this.buildEndpointUrl(path, options);
396
+ const { headers, body } = await this.makeEndpointHeadersAndBody(options, path);
397
+ let response;
398
+ try {
399
+ response = await this.fetchWithTimeout(url, {
400
+ method,
401
+ headers,
402
+ body,
403
+ }, this.timeout);
404
+ }
405
+ catch (err) {
406
+ if (err instanceof types_1.OakRequestTimeoutException) {
407
+ throw new types_1.OakNetworkException(`error::requestTimeout`, 'oak-domain');
408
+ }
409
+ throw new types_1.OakNetworkException(`error::networkException`, 'oak-domain');
410
+ }
411
+ const parsed = await this.parseEndpointResponse(response);
412
+ if (!(parsed.result instanceof ReadableStream) && !response.body) {
413
+ throw new types_1.OakException('error::content types not yet supported', 'oak-domain', {
414
+ contentType: response.headers.get('Content-Type') || response.headers.get('content-type'),
415
+ });
416
+ }
417
+ return {
418
+ result: parsed.result || response.body,
419
+ message: parsed.message,
420
+ status: response.status,
421
+ headers: response.headers,
422
+ };
423
+ }
424
+ async callSSEEndpoint(path, options) {
425
+ const url = this.makeEndpointUrl(path);
426
+ const { headers, body } = await this.makeSSEEndpointHeadersAndBody(path, options);
427
+ let response;
428
+ try {
429
+ response = await this.fetchWithTimeout(url, {
430
+ method: 'POST',
431
+ headers,
432
+ body,
433
+ oakSSE: true,
434
+ }, this.timeout);
435
+ }
436
+ catch (err) {
437
+ if (err instanceof types_1.OakRequestTimeoutException) {
438
+ throw new types_1.OakNetworkException(`error::requestTimeout`, 'oak-domain');
439
+ }
440
+ throw new types_1.OakNetworkException(`error::networkException`, 'oak-domain');
441
+ }
442
+ if (response.status > 299) {
443
+ throw new types_1.OakServerProxyException('error::serverProxyException', 'oak-domain', {
444
+ status: response.status,
445
+ });
446
+ }
447
+ if (!response.body) {
448
+ throw new types_1.OakException('error::content types not yet supported', 'oak-domain', {
449
+ contentType: response.headers.get('Content-Type') || response.headers.get('content-type'),
450
+ });
451
+ }
452
+ return this.createSSEClient(response.body);
453
+ }
454
+ async serializeSSEEndpointResult(result, headers, body, rawMessage) {
455
+ const message = rawMessage ? encodeURIComponent(rawMessage) : undefined;
456
+ return {
457
+ body: result,
458
+ headers: {
459
+ 'Content-Type': 'text/event-stream; charset=utf-8',
460
+ 'Cache-Control': 'no-cache, no-transform',
461
+ Connection: 'keep-alive',
462
+ 'oak-message': message,
463
+ },
464
+ };
465
+ }
193
466
  parseRequest(headers, body, files) {
194
467
  const { 'oak-cxt': oakCxtStr, 'oak-aspect': aspectName } = headers;
195
- (0, assert_1.default)(typeof oakCxtStr === 'string' || oakCxtStr === undefined);
196
- (0, assert_1.default)(typeof aspectName === 'string');
468
+ (0, assert_1.assert)(typeof oakCxtStr === 'string' || oakCxtStr === undefined);
469
+ (0, assert_1.assert)(typeof aspectName === 'string');
197
470
  return {
198
471
  contextString: oakCxtStr,
199
472
  aspectName,
@@ -257,9 +530,9 @@ class SimpleConnector {
257
530
  return {};
258
531
  }
259
532
  async fetchWithTimeout(url, options, timeout = 5000) {
260
- return global.fetch(url, options);
533
+ return (0, shared_1.getGlobalFetch)()(url, options);
261
534
  // if (typeof AbortController === 'undefined' || timeout === 0) {
262
- // return global.fetch(url, options);
535
+ // return getGlobalFetch()(url, options);
263
536
  // }
264
537
  // const controller = new AbortController();
265
538
  // const signal = controller.signal;
@@ -268,7 +541,7 @@ class SimpleConnector {
268
541
  // controller.abort();
269
542
  // }, timeout);
270
543
  // // 发起 fetch 请求并传递 signal
271
- // return global.fetch(url, Object.assign({}, options, { signal }))
544
+ // return getGlobalFetch()(url, Object.assign({}, options, { signal }))
272
545
  // .then(response => {
273
546
  // clearTimeout(timeoutId); // 如果请求成功,清除超时
274
547
  // return response;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RWLock = void 0;
4
- const tslib_1 = require("tslib");
5
- const assert_1 = tslib_1.__importDefault(require("assert"));
4
+ const assert_1 = require("./assert");
6
5
  /**
7
6
  * 模拟一个读写锁,用于同步。
8
7
  * 注意,千万不要发生自己等自己
@@ -36,7 +35,7 @@ class RWLock {
36
35
  }
37
36
  release() {
38
37
  if (this.writeNumber) {
39
- (0, assert_1.default)(this.writeNumber === 1);
38
+ (0, assert_1.assert)(this.writeNumber === 1);
40
39
  this.writeNumber = 0;
41
40
  if (this.readWaiter.length > 0) {
42
41
  for (const f of this.readWaiter) {
@@ -50,8 +49,8 @@ class RWLock {
50
49
  }
51
50
  }
52
51
  else {
53
- (0, assert_1.default)(this.readNumber > 0);
54
- (0, assert_1.default)(this.readWaiter.length === 0);
52
+ (0, assert_1.assert)(this.readNumber > 0);
53
+ (0, assert_1.assert)(this.readWaiter.length === 0);
55
54
  this.readNumber--;
56
55
  if (this.readNumber === 0) {
57
56
  const f = this.writeWaiter.pop();
@@ -0,0 +1,26 @@
1
+ import BigNumber from 'bignumber.js';
2
+ export type DecimalValue = string | null | undefined;
3
+ export type DecimalInput = string | null | undefined;
4
+ export type DecimalCalculationInput = DecimalInput | BigNumber;
5
+ export declare function toBigNumber(value: DecimalCalculationInput): BigNumber;
6
+ export declare function toDecimalString(value: DecimalInput): string;
7
+ export declare function numberToDecimalString(value: number | string): string;
8
+ export declare function requireDecimalString(value: unknown, label: string): string;
9
+ export declare function decimalToDisplayNumber(value: DecimalCalculationInput): number;
10
+ export declare function decimalToApiNumber(value: DecimalCalculationInput): number;
11
+ export declare function decimalRound(value: DecimalCalculationInput, roundingMode?: 4): string;
12
+ export declare function decimalIsZero(value: DecimalCalculationInput): boolean;
13
+ export declare function decimalEq(left: DecimalCalculationInput, right: DecimalCalculationInput): boolean;
14
+ export declare function decimalGt(left: DecimalCalculationInput, right: DecimalCalculationInput): boolean;
15
+ export declare function decimalGte(left: DecimalCalculationInput, right: DecimalCalculationInput): boolean;
16
+ export declare function decimalLt(left: DecimalCalculationInput, right: DecimalCalculationInput): boolean;
17
+ export declare function decimalLte(left: DecimalCalculationInput, right: DecimalCalculationInput): boolean;
18
+ export declare function decimalAdd(left: DecimalCalculationInput, right: DecimalCalculationInput): string;
19
+ export declare function decimalSub(left: DecimalCalculationInput, right: DecimalCalculationInput): string;
20
+ export declare function decimalNeg(value: DecimalCalculationInput): string;
21
+ export declare function decimalAbs(value: DecimalCalculationInput): string;
22
+ export declare function decimalMul(left: DecimalCalculationInput, right: DecimalCalculationInput): string;
23
+ export declare function decimalDiv(left: DecimalCalculationInput, right: DecimalCalculationInput): string;
24
+ export declare function decimalMin(left: DecimalCalculationInput, right: DecimalCalculationInput): string;
25
+ export declare function setDecimal(value: DecimalCalculationInput): any;
26
+ export declare function addDecimal<A extends string>(attr: A, delta: DecimalCalculationInput): any;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toBigNumber = toBigNumber;
4
+ exports.toDecimalString = toDecimalString;
5
+ exports.numberToDecimalString = numberToDecimalString;
6
+ exports.requireDecimalString = requireDecimalString;
7
+ exports.decimalToDisplayNumber = decimalToDisplayNumber;
8
+ exports.decimalToApiNumber = decimalToApiNumber;
9
+ exports.decimalRound = decimalRound;
10
+ exports.decimalIsZero = decimalIsZero;
11
+ exports.decimalEq = decimalEq;
12
+ exports.decimalGt = decimalGt;
13
+ exports.decimalGte = decimalGte;
14
+ exports.decimalLt = decimalLt;
15
+ exports.decimalLte = decimalLte;
16
+ exports.decimalAdd = decimalAdd;
17
+ exports.decimalSub = decimalSub;
18
+ exports.decimalNeg = decimalNeg;
19
+ exports.decimalAbs = decimalAbs;
20
+ exports.decimalMul = decimalMul;
21
+ exports.decimalDiv = decimalDiv;
22
+ exports.decimalMin = decimalMin;
23
+ exports.setDecimal = setDecimal;
24
+ exports.addDecimal = addDecimal;
25
+ const tslib_1 = require("tslib");
26
+ const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
27
+ const assert_1 = require("./assert");
28
+ function toBigNumber(value) {
29
+ (0, assert_1.assert)(value !== null && value !== undefined, 'decimal value is required');
30
+ const decimal = bignumber_js_1.default.isBigNumber(value) ? value : new bignumber_js_1.default(value);
31
+ (0, assert_1.assert)(decimal.isFinite(), `invalid decimal value: ${value}`);
32
+ return decimal;
33
+ }
34
+ function toDecimalString(value) {
35
+ return toBigNumber(value).toFixed();
36
+ }
37
+ function numberToDecimalString(value) {
38
+ (0, assert_1.assert)(typeof value === 'number' || typeof value === 'string', `invalid decimal input: ${value}`);
39
+ const decimal = new bignumber_js_1.default(value);
40
+ (0, assert_1.assert)(decimal.isFinite(), `invalid decimal input: ${value}`);
41
+ return decimal.toFixed();
42
+ }
43
+ function requireDecimalString(value, label) {
44
+ (0, assert_1.assert)(typeof value === 'string', `${label} must be a decimal string`);
45
+ return value;
46
+ }
47
+ function decimalToDisplayNumber(value) {
48
+ return toBigNumber(value).toNumber();
49
+ }
50
+ function decimalToApiNumber(value) {
51
+ return toBigNumber(value).toNumber();
52
+ }
53
+ function decimalRound(value, roundingMode = bignumber_js_1.default.ROUND_HALF_UP) {
54
+ return toBigNumber(value).integerValue(roundingMode).toFixed();
55
+ }
56
+ function decimalIsZero(value) {
57
+ return toBigNumber(value).isZero();
58
+ }
59
+ function decimalEq(left, right) {
60
+ return toBigNumber(left).isEqualTo(toBigNumber(right));
61
+ }
62
+ function decimalGt(left, right) {
63
+ return toBigNumber(left).isGreaterThan(toBigNumber(right));
64
+ }
65
+ function decimalGte(left, right) {
66
+ return toBigNumber(left).isGreaterThanOrEqualTo(toBigNumber(right));
67
+ }
68
+ function decimalLt(left, right) {
69
+ return toBigNumber(left).isLessThan(toBigNumber(right));
70
+ }
71
+ function decimalLte(left, right) {
72
+ return toBigNumber(left).isLessThanOrEqualTo(toBigNumber(right));
73
+ }
74
+ function decimalAdd(left, right) {
75
+ return toBigNumber(left).plus(toBigNumber(right)).toFixed();
76
+ }
77
+ function decimalSub(left, right) {
78
+ return toBigNumber(left).minus(toBigNumber(right)).toFixed();
79
+ }
80
+ function decimalNeg(value) {
81
+ return toBigNumber(value).negated().toFixed();
82
+ }
83
+ function decimalAbs(value) {
84
+ return toBigNumber(value).absoluteValue().toFixed();
85
+ }
86
+ function decimalMul(left, right) {
87
+ return toBigNumber(left).multipliedBy(toBigNumber(right)).toFixed();
88
+ }
89
+ function decimalDiv(left, right) {
90
+ return toBigNumber(left).dividedBy(toBigNumber(right)).toFixed();
91
+ }
92
+ function decimalMin(left, right) {
93
+ const leftDecimal = toBigNumber(left);
94
+ const rightDecimal = toBigNumber(right);
95
+ return bignumber_js_1.default.minimum(leftDecimal, rightDecimal).toFixed();
96
+ }
97
+ function decimalAddExpr(left, right) {
98
+ return {
99
+ $expr: {
100
+ $add: [
101
+ left,
102
+ toBigNumber(right).toFixed(),
103
+ ],
104
+ },
105
+ };
106
+ }
107
+ function setDecimal(value) {
108
+ return decimalAddExpr(0, value);
109
+ }
110
+ function addDecimal(attr, delta) {
111
+ return decimalAddExpr({ '#attr': attr }, delta);
112
+ }
@@ -0,0 +1 @@
1
+ export * from './shared';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const shared_1 = require("./shared");
5
+ (0, shared_1.getGlobalFetch)();
6
+ tslib_1.__exportStar(require("./shared"), exports);
@@ -0,0 +1,3 @@
1
+ export declare function createWechatMpFetch(): typeof fetch;
2
+ export declare function ensureWechatMpFetch(): typeof fetch;
3
+ export * from './shared';