@ariestools/sdk 7.0.3

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 (409) hide show
  1. package/LICENSE +165 -0
  2. package/README.md +45 -0
  3. package/dist/_pkg/api/neutral/ApiClient.d.ts +10 -0
  4. package/dist/_pkg/api/neutral/ApiConfig.d.ts +9 -0
  5. package/dist/_pkg/api/neutral/ApiEndpoint.d.ts +19 -0
  6. package/dist/_pkg/api/neutral/ApiStage.d.ts +11 -0
  7. package/dist/_pkg/api/neutral/getApiStage.d.ts +8 -0
  8. package/dist/_pkg/api/neutral/index.d.ts +6 -0
  9. package/dist/_pkg/api/neutral/index.mjs +78 -0
  10. package/dist/_pkg/api/neutral/model.d.ts +3 -0
  11. package/dist/_pkg/api/neutral/model.mjs +1 -0
  12. package/dist/_pkg/array/neutral/containsAll.d.ts +8 -0
  13. package/dist/_pkg/array/neutral/distinct.d.ts +6 -0
  14. package/dist/_pkg/array/neutral/filterAs.d.ts +8 -0
  15. package/dist/_pkg/array/neutral/filterAsync.d.ts +9 -0
  16. package/dist/_pkg/array/neutral/findAs.d.ts +15 -0
  17. package/dist/_pkg/array/neutral/flatten.d.ts +8 -0
  18. package/dist/_pkg/array/neutral/index.d.ts +8 -0
  19. package/dist/_pkg/array/neutral/index.mjs +80 -0
  20. package/dist/_pkg/array/neutral/uniq.d.ts +14 -0
  21. package/dist/_pkg/arraybuffer/neutral/equalArrayBuffers.d.ts +8 -0
  22. package/dist/_pkg/arraybuffer/neutral/index.d.ts +5 -0
  23. package/dist/_pkg/arraybuffer/neutral/index.mjs +74 -0
  24. package/dist/_pkg/arraybuffer/neutral/isArrayBuffer.d.ts +7 -0
  25. package/dist/_pkg/arraybuffer/neutral/toArrayBuffer.d.ts +11 -0
  26. package/dist/_pkg/arraybuffer/neutral/toUint8Array.d.ts +11 -0
  27. package/dist/_pkg/assert/neutral/assertDefinedEx.d.ts +41 -0
  28. package/dist/_pkg/assert/neutral/assertEx.d.ts +41 -0
  29. package/dist/_pkg/assert/neutral/index.d.ts +4 -0
  30. package/dist/_pkg/assert/neutral/index.mjs +30 -0
  31. package/dist/_pkg/assert/neutral/model.d.ts +2 -0
  32. package/dist/_pkg/assert/neutral/model.mjs +1 -0
  33. package/dist/_pkg/assert/neutral/types.d.ts +36 -0
  34. package/dist/_pkg/base/neutral/Base.d.ts +53 -0
  35. package/dist/_pkg/base/neutral/UniqueBase.d.ts +10 -0
  36. package/dist/_pkg/base/neutral/globallyUnique.d.ts +21 -0
  37. package/dist/_pkg/base/neutral/index.d.ts +4 -0
  38. package/dist/_pkg/base/neutral/index.mjs +164 -0
  39. package/dist/_pkg/base/neutral/model.d.ts +2 -0
  40. package/dist/_pkg/base/neutral/model.mjs +1 -0
  41. package/dist/_pkg/creatable/neutral/AbstractCreatable.d.ts +123 -0
  42. package/dist/_pkg/creatable/neutral/Creatable.d.ts +49 -0
  43. package/dist/_pkg/creatable/neutral/Factory.d.ts +28 -0
  44. package/dist/_pkg/creatable/neutral/index.d.ts +5 -0
  45. package/dist/_pkg/creatable/neutral/index.mjs +396 -0
  46. package/dist/_pkg/creatable/neutral/lib/getFunctionName.d.ts +7 -0
  47. package/dist/_pkg/creatable/neutral/lib/getRootFunction.d.ts +8 -0
  48. package/dist/_pkg/creatable/neutral/lib/index.d.ts +3 -0
  49. package/dist/_pkg/creatable/neutral/model/CreatableInstance.d.ts +16 -0
  50. package/dist/_pkg/creatable/neutral/model/CreatableParams.d.ts +16 -0
  51. package/dist/_pkg/creatable/neutral/model/CreatableStatusReporter.d.ts +15 -0
  52. package/dist/_pkg/creatable/neutral/model/Labels.d.ts +24 -0
  53. package/dist/_pkg/creatable/neutral/model/index.d.ts +5 -0
  54. package/dist/_pkg/creatable/neutral/model.d.ts +3 -0
  55. package/dist/_pkg/creatable/neutral/model.mjs +1 -0
  56. package/dist/_pkg/decimal-precision/neutral/fromFixedPoint.d.ts +8 -0
  57. package/dist/_pkg/decimal-precision/neutral/index.d.ts +4 -0
  58. package/dist/_pkg/decimal-precision/neutral/index.mjs +39 -0
  59. package/dist/_pkg/decimal-precision/neutral/toDecimalPrecision.d.ts +8 -0
  60. package/dist/_pkg/decimal-precision/neutral/toFixedPoint.d.ts +8 -0
  61. package/dist/_pkg/delay/neutral/delay.d.ts +7 -0
  62. package/dist/_pkg/delay/neutral/index.d.ts +2 -0
  63. package/dist/_pkg/delay/neutral/index.mjs +9 -0
  64. package/dist/_pkg/ellipsize/neutral/index.d.ts +8 -0
  65. package/dist/_pkg/ellipsize/neutral/index.mjs +10 -0
  66. package/dist/_pkg/enum/neutral/Enum.d.ts +88 -0
  67. package/dist/_pkg/enum/neutral/index.d.ts +2 -0
  68. package/dist/_pkg/enum/neutral/index.mjs +8 -0
  69. package/dist/_pkg/enum/neutral/model.d.ts +2 -0
  70. package/dist/_pkg/enum/neutral/model.mjs +1 -0
  71. package/dist/_pkg/error/neutral/assert.d.ts +12 -0
  72. package/dist/_pkg/error/neutral/handleError.d.ts +15 -0
  73. package/dist/_pkg/error/neutral/index.d.ts +3 -0
  74. package/dist/_pkg/error/neutral/index.mjs +32 -0
  75. package/dist/_pkg/error/neutral/model.d.ts +2 -0
  76. package/dist/_pkg/error/neutral/model.mjs +1 -0
  77. package/dist/_pkg/events/neutral/BaseEmitter.d.ts +74 -0
  78. package/dist/_pkg/events/neutral/Events/Events.d.ts +132 -0
  79. package/dist/_pkg/events/neutral/Events/index.d.ts +2 -0
  80. package/dist/_pkg/events/neutral/index.d.ts +4 -0
  81. package/dist/_pkg/events/neutral/index.mjs +415 -0
  82. package/dist/_pkg/events/neutral/model/Event.d.ts +21 -0
  83. package/dist/_pkg/events/neutral/model/EventEmitter.d.ts +25 -0
  84. package/dist/_pkg/events/neutral/model/index.d.ts +3 -0
  85. package/dist/_pkg/events/neutral/model.d.ts +3 -0
  86. package/dist/_pkg/events/neutral/model.mjs +1 -0
  87. package/dist/_pkg/exists/neutral/index.d.ts +10 -0
  88. package/dist/_pkg/exists/neutral/index.mjs +8 -0
  89. package/dist/_pkg/fetch/neutral/FetchClient.d.ts +46 -0
  90. package/dist/_pkg/fetch/neutral/FetchError.d.ts +80 -0
  91. package/dist/_pkg/fetch/neutral/FetchJsonClient.d.ts +19 -0
  92. package/dist/_pkg/fetch/neutral/fetchCompress.d.ts +12 -0
  93. package/dist/_pkg/fetch/neutral/fetchJson.d.ts +7 -0
  94. package/dist/_pkg/fetch/neutral/index.d.ts +11 -0
  95. package/dist/_pkg/fetch/neutral/index.mjs +365 -0
  96. package/dist/_pkg/fetch/neutral/methods.d.ts +12 -0
  97. package/dist/_pkg/fetch/neutral/model.d.ts +5 -0
  98. package/dist/_pkg/fetch/neutral/model.mjs +1 -0
  99. package/dist/_pkg/fetch/neutral/parseJson.d.ts +16 -0
  100. package/dist/_pkg/fetch/neutral/types.d.ts +12 -0
  101. package/dist/_pkg/forget/neutral/ForgetConfig.d.ts +21 -0
  102. package/dist/_pkg/forget/neutral/ForgetNodeConfig.d.ts +13 -0
  103. package/dist/_pkg/forget/neutral/ForgetPromise.d.ts +49 -0
  104. package/dist/_pkg/forget/neutral/ForgetPromiseNode.d.ts +15 -0
  105. package/dist/_pkg/forget/neutral/forget.d.ts +10 -0
  106. package/dist/_pkg/forget/neutral/forgetNode.d.ts +9 -0
  107. package/dist/_pkg/forget/neutral/index.d.ts +2 -0
  108. package/dist/_pkg/forget/neutral/index.mjs +162 -0
  109. package/dist/_pkg/forget/neutral/model.d.ts +3 -0
  110. package/dist/_pkg/forget/neutral/model.mjs +1 -0
  111. package/dist/_pkg/forget/neutral/neutral/index.d.ts +4 -0
  112. package/dist/_pkg/forget/neutral/node/index.d.ts +4 -0
  113. package/dist/_pkg/function-name/neutral/functionName.d.ts +7 -0
  114. package/dist/_pkg/function-name/neutral/index.d.ts +2 -0
  115. package/dist/_pkg/function-name/neutral/index.mjs +27 -0
  116. package/dist/_pkg/hex/neutral/HexRegEx.d.ts +19 -0
  117. package/dist/_pkg/hex/neutral/address/AddressTransformZod.d.ts +10 -0
  118. package/dist/_pkg/hex/neutral/address/AddressValidationZod.d.ts +10 -0
  119. package/dist/_pkg/hex/neutral/address/address.d.ts +18 -0
  120. package/dist/_pkg/hex/neutral/address/as.d.ts +13 -0
  121. package/dist/_pkg/hex/neutral/address/index.d.ts +7 -0
  122. package/dist/_pkg/hex/neutral/address/is.d.ts +12 -0
  123. package/dist/_pkg/hex/neutral/address/to.d.ts +12 -0
  124. package/dist/_pkg/hex/neutral/ethAddress.d.ts +45 -0
  125. package/dist/_pkg/hex/neutral/hash/as.d.ts +11 -0
  126. package/dist/_pkg/hex/neutral/hash/hash.d.ts +28 -0
  127. package/dist/_pkg/hex/neutral/hash/index.d.ts +5 -0
  128. package/dist/_pkg/hex/neutral/hash/is.d.ts +9 -0
  129. package/dist/_pkg/hex/neutral/hash/zod.d.ts +6 -0
  130. package/dist/_pkg/hex/neutral/hex/as.d.ts +11 -0
  131. package/dist/_pkg/hex/neutral/hex/from/from.d.ts +8 -0
  132. package/dist/_pkg/hex/neutral/hex/from/fromArrayBuffer.d.ts +8 -0
  133. package/dist/_pkg/hex/neutral/hex/from/fromBigInt.d.ts +8 -0
  134. package/dist/_pkg/hex/neutral/hex/from/fromHexString.d.ts +9 -0
  135. package/dist/_pkg/hex/neutral/hex/from/fromNumber.d.ts +9 -0
  136. package/dist/_pkg/hex/neutral/hex/from/index.d.ts +6 -0
  137. package/dist/_pkg/hex/neutral/hex/hex.d.ts +17 -0
  138. package/dist/_pkg/hex/neutral/hex/index.d.ts +9 -0
  139. package/dist/_pkg/hex/neutral/hex/is.d.ts +9 -0
  140. package/dist/_pkg/hex/neutral/hex/isHexZero.d.ts +7 -0
  141. package/dist/_pkg/hex/neutral/hex/legacy.d.ts +7 -0
  142. package/dist/_pkg/hex/neutral/hex/nibble.d.ts +13 -0
  143. package/dist/_pkg/hex/neutral/hex/to.d.ts +8 -0
  144. package/dist/_pkg/hex/neutral/hexToBigInt.d.ts +8 -0
  145. package/dist/_pkg/hex/neutral/index.d.ts +8 -0
  146. package/dist/_pkg/hex/neutral/index.mjs +381 -0
  147. package/dist/_pkg/hex/neutral/model.d.ts +3 -0
  148. package/dist/_pkg/hex/neutral/model.mjs +1 -0
  149. package/dist/_pkg/hex/neutral/zod.d.ts +6 -0
  150. package/dist/_pkg/logger/neutral/ConsoleLogger.d.ts +7 -0
  151. package/dist/_pkg/logger/neutral/IdLogger.d.ts +19 -0
  152. package/dist/_pkg/logger/neutral/LevelLogger.d.ts +47 -0
  153. package/dist/_pkg/logger/neutral/NoOpLogFunction.d.ts +3 -0
  154. package/dist/_pkg/logger/neutral/SilentLogger.d.ts +17 -0
  155. package/dist/_pkg/logger/neutral/getFunctionName.d.ts +7 -0
  156. package/dist/_pkg/logger/neutral/index.d.ts +7 -0
  157. package/dist/_pkg/logger/neutral/index.mjs +126 -0
  158. package/dist/_pkg/object/neutral/AsObjectFactory.d.ts +8 -0
  159. package/dist/_pkg/object/neutral/AsTypeFactory.d.ts +11 -0
  160. package/dist/_pkg/object/neutral/EmptyObject.d.ts +2 -0
  161. package/dist/_pkg/object/neutral/IsObjectFactory.d.ts +16 -0
  162. package/dist/_pkg/object/neutral/JsonObject.d.ts +49 -0
  163. package/dist/_pkg/object/neutral/ObjectWrapper.d.ts +9 -0
  164. package/dist/_pkg/object/neutral/OmitStartsWith.d.ts +18 -0
  165. package/dist/_pkg/object/neutral/Optional.d.ts +3 -0
  166. package/dist/_pkg/object/neutral/Override.d.ts +4 -0
  167. package/dist/_pkg/object/neutral/PartialRecord.d.ts +3 -0
  168. package/dist/_pkg/object/neutral/PickStartsWith.d.ts +9 -0
  169. package/dist/_pkg/object/neutral/Simplify.d.ts +5 -0
  170. package/dist/_pkg/object/neutral/StringKeyObject.d.ts +3 -0
  171. package/dist/_pkg/object/neutral/Validator.d.ts +13 -0
  172. package/dist/_pkg/object/neutral/WithAdditional.d.ts +4 -0
  173. package/dist/_pkg/object/neutral/asObject.d.ts +4 -0
  174. package/dist/_pkg/object/neutral/deepMerge.d.ts +49 -0
  175. package/dist/_pkg/object/neutral/index-deprecated.d.ts +2 -0
  176. package/dist/_pkg/object/neutral/index-un-deprecated.d.ts +22 -0
  177. package/dist/_pkg/object/neutral/index-un-deprecated.mjs +320 -0
  178. package/dist/_pkg/object/neutral/index.d.ts +3 -0
  179. package/dist/_pkg/object/neutral/index.mjs +435 -0
  180. package/dist/_pkg/object/neutral/isType.d.ts +4 -0
  181. package/dist/_pkg/object/neutral/model.d.ts +14 -0
  182. package/dist/_pkg/object/neutral/model.mjs +1 -0
  183. package/dist/_pkg/object/neutral/omitBy.d.ts +21 -0
  184. package/dist/_pkg/object/neutral/pickBy.d.ts +21 -0
  185. package/dist/_pkg/object/neutral/removeFields.d.ts +9 -0
  186. package/dist/_pkg/object/neutral/toSafeJson.d.ts +41 -0
  187. package/dist/_pkg/object-model/neutral/AnyObject.d.ts +8 -0
  188. package/dist/_pkg/object-model/neutral/AsTypeFactory.d.ts +12 -0
  189. package/dist/_pkg/object-model/neutral/AsTypeFunction.d.ts +14 -0
  190. package/dist/_pkg/object-model/neutral/Compare.d.ts +3 -0
  191. package/dist/_pkg/object-model/neutral/EmptyObject.d.ts +8 -0
  192. package/dist/_pkg/object-model/neutral/index.d.ts +6 -0
  193. package/dist/_pkg/object-model/neutral/index.mjs +1 -0
  194. package/dist/_pkg/object-model/neutral/model.d.ts +6 -0
  195. package/dist/_pkg/object-model/neutral/model.mjs +1 -0
  196. package/dist/_pkg/object-model/neutral/types.d.ts +25 -0
  197. package/dist/_pkg/platform/browser/browser/index.d.ts +9 -0
  198. package/dist/_pkg/platform/browser/index-browser.d.ts +2 -0
  199. package/dist/_pkg/platform/browser/index-browser.mjs +18 -0
  200. package/dist/_pkg/platform/browser/index-node.d.ts +2 -0
  201. package/dist/_pkg/platform/browser/node/index.d.ts +9 -0
  202. package/dist/_pkg/platform/node/browser/index.d.ts +9 -0
  203. package/dist/_pkg/platform/node/index-browser.d.ts +2 -0
  204. package/dist/_pkg/platform/node/index-node.d.ts +2 -0
  205. package/dist/_pkg/platform/node/index-node.mjs +18 -0
  206. package/dist/_pkg/platform/node/node/index.d.ts +9 -0
  207. package/dist/_pkg/profile/neutral/index.d.ts +2 -0
  208. package/dist/_pkg/profile/neutral/index.mjs +37 -0
  209. package/dist/_pkg/profile/neutral/model.d.ts +2 -0
  210. package/dist/_pkg/profile/neutral/model.mjs +1 -0
  211. package/dist/_pkg/profile/neutral/profiler.d.ts +17 -0
  212. package/dist/_pkg/promise/neutral/PromiseEx.d.ts +24 -0
  213. package/dist/_pkg/promise/neutral/fulfilled.d.ts +7 -0
  214. package/dist/_pkg/promise/neutral/fulfilledValues.d.ts +20 -0
  215. package/dist/_pkg/promise/neutral/index.d.ts +7 -0
  216. package/dist/_pkg/promise/neutral/index.mjs +57 -0
  217. package/dist/_pkg/promise/neutral/model.d.ts +3 -0
  218. package/dist/_pkg/promise/neutral/model.mjs +1 -0
  219. package/dist/_pkg/promise/neutral/rejected.d.ts +7 -0
  220. package/dist/_pkg/promise/neutral/toPromise.d.ts +8 -0
  221. package/dist/_pkg/promise/neutral/types.d.ts +23 -0
  222. package/dist/_pkg/retry/neutral/index.d.ts +2 -0
  223. package/dist/_pkg/retry/neutral/index.mjs +28 -0
  224. package/dist/_pkg/retry/neutral/model.d.ts +2 -0
  225. package/dist/_pkg/retry/neutral/model.mjs +1 -0
  226. package/dist/_pkg/retry/neutral/retry.d.ts +23 -0
  227. package/dist/_pkg/set/neutral/index.d.ts +2 -0
  228. package/dist/_pkg/set/neutral/index.mjs +20 -0
  229. package/dist/_pkg/set/neutral/lib/difference.d.ts +8 -0
  230. package/dist/_pkg/set/neutral/lib/index.d.ts +4 -0
  231. package/dist/_pkg/set/neutral/lib/intersection.d.ts +8 -0
  232. package/dist/_pkg/set/neutral/lib/union.d.ts +8 -0
  233. package/dist/_pkg/static-implements/neutral/index.d.ts +2 -0
  234. package/dist/_pkg/static-implements/neutral/index.mjs +10 -0
  235. package/dist/_pkg/static-implements/neutral/staticImplements.d.ts +7 -0
  236. package/dist/_pkg/storage/neutral/KeyValueStore.d.ts +34 -0
  237. package/dist/_pkg/storage/neutral/index.d.ts +2 -0
  238. package/dist/_pkg/storage/neutral/index.mjs +1 -0
  239. package/dist/_pkg/storage/neutral/model.d.ts +2 -0
  240. package/dist/_pkg/storage/neutral/model.mjs +1 -0
  241. package/dist/_pkg/telemetry/neutral/index.d.ts +3 -0
  242. package/dist/_pkg/telemetry/neutral/index.mjs +152 -0
  243. package/dist/_pkg/telemetry/neutral/model.d.ts +2 -0
  244. package/dist/_pkg/telemetry/neutral/model.mjs +1 -0
  245. package/dist/_pkg/telemetry/neutral/span.d.ts +51 -0
  246. package/dist/_pkg/telemetry/neutral/timeBudget.d.ts +12 -0
  247. package/dist/_pkg/telemetry-exporter/neutral/XyConsoleSpanExporter.d.ts +40 -0
  248. package/dist/_pkg/telemetry-exporter/neutral/index.d.ts +2 -0
  249. package/dist/_pkg/telemetry-exporter/neutral/index.mjs +88 -0
  250. package/dist/_pkg/timer/neutral/index.d.ts +2 -0
  251. package/dist/_pkg/timer/neutral/index.mjs +75 -0
  252. package/dist/_pkg/timer/neutral/setTimeoutEx.d.ts +37 -0
  253. package/dist/_pkg/typeof/neutral/Brand.d.ts +5 -0
  254. package/dist/_pkg/typeof/neutral/IdentityFunction.d.ts +3 -0
  255. package/dist/_pkg/typeof/neutral/ObjectTypeShape.d.ts +5 -0
  256. package/dist/_pkg/typeof/neutral/TypeOfTypes.d.ts +3 -0
  257. package/dist/_pkg/typeof/neutral/Typed.d.ts +41 -0
  258. package/dist/_pkg/typeof/neutral/ifDefined.d.ts +8 -0
  259. package/dist/_pkg/typeof/neutral/ifTypeOf.d.ts +11 -0
  260. package/dist/_pkg/typeof/neutral/index.d.ts +12 -0
  261. package/dist/_pkg/typeof/neutral/index.mjs +255 -0
  262. package/dist/_pkg/typeof/neutral/is.d.ts +116 -0
  263. package/dist/_pkg/typeof/neutral/isType.d.ts +9 -0
  264. package/dist/_pkg/typeof/neutral/model.d.ts +7 -0
  265. package/dist/_pkg/typeof/neutral/model.mjs +1 -0
  266. package/dist/_pkg/typeof/neutral/typeOf.d.ts +8 -0
  267. package/dist/_pkg/typeof/neutral/validateType.d.ts +10 -0
  268. package/dist/_pkg/url/browser/index-browser.d.ts +12 -0
  269. package/dist/_pkg/url/browser/index-browser.mjs +12 -0
  270. package/dist/_pkg/url/browser/index-neutral.d.ts +12 -0
  271. package/dist/_pkg/url/browser/index-node.d.ts +13 -0
  272. package/dist/_pkg/url/browser/lib/index.d.ts +2 -0
  273. package/dist/_pkg/url/browser/lib/isLocalhost.d.ts +7 -0
  274. package/dist/_pkg/url/neutral/index-browser.d.ts +12 -0
  275. package/dist/_pkg/url/neutral/index-neutral.d.ts +12 -0
  276. package/dist/_pkg/url/neutral/index-neutral.mjs +12 -0
  277. package/dist/_pkg/url/neutral/index-node.d.ts +13 -0
  278. package/dist/_pkg/url/neutral/lib/index.d.ts +2 -0
  279. package/dist/_pkg/url/neutral/lib/isLocalhost.d.ts +7 -0
  280. package/dist/_pkg/url/node/index-browser.d.ts +12 -0
  281. package/dist/_pkg/url/node/index-neutral.d.ts +12 -0
  282. package/dist/_pkg/url/node/index-node.d.ts +13 -0
  283. package/dist/_pkg/url/node/index-node.mjs +15 -0
  284. package/dist/_pkg/url/node/lib/index.d.ts +2 -0
  285. package/dist/_pkg/url/node/lib/isLocalhost.d.ts +7 -0
  286. package/dist/_pkg/zod/neutral/Config.d.ts +8 -0
  287. package/dist/_pkg/zod/neutral/index.d.ts +8 -0
  288. package/dist/_pkg/zod/neutral/index.mjs +127 -0
  289. package/dist/_pkg/zod/neutral/model.d.ts +2 -0
  290. package/dist/_pkg/zod/neutral/model.mjs +1 -0
  291. package/dist/_pkg/zod/neutral/zodAllFactory.d.ts +20 -0
  292. package/dist/_pkg/zod/neutral/zodAsAsyncFactory.d.ts +14 -0
  293. package/dist/_pkg/zod/neutral/zodAsFactory.d.ts +14 -0
  294. package/dist/_pkg/zod/neutral/zodIsFactory.d.ts +8 -0
  295. package/dist/_pkg/zod/neutral/zodToAsyncFactory.d.ts +14 -0
  296. package/dist/_pkg/zod/neutral/zodToFactory.d.ts +14 -0
  297. package/dist/browser/index.d.ts +32 -0
  298. package/dist/browser/index.mjs +32 -0
  299. package/dist/browser/platform.d.ts +1 -0
  300. package/dist/browser/platform.mjs +1 -0
  301. package/dist/browser/url.d.ts +1 -0
  302. package/dist/browser/url.mjs +1 -0
  303. package/dist/neutral/api.d.ts +1 -0
  304. package/dist/neutral/api.mjs +1 -0
  305. package/dist/neutral/api.model.d.ts +1 -0
  306. package/dist/neutral/api.model.mjs +1 -0
  307. package/dist/neutral/array.d.ts +1 -0
  308. package/dist/neutral/array.mjs +1 -0
  309. package/dist/neutral/arraybuffer.d.ts +1 -0
  310. package/dist/neutral/arraybuffer.mjs +1 -0
  311. package/dist/neutral/assert.d.ts +1 -0
  312. package/dist/neutral/assert.mjs +1 -0
  313. package/dist/neutral/assert.model.d.ts +1 -0
  314. package/dist/neutral/assert.model.mjs +1 -0
  315. package/dist/neutral/base.d.ts +1 -0
  316. package/dist/neutral/base.mjs +1 -0
  317. package/dist/neutral/base.model.d.ts +1 -0
  318. package/dist/neutral/base.model.mjs +1 -0
  319. package/dist/neutral/creatable.d.ts +1 -0
  320. package/dist/neutral/creatable.mjs +1 -0
  321. package/dist/neutral/creatable.model.d.ts +1 -0
  322. package/dist/neutral/creatable.model.mjs +1 -0
  323. package/dist/neutral/decimal-precision.d.ts +1 -0
  324. package/dist/neutral/decimal-precision.mjs +1 -0
  325. package/dist/neutral/delay.d.ts +1 -0
  326. package/dist/neutral/delay.mjs +1 -0
  327. package/dist/neutral/ellipsize.d.ts +1 -0
  328. package/dist/neutral/ellipsize.mjs +1 -0
  329. package/dist/neutral/enum.d.ts +1 -0
  330. package/dist/neutral/enum.mjs +1 -0
  331. package/dist/neutral/enum.model.d.ts +1 -0
  332. package/dist/neutral/enum.model.mjs +1 -0
  333. package/dist/neutral/error.d.ts +1 -0
  334. package/dist/neutral/error.mjs +1 -0
  335. package/dist/neutral/error.model.d.ts +1 -0
  336. package/dist/neutral/error.model.mjs +1 -0
  337. package/dist/neutral/events.d.ts +1 -0
  338. package/dist/neutral/events.mjs +1 -0
  339. package/dist/neutral/events.model.d.ts +1 -0
  340. package/dist/neutral/events.model.mjs +1 -0
  341. package/dist/neutral/exists.d.ts +1 -0
  342. package/dist/neutral/exists.mjs +1 -0
  343. package/dist/neutral/fetch.d.ts +1 -0
  344. package/dist/neutral/fetch.mjs +1 -0
  345. package/dist/neutral/fetch.model.d.ts +1 -0
  346. package/dist/neutral/fetch.model.mjs +1 -0
  347. package/dist/neutral/forget.d.ts +1 -0
  348. package/dist/neutral/forget.mjs +1 -0
  349. package/dist/neutral/forget.model.d.ts +1 -0
  350. package/dist/neutral/forget.model.mjs +1 -0
  351. package/dist/neutral/function-name.d.ts +1 -0
  352. package/dist/neutral/function-name.mjs +1 -0
  353. package/dist/neutral/hex.d.ts +1 -0
  354. package/dist/neutral/hex.mjs +1 -0
  355. package/dist/neutral/hex.model.d.ts +1 -0
  356. package/dist/neutral/hex.model.mjs +1 -0
  357. package/dist/neutral/logger.d.ts +1 -0
  358. package/dist/neutral/logger.mjs +1 -0
  359. package/dist/neutral/model.d.ts +18 -0
  360. package/dist/neutral/model.mjs +18 -0
  361. package/dist/neutral/object.d.ts +1 -0
  362. package/dist/neutral/object.mjs +1 -0
  363. package/dist/neutral/object.model.d.ts +1 -0
  364. package/dist/neutral/object.model.mjs +1 -0
  365. package/dist/neutral/profile.d.ts +1 -0
  366. package/dist/neutral/profile.mjs +1 -0
  367. package/dist/neutral/profile.model.d.ts +1 -0
  368. package/dist/neutral/profile.model.mjs +1 -0
  369. package/dist/neutral/promise.d.ts +1 -0
  370. package/dist/neutral/promise.mjs +1 -0
  371. package/dist/neutral/promise.model.d.ts +1 -0
  372. package/dist/neutral/promise.model.mjs +1 -0
  373. package/dist/neutral/retry.d.ts +1 -0
  374. package/dist/neutral/retry.mjs +1 -0
  375. package/dist/neutral/retry.model.d.ts +1 -0
  376. package/dist/neutral/retry.model.mjs +1 -0
  377. package/dist/neutral/set.d.ts +1 -0
  378. package/dist/neutral/set.mjs +1 -0
  379. package/dist/neutral/static-implements.d.ts +1 -0
  380. package/dist/neutral/static-implements.mjs +1 -0
  381. package/dist/neutral/storage.d.ts +1 -0
  382. package/dist/neutral/storage.mjs +1 -0
  383. package/dist/neutral/storage.model.d.ts +1 -0
  384. package/dist/neutral/storage.model.mjs +1 -0
  385. package/dist/neutral/telemetry-exporter.d.ts +1 -0
  386. package/dist/neutral/telemetry-exporter.mjs +1 -0
  387. package/dist/neutral/telemetry.d.ts +1 -0
  388. package/dist/neutral/telemetry.mjs +1 -0
  389. package/dist/neutral/telemetry.model.d.ts +1 -0
  390. package/dist/neutral/telemetry.model.mjs +1 -0
  391. package/dist/neutral/timer.d.ts +1 -0
  392. package/dist/neutral/timer.mjs +1 -0
  393. package/dist/neutral/typeof.d.ts +1 -0
  394. package/dist/neutral/typeof.mjs +1 -0
  395. package/dist/neutral/typeof.model.d.ts +1 -0
  396. package/dist/neutral/typeof.model.mjs +1 -0
  397. package/dist/neutral/url.d.ts +1 -0
  398. package/dist/neutral/url.mjs +1 -0
  399. package/dist/neutral/zod.d.ts +1 -0
  400. package/dist/neutral/zod.mjs +1 -0
  401. package/dist/neutral/zod.model.d.ts +1 -0
  402. package/dist/neutral/zod.model.mjs +1 -0
  403. package/dist/node/index.d.ts +32 -0
  404. package/dist/node/index.mjs +32 -0
  405. package/dist/node/platform.d.ts +1 -0
  406. package/dist/node/platform.mjs +1 -0
  407. package/dist/node/url.d.ts +1 -0
  408. package/dist/node/url.mjs +1 -0
  409. package/package.json +339 -0
