@tstdl/base 0.86.0-beta1 → 0.86.0-beta10

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 (869) hide show
  1. package/.eslintrc.json +1 -0
  2. package/_container/container.js +443 -0
  3. package/_container/decorators.d.ts +76 -0
  4. package/_container/decorators.js +110 -0
  5. package/_container/index.d.ts +10 -0
  6. package/_container/index.js +27 -0
  7. package/_container/interfaces.d.ts +16 -0
  8. package/_container/interfaces.js +26 -0
  9. package/_container/provider.js +60 -0
  10. package/_container/resolve-chain.js +105 -0
  11. package/_container/resolve.error.js +36 -0
  12. package/_container/token.d.ts +18 -0
  13. package/_container/token.js +41 -0
  14. package/_container/type-info.js +16 -0
  15. package/_container/types.js +16 -0
  16. package/_container/utils.js +44 -0
  17. package/api/client/client.d.ts +2 -2
  18. package/api/client/client.js +127 -109
  19. package/api/client/index.js +18 -1
  20. package/api/default-error-handlers.js +44 -18
  21. package/api/index.js +20 -14
  22. package/api/response.js +123 -99
  23. package/api/server/api-controller.d.ts +2 -2
  24. package/api/server/api-controller.js +71 -42
  25. package/api/server/api-request-token.provider.js +40 -12
  26. package/api/server/error-handler.js +46 -25
  27. package/api/server/gateway.d.ts +5 -6
  28. package/api/server/gateway.js +226 -207
  29. package/api/server/index.js +22 -5
  30. package/api/server/middlewares/allowed-methods.middleware.js +40 -17
  31. package/api/server/middlewares/catch-error.middleware.js +33 -12
  32. package/api/server/middlewares/cors.middleware.js +69 -49
  33. package/api/server/middlewares/index.js +21 -4
  34. package/api/server/middlewares/response-time.middleware.js +31 -8
  35. package/api/server/module.js +42 -18
  36. package/api/server/tokens.d.ts +4 -1
  37. package/api/server/tokens.js +31 -2
  38. package/api/types.js +40 -14
  39. package/api/utils.js +36 -13
  40. package/application/application.d.ts +13 -10
  41. package/application/application.js +168 -155
  42. package/application/index.js +18 -1
  43. package/async-iterator-symbol.js +28 -5
  44. package/authentication/authentication.api.js +113 -89
  45. package/authentication/client/api.client.js +57 -28
  46. package/authentication/client/authentication.service.d.ts +4 -4
  47. package/authentication/client/authentication.service.js +249 -223
  48. package/authentication/client/http-client.middleware.d.ts +3 -5
  49. package/authentication/client/http-client.middleware.js +35 -21
  50. package/authentication/client/index.js +22 -5
  51. package/authentication/client/module.d.ts +2 -1
  52. package/authentication/client/module.js +46 -15
  53. package/authentication/client/tokens.d.ts +2 -2
  54. package/authentication/client/tokens.js +30 -5
  55. package/authentication/errors/index.js +18 -1
  56. package/authentication/errors/secret-requirements.error.js +29 -6
  57. package/authentication/index.js +19 -2
  58. package/authentication/models/authentication-credentials.model.js +66 -37
  59. package/authentication/models/authentication-session.model.js +80 -51
  60. package/authentication/models/index.js +23 -6
  61. package/authentication/models/init-secret-reset-data.model.js +44 -16
  62. package/authentication/models/secret-check-result.model.js +36 -9
  63. package/authentication/models/token-payload-base.model.js +59 -31
  64. package/authentication/models/token.model.js +16 -1
  65. package/authentication/server/authentication-api-request-token.provider.js +52 -24
  66. package/authentication/server/authentication-credentials.repository.js +24 -1
  67. package/authentication/server/authentication-secret-requirements.validator.d.ts +11 -2
  68. package/authentication/server/authentication-secret-requirements.validator.js +58 -23
  69. package/authentication/server/authentication-secret-reset.handler.js +24 -1
  70. package/authentication/server/authentication-session.repository.js +24 -1
  71. package/authentication/server/authentication-subject.resolver.js +24 -5
  72. package/authentication/server/authentication-token-payload.provider.js +29 -5
  73. package/authentication/server/authentication.api-controller.js +114 -88
  74. package/authentication/server/authentication.service.d.ts +10 -3
  75. package/authentication/server/authentication.service.js +308 -264
  76. package/authentication/server/helper.js +87 -66
  77. package/authentication/server/index.js +28 -11
  78. package/authentication/server/module.d.ts +2 -1
  79. package/authentication/server/module.js +48 -25
  80. package/authentication/server/mongo/index.js +19 -2
  81. package/authentication/server/mongo/mongo-authentication-credentials.repository.d.ts +3 -3
  82. package/authentication/server/mongo/mongo-authentication-credentials.repository.js +84 -52
  83. package/authentication/server/mongo/mongo-authentication-session.repository.d.ts +3 -3
  84. package/authentication/server/mongo/mongo-authentication-session.repository.js +81 -49
  85. package/browser/browser-context-controller.d.ts +4 -4
  86. package/browser/browser-context-controller.js +106 -72
  87. package/browser/browser-controller.d.ts +12 -5
  88. package/browser/browser-controller.js +115 -74
  89. package/browser/browser.service.d.ts +12 -6
  90. package/browser/browser.service.js +117 -83
  91. package/browser/document-controller.js +81 -48
  92. package/browser/element-controller.d.ts +24 -0
  93. package/browser/element-controller.js +217 -139
  94. package/browser/frame-controller.js +50 -27
  95. package/browser/index.js +27 -10
  96. package/browser/locator-controller.js +59 -36
  97. package/browser/module.js +47 -23
  98. package/browser/page-controller.js +108 -89
  99. package/browser/pdf-options.js +103 -73
  100. package/browser/types.js +16 -1
  101. package/browser/utils.d.ts +2 -0
  102. package/browser/utils.js +116 -77
  103. package/collections/awaitable/awaitable-list.js +122 -99
  104. package/collections/awaitable/awaitable-map.js +116 -93
  105. package/collections/awaitable/awaitable-set.js +86 -63
  106. package/collections/awaitable/index.js +20 -3
  107. package/collections/collection.js +16 -1
  108. package/collections/index.js +23 -6
  109. package/collections/keyed-set.js +77 -53
  110. package/collections/list.js +16 -1
  111. package/collections/observable/index.js +25 -8
  112. package/collections/observable/observable-array.js +118 -95
  113. package/collections/observable/observable-collection-base.js +83 -60
  114. package/collections/observable/observable-collection.js +16 -1
  115. package/collections/observable/observable-list-base.js +78 -55
  116. package/collections/observable/observable-list.js +16 -1
  117. package/collections/observable/observable-map.js +79 -56
  118. package/collections/observable/observable-set.js +98 -75
  119. package/collections/observable/observable-sorted-array-list.js +188 -165
  120. package/collections/sorted-array-list.js +179 -156
  121. package/collections/sorted-list.js +16 -1
  122. package/collections/sorted-map.js +93 -70
  123. package/container/decorators.d.ts +2 -76
  124. package/container/decorators.js +34 -126
  125. package/container/index.d.ts +0 -7
  126. package/container/index.js +20 -10
  127. package/container/interfaces.d.ts +2 -16
  128. package/container/interfaces.js +25 -2
  129. package/container/token.d.ts +2 -18
  130. package/container/token.js +26 -20
  131. package/cookie/cookie.js +71 -49
  132. package/cookie/index.js +18 -1
  133. package/core.d.ts +4 -2
  134. package/core.js +82 -46
  135. package/data-structures/array-dictionary.js +110 -89
  136. package/data-structures/array-list.d.ts +1 -1
  137. package/data-structures/array-list.js +128 -105
  138. package/data-structures/cache.js +64 -41
  139. package/data-structures/circular-buffer.js +219 -195
  140. package/data-structures/collection.js +109 -86
  141. package/data-structures/dictionary.js +75 -51
  142. package/data-structures/distinct-collection.d.ts +24 -0
  143. package/data-structures/distinct-collection.js +77 -0
  144. package/data-structures/index-out-of-bounds.error.js +31 -8
  145. package/data-structures/index.d.ts +2 -1
  146. package/data-structures/index.js +33 -15
  147. package/data-structures/iterable-weak-map.js +149 -129
  148. package/data-structures/linked-list.js +385 -367
  149. package/data-structures/list.js +109 -78
  150. package/data-structures/map-dictionary.js +78 -55
  151. package/data-structures/multi-key-map.d.ts +1 -1
  152. package/data-structures/multi-key-map.js +163 -138
  153. package/data-structures/multi-key-set.d.ts +19 -0
  154. package/data-structures/multi-key-set.js +81 -0
  155. package/data-structures/{set.d.ts → set-collection.d.ts} +3 -3
  156. package/data-structures/set-collection.js +79 -0
  157. package/data-structures/sorted-array-list.d.ts +1 -1
  158. package/data-structures/sorted-array-list.js +166 -142
  159. package/data-structures/weak-ref-map.js +146 -123
  160. package/database/entity-repository.js +26 -2
  161. package/database/entity.js +16 -1
  162. package/database/id.js +29 -8
  163. package/database/index.js +23 -6
  164. package/database/module.js +33 -9
  165. package/database/mongo/classes.d.ts +5 -5
  166. package/database/mongo/classes.js +43 -13
  167. package/database/mongo/index.js +27 -10
  168. package/database/mongo/model/document.js +93 -62
  169. package/database/mongo/model/index.js +18 -1
  170. package/database/mongo/module.js +79 -51
  171. package/database/mongo/mongo-base.repository.js +283 -259
  172. package/database/mongo/mongo-bulk.js +110 -87
  173. package/database/mongo/mongo-entity-repository.d.ts +5 -5
  174. package/database/mongo/mongo-entity-repository.js +296 -270
  175. package/database/mongo/operations.js +76 -48
  176. package/database/mongo/query-converter.js +96 -73
  177. package/database/mongo/simple-entity-repository.js +28 -5
  178. package/database/mongo/types.js +25 -2
  179. package/database/query.js +36 -7
  180. package/database/utils.js +25 -2
  181. package/decorators/index.d.ts +1 -0
  182. package/decorators/index.js +18 -0
  183. package/decorators/log.d.ts +2 -0
  184. package/decorators/log.js +56 -0
  185. package/disposable/async-disposer.d.ts +4 -4
  186. package/disposable/async-disposer.js +105 -93
  187. package/disposable/disposable.js +33 -7
  188. package/disposable/index.js +20 -3
  189. package/disposable/using.js +37 -15
  190. package/distributed-loop/controller.js +16 -1
  191. package/distributed-loop/distributed-loop.d.ts +3 -3
  192. package/distributed-loop/distributed-loop.js +105 -78
  193. package/distributed-loop/index.js +20 -3
  194. package/distributed-loop/provider.js +48 -20
  195. package/enumerable/async-enumerable.js +261 -238
  196. package/enumerable/enumerable-methods.js +16 -1
  197. package/enumerable/enumerable.js +200 -177
  198. package/enumerable/index.js +19 -2
  199. package/environment.js +57 -25
  200. package/error/api.error.js +33 -10
  201. package/error/assertion.error.js +29 -6
  202. package/error/bad-request.error.js +29 -6
  203. package/error/custom.error.js +47 -25
  204. package/error/details.error.js +31 -8
  205. package/error/forbidden.error.js +29 -6
  206. package/error/index.js +33 -16
  207. package/error/invalid-token.error.js +29 -6
  208. package/error/max-bytes-exceeded.error.js +32 -9
  209. package/error/method-not-allowed.error.js +29 -6
  210. package/error/multi.error.js +31 -8
  211. package/error/not-found.error.js +29 -6
  212. package/error/not-implemented.error.js +29 -6
  213. package/error/not-supported.error.js +34 -11
  214. package/error/timeout.error.js +29 -6
  215. package/error/unauthorized.error.js +29 -6
  216. package/error/unsupported-media-type.error.js +29 -6
  217. package/examples/api/authentication.js +49 -42
  218. package/examples/api/basic-overview.js +85 -81
  219. package/examples/api/custom-authentication.js +69 -61
  220. package/examples/api/streaming.js +95 -90
  221. package/examples/browser/basic.js +21 -20
  222. package/examples/http/client.js +16 -13
  223. package/examples/mail/basic.js +42 -36
  224. package/examples/mail/templates/hello-name.js +33 -10
  225. package/examples/pdf/basic.js +49 -44
  226. package/examples/pdf/templates/hello-name.js +58 -35
  227. package/examples/reflection/basic.js +84 -52
  228. package/examples/template/basic.js +33 -30
  229. package/examples/template/templates/hello-jsx.js +32 -8
  230. package/examples/template/templates/hello-name.js +41 -18
  231. package/function/index.d.ts +1 -0
  232. package/function/index.js +18 -0
  233. package/function/log.d.ts +6 -0
  234. package/function/log.js +37 -0
  235. package/global-this.js +36 -17
  236. package/http/client/adapters/undici-http-client.adapter.js +111 -90
  237. package/http/client/http-client-options.d.ts +0 -5
  238. package/http/client/http-client-options.js +33 -14
  239. package/http/client/http-client-request.js +171 -149
  240. package/http/client/http-client-response.js +56 -33
  241. package/http/client/http-client.adapter.js +24 -1
  242. package/http/client/http-client.d.ts +5 -8
  243. package/http/client/http-client.js +325 -301
  244. package/http/client/index.js +23 -6
  245. package/http/client/middleware.d.ts +6 -0
  246. package/http/client/middleware.js +16 -0
  247. package/http/client/module.d.ts +6 -1
  248. package/http/client/module.js +42 -14
  249. package/http/client/tokens.d.ts +2 -0
  250. package/http/client/tokens.js +25 -0
  251. package/http/cookie-parser.js +42 -19
  252. package/http/http-body.js +75 -52
  253. package/http/http-form.js +37 -14
  254. package/http/http-headers.js +109 -86
  255. package/http/http-query.js +37 -14
  256. package/http/http-url-parameters.js +31 -8
  257. package/http/http-value-map.js +133 -110
  258. package/http/http.error.js +82 -60
  259. package/http/index.js +28 -11
  260. package/http/server/http-server-request.js +47 -24
  261. package/http/server/http-server-response.js +45 -22
  262. package/http/server/http-server.js +25 -2
  263. package/http/server/index.js +20 -3
  264. package/http/server/node/index.js +19 -2
  265. package/http/server/node/module.js +28 -8
  266. package/http/server/node/node-http-server.d.ts +1 -4
  267. package/http/server/node/node-http-server.js +230 -208
  268. package/http/types.js +47 -21
  269. package/http/utils.js +108 -92
  270. package/image-service/image-service.js +91 -59
  271. package/image-service/imgproxy/imgproxy-image-service.d.ts +6 -8
  272. package/image-service/imgproxy/imgproxy-image-service.js +125 -86
  273. package/image-service/imgproxy/index.js +18 -1
  274. package/image-service/index.js +18 -1
  275. package/import.js +25 -2
  276. package/index.js +18 -1
  277. package/injector/decorators.d.ts +81 -0
  278. package/injector/decorators.js +126 -0
  279. package/injector/index.d.ts +11 -0
  280. package/injector/index.js +28 -0
  281. package/injector/inject.d.ts +85 -0
  282. package/injector/inject.js +106 -0
  283. package/injector/injector.d.ts +91 -0
  284. package/injector/injector.js +497 -0
  285. package/injector/interfaces.d.ts +16 -0
  286. package/injector/interfaces.js +26 -0
  287. package/injector/provider.d.ts +49 -0
  288. package/injector/provider.js +64 -0
  289. package/injector/resolve-chain.d.ts +31 -0
  290. package/injector/resolve-chain.js +113 -0
  291. package/injector/resolve.error.d.ts +5 -0
  292. package/injector/resolve.error.js +36 -0
  293. package/injector/symbols.d.ts +2 -0
  294. package/injector/symbols.js +26 -0
  295. package/injector/token.d.ts +25 -0
  296. package/injector/token.js +41 -0
  297. package/injector/type-info.d.ts +20 -0
  298. package/injector/type-info.js +16 -0
  299. package/injector/types.d.ts +49 -0
  300. package/injector/types.js +16 -0
  301. package/interfaces.js +16 -1
  302. package/json-path/index.js +18 -1
  303. package/json-path/json-path.js +138 -138
  304. package/key-value-store/index.js +19 -2
  305. package/key-value-store/key-value-store.provider.js +24 -1
  306. package/key-value-store/key-value.store.d.ts +3 -3
  307. package/key-value-store/key-value.store.js +29 -6
  308. package/key-value-store/mongo/index.js +23 -6
  309. package/key-value-store/mongo/module.js +35 -17
  310. package/key-value-store/mongo/mongo-key-value-store.provider.js +48 -20
  311. package/key-value-store/mongo/mongo-key-value.model.js +16 -1
  312. package/key-value-store/mongo/mongo-key-value.repository.d.ts +3 -3
  313. package/key-value-store/mongo/mongo-key-value.repository.js +52 -22
  314. package/key-value-store/mongo/mongo-key-value.store.js +89 -59
  315. package/key-value-store/mongo/tokens.d.ts +1 -1
  316. package/key-value-store/mongo/tokens.js +25 -2
  317. package/lock/index.js +19 -2
  318. package/lock/lock.d.ts +3 -2
  319. package/lock/lock.js +29 -5
  320. package/lock/mongo/index.js +22 -5
  321. package/lock/mongo/lock.js +135 -111
  322. package/lock/mongo/model.js +16 -1
  323. package/lock/mongo/module.js +37 -18
  324. package/lock/mongo/mongo-lock-repository.d.ts +3 -3
  325. package/lock/mongo/mongo-lock-repository.js +85 -56
  326. package/lock/mongo/provider.js +68 -38
  327. package/lock/provider.d.ts +3 -2
  328. package/lock/provider.js +25 -1
  329. package/lock/web/index.js +20 -3
  330. package/lock/web/module.js +31 -11
  331. package/lock/web/web-lock.js +105 -80
  332. package/lock/web/web-lock.provider.js +57 -27
  333. package/logger/console/index.js +18 -1
  334. package/logger/console/logger.js +80 -53
  335. package/logger/index.js +19 -2
  336. package/logger/level.js +31 -8
  337. package/logger/logger.d.ts +3 -2
  338. package/logger/logger.js +61 -37
  339. package/logger/noop/index.js +18 -1
  340. package/logger/noop/logger.js +42 -20
  341. package/mail/clients/nodemailer.mail-client.js +91 -62
  342. package/mail/index.js +22 -5
  343. package/mail/mail-log.repository.js +25 -2
  344. package/mail/mail.client.d.ts +3 -2
  345. package/mail/mail.client.js +63 -34
  346. package/mail/mail.service.js +106 -73
  347. package/mail/models/index.js +23 -6
  348. package/mail/models/mail-address.model.js +16 -1
  349. package/mail/models/mail-content.model.js +16 -1
  350. package/mail/models/mail-data.model.js +16 -1
  351. package/mail/models/mail-log.model.js +16 -1
  352. package/mail/models/mail-send-result.model.js +16 -1
  353. package/mail/models/mail-template.model.js +28 -5
  354. package/mail/module.js +41 -21
  355. package/mail/repositories/mongo-mail-log.repository.d.ts +3 -3
  356. package/mail/repositories/mongo-mail-log.repository.js +56 -24
  357. package/mail/tokens.d.ts +1 -1
  358. package/mail/tokens.js +25 -2
  359. package/memory/finalization.js +60 -36
  360. package/memory/index.js +19 -2
  361. package/memory/observable-finalization-registry.js +32 -9
  362. package/message-bus/broadcast-channel/broadcast-channel-message-bus-provider.js +53 -23
  363. package/message-bus/broadcast-channel/broadcast-channel-message-bus.d.ts +1 -1
  364. package/message-bus/broadcast-channel/broadcast-channel-message-bus.js +74 -46
  365. package/message-bus/broadcast-channel/index.js +20 -3
  366. package/message-bus/broadcast-channel/module.js +31 -11
  367. package/message-bus/index.js +20 -3
  368. package/message-bus/local/index.js +20 -3
  369. package/message-bus/local/local-message-bus-provider.js +65 -35
  370. package/message-bus/local/local-message-bus.d.ts +1 -1
  371. package/message-bus/local/local-message-bus.js +66 -38
  372. package/message-bus/local/module.js +31 -11
  373. package/message-bus/local/types.js +16 -1
  374. package/message-bus/message-bus-base.js +63 -41
  375. package/message-bus/message-bus-provider.js +24 -1
  376. package/message-bus/message-bus.d.ts +3 -3
  377. package/message-bus/message-bus.js +29 -5
  378. package/migration/index.d.ts +1 -1
  379. package/migration/index.js +20 -3
  380. package/migration/migration-state-repository.js +25 -2
  381. package/migration/migration-state.js +16 -1
  382. package/migration/migrator.js +108 -80
  383. package/migration/mongo/index.js +19 -2
  384. package/migration/mongo/migration-state-repository.d.ts +3 -3
  385. package/migration/mongo/migration-state-repository.js +53 -23
  386. package/migration/mongo/module.js +34 -15
  387. package/module/index.js +21 -4
  388. package/module/module-base.js +60 -37
  389. package/module/module-metric-reporter.js +77 -58
  390. package/module/module.js +34 -10
  391. package/module/modules/function.module.js +34 -11
  392. package/module/modules/index.js +19 -2
  393. package/module/modules/web-server.module.d.ts +5 -10
  394. package/module/modules/web-server.module.js +83 -67
  395. package/module/utils.js +43 -19
  396. package/notification/api.js +50 -21
  397. package/notification/models/index.js +19 -2
  398. package/notification/models/notification-channel-job.model.js +16 -1
  399. package/notification/models/notification.model.js +103 -74
  400. package/notification/module.js +28 -8
  401. package/notification/notification-channel.service.js +24 -1
  402. package/notification/notification.repository.js +24 -1
  403. package/notification/notification.service.js +58 -30
  404. package/object-storage/index.js +20 -3
  405. package/object-storage/object-storage-provider.js +24 -1
  406. package/object-storage/object-storage.d.ts +3 -3
  407. package/object-storage/object-storage.js +30 -6
  408. package/object-storage/object.js +30 -7
  409. package/object-storage/s3/index.js +20 -3
  410. package/object-storage/s3/s3.object-storage-provider.js +109 -82
  411. package/object-storage/s3/s3.object-storage.d.ts +2 -2
  412. package/object-storage/s3/s3.object-storage.js +157 -130
  413. package/object-storage/s3/s3.object.js +62 -39
  414. package/openid-connect/cached-oidc-configuration.service.js +65 -35
  415. package/openid-connect/index.d.ts +1 -1
  416. package/openid-connect/index.js +28 -11
  417. package/openid-connect/mongo-oidc-state.repository.d.ts +3 -3
  418. package/openid-connect/mongo-oidc-state.repository.js +65 -38
  419. package/openid-connect/oidc-configuration.service.js +66 -38
  420. package/openid-connect/oidc-state.model.js +16 -1
  421. package/openid-connect/oidc-state.repository.js +25 -2
  422. package/openid-connect/oidc.service-model.js +16 -1
  423. package/openid-connect/oidc.service.js +187 -157
  424. package/package.json +16 -16
  425. package/password/have-i-been-pwned.js +39 -21
  426. package/password/index.js +21 -4
  427. package/password/password-check-result.model.js +63 -34
  428. package/password/password-check.js +76 -46
  429. package/password/password-check.localization.js +111 -86
  430. package/pdf/index.js +18 -1
  431. package/pdf/pdf.service.d.ts +3 -3
  432. package/pdf/pdf.service.js +206 -171
  433. package/pool/index.js +18 -1
  434. package/pool/pool.js +133 -116
  435. package/process-shutdown.d.ts +2 -2
  436. package/process-shutdown.js +75 -54
  437. package/promise/cancelable-promise.js +41 -23
  438. package/promise/deferred-promise.js +92 -68
  439. package/promise/index.js +20 -3
  440. package/promise/lazy-promise.js +47 -24
  441. package/queue/enqueue-batch.js +41 -18
  442. package/queue/index.js +20 -3
  443. package/queue/mongo/index.js +21 -4
  444. package/queue/mongo/job.js +16 -1
  445. package/queue/mongo/mongo-job.repository.d.ts +3 -3
  446. package/queue/mongo/mongo-job.repository.js +70 -44
  447. package/queue/mongo/queue.js +265 -242
  448. package/queue/mongo/queue.provider.d.ts +3 -3
  449. package/queue/mongo/queue.provider.js +72 -44
  450. package/queue/provider.js +24 -1
  451. package/queue/queue.d.ts +3 -3
  452. package/queue/queue.js +41 -15
  453. package/random/index.js +19 -2
  454. package/random/number-generator/index.js +20 -3
  455. package/random/number-generator/mulberry32.js +51 -34
  456. package/random/number-generator/random-number-generator-function.js +24 -1
  457. package/random/number-generator/random-number-generator.js +31 -8
  458. package/random/number-generator/seeded-random-number-generator.js +28 -5
  459. package/random/number-generator/sfc32.js +64 -41
  460. package/random/number-generator/utils.js +25 -2
  461. package/random/series.js +43 -41
  462. package/reflection/decorator-data.js +80 -63
  463. package/reflection/decorators.js +69 -39
  464. package/reflection/index.js +22 -5
  465. package/reflection/reflection-data-map.js +55 -32
  466. package/reflection/registry.d.ts +0 -1
  467. package/reflection/registry.js +130 -111
  468. package/reflection/types.js +16 -1
  469. package/reflection/utils.js +124 -96
  470. package/require.js +26 -3
  471. package/rpc/endpoints/message-port.rpc-endpoint.js +48 -29
  472. package/rpc/index.js +21 -4
  473. package/rpc/model.js +30 -7
  474. package/rpc/rpc-endpoint.js +40 -17
  475. package/rpc/rpc-error.js +40 -17
  476. package/rpc/rpc.js +235 -223
  477. package/rxjs/cast.js +28 -4
  478. package/rxjs/index.d.ts +1 -0
  479. package/rxjs/index.js +30 -12
  480. package/rxjs/intersection-observer.js +48 -25
  481. package/rxjs/media-query.js +27 -8
  482. package/rxjs/mutation-observer.js +50 -28
  483. package/rxjs/noop.js +28 -4
  484. package/rxjs/performance-observer.js +60 -37
  485. package/rxjs/resize-observer.js +50 -28
  486. package/rxjs/retry-backoff.js +47 -23
  487. package/rxjs/slow-array.js +36 -22
  488. package/rxjs/start-with-provider.d.ts +2 -0
  489. package/rxjs/start-with-provider.js +29 -0
  490. package/rxjs/teardown.js +44 -21
  491. package/rxjs/timing.js +57 -26
  492. package/rxjs/touch.js +30 -11
  493. package/schema/array-constraints/index.js +19 -2
  494. package/schema/array-constraints/maximum-length.js +42 -19
  495. package/schema/array-constraints/minimum-length.js +42 -19
  496. package/schema/coercers/boolean.coercer.js +49 -25
  497. package/schema/coercers/date.coercer.js +38 -14
  498. package/schema/coercers/index.js +23 -6
  499. package/schema/coercers/number.coercer.js +36 -12
  500. package/schema/coercers/regexp.coercer.js +41 -18
  501. package/schema/coercers/string.coercer.js +36 -12
  502. package/schema/coercers/uint8-array.coercer.js +44 -20
  503. package/schema/constraints/enumeration.js +49 -27
  504. package/schema/constraints/generic.js +41 -21
  505. package/schema/constraints/index.js +29 -12
  506. package/schema/constraints/integer.js +44 -20
  507. package/schema/constraints/length.js +36 -14
  508. package/schema/constraints/literal.js +44 -22
  509. package/schema/constraints/maximum-date.js +46 -23
  510. package/schema/constraints/maximum-length.js +45 -22
  511. package/schema/constraints/maximum.js +44 -21
  512. package/schema/constraints/minimum-date.js +46 -23
  513. package/schema/constraints/minimum-length.js +45 -22
  514. package/schema/constraints/minimum.js +44 -21
  515. package/schema/constraints/pattern.js +46 -23
  516. package/schema/decorators/class.js +26 -4
  517. package/schema/decorators/coerce.js +26 -4
  518. package/schema/decorators/constraint.js +28 -6
  519. package/schema/decorators/index.js +23 -6
  520. package/schema/decorators/property.js +38 -16
  521. package/schema/decorators/types.js +16 -1
  522. package/schema/decorators/utils.js +73 -45
  523. package/schema/index.js +27 -10
  524. package/schema/schema.error.js +72 -59
  525. package/schema/schema.js +274 -256
  526. package/schema/schemas/any.js +30 -7
  527. package/schema/schemas/array.js +44 -21
  528. package/schema/schemas/assign.js +46 -23
  529. package/schema/schemas/boolean.js +30 -7
  530. package/schema/schemas/constraint.js +29 -6
  531. package/schema/schemas/date.js +43 -20
  532. package/schema/schemas/defaulted.js +31 -8
  533. package/schema/schemas/enumeration.js +38 -15
  534. package/schema/schemas/index.js +43 -26
  535. package/schema/schemas/instance.js +26 -4
  536. package/schema/schemas/literal.js +38 -15
  537. package/schema/schemas/nullable.js +30 -7
  538. package/schema/schemas/number.js +48 -25
  539. package/schema/schemas/object.js +34 -10
  540. package/schema/schemas/omit.js +37 -14
  541. package/schema/schemas/one-or-many.js +35 -13
  542. package/schema/schemas/optional.js +30 -6
  543. package/schema/schemas/partial.js +39 -16
  544. package/schema/schemas/pick.js +37 -14
  545. package/schema/schemas/readable-stream.js +30 -7
  546. package/schema/schemas/record.js +31 -9
  547. package/schema/schemas/regexp.js +30 -7
  548. package/schema/schemas/string.js +59 -36
  549. package/schema/schemas/transform.js +29 -6
  550. package/schema/schemas/uint8-array.js +50 -27
  551. package/schema/schemas/union.js +34 -11
  552. package/schema/schemas/unknown.js +30 -7
  553. package/schema/transformers/generic.js +39 -16
  554. package/schema/transformers/index.js +21 -4
  555. package/schema/transformers/lowercase.js +33 -10
  556. package/schema/transformers/trim.js +33 -10
  557. package/schema/transformers/uppercase.js +33 -10
  558. package/schema/types/index.js +22 -5
  559. package/schema/types/schema-array-constraint.js +24 -1
  560. package/schema/types/schema-value-coercer.js +24 -1
  561. package/schema/types/schema-value-constraint.js +24 -1
  562. package/schema/types/schema-value-transformer.js +24 -1
  563. package/schema/types/types.js +191 -161
  564. package/schema/utils/index.js +19 -2
  565. package/schema/utils/schema.js +142 -120
  566. package/schema/utils/value-type.js +74 -51
  567. package/search-index/elastic/config.d.ts +3 -3
  568. package/search-index/elastic/config.js +50 -19
  569. package/search-index/elastic/index.js +23 -6
  570. package/search-index/elastic/keyword-rewriter.js +40 -17
  571. package/search-index/elastic/model/elastic-query.js +16 -1
  572. package/search-index/elastic/model/index-mapping.js +26 -4
  573. package/search-index/elastic/model/index.js +20 -3
  574. package/search-index/elastic/model/sort.js +16 -1
  575. package/search-index/elastic/module.d.ts +1 -3
  576. package/search-index/elastic/module.js +69 -40
  577. package/search-index/elastic/query-builder/boolean-query-builder.js +69 -46
  578. package/search-index/elastic/query-builder/index.js +18 -1
  579. package/search-index/elastic/query-converter.js +192 -174
  580. package/search-index/elastic/search-index.d.ts +2 -2
  581. package/search-index/elastic/search-index.js +153 -132
  582. package/search-index/elastic/sort-converter.js +34 -12
  583. package/search-index/elastic/types.js +16 -1
  584. package/search-index/error.js +35 -12
  585. package/search-index/index.js +20 -3
  586. package/search-index/memory/index.js +18 -1
  587. package/search-index/memory/memory-search-index.js +152 -130
  588. package/search-index/search-index.js +53 -30
  589. package/search-index/search-result.js +16 -1
  590. package/serializer/handlers/binary.js +47 -19
  591. package/serializer/handlers/date.js +28 -4
  592. package/serializer/handlers/error.js +31 -7
  593. package/serializer/handlers/index.js +24 -7
  594. package/serializer/handlers/map.js +40 -16
  595. package/serializer/handlers/regex.js +31 -7
  596. package/serializer/handlers/register.js +59 -36
  597. package/serializer/handlers/set.js +37 -13
  598. package/serializer/index.js +30 -3
  599. package/serializer/serializable.js +68 -43
  600. package/serializer/serializer.js +264 -244
  601. package/serializer/types.js +34 -6
  602. package/signals/api.d.ts +1 -1
  603. package/signals/api.js +48 -17
  604. package/signals/computed-with-dependencies.js +31 -8
  605. package/signals/effect-with-dependencies.js +31 -8
  606. package/signals/implementation/api.js +33 -33
  607. package/signals/implementation/computed.js +104 -125
  608. package/signals/implementation/configure.js +41 -18
  609. package/signals/implementation/effect.js +66 -48
  610. package/signals/implementation/errors.js +29 -5
  611. package/signals/implementation/graph.js +136 -164
  612. package/signals/implementation/index.js +27 -10
  613. package/signals/implementation/signal.js +101 -91
  614. package/signals/implementation/to-observable.js +38 -21
  615. package/signals/implementation/to-signal.js +60 -44
  616. package/signals/implementation/untracked.js +31 -15
  617. package/signals/implementation/watch.js +73 -58
  618. package/signals/index.d.ts +2 -0
  619. package/signals/index.js +26 -7
  620. package/signals/lazylize.d.ts +2 -0
  621. package/signals/lazylize.js +28 -0
  622. package/signals/pipe.d.ts +1 -1
  623. package/signals/pipe.js +33 -7
  624. package/signals/switch-map.js +27 -4
  625. package/signals/to-signal-2.d.ts +14 -0
  626. package/signals/to-signal-2.js +67 -0
  627. package/signals/types.js +16 -1
  628. package/signals/untracked-operator.js +33 -11
  629. package/sse/index.js +19 -2
  630. package/sse/model.js +16 -1
  631. package/sse/server-sent-events-source.js +76 -54
  632. package/sse/server-sent-events.js +72 -48
  633. package/supports.js +32 -5
  634. package/templates/index.js +26 -9
  635. package/templates/module.d.ts +2 -2
  636. package/templates/module.js +47 -40
  637. package/templates/providers/file.template-provider.d.ts +3 -3
  638. package/templates/providers/file.template-provider.js +82 -39
  639. package/templates/providers/memory.template-provider.js +55 -27
  640. package/templates/renderers/handlebars.template-renderer.js +122 -84
  641. package/templates/renderers/jsx.template-renderer.js +56 -28
  642. package/templates/renderers/mjml.template-renderer.js +82 -42
  643. package/templates/renderers/string.template-renderer.js +52 -24
  644. package/templates/resolvers/file.template-resolver.d.ts +3 -3
  645. package/templates/resolvers/file.template-resolver.js +90 -45
  646. package/templates/resolvers/jsx.template-resolver.js +59 -29
  647. package/templates/resolvers/string.template-resolver.js +59 -29
  648. package/templates/template-renderer.provider.js +66 -36
  649. package/templates/template-resolver.provider.js +66 -36
  650. package/templates/template.model.js +69 -39
  651. package/templates/template.provider.js +24 -1
  652. package/templates/template.renderer.js +34 -11
  653. package/templates/template.resolver.js +24 -1
  654. package/templates/template.service.js +82 -49
  655. package/templates/tokens.d.ts +2 -2
  656. package/templates/tokens.js +27 -3
  657. package/templates/types/jsx.intrinsic-elements.js +16 -1
  658. package/text/dynamic-text.model.js +69 -41
  659. package/text/index.js +20 -3
  660. package/text/localizable-text.model.js +16 -1
  661. package/text/localization.service.js +229 -196
  662. package/theme/adapters/css-adapter.js +46 -23
  663. package/theme/adapters/tailwind-adapter.js +52 -29
  664. package/theme/index.js +18 -1
  665. package/theme/theme-service.d.ts +1 -1
  666. package/theme/theme-service.js +147 -107
  667. package/threading/index.js +19 -2
  668. package/threading/thread-pool.js +70 -48
  669. package/threading/thread-worker.js +26 -3
  670. package/tokens.d.ts +1 -1
  671. package/tokens.js +25 -2
  672. package/types/geo-json.js +16 -1
  673. package/types.js +16 -2
  674. package/utils/alphabet.js +35 -12
  675. package/utils/any-iterable-iterator.js +27 -4
  676. package/utils/array/array-backtracker.js +65 -42
  677. package/utils/array/array.js +79 -76
  678. package/utils/array/index.js +19 -2
  679. package/utils/async-iterable-helpers/all.js +46 -25
  680. package/utils/async-iterable-helpers/any.js +46 -25
  681. package/utils/async-iterable-helpers/assert.js +43 -22
  682. package/utils/async-iterable-helpers/batch.js +46 -26
  683. package/utils/async-iterable-helpers/buffer.js +64 -47
  684. package/utils/async-iterable-helpers/concat.js +27 -5
  685. package/utils/async-iterable-helpers/default-if-empty.js +32 -9
  686. package/utils/async-iterable-helpers/deferred.js +26 -3
  687. package/utils/async-iterable-helpers/difference.js +48 -24
  688. package/utils/async-iterable-helpers/distinct.js +44 -23
  689. package/utils/async-iterable-helpers/drain.js +26 -4
  690. package/utils/async-iterable-helpers/filter.js +44 -23
  691. package/utils/async-iterable-helpers/first-or-default.js +30 -8
  692. package/utils/async-iterable-helpers/first.js +30 -8
  693. package/utils/async-iterable-helpers/for-each.js +38 -18
  694. package/utils/async-iterable-helpers/group-single.js +26 -3
  695. package/utils/async-iterable-helpers/group-to-map.js +41 -20
  696. package/utils/async-iterable-helpers/group-to-single-map.js +44 -23
  697. package/utils/async-iterable-helpers/group.js +26 -3
  698. package/utils/async-iterable-helpers/includes.js +28 -7
  699. package/utils/async-iterable-helpers/index.js +65 -48
  700. package/utils/async-iterable-helpers/interrupt.js +43 -19
  701. package/utils/async-iterable-helpers/is-async-iterable.js +29 -5
  702. package/utils/async-iterable-helpers/last-or-default.js +36 -13
  703. package/utils/async-iterable-helpers/last.js +36 -13
  704. package/utils/async-iterable-helpers/map-many.js +40 -19
  705. package/utils/async-iterable-helpers/map.js +40 -19
  706. package/utils/async-iterable-helpers/materialize.js +42 -21
  707. package/utils/async-iterable-helpers/metadata.js +58 -38
  708. package/utils/async-iterable-helpers/multiplex.js +44 -23
  709. package/utils/async-iterable-helpers/observable-iterable.js +53 -31
  710. package/utils/async-iterable-helpers/pairwise.js +44 -26
  711. package/utils/async-iterable-helpers/parallel/feed.js +45 -24
  712. package/utils/async-iterable-helpers/parallel/filter.js +31 -8
  713. package/utils/async-iterable-helpers/parallel/for-each.js +44 -21
  714. package/utils/async-iterable-helpers/parallel/group.js +32 -9
  715. package/utils/async-iterable-helpers/parallel/index.js +24 -7
  716. package/utils/async-iterable-helpers/parallel/map.js +29 -6
  717. package/utils/async-iterable-helpers/parallel/tap.js +29 -6
  718. package/utils/async-iterable-helpers/parallel/types.js +16 -1
  719. package/utils/async-iterable-helpers/reduce.js +46 -31
  720. package/utils/async-iterable-helpers/retry.js +58 -43
  721. package/utils/async-iterable-helpers/single-or-default.js +40 -17
  722. package/utils/async-iterable-helpers/single.js +42 -19
  723. package/utils/async-iterable-helpers/skip.js +26 -3
  724. package/utils/async-iterable-helpers/sort.js +29 -6
  725. package/utils/async-iterable-helpers/take-until.js +49 -32
  726. package/utils/async-iterable-helpers/take-while.js +46 -29
  727. package/utils/async-iterable-helpers/take.js +33 -10
  728. package/utils/async-iterable-helpers/tap.js +40 -19
  729. package/utils/async-iterable-helpers/throttle.js +30 -9
  730. package/utils/async-iterable-helpers/to-array.js +33 -10
  731. package/utils/async-iterable-helpers/to-async-iterable-iterator.js +59 -40
  732. package/utils/async-iterable-helpers/to-async-iterator.js +54 -32
  733. package/utils/async-iterable-helpers/to-set.js +33 -10
  734. package/utils/async-iterable-helpers/to-sync-iterable.js +27 -6
  735. package/utils/async-iterable-helpers/types.js +16 -1
  736. package/utils/async-iterable-helpers/while.js +46 -25
  737. package/utils/async-iterator-iterable-iterator.js +62 -41
  738. package/utils/backoff.js +109 -109
  739. package/utils/base64.js +140 -153
  740. package/utils/benchmark.js +107 -114
  741. package/utils/binary-search.js +87 -70
  742. package/utils/binary.js +61 -50
  743. package/utils/cancellation-token.js +140 -120
  744. package/utils/clone.js +64 -43
  745. package/utils/comparison.js +98 -76
  746. package/utils/compression.js +118 -107
  747. package/utils/config-parser.js +48 -21
  748. package/utils/crc32.js +42 -20
  749. package/utils/cryptography.js +121 -163
  750. package/utils/date-time.js +138 -102
  751. package/utils/encoding.js +60 -62
  752. package/utils/enum.js +53 -27
  753. package/utils/equals.js +119 -103
  754. package/utils/event-loop.js +39 -19
  755. package/utils/factory-map.js +75 -53
  756. package/utils/feedable-async-iterable.js +70 -47
  757. package/utils/file-reader.js +41 -15
  758. package/utils/format-error.js +57 -36
  759. package/utils/format.js +53 -32
  760. package/utils/function/index.js +19 -2
  761. package/utils/function/memoize.js +53 -38
  762. package/utils/function/throttle.js +48 -26
  763. package/utils/helpers.js +102 -93
  764. package/utils/image.js +88 -62
  765. package/utils/index.js +65 -48
  766. package/utils/iterable-helpers/all.js +31 -8
  767. package/utils/iterable-helpers/any.js +31 -8
  768. package/utils/iterable-helpers/assert.js +30 -7
  769. package/utils/iterable-helpers/batch.js +34 -11
  770. package/utils/iterable-helpers/concat.js +27 -4
  771. package/utils/iterable-helpers/default-if-empty.js +32 -9
  772. package/utils/iterable-helpers/deferred.js +25 -2
  773. package/utils/iterable-helpers/difference.js +45 -21
  774. package/utils/iterable-helpers/distinct.js +32 -9
  775. package/utils/iterable-helpers/drain.js +26 -4
  776. package/utils/iterable-helpers/filter.js +30 -7
  777. package/utils/iterable-helpers/first-or-default.js +30 -8
  778. package/utils/iterable-helpers/first.js +30 -8
  779. package/utils/iterable-helpers/for-each.js +28 -5
  780. package/utils/iterable-helpers/group-single.js +26 -3
  781. package/utils/iterable-helpers/group-to-map.js +32 -9
  782. package/utils/iterable-helpers/group-to-single-map.js +33 -10
  783. package/utils/iterable-helpers/group.js +26 -3
  784. package/utils/iterable-helpers/includes.js +26 -3
  785. package/utils/iterable-helpers/index.js +56 -39
  786. package/utils/iterable-helpers/is-iterable.js +29 -5
  787. package/utils/iterable-helpers/last-or-default.js +36 -13
  788. package/utils/iterable-helpers/last.js +36 -13
  789. package/utils/iterable-helpers/map-many.js +29 -6
  790. package/utils/iterable-helpers/map.js +29 -6
  791. package/utils/iterable-helpers/materialize.js +25 -2
  792. package/utils/iterable-helpers/metadata.js +38 -16
  793. package/utils/iterable-helpers/pairwise.js +33 -11
  794. package/utils/iterable-helpers/range.js +27 -4
  795. package/utils/iterable-helpers/reduce.js +33 -11
  796. package/utils/iterable-helpers/single-or-default.js +37 -14
  797. package/utils/iterable-helpers/single.js +40 -17
  798. package/utils/iterable-helpers/skip.js +29 -6
  799. package/utils/iterable-helpers/sort.js +27 -4
  800. package/utils/iterable-helpers/take-until.js +31 -8
  801. package/utils/iterable-helpers/take-while.js +33 -10
  802. package/utils/iterable-helpers/take.js +33 -10
  803. package/utils/iterable-helpers/tap.js +29 -6
  804. package/utils/iterable-helpers/types.js +16 -1
  805. package/utils/iterable-helpers/while.js +31 -8
  806. package/utils/jwt.js +100 -77
  807. package/utils/map.js +62 -35
  808. package/utils/math.js +64 -102
  809. package/utils/merge.js +45 -26
  810. package/utils/middleware.js +60 -36
  811. package/utils/moving-metric.js +188 -155
  812. package/utils/noop.js +27 -4
  813. package/utils/object/decycle.js +78 -57
  814. package/utils/object/dereference.js +44 -46
  815. package/utils/object/forward-ref.js +73 -57
  816. package/utils/object/index.js +24 -7
  817. package/utils/object/lazy-property.js +96 -81
  818. package/utils/object/merge.js +70 -48
  819. package/utils/object/object.js +136 -106
  820. package/utils/object/property-name.js +72 -69
  821. package/utils/ordered-feedable-async-iterable.js +65 -42
  822. package/utils/patch-worker.js +90 -69
  823. package/utils/patterns.js +29 -7
  824. package/utils/periodic-reporter.js +82 -60
  825. package/utils/periodic-sampler.js +91 -67
  826. package/utils/provider-function-iterable.js +48 -26
  827. package/utils/proxy.js +42 -17
  828. package/utils/random.js +50 -40
  829. package/utils/reflection.js +41 -13
  830. package/utils/repl.js +33 -14
  831. package/utils/set.js +62 -36
  832. package/utils/singleton.js +41 -18
  833. package/utils/sort.js +77 -53
  834. package/utils/stream/finalize-stream.js +62 -43
  835. package/utils/stream/index.js +23 -6
  836. package/utils/stream/readable-stream-adapter.js +57 -35
  837. package/utils/stream/readable-stream-from-promise.js +28 -7
  838. package/utils/stream/size-limited-stream.js +35 -12
  839. package/utils/stream/stream-helper-types.js +16 -1
  840. package/utils/stream/stream-reader.js +52 -30
  841. package/utils/string/hypenate.js +25 -2
  842. package/utils/string/index.js +20 -3
  843. package/utils/string/title-case.js +26 -6
  844. package/utils/string/trim.js +32 -9
  845. package/utils/throw.js +30 -7
  846. package/utils/timer.js +91 -70
  847. package/utils/timing.js +80 -52
  848. package/utils/type-guards.js +1076 -253
  849. package/utils/type-of.js +43 -25
  850. package/utils/units.js +124 -53
  851. package/utils/url-builder.js +68 -47
  852. package/utils/value-or-provider.js +29 -6
  853. package/utils/z-base32.js +63 -42
  854. package/web-types.js +16 -1
  855. package/container/container.js +0 -428
  856. package/container/provider.js +0 -29
  857. package/container/resolve-chain.js +0 -80
  858. package/container/resolve.error.js +0 -11
  859. package/container/type-info.js +0 -1
  860. package/container/types.js +0 -1
  861. package/container/utils.js +0 -20
  862. package/data-structures/set.js +0 -56
  863. /package/{container → _container}/container.d.ts +0 -0
  864. /package/{container → _container}/provider.d.ts +0 -0
  865. /package/{container → _container}/resolve-chain.d.ts +0 -0
  866. /package/{container → _container}/resolve.error.d.ts +0 -0
  867. /package/{container → _container}/type-info.d.ts +0 -0
  868. /package/{container → _container}/types.d.ts +0 -0
  869. /package/{container → _container}/utils.d.ts +0 -0