@@ -0,0 +1,41 @@
1
+ import type { AssertExErrorFunc, AssertExMessageFunc } from './types.ts';
2
+ /**
3
+ * Asserts that a value is defined (not undefined) and returns the value.
4
+ * Throws an error if the value is undefined.
5
+ *
6
+ * @template T - The type of value to check
7
+ * @param expr - Expression to be evaluated for being defined
8
+ * @param messageFunc - Function that returns a message for the error if expression is undefined
9
+ * @throws Error with the message returned by messageFunc
10
+ * @returns The value of the expression (guaranteed to be defined)
11
+ * @example
12
+ * ```typescript
13
+ * // Simple usage with a message function
14
+ * const value = assertDefinedEx(possiblyUndefined, () => 'Value must be defined')
15
+ *
16
+ * // Using with type narrowing
17
+ * const config: Config | undefined = loadConfig()
18
+ * const safeConfig = assertDefinedEx(config, () => 'Config failed to load')
19
+ * // safeConfig is now type Config (not Config | undefined)
20
+ * ```
21
+ */
22
+ declare function assertDefinedEx<T>(expr: T | undefined, messageFunc?: AssertExMessageFunc<T>): T;
23
+ /**
24
+ * Asserts that a value is defined (not undefined) and returns the value.
25
+ * Throws a custom error if the value is undefined.
26
+ *
27
+ * @template T - The type of value to check
28
+ * @template R - The type of error to throw
29
+ * @param expr - Expression to be evaluated for being defined
30
+ * @param errorFunc - Function that returns a custom error instance if expression is undefined
31
+ * @throws Custom error returned by errorFunc
32
+ * @returns The value of the expression (guaranteed to be defined)
33
+ * @example
34
+ * ```typescript
35
+ * // Using with a custom error
36
+ * const user = assertDefinedEx(getUser(), () => new UserNotFoundError('User not found'))
37
+ * ```
38
+ */
39
+ declare function assertDefinedEx<T, R extends Error>(expr: T | undefined, errorFunc?: AssertExErrorFunc<T, R>): T;
40
+ export { assertDefinedEx };
41
+ //# sourceMappingURL=assertDefinedEx.d.ts.map
@@ -0,0 +1,41 @@
1
+ import type { AssertExErrorFunc, AssertExMessageFunc } from './types.ts';
2
+ /**
3
+ * Asserts that an expression is truthy and returns the value.
4
+ * Throws an error if the expression is falsy.
5
+ *
6
+ * @template T - The type of value to check
7
+ * @param expr - Expression to be evaluated for truthiness
8
+ * @param messageFunc - Function that returns a message for the error if expression is falsy
9
+ * @throws Error with the message returned by messageFunc
10
+ * @returns The value of the expression (guaranteed to be truthy)
11
+ * @example
12
+ * ```typescript
13
+ * // Simple usage with a message function
14
+ * const value = assertEx(possiblyFalsy, () => 'Value must be truthy')
15
+ *
16
+ * // Using with type narrowing
17
+ * const config: Config | null = loadConfig()
18
+ * const safeConfig = assertEx(config, () => 'Config failed to load')
19
+ * // safeConfig is now type Config (not Config | null)
20
+ * ```
21
+ */
22
+ declare function assertEx<T>(expr: T | null | undefined, messageFunc?: AssertExMessageFunc<T>): T;
23
+ /**
24
+ * Asserts that an expression is truthy and returns the value.
25
+ * Throws a custom error if the expression is falsy.
26
+ *
27
+ * @template T - The type of value to check
28
+ * @template R - The type of error to throw
29
+ * @param expr - Expression to be evaluated for truthiness
30
+ * @param errorFunc - Function that returns a custom error instance if expression is falsy
31
+ * @throws Custom error returned by errorFunc
32
+ * @returns The value of the expression (guaranteed to be truthy)
33
+ * @example
34
+ * ```typescript
35
+ * // Using with a custom error
36
+ * const user = assertEx(getUser(), () => new UserNotFoundError('User not found'))
37
+ * ```
38
+ */
39
+ declare function assertEx<T, R extends Error>(expr: T | null | undefined, errorFunc?: AssertExErrorFunc<T, R>): T;
40
+ export { assertEx };
41
+ //# sourceMappingURL=assertEx.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './assertDefinedEx.ts';
2
+ export * from './assertEx.ts';
3
+ export type * from './types.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,30 @@
1
+ // src/assertDefinedEx.ts
2
+ function assertDefinedEx(expr, func) {
3
+ if (expr !== void 0) return expr;
4
+ if (typeof func === "function") {
5
+ const errorOrMessage = func(expr);
6
+ throw typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
7
+ }
8
+ if (func !== void 0) {
9
+ throw new Error("Invalid assertDefinedEx usage: second argument must be a function or undefined");
10
+ }
11
+ throw new Error("Assertion failed: value is undefined");
12
+ }
13
+
14
+ // src/assertEx.ts
15
+ function assertEx(expr, func) {
16
+ if (expr !== void 0 && expr !== null && expr !== false && expr !== 0 && expr !== "" && expr !== 0n) return expr;
17
+ if (typeof func === "function") {
18
+ const errorOrMessage = func(expr);
19
+ throw typeof errorOrMessage === "string" ? new Error(errorOrMessage) : errorOrMessage;
20
+ }
21
+ if (func !== void 0) {
22
+ throw new Error("Invalid assertEx usage: second argument must be a function or undefined");
23
+ }
24
+ throw new Error("Assertion failed");
25
+ }
26
+ export {
27
+ assertDefinedEx,
28
+ assertEx
29
+ };
30
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,2 @@
1
+ export type * from './types.ts';
2
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=model.mjs.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @internal
3
+ * A function that takes a possibly null or undefined value and returns an error message string.
4
+ * Used in assertion functions to provide custom error messages.
5
+ *
6
+ * @internal
7
+ * @template T - The type of value being asserted
8
+ * @param value - The value being asserted (may be null or undefined)
9
+ * @returns A string message to be used in the error thrown by the assertion
10
+ * @example
11
+ * ```typescript
12
+ * const messageFunc: AssertExMessageFunc<User> = (user) =>
13
+ * `User ${user ? user.id : 'unknown'} is not valid or accessible`
14
+ * ```
15
+ */
16
+ export type AssertExMessageFunc<T> = (value?: T | null) => string;
17
+ /**
18
+ * A function that takes a possibly null or undefined value and returns a custom error instance.
19
+ * Used in assertion functions to provide specific error types with custom properties.
20
+ *
21
+ * @internal
22
+ * @template T - The type of value being asserted
23
+ * @template R - The specific error type to be returned, must extend Error
24
+ * @param value - The value being asserted (may be null or undefined)
25
+ * @returns An instance of the custom error type
26
+ * @example
27
+ * ```typescript
28
+ * const errorFunc: AssertExErrorFunc<User, UserNotFoundError> = (user) =>
29
+ * new UserNotFoundError(`User ${user?.id || 'unknown'} not found`, {
30
+ * userId: user?.id,
31
+ * timestamp: new Date()
32
+ * })
33
+ * ```
34
+ */
35
+ export type AssertExErrorFunc<T, R extends Error> = (value?: T | null) => R;
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,53 @@
1
+ import type { Logger } from '../../logger/neutral/index.ts';
2
+ import type { EmptyObject } from '../../object/neutral/index.ts';
3
+ import type { Meter, MeterProvider, Tracer, TracerProvider } from '@opentelemetry/api';
4
+ /** Branded string type representing a class name used for global instance tracking. */
5
+ export type BaseClassName = string & {
6
+ __baseClassName: true;
7
+ };
8
+ /** Common parameter fields available to all Base instances (logger, meter, tracer). */
9
+ export interface BaseParamsFields {
10
+ logger?: Logger;
11
+ meterProvider?: MeterProvider;
12
+ traceProvider?: TracerProvider;
13
+ }
14
+ /** Parameters for constructing a Base instance, combining BaseParamsFields with optional additional params. */
15
+ export type BaseParams<TAdditionalParams extends EmptyObject = EmptyObject> = TAdditionalParams & BaseParamsFields;
16
+ /**
17
+ * Abstract base class providing logging, telemetry, and global instance tracking with WeakRef-based GC.
18
+ * @typeParam TParams - The parameter type, extending BaseParams
19
+ */
20
+ export declare abstract class Base<TParams extends BaseParams = BaseParams> {
21
+ static defaultLogger?: Logger;
22
+ static readonly globalInstances: Record<BaseClassName, WeakRef<Base>[]>;
23
+ static readonly globalInstancesCountHistory: Record<BaseClassName, number[]>;
24
+ private static _historyInterval;
25
+ private static _historyTime;
26
+ private static _historyTimeout?;
27
+ private static _lastGC;
28
+ private static _maxGcFrequency;
29
+ private _params;
30
+ constructor(params: BaseParams<TParams>);
31
+ static get historyInterval(): number;
32
+ static set historyInterval(value: number);
33
+ static get historyTime(): number;
34
+ static set historyTime(value: number);
35
+ static get maxGcFrequency(): number;
36
+ static set maxGcFrequency(value: number);
37
+ static get maxHistoryDepth(): number;
38
+ get logger(): Logger | undefined;
39
+ get meter(): Meter | undefined;
40
+ get params(): BaseParams<TParams>;
41
+ get tracer(): Tracer | undefined;
42
+ static gc(force?: boolean): void;
43
+ static gc(className: BaseClassName): void;
44
+ static instanceCount(className: BaseClassName): number;
45
+ static instanceCounts(): Record<BaseClassName, number>;
46
+ static startHistory(): void;
47
+ static stopHistory(): void;
48
+ private static addToHistory;
49
+ private static gcAll;
50
+ private static gcClass;
51
+ private recordInstance;
52
+ }
53
+ //# sourceMappingURL=Base.d.ts.map
@@ -0,0 +1,10 @@
1
+ import type { BaseParams } from './Base.ts';
2
+ import { Base } from './Base.ts';
3
+ /** Base class that registers itself as globally unique, preventing duplicate module instances. */
4
+ export declare abstract class UniqueBase<TParams extends BaseParams = BaseParams> extends Base<TParams> {
5
+ static readonly uniqueDomain = "xy";
6
+ static readonly uniqueName: string;
7
+ static readonly uniqueNameXyo: string;
8
+ constructor(params: BaseParams<TParams>);
9
+ }
10
+ //# sourceMappingURL=UniqueBase.d.ts.map
@@ -0,0 +1,21 @@
1
+ declare global {
2
+ interface ImportMeta {
3
+ url: string;
4
+ }
5
+ var xylabs: {
6
+ unique: Record<string, unknown>;
7
+ uniqueDisabled?: boolean;
8
+ };
9
+ }
10
+ /** Disables global uniqueness checks, allowing duplicate registrations without throwing. */
11
+ export declare const disableGloballyUnique: () => void;
12
+ /**
13
+ * Registers a value as globally unique under the given name and domain.
14
+ * Throws if a different value is already registered under the same key.
15
+ * @param name - The unique name or symbol
16
+ * @param value - The value to register
17
+ * @param domain - The namespace domain (default 'global')
18
+ * @returns The fully qualified unique name
19
+ */
20
+ export declare const globallyUnique: (name: string | symbol, value: unknown, domain?: string) => string;
21
+ //# sourceMappingURL=globallyUnique.d.ts.map
@@ -0,0 +1,4 @@
1
+ export * from './Base.ts';
2
+ export * from './globallyUnique.ts';
3
+ export * from './UniqueBase.ts';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,164 @@
1
+ // src/Base.ts
2
+ import { assertEx } from "../../assert/neutral/index.mjs";
3
+ var DEFAULT_HISTORY_INTERVAL = 1e3 * 5;
4
+ var DEFAULT_HISTORY_TIME = 60 * 60 * 1e3;
5
+ var MAX_GC_FREQUENCY = 1e3 * 60;
6
+ var MIN_GC_FREQUENCY = 1e3;
7
+ var MIN_HISTORY_INTERVAL = 1e3;
8
+ var Base = class _Base {
9
+ static defaultLogger;
10
+ static globalInstances = {};
11
+ static globalInstancesCountHistory = {};
12
+ static _historyInterval = DEFAULT_HISTORY_INTERVAL;
13
+ static _historyTime = DEFAULT_HISTORY_TIME;
14
+ static _historyTimeout;
15
+ static _lastGC = 0;
16
+ static _maxGcFrequency = MAX_GC_FREQUENCY;
17
+ _params;
18
+ constructor(params) {
19
+ this._params = params;
20
+ params?.logger?.debug(`Base constructed [${this.constructor.name}]`);
21
+ this.recordInstance();
22
+ }
23
+ static get historyInterval() {
24
+ return this._historyInterval;
25
+ }
26
+ static set historyInterval(value) {
27
+ assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`);
28
+ this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL);
29
+ }
30
+ static get historyTime() {
31
+ return this._historyTime;
32
+ }
33
+ static set historyTime(value) {
34
+ assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`);
35
+ this._historyInterval = value;
36
+ }
37
+ static get maxGcFrequency() {
38
+ return this._maxGcFrequency;
39
+ }
40
+ static set maxGcFrequency(value) {
41
+ this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY);
42
+ }
43
+ static get maxHistoryDepth() {
44
+ return Math.floor(this.historyTime / this.historyInterval);
45
+ }
46
+ get logger() {
47
+ return this.params?.logger ?? _Base.defaultLogger;
48
+ }
49
+ get meter() {
50
+ return this.params?.meterProvider?.getMeter(this.constructor.name);
51
+ }
52
+ get params() {
53
+ return this._params;
54
+ }
55
+ get tracer() {
56
+ return this.params?.traceProvider?.getTracer(this.constructor.name);
57
+ }
58
+ static gc(classNameOrForce = false) {
59
+ if (typeof classNameOrForce === "string") {
60
+ this.gcClass(classNameOrForce);
61
+ } else {
62
+ if (classNameOrForce || Date.now() - this._lastGC > this._maxGcFrequency) {
63
+ this.gcAll();
64
+ }
65
+ }
66
+ }
67
+ static instanceCount(className) {
68
+ return this.globalInstances[className]?.length ?? 0;
69
+ }
70
+ static instanceCounts() {
71
+ this.gc();
72
+ const result = {};
73
+ for (const [className, instances] of Object.entries(this.globalInstances)) result[className] = instances.length;
74
+ return result;
75
+ }
76
+ static startHistory() {
77
+ if (this._historyTimeout !== void 0) {
78
+ this.stopHistory();
79
+ }
80
+ const timeoutHandler = () => {
81
+ if (this._historyTimeout === void 0) {
82
+ return;
83
+ }
84
+ this.addToHistory();
85
+ this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval);
86
+ };
87
+ this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval);
88
+ }
89
+ static stopHistory() {
90
+ if (this._historyTimeout === void 0) {
91
+ return;
92
+ }
93
+ clearTimeout(this._historyTimeout);
94
+ this._historyTimeout = void 0;
95
+ }
96
+ static addToHistory() {
97
+ const counts = this.instanceCounts();
98
+ for (const className of Object.keys(this.globalInstances)) {
99
+ this.globalInstancesCountHistory[className] = this.globalInstancesCountHistory[className]?.slice(-this.maxHistoryDepth) ?? [];
100
+ this.globalInstancesCountHistory[className].push(counts[className]);
101
+ }
102
+ }
103
+ static gcAll() {
104
+ for (const className of Object.keys(this.globalInstances)) {
105
+ this.gcClass(className);
106
+ }
107
+ }
108
+ static gcClass(className) {
109
+ this.globalInstances[className] = this.globalInstances[className]?.filter((ref) => ref.deref() !== null) ?? [];
110
+ }
111
+ recordInstance() {
112
+ const baseClassName = this.constructor.name;
113
+ const instanceArray = _Base.globalInstances[baseClassName] ?? [];
114
+ instanceArray.push(new WeakRef(this));
115
+ _Base.globalInstances[baseClassName] = instanceArray;
116
+ }
117
+ };
118
+
119
+ // src/globallyUnique.ts
120
+ var xyoGlobal = () => {
121
+ if (globalThis.xylabs === void 0) {
122
+ Reflect.set(globalThis, "xylabs", {});
123
+ }
124
+ return globalThis.xylabs;
125
+ };
126
+ var disableGloballyUnique = () => {
127
+ xyoGlobal().uniqueDisabled = true;
128
+ };
129
+ var globallyUnique = (name, value, domain = "global") => {
130
+ const uniqueName = [domain, ...domain === "bundle" ? [name] : [import.meta.url, name]].join(":");
131
+ if (xyoGlobal().uniqueDisabled !== true) {
132
+ const xylabs = xyoGlobal();
133
+ xylabs.unique ??= {};
134
+ const unique = xylabs.unique;
135
+ if (unique[uniqueName] === void 0) {
136
+ unique[uniqueName] = value;
137
+ } else {
138
+ if (unique[uniqueName] !== value) {
139
+ throw new Error(
140
+ `Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`
141
+ );
142
+ }
143
+ }
144
+ }
145
+ return uniqueName;
146
+ };
147
+
148
+ // src/UniqueBase.ts
149
+ var UniqueBase = class extends Base {
150
+ static uniqueDomain = "xy";
151
+ static uniqueName = globallyUnique(this.name, this, this.uniqueDomain);
152
+ // TODO: Remove xyo domain version when old xyo versions are no longer needed
153
+ static uniqueNameXyo = globallyUnique(this.name, this, "xyo");
154
+ constructor(params) {
155
+ super(params);
156
+ }
157
+ };
158
+ export {
159
+ Base,
160
+ UniqueBase,
161
+ disableGloballyUnique,
162
+ globallyUnique
163
+ };
164
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,2 @@
1
+ export type { BaseClassName, BaseParams, BaseParamsFields, } from './Base.ts';
2
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=model.mjs.map
@@ -0,0 +1,123 @@
1
+ import type { EventData } from '../../events/neutral/index.ts';
2
+ import { BaseEmitter } from '../../events/neutral/index.ts';
3
+ import { type Logger } from '../../logger/neutral/index.ts';
4
+ import type { Promisable } from '../../promise/neutral/index.ts';
5
+ import type { SpanConfig } from '../../telemetry/neutral/index.ts';
6
+ import { type Creatable, type CreatableFactory } from './Creatable.ts';
7
+ import type { CreatableInstance, CreatableName, CreatableParams, CreatableStatus, Labels, RequiredCreatableParams } from './model/index.ts';
8
+ /**
9
+ * Base class for objects that follow an asynchronous creation and lifecycle pattern.
10
+ * Instances must be created via the static `create` method rather than direct construction.
11
+ * Provides start/stop lifecycle management with status tracking and telemetry support.
12
+ */
13
+ export declare class AbstractCreatable<TParams extends CreatableParams = CreatableParams, TEventData extends EventData = EventData> extends BaseEmitter<Partial<TParams & RequiredCreatableParams>, TEventData> {
14
+ /** Optional default logger for this instance. */
15
+ defaultLogger?: Logger;
16
+ protected _startPromise: Promisable<boolean> | undefined;
17
+ private _status;
18
+ private _statusMutex;
19
+ private _validatedParams?;
20
+ constructor(key: unknown, params: Partial<TParams & RequiredCreatableParams>);
21
+ /** The name identifier for this creatable instance. */
22
+ get name(): CreatableName;
23
+ /** The validated and merged parameters for this instance. */
24
+ get params(): TParams & RequiredCreatableParams;
25
+ /** Whether this instance can be started (must be in 'created' or 'stopped' status). */
26
+ get startable(): boolean;
27
+ /** The current lifecycle status of this instance, or null if not yet initialized. */
28
+ get status(): CreatableStatus | null;
29
+ /** The status reporter used to broadcast lifecycle changes. */
30
+ get statusReporter(): import("./model/CreatableStatusReporter.ts").CreatableStatusReporter<void> | undefined;
31
+ /**
32
+ * Asynchronously creates a new instance by processing params, constructing,
33
+ * and running both static and instance createHandlers.
34
+ * @param inParams - Optional partial parameters to configure the instance
35
+ * @returns The fully initialized instance
36
+ */
37
+ static create<T extends CreatableInstance>(this: Creatable<T>, inParams?: Partial<T['params']>): Promise<T>;
38
+ /**
39
+ * Static hook called during creation to perform additional initialization.
40
+ * Override in subclasses to customize post-construction setup.
41
+ * @param instance - The newly constructed instance
42
+ * @returns The instance, potentially modified
43
+ */
44
+ static createHandler<T extends CreatableInstance>(this: Creatable<T>, instance: T): Promisable<T>;
45
+ /**
46
+ * Static hook called during creation to validate and transform params.
47
+ * Override in subclasses to add default values or validation.
48
+ * @param params - The raw partial params provided to `create`
49
+ * @returns The processed params ready for construction
50
+ */
51
+ static paramsHandler<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>): Promisable<T['params']>;
52
+ /** Instance-level creation hook. Override in subclasses to perform setup after construction. */
53
+ createHandler(): Promisable<void>;
54
+ /**
55
+ * Validates and returns the merged params, ensuring required fields are present.
56
+ * Override in subclasses to add custom validation logic.
57
+ * @param params - The raw partial params to validate
58
+ * @returns The validated params
59
+ */
60
+ paramsValidator(params: Partial<TParams & RequiredCreatableParams>): TParams & RequiredCreatableParams;
61
+ /**
62
+ * Executes a function within a telemetry span.
63
+ * @param name - The span name
64
+ * @param fn - The function to execute within the span
65
+ */
66
+ span<T>(name: string, fn: () => T): T;
67
+ /**
68
+ * Executes an async function within a telemetry span.
69
+ * @param name - The span name
70
+ * @param fn - The async function to execute within the span
71
+ * @param config - Optional span configuration
72
+ */
73
+ spanAsync<T>(name: string, fn: () => Promise<T>, config?: SpanConfig): Promise<T>;
74
+ /**
75
+ * Starts the instance, transitioning through 'starting' to 'started' status.
76
+ * Thread-safe via mutex. Returns true if already started or started successfully.
77
+ */
78
+ start(): Promise<boolean>;
79
+ /**
80
+ * Checks whether this instance is currently started.
81
+ * Takes an action if not started, based on the notStartedAction parameter.
82
+ * @param notStartedAction - What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent
83
+ * @returns True if started, false otherwise
84
+ */
85
+ started(notStartedAction?: 'error' | 'throw' | 'warn' | 'log' | 'none'): boolean;
86
+ /**
87
+ * Async version of `started` that can optionally auto-start the instance.
88
+ * @param notStartedAction - What to do if not started and auto-start is disabled
89
+ * @param tryStart - If true, attempts to start the instance automatically
90
+ * @returns True if the instance is or becomes started
91
+ */
92
+ startedAsync(notStartedAction?: 'error' | 'throw' | 'warn' | 'log' | 'none', tryStart?: boolean): Promise<boolean>;
93
+ /**
94
+ * Stops the instance, transitioning through 'stopping' to 'stopped' status.
95
+ * Thread-safe via mutex. Returns true if already stopped or stopped successfully.
96
+ */
97
+ stop(): Promise<boolean>;
98
+ /**
99
+ * Asserts that the given function has not been overridden in a subclass.
100
+ * Used to enforce the handler pattern (override `startHandler` not `start`).
101
+ */
102
+ protected _noOverride(functionName?: string): void;
103
+ /** Sets the lifecycle status and reports it via the status reporter. */
104
+ protected setStatus(value: Exclude<CreatableStatus, 'error'>, progress?: number): void;
105
+ protected setStatus(value: Extract<CreatableStatus, 'error'>, error?: Error): void;
106
+ /** Override in subclasses to define start behavior. Throw an error on failure. */
107
+ protected startHandler(): Promisable<void>;
108
+ /** Override in subclasses to define stop behavior. Throw an error on failure. */
109
+ protected stopHandler(): Promisable<void>;
110
+ }
111
+ /**
112
+ * Extends AbstractCreatable with a static `factory` method for creating
113
+ * pre-configured CreatableFactory instances.
114
+ */
115
+ export declare class AbstractCreatableWithFactory<TParams extends CreatableParams = CreatableParams, TEventData extends EventData = EventData> extends AbstractCreatable<TParams, TEventData> {
116
+ /**
117
+ * Creates a factory that produces instances of this class with pre-configured params and labels.
118
+ * @param params - Default parameters for instances created by the factory
119
+ * @param labels - Labels to assign to created instances
120
+ */
121
+ static factory<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>, labels?: Labels): CreatableFactory<T>;
122
+ }
123
+ //# sourceMappingURL=AbstractCreatable.d.ts.map
@@ -0,0 +1,49 @@
1
+ import type { Logger } from '../../logger/neutral/index.ts';
2
+ import type { Promisable } from '../../promise/neutral/index.ts';
3
+ import type { AbstractCreatable } from './AbstractCreatable.ts';
4
+ import type { CreatableInstance, CreatableParams, Labels, RequiredCreatableParams } from './model/index.ts';
5
+ /**
6
+ * A factory interface for creating instances of a Creatable with pre-configured parameters.
7
+ * Unlike the full Creatable, this only exposes the `create` method.
8
+ */
9
+ export interface CreatableFactory<T extends CreatableInstance = CreatableInstance> extends Omit<Creatable<T>, 'create' | 'createHandler' | 'paramsHandler' | 'defaultLogger' | 'factory'> {
10
+ /** Creates a new instance, merging the provided params with the factory's defaults. */
11
+ create(this: CreatableFactory<T>, params?: Partial<T['params']>): Promise<T>;
12
+ }
13
+ /**
14
+ * Static interface for classes that support asynchronous creation.
15
+ * Provides the `create`, `createHandler`, and `paramsHandler` static methods
16
+ * used to construct instances through the creatable lifecycle.
17
+ */
18
+ export interface Creatable<T extends CreatableInstance = CreatableInstance> {
19
+ /** Optional default logger shared across instances created by this class. */
20
+ defaultLogger?: Logger;
21
+ /** Constructs a new raw instance. Should not be called directly; use `create` instead. */
22
+ new (key: unknown, params: Partial<CreatableParams>): T & AbstractCreatable<T['params']>;
23
+ /** Asynchronously creates and initializes a new instance with the given params. */
24
+ create<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>): Promise<T>;
25
+ /** Hook called after construction to perform additional initialization on the instance. */
26
+ createHandler<T extends CreatableInstance>(this: Creatable<T>, instance: T): Promisable<T>;
27
+ /** Hook called to validate and transform params before instance construction. */
28
+ paramsHandler<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>): Promisable<T['params'] & RequiredCreatableParams>;
29
+ }
30
+ /** Extends Creatable with a `factory` method that produces pre-configured CreatableFactory instances. */
31
+ export interface CreatableWithFactory<T extends CreatableInstance = CreatableInstance> extends Creatable<T> {
32
+ /** Creates a factory with the given default params and labels. */
33
+ factory<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>, labels?: Labels): CreatableFactory<T>;
34
+ }
35
+ /**
36
+ * Class annotation to be used to decorate Modules which support
37
+ * an asynchronous creation pattern
38
+ * @returns The decorated Module requiring it implement the members
39
+ * of the CreatableModule as statics properties/methods
40
+ */
41
+ export declare function creatable<T extends CreatableInstance>(): <U extends Creatable<T>>(constructor: U) => void;
42
+ /**
43
+ * Class annotation to be used to decorate Modules which support
44
+ * an asynchronous creation factory pattern
45
+ * @returns The decorated Module requiring it implement the members
46
+ * of the CreatableModule as statics properties/methods
47
+ */
48
+ export declare function creatableFactory(): <U extends CreatableFactory>(constructor: U) => void;
49
+ //# sourceMappingURL=Creatable.d.ts.map
@@ -0,0 +1,28 @@
1
+ import { type Creatable, type CreatableFactory } from './Creatable.ts';
2
+ import type { CreatableInstance, Labels } from './model/index.ts';
3
+ /**
4
+ * A concrete factory that wraps a Creatable class with default parameters and labels.
5
+ * Instances are created by merging caller-provided params over the factory defaults.
6
+ */
7
+ export declare class Factory<T extends CreatableInstance = CreatableInstance> implements CreatableFactory<T> {
8
+ /** The Creatable class this factory delegates creation to. */
9
+ creatable: Creatable<T>;
10
+ /** Default parameters merged into every `create` call. */
11
+ defaultParams?: Partial<T['params']>;
12
+ /** Labels identifying resources created by this factory. */
13
+ labels?: Labels;
14
+ constructor(creatable: Creatable<T>, params?: Partial<T['params']>, labels?: Labels);
15
+ /**
16
+ * Creates a new Factory instance with the given default params and labels.
17
+ * @param creatableModule - The Creatable class to wrap
18
+ * @param params - Default parameters for new instances
19
+ * @param labels - Labels to assign to created instances
20
+ */
21
+ static withParams<T extends CreatableInstance>(creatableModule: Creatable<T>, params?: Partial<T['params']>, labels?: Labels): Factory<T>;
22
+ /**
23
+ * Creates a new instance, merging the provided params over the factory defaults.
24
+ * @param params - Optional parameters to override the factory defaults
25
+ */
26
+ create(params?: Partial<T['params']>): Promise<T>;
27
+ }
28
+ //# sourceMappingURL=Factory.d.ts.map
@@ -0,0 +1,5 @@
1
+ export * from './AbstractCreatable.ts';
2
+ export * from './Creatable.ts';
3
+ export * from './Factory.ts';
4
+ export * from './model/index.ts';
5
+ //# sourceMappingURL=index.d.ts.map