@@ -1,3 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var to_signal_exports = {};
20
+ __export(to_signal_exports, {
21
+ toSignal: () => toSignal
22
+ });
23
+ module.exports = __toCommonJS(to_signal_exports);
24
+ var import_core = require("../../core.js");
25
+ var import_finalization = require("../../memory/finalization.js");
26
+ var import_computed = require("./computed.js");
27
+ var import_signal = require("./signal.js");
28
+ var import_untracked = require("./untracked.js");
1
29
  /**
2
30
  * @license
3
31
  * Copyright Google LLC All Rights Reserved.
@@ -5,51 +33,39 @@
5
33
  * Use of this source code is governed by an MIT-style license that can be
6
34
  * found in the LICENSE file at https://angular.io/license
7
35
  */
8
- import { isDevMode } from '../../core.js';
9
- import { registerFinalization } from '../../memory/finalization.js';
10
- import { computed } from './computed.js';
11
- import { signal } from './signal.js';
12
- import { untracked } from './untracked.js';
13
36
  var StateKind;
14
- (function (StateKind) {
15
- StateKind[StateKind["NoValue"] = 0] = "NoValue";
16
- StateKind[StateKind["Value"] = 1] = "Value";
17
- StateKind[StateKind["Error"] = 2] = "Error";
37
+ (function(StateKind2) {
38
+ StateKind2[StateKind2["NoValue"] = 0] = "NoValue";
39
+ StateKind2[StateKind2["Value"] = 1] = "Value";
40
+ StateKind2[StateKind2["Error"] = 2] = "Error";
18
41
  })(StateKind || (StateKind = {}));
19
- export function toSignal(source, options) {
20
- // Note: T is the Observable value type, and U is the initial value type. They don't have to be
21
- // the same - the returned signal gives values of type `T`.
22
- let state;
23
- if (options?.requireSync) {
24
- // Initially the signal is in a `NoValue` state.
25
- state = signal({ kind: StateKind.NoValue });
42
+ function toSignal(source, options) {
43
+ let state;
44
+ if (options?.requireSync) {
45
+ state = (0, import_signal.signal)({ kind: StateKind.NoValue });
46
+ } else {
47
+ state = (0, import_signal.signal)({ kind: StateKind.Value, value: options?.initialValue });
48
+ }
49
+ const sub = source.subscribe({
50
+ next: (value) => state.set({ kind: StateKind.Value, value }),
51
+ error: (error) => state.set({ kind: StateKind.Error, error })
52
+ // Completion of the Observable is meaningless to the signal. Signals don't have a concept of
53
+ // "complete".
54
+ });
55
+ if ((0, import_core.isDevMode)() && options?.requireSync && (0, import_untracked.untracked)(state).kind === StateKind.NoValue) {
56
+ throw new Error("`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.");
57
+ }
58
+ const result = (0, import_computed.computed)(() => {
59
+ const current = state();
60
+ switch (current.kind) {
61
+ case StateKind.Value:
62
+ return current.value;
63
+ case StateKind.Error:
64
+ throw current.error;
65
+ case StateKind.NoValue:
66
+ throw new Error("`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.");
26
67
  }
27
- else {
28
- // If an initial value was passed, use it. Otherwise, use `undefined` as the initial value.
29
- state = signal({ kind: StateKind.Value, value: options?.initialValue });
30
- }
31
- const sub = source.subscribe({
32
- next: value => state.set({ kind: StateKind.Value, value }),
33
- error: error => state.set({ kind: StateKind.Error, error }),
34
- // Completion of the Observable is meaningless to the signal. Signals don't have a concept of
35
- // "complete".
36
- });
37
- if (isDevMode() && options?.requireSync && untracked(state).kind === StateKind.NoValue) {
38
- throw new Error('`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.');
39
- }
40
- // The actual returned signal is a `computed` of the `State` signal, which maps the various states
41
- // to either values or errors.
42
- const result = computed(() => {
43
- const current = state();
44
- switch (current.kind) {
45
- case StateKind.Value:
46
- return current.value;
47
- case StateKind.Error:
48
- throw current.error;
49
- case StateKind.NoValue:
50
- throw new Error('`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.');
51
- }
52
- });
53
- registerFinalization(result, () => sub.unsubscribe());
54
- return result;
68
+ });
69
+ (0, import_finalization.registerFinalization)(result, () => sub.unsubscribe());
70
+ return result;
55
71
  }
@@ -1,3 +1,27 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var untracked_exports = {};
20
+ __export(untracked_exports, {
21
+ untracked: () => untracked
22
+ });
23
+ module.exports = __toCommonJS(untracked_exports);
24
+ var import_graph = require("./graph.js");
1
25
  /**
2
26
  * @license
3
27
  * Copyright Google LLC All Rights Reserved.
@@ -5,19 +29,11 @@
5
29
  * Use of this source code is governed by an MIT-style license that can be
6
30
  * found in the LICENSE file at https://angular.io/license
7
31
  */
8
- import { setActiveConsumer } from './graph.js';
9
- /**
10
- * Execute an arbitrary function in a non-reactive (non-tracking) context. The executed function
11
- * can, optionally, return a value.
12
- */
13
- export function untracked(nonReactiveReadsFn) {
14
- const prevConsumer = setActiveConsumer(null);
15
- // We are not trying to catch any particular errors here, just making sure that the consumers
16
- // stack is restored in case of errors.
17
- try {
18
- return nonReactiveReadsFn();
19
- }
20
- finally {
21
- setActiveConsumer(prevConsumer);
22
- }
32
+ function untracked(nonReactiveReadsFn) {
33
+ const prevConsumer = (0, import_graph.setActiveConsumer)(null);
34
+ try {
35
+ return nonReactiveReadsFn();
36
+ } finally {
37
+ (0, import_graph.setActiveConsumer)(prevConsumer);
38
+ }
23
39
  }
@@ -1,3 +1,27 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var watch_exports = {};
20
+ __export(watch_exports, {
21
+ Watch: () => Watch
22
+ });
23
+ module.exports = __toCommonJS(watch_exports);
24
+ var import_graph = require("./graph.js");
1
25
  /**
2
26
  * @license
3
27
  * Copyright Google LLC All Rights Reserved.
@@ -5,65 +29,56 @@
5
29
  * Use of this source code is governed by an MIT-style license that can be
6
30
  * found in the LICENSE file at https://angular.io/license
7
31
  */
8
- import { ReactiveNode, setActiveConsumer } from './graph.js';
9
- const NOOP_CLEANUP_FN = () => { };
10
- /**
11
- * Watches a reactive expression and allows it to be scheduled to re-run
12
- * when any dependencies notify of a change.
13
- *
14
- * `Watch` doesn't run reactive expressions itself, but relies on a consumer-
15
- * provided scheduling operation to coordinate calling `Watch.run()`.
16
- */
17
- export class Watch extends ReactiveNode {
18
- watch;
19
- schedule;
20
- consumerAllowSignalWrites;
21
- dirty = false;
22
- cleanupFn = NOOP_CLEANUP_FN;
23
- registerOnCleanup = (cleanupFn) => {
24
- this.cleanupFn = cleanupFn;
25
- };
26
- constructor(watch, schedule, allowSignalWrites) {
27
- super();
28
- this.watch = watch;
29
- this.schedule = schedule;
30
- this.consumerAllowSignalWrites = allowSignalWrites;
31
- }
32
- notify() {
33
- if (!this.dirty) {
34
- this.schedule(this);
35
- }
36
- this.dirty = true;
37
- }
38
- onConsumerDependencyMayHaveChanged() {
39
- this.notify();
40
- }
41
- onProducerUpdateValueVersion() {
42
- // Watches are not producers.
32
+ const NOOP_CLEANUP_FN = () => {
33
+ };
34
+ class Watch extends import_graph.ReactiveNode {
35
+ watch;
36
+ schedule;
37
+ consumerAllowSignalWrites;
38
+ dirty = false;
39
+ cleanupFn = NOOP_CLEANUP_FN;
40
+ registerOnCleanup = (cleanupFn) => {
41
+ this.cleanupFn = cleanupFn;
42
+ };
43
+ constructor(watch, schedule, allowSignalWrites) {
44
+ super();
45
+ this.watch = watch;
46
+ this.schedule = schedule;
47
+ this.consumerAllowSignalWrites = allowSignalWrites;
48
+ }
49
+ notify() {
50
+ if (!this.dirty) {
51
+ this.schedule(this);
43
52
  }
44
- /**
45
- * Execute the reactive expression in the context of this `Watch` consumer.
46
- *
47
- * Should be called by the user scheduling algorithm when the provided
48
- * `schedule` hook is called by `Watch`.
49
- */
50
- run() {
51
- this.dirty = false;
52
- if (this.trackingVersion !== 0 && !this.consumerPollProducersForChange()) {
53
- return;
54
- }
55
- const prevConsumer = setActiveConsumer(this);
56
- this.trackingVersion++;
57
- try {
58
- this.cleanupFn();
59
- this.cleanupFn = NOOP_CLEANUP_FN;
60
- this.watch(this.registerOnCleanup);
61
- }
62
- finally {
63
- setActiveConsumer(prevConsumer);
64
- }
53
+ this.dirty = true;
54
+ }
55
+ onConsumerDependencyMayHaveChanged() {
56
+ this.notify();
57
+ }
58
+ onProducerUpdateValueVersion() {
59
+ }
60
+ /**
61
+ * Execute the reactive expression in the context of this `Watch` consumer.
62
+ *
63
+ * Should be called by the user scheduling algorithm when the provided
64
+ * `schedule` hook is called by `Watch`.
65
+ */
66
+ run() {
67
+ this.dirty = false;
68
+ if (this.trackingVersion !== 0 && !this.consumerPollProducersForChange()) {
69
+ return;
65
70
  }
66
- cleanup() {
67
- this.cleanupFn();
71
+ const prevConsumer = (0, import_graph.setActiveConsumer)(this);
72
+ this.trackingVersion++;
73
+ try {
74
+ this.cleanupFn();
75
+ this.cleanupFn = NOOP_CLEANUP_FN;
76
+ this.watch(this.registerOnCleanup);
77
+ } finally {
78
+ (0, import_graph.setActiveConsumer)(prevConsumer);
68
79
  }
80
+ }
81
+ cleanup() {
82
+ this.cleanupFn();
83
+ }
69
84
  }
@@ -1,7 +1,9 @@
1
1
  export * from './api.js';
2
2
  export * from './computed-with-dependencies.js';
3
3
  export * from './effect-with-dependencies.js';
4
+ export * from './lazylize.js';
4
5
  export * from './pipe.js';
5
6
  export * from './switch-map.js';
7
+ export * from './to-signal-2.js';
6
8
  export * from './types.js';
7
9
  export * from './untracked-operator.js';
package/signals/index.js CHANGED
@@ -1,7 +1,26 @@
1
- export * from './api.js';
2
- export * from './computed-with-dependencies.js';
3
- export * from './effect-with-dependencies.js';
4
- export * from './pipe.js';
5
- export * from './switch-map.js';
6
- export * from './types.js';
7
- export * from './untracked-operator.js';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var signals_exports = {};
17
+ module.exports = __toCommonJS(signals_exports);
18
+ __reExport(signals_exports, require("./api.js"), module.exports);
19
+ __reExport(signals_exports, require("./computed-with-dependencies.js"), module.exports);
20
+ __reExport(signals_exports, require("./effect-with-dependencies.js"), module.exports);
21
+ __reExport(signals_exports, require("./lazylize.js"), module.exports);
22
+ __reExport(signals_exports, require("./pipe.js"), module.exports);
23
+ __reExport(signals_exports, require("./switch-map.js"), module.exports);
24
+ __reExport(signals_exports, require("./to-signal-2.js"), module.exports);
25
+ __reExport(signals_exports, require("./types.js"), module.exports);
26
+ __reExport(signals_exports, require("./untracked-operator.js"), module.exports);
@@ -0,0 +1,2 @@
1
+ import { type Signal } from './api.js';
2
+ export declare function lazylize<T>(signalProvider: () => Signal<T>): Signal<T>;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var lazylize_exports = {};
20
+ __export(lazylize_exports, {
21
+ lazylize: () => lazylize
22
+ });
23
+ module.exports = __toCommonJS(lazylize_exports);
24
+ var import_api = require("./api.js");
25
+ function lazylize(signalProvider) {
26
+ let source;
27
+ return (0, import_api.computed)(() => (source ??= (0, import_api.untracked)(() => signalProvider()))());
28
+ }
package/signals/pipe.d.ts CHANGED
@@ -16,7 +16,7 @@ export declare function pipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1:
16
16
  export declare function pipe<T, A, B, C, D, E, F, G, H, I>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Signal<I>;
17
17
  export declare function pipe(source: Signal<unknown>, ...operators: OperatorFunction<unknown, unknown>[]): Signal<unknown>;
18
18
  /**
19
- * As we need an synchronous value for the resulting signal and effect scheduling is async, you have to provide an immediate value on subscription, for example via the {@link startWith} operator, otherwise an error is thrown.
19
+ * As we need an synchronous value for the resulting signal and effect scheduling is async, you have to provide an immediate value on subscription, for example via the `startWith` operator, otherwise an error is thrown.
20
20
  */
21
21
  export declare function rawPipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A>): Signal<A>;
22
22
  export declare function rawPipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Signal<B>;
package/signals/pipe.js CHANGED
@@ -1,9 +1,35 @@
1
- import { distinctUntilChanged, startWith } from 'rxjs';
2
- import { toObservable, toSignal } from './api.js';
3
- export function pipe(source, ...operators) {
4
- return rawPipe(source, startWith(source()), distinctUntilChanged(), ...operators);
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var pipe_exports = {};
20
+ __export(pipe_exports, {
21
+ pipe: () => pipe,
22
+ rawPipe: () => rawPipe
23
+ });
24
+ module.exports = __toCommonJS(pipe_exports);
25
+ var import_rxjs = require("rxjs");
26
+ var import_start_with_provider = require("../rxjs/start-with-provider.js");
27
+ var import_api = require("./api.js");
28
+ var import_to_signal_2 = require("./to-signal-2.js");
29
+ function pipe(source, ...operators) {
30
+ return rawPipe(source, (0, import_start_with_provider.startWithProvider)(source), (0, import_rxjs.distinctUntilChanged)(), ...operators);
5
31
  }
6
- export function rawPipe(source, ...operators) {
7
- const piped = toObservable(source).pipe(...operators);
8
- return toSignal(piped, { requireSync: true });
32
+ function rawPipe(source, ...operators) {
33
+ const piped = (0, import_api.toObservable)(source).pipe(...operators);
34
+ return (0, import_to_signal_2.toSignal2)(piped, { requireSync: true });
9
35
  }
@@ -1,5 +1,28 @@
1
- import { computed } from './api.js';
2
- export function switchMap(source) {
3
- const outerSource = computed(() => source());
4
- return computed(() => outerSource()());
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var switch_map_exports = {};
20
+ __export(switch_map_exports, {
21
+ switchMap: () => switchMap
22
+ });
23
+ module.exports = __toCommonJS(switch_map_exports);
24
+ var import_api = require("./api.js");
25
+ function switchMap(source) {
26
+ const outerSource = (0, import_api.computed)(() => source());
27
+ return (0, import_api.computed)(() => outerSource()());
5
28
  }
@@ -0,0 +1,14 @@
1
+ import type { Subscribable } from 'rxjs';
2
+ import type { Signal, ToSignalOptions } from './api.js';
3
+ export type ToSignal2Options<T> = ToSignalOptions<T> & {
4
+ /** defer subscription until signal is used */
5
+ lazy?: boolean;
6
+ };
7
+ /** like `toSignal`, except that it uses untracked internal operations (required for some scenarios, but might be less safe in terms of bugs catching) and has the ability to subscribe lazily */
8
+ export declare function toSignal2<T>(source: Subscribable<T>): Signal<T | undefined>;
9
+ export declare function toSignal2<T>(source: Subscribable<T>, options: ToSignal2Options<undefined> & {
10
+ requireSync: true;
11
+ }): Signal<T>;
12
+ export declare function toSignal2<T, const I = undefined>(source: Subscribable<T>, options: ToSignal2Options<I> & {
13
+ requireSync?: false;
14
+ }): Signal<T | I>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var to_signal_2_exports = {};
20
+ __export(to_signal_2_exports, {
21
+ toSignal2: () => toSignal2
22
+ });
23
+ module.exports = __toCommonJS(to_signal_2_exports);
24
+ var import_core = require("../core.js");
25
+ var import_finalization = require("../memory/finalization.js");
26
+ var import_type_guards = require("../utils/type-guards.js");
27
+ var import_api = require("./api.js");
28
+ var StateKind;
29
+ (function(StateKind2) {
30
+ StateKind2[StateKind2["NoValue"] = 0] = "NoValue";
31
+ StateKind2[StateKind2["Value"] = 1] = "Value";
32
+ StateKind2[StateKind2["Error"] = 2] = "Error";
33
+ })(StateKind || (StateKind = {}));
34
+ function toSignal2(source, options) {
35
+ const initialState = options?.requireSync == true ? { kind: StateKind.NoValue } : { kind: StateKind.Value, value: options?.initialValue };
36
+ const state = (0, import_api.signal)(initialState);
37
+ let subscription;
38
+ if (options?.lazy != true) {
39
+ subscription = subscribe(source, state, options);
40
+ }
41
+ const result = (0, import_api.computed)(() => {
42
+ if ((0, import_type_guards.isUndefined)(subscription)) {
43
+ subscription = subscribe(source, state, options);
44
+ }
45
+ const current = state();
46
+ switch (current.kind) {
47
+ case StateKind.Value:
48
+ return current.value;
49
+ case StateKind.Error:
50
+ throw current.error;
51
+ case StateKind.NoValue:
52
+ throw new Error("`toSignalLazy()` called with `requireSync` but `Observable` did not emit synchronously.");
53
+ }
54
+ });
55
+ (0, import_finalization.registerFinalization)(result, () => subscription?.unsubscribe());
56
+ return result;
57
+ }
58
+ function subscribe(source, state, options) {
59
+ const subscription = source.subscribe({
60
+ next: (value) => (0, import_api.untracked)(() => state.set({ kind: StateKind.Value, value })),
61
+ error: (error) => (0, import_api.untracked)(() => state.set({ kind: StateKind.Error, error }))
62
+ });
63
+ if ((0, import_core.isDevMode)() && options?.requireSync == true && (0, import_api.untracked)(state).kind == StateKind.NoValue) {
64
+ throw new Error("`toSignal()` called with `requireSync` but `Observable` did not emit synchronously.");
65
+ }
66
+ return subscription;
67
+ }
package/signals/types.js CHANGED
@@ -1 +1,16 @@
1
- export {};
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -1,12 +1,34 @@
1
- import { Observable } from 'rxjs';
2
- import { untracked } from './api.js';
3
- /** wraps observer in {@link untracked} */
4
- export function runInUntracked() {
5
- return function runInUntracked(source) {
6
- return new Observable((subscriber) => source.subscribe({
7
- next: (state) => untracked(() => subscriber.next(state)),
8
- complete: () => untracked(() => subscriber.complete()),
9
- error: (error) => untracked(() => subscriber.error(error))
10
- }));
11
- };
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var untracked_operator_exports = {};
20
+ __export(untracked_operator_exports, {
21
+ runInUntracked: () => runInUntracked
22
+ });
23
+ module.exports = __toCommonJS(untracked_operator_exports);
24
+ var import_rxjs = require("rxjs");
25
+ var import_api = require("./api.js");
26
+ function runInUntracked() {
27
+ return function runInUntracked2(source) {
28
+ return new import_rxjs.Observable((subscriber) => source.subscribe({
29
+ next: (state) => (0, import_api.untracked)(() => subscriber.next(state)),
30
+ complete: () => (0, import_api.untracked)(() => subscriber.complete()),
31
+ error: (error) => (0, import_api.untracked)(() => subscriber.error(error))
32
+ }));
33
+ };
12
34
  }
package/sse/index.js CHANGED
@@ -1,2 +1,19 @@
1
- export * from './server-sent-events-source.js';
2
- export * from './server-sent-events.js';
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
+ var sse_exports = {};
17
+ module.exports = __toCommonJS(sse_exports);
18
+ __reExport(sse_exports, require("./server-sent-events-source.js"), module.exports);
19
+ __reExport(sse_exports, require("./server-sent-events.js"), module.exports);