@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.
- package/LICENSE +165 -0
- package/README.md +45 -0
- package/dist/_pkg/api/neutral/ApiClient.d.ts +10 -0
- package/dist/_pkg/api/neutral/ApiConfig.d.ts +9 -0
- package/dist/_pkg/api/neutral/ApiEndpoint.d.ts +19 -0
- package/dist/_pkg/api/neutral/ApiStage.d.ts +11 -0
- package/dist/_pkg/api/neutral/getApiStage.d.ts +8 -0
- package/dist/_pkg/api/neutral/index.d.ts +6 -0
- package/dist/_pkg/api/neutral/index.mjs +78 -0
- package/dist/_pkg/api/neutral/model.d.ts +3 -0
- package/dist/_pkg/api/neutral/model.mjs +1 -0
- package/dist/_pkg/array/neutral/containsAll.d.ts +8 -0
- package/dist/_pkg/array/neutral/distinct.d.ts +6 -0
- package/dist/_pkg/array/neutral/filterAs.d.ts +8 -0
- package/dist/_pkg/array/neutral/filterAsync.d.ts +9 -0
- package/dist/_pkg/array/neutral/findAs.d.ts +15 -0
- package/dist/_pkg/array/neutral/flatten.d.ts +8 -0
- package/dist/_pkg/array/neutral/index.d.ts +8 -0
- package/dist/_pkg/array/neutral/index.mjs +80 -0
- package/dist/_pkg/array/neutral/uniq.d.ts +14 -0
- package/dist/_pkg/arraybuffer/neutral/equalArrayBuffers.d.ts +8 -0
- package/dist/_pkg/arraybuffer/neutral/index.d.ts +5 -0
- package/dist/_pkg/arraybuffer/neutral/index.mjs +74 -0
- package/dist/_pkg/arraybuffer/neutral/isArrayBuffer.d.ts +7 -0
- package/dist/_pkg/arraybuffer/neutral/toArrayBuffer.d.ts +11 -0
- package/dist/_pkg/arraybuffer/neutral/toUint8Array.d.ts +11 -0
- package/dist/_pkg/assert/neutral/assertDefinedEx.d.ts +41 -0
- package/dist/_pkg/assert/neutral/assertEx.d.ts +41 -0
- package/dist/_pkg/assert/neutral/index.d.ts +4 -0
- package/dist/_pkg/assert/neutral/index.mjs +30 -0
- package/dist/_pkg/assert/neutral/model.d.ts +2 -0
- package/dist/_pkg/assert/neutral/model.mjs +1 -0
- package/dist/_pkg/assert/neutral/types.d.ts +36 -0
- package/dist/_pkg/base/neutral/Base.d.ts +53 -0
- package/dist/_pkg/base/neutral/UniqueBase.d.ts +10 -0
- package/dist/_pkg/base/neutral/globallyUnique.d.ts +21 -0
- package/dist/_pkg/base/neutral/index.d.ts +4 -0
- package/dist/_pkg/base/neutral/index.mjs +164 -0
- package/dist/_pkg/base/neutral/model.d.ts +2 -0
- package/dist/_pkg/base/neutral/model.mjs +1 -0
- package/dist/_pkg/creatable/neutral/AbstractCreatable.d.ts +123 -0
- package/dist/_pkg/creatable/neutral/Creatable.d.ts +49 -0
- package/dist/_pkg/creatable/neutral/Factory.d.ts +28 -0
- package/dist/_pkg/creatable/neutral/index.d.ts +5 -0
- package/dist/_pkg/creatable/neutral/index.mjs +396 -0
- package/dist/_pkg/creatable/neutral/lib/getFunctionName.d.ts +7 -0
- package/dist/_pkg/creatable/neutral/lib/getRootFunction.d.ts +8 -0
- package/dist/_pkg/creatable/neutral/lib/index.d.ts +3 -0
- package/dist/_pkg/creatable/neutral/model/CreatableInstance.d.ts +16 -0
- package/dist/_pkg/creatable/neutral/model/CreatableParams.d.ts +16 -0
- package/dist/_pkg/creatable/neutral/model/CreatableStatusReporter.d.ts +15 -0
- package/dist/_pkg/creatable/neutral/model/Labels.d.ts +24 -0
- package/dist/_pkg/creatable/neutral/model/index.d.ts +5 -0
- package/dist/_pkg/creatable/neutral/model.d.ts +3 -0
- package/dist/_pkg/creatable/neutral/model.mjs +1 -0
- package/dist/_pkg/decimal-precision/neutral/fromFixedPoint.d.ts +8 -0
- package/dist/_pkg/decimal-precision/neutral/index.d.ts +4 -0
- package/dist/_pkg/decimal-precision/neutral/index.mjs +39 -0
- package/dist/_pkg/decimal-precision/neutral/toDecimalPrecision.d.ts +8 -0
- package/dist/_pkg/decimal-precision/neutral/toFixedPoint.d.ts +8 -0
- package/dist/_pkg/delay/neutral/delay.d.ts +7 -0
- package/dist/_pkg/delay/neutral/index.d.ts +2 -0
- package/dist/_pkg/delay/neutral/index.mjs +9 -0
- package/dist/_pkg/ellipsize/neutral/index.d.ts +8 -0
- package/dist/_pkg/ellipsize/neutral/index.mjs +10 -0
- package/dist/_pkg/enum/neutral/Enum.d.ts +88 -0
- package/dist/_pkg/enum/neutral/index.d.ts +2 -0
- package/dist/_pkg/enum/neutral/index.mjs +8 -0
- package/dist/_pkg/enum/neutral/model.d.ts +2 -0
- package/dist/_pkg/enum/neutral/model.mjs +1 -0
- package/dist/_pkg/error/neutral/assert.d.ts +12 -0
- package/dist/_pkg/error/neutral/handleError.d.ts +15 -0
- package/dist/_pkg/error/neutral/index.d.ts +3 -0
- package/dist/_pkg/error/neutral/index.mjs +32 -0
- package/dist/_pkg/error/neutral/model.d.ts +2 -0
- package/dist/_pkg/error/neutral/model.mjs +1 -0
- package/dist/_pkg/events/neutral/BaseEmitter.d.ts +74 -0
- package/dist/_pkg/events/neutral/Events/Events.d.ts +132 -0
- package/dist/_pkg/events/neutral/Events/index.d.ts +2 -0
- package/dist/_pkg/events/neutral/index.d.ts +4 -0
- package/dist/_pkg/events/neutral/index.mjs +415 -0
- package/dist/_pkg/events/neutral/model/Event.d.ts +21 -0
- package/dist/_pkg/events/neutral/model/EventEmitter.d.ts +25 -0
- package/dist/_pkg/events/neutral/model/index.d.ts +3 -0
- package/dist/_pkg/events/neutral/model.d.ts +3 -0
- package/dist/_pkg/events/neutral/model.mjs +1 -0
- package/dist/_pkg/exists/neutral/index.d.ts +10 -0
- package/dist/_pkg/exists/neutral/index.mjs +8 -0
- package/dist/_pkg/fetch/neutral/FetchClient.d.ts +46 -0
- package/dist/_pkg/fetch/neutral/FetchError.d.ts +80 -0
- package/dist/_pkg/fetch/neutral/FetchJsonClient.d.ts +19 -0
- package/dist/_pkg/fetch/neutral/fetchCompress.d.ts +12 -0
- package/dist/_pkg/fetch/neutral/fetchJson.d.ts +7 -0
- package/dist/_pkg/fetch/neutral/index.d.ts +11 -0
- package/dist/_pkg/fetch/neutral/index.mjs +365 -0
- package/dist/_pkg/fetch/neutral/methods.d.ts +12 -0
- package/dist/_pkg/fetch/neutral/model.d.ts +5 -0
- package/dist/_pkg/fetch/neutral/model.mjs +1 -0
- package/dist/_pkg/fetch/neutral/parseJson.d.ts +16 -0
- package/dist/_pkg/fetch/neutral/types.d.ts +12 -0
- package/dist/_pkg/forget/neutral/ForgetConfig.d.ts +21 -0
- package/dist/_pkg/forget/neutral/ForgetNodeConfig.d.ts +13 -0
- package/dist/_pkg/forget/neutral/ForgetPromise.d.ts +49 -0
- package/dist/_pkg/forget/neutral/ForgetPromiseNode.d.ts +15 -0
- package/dist/_pkg/forget/neutral/forget.d.ts +10 -0
- package/dist/_pkg/forget/neutral/forgetNode.d.ts +9 -0
- package/dist/_pkg/forget/neutral/index.d.ts +2 -0
- package/dist/_pkg/forget/neutral/index.mjs +162 -0
- package/dist/_pkg/forget/neutral/model.d.ts +3 -0
- package/dist/_pkg/forget/neutral/model.mjs +1 -0
- package/dist/_pkg/forget/neutral/neutral/index.d.ts +4 -0
- package/dist/_pkg/forget/neutral/node/index.d.ts +4 -0
- package/dist/_pkg/function-name/neutral/functionName.d.ts +7 -0
- package/dist/_pkg/function-name/neutral/index.d.ts +2 -0
- package/dist/_pkg/function-name/neutral/index.mjs +27 -0
- package/dist/_pkg/hex/neutral/HexRegEx.d.ts +19 -0
- package/dist/_pkg/hex/neutral/address/AddressTransformZod.d.ts +10 -0
- package/dist/_pkg/hex/neutral/address/AddressValidationZod.d.ts +10 -0
- package/dist/_pkg/hex/neutral/address/address.d.ts +18 -0
- package/dist/_pkg/hex/neutral/address/as.d.ts +13 -0
- package/dist/_pkg/hex/neutral/address/index.d.ts +7 -0
- package/dist/_pkg/hex/neutral/address/is.d.ts +12 -0
- package/dist/_pkg/hex/neutral/address/to.d.ts +12 -0
- package/dist/_pkg/hex/neutral/ethAddress.d.ts +45 -0
- package/dist/_pkg/hex/neutral/hash/as.d.ts +11 -0
- package/dist/_pkg/hex/neutral/hash/hash.d.ts +28 -0
- package/dist/_pkg/hex/neutral/hash/index.d.ts +5 -0
- package/dist/_pkg/hex/neutral/hash/is.d.ts +9 -0
- package/dist/_pkg/hex/neutral/hash/zod.d.ts +6 -0
- package/dist/_pkg/hex/neutral/hex/as.d.ts +11 -0
- package/dist/_pkg/hex/neutral/hex/from/from.d.ts +8 -0
- package/dist/_pkg/hex/neutral/hex/from/fromArrayBuffer.d.ts +8 -0
- package/dist/_pkg/hex/neutral/hex/from/fromBigInt.d.ts +8 -0
- package/dist/_pkg/hex/neutral/hex/from/fromHexString.d.ts +9 -0
- package/dist/_pkg/hex/neutral/hex/from/fromNumber.d.ts +9 -0
- package/dist/_pkg/hex/neutral/hex/from/index.d.ts +6 -0
- package/dist/_pkg/hex/neutral/hex/hex.d.ts +17 -0
- package/dist/_pkg/hex/neutral/hex/index.d.ts +9 -0
- package/dist/_pkg/hex/neutral/hex/is.d.ts +9 -0
- package/dist/_pkg/hex/neutral/hex/isHexZero.d.ts +7 -0
- package/dist/_pkg/hex/neutral/hex/legacy.d.ts +7 -0
- package/dist/_pkg/hex/neutral/hex/nibble.d.ts +13 -0
- package/dist/_pkg/hex/neutral/hex/to.d.ts +8 -0
- package/dist/_pkg/hex/neutral/hexToBigInt.d.ts +8 -0
- package/dist/_pkg/hex/neutral/index.d.ts +8 -0
- package/dist/_pkg/hex/neutral/index.mjs +381 -0
- package/dist/_pkg/hex/neutral/model.d.ts +3 -0
- package/dist/_pkg/hex/neutral/model.mjs +1 -0
- package/dist/_pkg/hex/neutral/zod.d.ts +6 -0
- package/dist/_pkg/logger/neutral/ConsoleLogger.d.ts +7 -0
- package/dist/_pkg/logger/neutral/IdLogger.d.ts +19 -0
- package/dist/_pkg/logger/neutral/LevelLogger.d.ts +47 -0
- package/dist/_pkg/logger/neutral/NoOpLogFunction.d.ts +3 -0
- package/dist/_pkg/logger/neutral/SilentLogger.d.ts +17 -0
- package/dist/_pkg/logger/neutral/getFunctionName.d.ts +7 -0
- package/dist/_pkg/logger/neutral/index.d.ts +7 -0
- package/dist/_pkg/logger/neutral/index.mjs +126 -0
- package/dist/_pkg/object/neutral/AsObjectFactory.d.ts +8 -0
- package/dist/_pkg/object/neutral/AsTypeFactory.d.ts +11 -0
- package/dist/_pkg/object/neutral/EmptyObject.d.ts +2 -0
- package/dist/_pkg/object/neutral/IsObjectFactory.d.ts +16 -0
- package/dist/_pkg/object/neutral/JsonObject.d.ts +49 -0
- package/dist/_pkg/object/neutral/ObjectWrapper.d.ts +9 -0
- package/dist/_pkg/object/neutral/OmitStartsWith.d.ts +18 -0
- package/dist/_pkg/object/neutral/Optional.d.ts +3 -0
- package/dist/_pkg/object/neutral/Override.d.ts +4 -0
- package/dist/_pkg/object/neutral/PartialRecord.d.ts +3 -0
- package/dist/_pkg/object/neutral/PickStartsWith.d.ts +9 -0
- package/dist/_pkg/object/neutral/Simplify.d.ts +5 -0
- package/dist/_pkg/object/neutral/StringKeyObject.d.ts +3 -0
- package/dist/_pkg/object/neutral/Validator.d.ts +13 -0
- package/dist/_pkg/object/neutral/WithAdditional.d.ts +4 -0
- package/dist/_pkg/object/neutral/asObject.d.ts +4 -0
- package/dist/_pkg/object/neutral/deepMerge.d.ts +49 -0
- package/dist/_pkg/object/neutral/index-deprecated.d.ts +2 -0
- package/dist/_pkg/object/neutral/index-un-deprecated.d.ts +22 -0
- package/dist/_pkg/object/neutral/index-un-deprecated.mjs +320 -0
- package/dist/_pkg/object/neutral/index.d.ts +3 -0
- package/dist/_pkg/object/neutral/index.mjs +435 -0
- package/dist/_pkg/object/neutral/isType.d.ts +4 -0
- package/dist/_pkg/object/neutral/model.d.ts +14 -0
- package/dist/_pkg/object/neutral/model.mjs +1 -0
- package/dist/_pkg/object/neutral/omitBy.d.ts +21 -0
- package/dist/_pkg/object/neutral/pickBy.d.ts +21 -0
- package/dist/_pkg/object/neutral/removeFields.d.ts +9 -0
- package/dist/_pkg/object/neutral/toSafeJson.d.ts +41 -0
- package/dist/_pkg/object-model/neutral/AnyObject.d.ts +8 -0
- package/dist/_pkg/object-model/neutral/AsTypeFactory.d.ts +12 -0
- package/dist/_pkg/object-model/neutral/AsTypeFunction.d.ts +14 -0
- package/dist/_pkg/object-model/neutral/Compare.d.ts +3 -0
- package/dist/_pkg/object-model/neutral/EmptyObject.d.ts +8 -0
- package/dist/_pkg/object-model/neutral/index.d.ts +6 -0
- package/dist/_pkg/object-model/neutral/index.mjs +1 -0
- package/dist/_pkg/object-model/neutral/model.d.ts +6 -0
- package/dist/_pkg/object-model/neutral/model.mjs +1 -0
- package/dist/_pkg/object-model/neutral/types.d.ts +25 -0
- package/dist/_pkg/platform/browser/browser/index.d.ts +9 -0
- package/dist/_pkg/platform/browser/index-browser.d.ts +2 -0
- package/dist/_pkg/platform/browser/index-browser.mjs +18 -0
- package/dist/_pkg/platform/browser/index-node.d.ts +2 -0
- package/dist/_pkg/platform/browser/node/index.d.ts +9 -0
- package/dist/_pkg/platform/node/browser/index.d.ts +9 -0
- package/dist/_pkg/platform/node/index-browser.d.ts +2 -0
- package/dist/_pkg/platform/node/index-node.d.ts +2 -0
- package/dist/_pkg/platform/node/index-node.mjs +18 -0
- package/dist/_pkg/platform/node/node/index.d.ts +9 -0
- package/dist/_pkg/profile/neutral/index.d.ts +2 -0
- package/dist/_pkg/profile/neutral/index.mjs +37 -0
- package/dist/_pkg/profile/neutral/model.d.ts +2 -0
- package/dist/_pkg/profile/neutral/model.mjs +1 -0
- package/dist/_pkg/profile/neutral/profiler.d.ts +17 -0
- package/dist/_pkg/promise/neutral/PromiseEx.d.ts +24 -0
- package/dist/_pkg/promise/neutral/fulfilled.d.ts +7 -0
- package/dist/_pkg/promise/neutral/fulfilledValues.d.ts +20 -0
- package/dist/_pkg/promise/neutral/index.d.ts +7 -0
- package/dist/_pkg/promise/neutral/index.mjs +57 -0
- package/dist/_pkg/promise/neutral/model.d.ts +3 -0
- package/dist/_pkg/promise/neutral/model.mjs +1 -0
- package/dist/_pkg/promise/neutral/rejected.d.ts +7 -0
- package/dist/_pkg/promise/neutral/toPromise.d.ts +8 -0
- package/dist/_pkg/promise/neutral/types.d.ts +23 -0
- package/dist/_pkg/retry/neutral/index.d.ts +2 -0
- package/dist/_pkg/retry/neutral/index.mjs +28 -0
- package/dist/_pkg/retry/neutral/model.d.ts +2 -0
- package/dist/_pkg/retry/neutral/model.mjs +1 -0
- package/dist/_pkg/retry/neutral/retry.d.ts +23 -0
- package/dist/_pkg/set/neutral/index.d.ts +2 -0
- package/dist/_pkg/set/neutral/index.mjs +20 -0
- package/dist/_pkg/set/neutral/lib/difference.d.ts +8 -0
- package/dist/_pkg/set/neutral/lib/index.d.ts +4 -0
- package/dist/_pkg/set/neutral/lib/intersection.d.ts +8 -0
- package/dist/_pkg/set/neutral/lib/union.d.ts +8 -0
- package/dist/_pkg/static-implements/neutral/index.d.ts +2 -0
- package/dist/_pkg/static-implements/neutral/index.mjs +10 -0
- package/dist/_pkg/static-implements/neutral/staticImplements.d.ts +7 -0
- package/dist/_pkg/storage/neutral/KeyValueStore.d.ts +34 -0
- package/dist/_pkg/storage/neutral/index.d.ts +2 -0
- package/dist/_pkg/storage/neutral/index.mjs +1 -0
- package/dist/_pkg/storage/neutral/model.d.ts +2 -0
- package/dist/_pkg/storage/neutral/model.mjs +1 -0
- package/dist/_pkg/telemetry/neutral/index.d.ts +3 -0
- package/dist/_pkg/telemetry/neutral/index.mjs +152 -0
- package/dist/_pkg/telemetry/neutral/model.d.ts +2 -0
- package/dist/_pkg/telemetry/neutral/model.mjs +1 -0
- package/dist/_pkg/telemetry/neutral/span.d.ts +51 -0
- package/dist/_pkg/telemetry/neutral/timeBudget.d.ts +12 -0
- package/dist/_pkg/telemetry-exporter/neutral/XyConsoleSpanExporter.d.ts +40 -0
- package/dist/_pkg/telemetry-exporter/neutral/index.d.ts +2 -0
- package/dist/_pkg/telemetry-exporter/neutral/index.mjs +88 -0
- package/dist/_pkg/timer/neutral/index.d.ts +2 -0
- package/dist/_pkg/timer/neutral/index.mjs +75 -0
- package/dist/_pkg/timer/neutral/setTimeoutEx.d.ts +37 -0
- package/dist/_pkg/typeof/neutral/Brand.d.ts +5 -0
- package/dist/_pkg/typeof/neutral/IdentityFunction.d.ts +3 -0
- package/dist/_pkg/typeof/neutral/ObjectTypeShape.d.ts +5 -0
- package/dist/_pkg/typeof/neutral/TypeOfTypes.d.ts +3 -0
- package/dist/_pkg/typeof/neutral/Typed.d.ts +41 -0
- package/dist/_pkg/typeof/neutral/ifDefined.d.ts +8 -0
- package/dist/_pkg/typeof/neutral/ifTypeOf.d.ts +11 -0
- package/dist/_pkg/typeof/neutral/index.d.ts +12 -0
- package/dist/_pkg/typeof/neutral/index.mjs +255 -0
- package/dist/_pkg/typeof/neutral/is.d.ts +116 -0
- package/dist/_pkg/typeof/neutral/isType.d.ts +9 -0
- package/dist/_pkg/typeof/neutral/model.d.ts +7 -0
- package/dist/_pkg/typeof/neutral/model.mjs +1 -0
- package/dist/_pkg/typeof/neutral/typeOf.d.ts +8 -0
- package/dist/_pkg/typeof/neutral/validateType.d.ts +10 -0
- package/dist/_pkg/url/browser/index-browser.d.ts +12 -0
- package/dist/_pkg/url/browser/index-browser.mjs +12 -0
- package/dist/_pkg/url/browser/index-neutral.d.ts +12 -0
- package/dist/_pkg/url/browser/index-node.d.ts +13 -0
- package/dist/_pkg/url/browser/lib/index.d.ts +2 -0
- package/dist/_pkg/url/browser/lib/isLocalhost.d.ts +7 -0
- package/dist/_pkg/url/neutral/index-browser.d.ts +12 -0
- package/dist/_pkg/url/neutral/index-neutral.d.ts +12 -0
- package/dist/_pkg/url/neutral/index-neutral.mjs +12 -0
- package/dist/_pkg/url/neutral/index-node.d.ts +13 -0
- package/dist/_pkg/url/neutral/lib/index.d.ts +2 -0
- package/dist/_pkg/url/neutral/lib/isLocalhost.d.ts +7 -0
- package/dist/_pkg/url/node/index-browser.d.ts +12 -0
- package/dist/_pkg/url/node/index-neutral.d.ts +12 -0
- package/dist/_pkg/url/node/index-node.d.ts +13 -0
- package/dist/_pkg/url/node/index-node.mjs +15 -0
- package/dist/_pkg/url/node/lib/index.d.ts +2 -0
- package/dist/_pkg/url/node/lib/isLocalhost.d.ts +7 -0
- package/dist/_pkg/zod/neutral/Config.d.ts +8 -0
- package/dist/_pkg/zod/neutral/index.d.ts +8 -0
- package/dist/_pkg/zod/neutral/index.mjs +127 -0
- package/dist/_pkg/zod/neutral/model.d.ts +2 -0
- package/dist/_pkg/zod/neutral/model.mjs +1 -0
- package/dist/_pkg/zod/neutral/zodAllFactory.d.ts +20 -0
- package/dist/_pkg/zod/neutral/zodAsAsyncFactory.d.ts +14 -0
- package/dist/_pkg/zod/neutral/zodAsFactory.d.ts +14 -0
- package/dist/_pkg/zod/neutral/zodIsFactory.d.ts +8 -0
- package/dist/_pkg/zod/neutral/zodToAsyncFactory.d.ts +14 -0
- package/dist/_pkg/zod/neutral/zodToFactory.d.ts +14 -0
- package/dist/browser/index.d.ts +32 -0
- package/dist/browser/index.mjs +32 -0
- package/dist/browser/platform.d.ts +1 -0
- package/dist/browser/platform.mjs +1 -0
- package/dist/browser/url.d.ts +1 -0
- package/dist/browser/url.mjs +1 -0
- package/dist/neutral/api.d.ts +1 -0
- package/dist/neutral/api.mjs +1 -0
- package/dist/neutral/api.model.d.ts +1 -0
- package/dist/neutral/api.model.mjs +1 -0
- package/dist/neutral/array.d.ts +1 -0
- package/dist/neutral/array.mjs +1 -0
- package/dist/neutral/arraybuffer.d.ts +1 -0
- package/dist/neutral/arraybuffer.mjs +1 -0
- package/dist/neutral/assert.d.ts +1 -0
- package/dist/neutral/assert.mjs +1 -0
- package/dist/neutral/assert.model.d.ts +1 -0
- package/dist/neutral/assert.model.mjs +1 -0
- package/dist/neutral/base.d.ts +1 -0
- package/dist/neutral/base.mjs +1 -0
- package/dist/neutral/base.model.d.ts +1 -0
- package/dist/neutral/base.model.mjs +1 -0
- package/dist/neutral/creatable.d.ts +1 -0
- package/dist/neutral/creatable.mjs +1 -0
- package/dist/neutral/creatable.model.d.ts +1 -0
- package/dist/neutral/creatable.model.mjs +1 -0
- package/dist/neutral/decimal-precision.d.ts +1 -0
- package/dist/neutral/decimal-precision.mjs +1 -0
- package/dist/neutral/delay.d.ts +1 -0
- package/dist/neutral/delay.mjs +1 -0
- package/dist/neutral/ellipsize.d.ts +1 -0
- package/dist/neutral/ellipsize.mjs +1 -0
- package/dist/neutral/enum.d.ts +1 -0
- package/dist/neutral/enum.mjs +1 -0
- package/dist/neutral/enum.model.d.ts +1 -0
- package/dist/neutral/enum.model.mjs +1 -0
- package/dist/neutral/error.d.ts +1 -0
- package/dist/neutral/error.mjs +1 -0
- package/dist/neutral/error.model.d.ts +1 -0
- package/dist/neutral/error.model.mjs +1 -0
- package/dist/neutral/events.d.ts +1 -0
- package/dist/neutral/events.mjs +1 -0
- package/dist/neutral/events.model.d.ts +1 -0
- package/dist/neutral/events.model.mjs +1 -0
- package/dist/neutral/exists.d.ts +1 -0
- package/dist/neutral/exists.mjs +1 -0
- package/dist/neutral/fetch.d.ts +1 -0
- package/dist/neutral/fetch.mjs +1 -0
- package/dist/neutral/fetch.model.d.ts +1 -0
- package/dist/neutral/fetch.model.mjs +1 -0
- package/dist/neutral/forget.d.ts +1 -0
- package/dist/neutral/forget.mjs +1 -0
- package/dist/neutral/forget.model.d.ts +1 -0
- package/dist/neutral/forget.model.mjs +1 -0
- package/dist/neutral/function-name.d.ts +1 -0
- package/dist/neutral/function-name.mjs +1 -0
- package/dist/neutral/hex.d.ts +1 -0
- package/dist/neutral/hex.mjs +1 -0
- package/dist/neutral/hex.model.d.ts +1 -0
- package/dist/neutral/hex.model.mjs +1 -0
- package/dist/neutral/logger.d.ts +1 -0
- package/dist/neutral/logger.mjs +1 -0
- package/dist/neutral/model.d.ts +18 -0
- package/dist/neutral/model.mjs +18 -0
- package/dist/neutral/object.d.ts +1 -0
- package/dist/neutral/object.mjs +1 -0
- package/dist/neutral/object.model.d.ts +1 -0
- package/dist/neutral/object.model.mjs +1 -0
- package/dist/neutral/profile.d.ts +1 -0
- package/dist/neutral/profile.mjs +1 -0
- package/dist/neutral/profile.model.d.ts +1 -0
- package/dist/neutral/profile.model.mjs +1 -0
- package/dist/neutral/promise.d.ts +1 -0
- package/dist/neutral/promise.mjs +1 -0
- package/dist/neutral/promise.model.d.ts +1 -0
- package/dist/neutral/promise.model.mjs +1 -0
- package/dist/neutral/retry.d.ts +1 -0
- package/dist/neutral/retry.mjs +1 -0
- package/dist/neutral/retry.model.d.ts +1 -0
- package/dist/neutral/retry.model.mjs +1 -0
- package/dist/neutral/set.d.ts +1 -0
- package/dist/neutral/set.mjs +1 -0
- package/dist/neutral/static-implements.d.ts +1 -0
- package/dist/neutral/static-implements.mjs +1 -0
- package/dist/neutral/storage.d.ts +1 -0
- package/dist/neutral/storage.mjs +1 -0
- package/dist/neutral/storage.model.d.ts +1 -0
- package/dist/neutral/storage.model.mjs +1 -0
- package/dist/neutral/telemetry-exporter.d.ts +1 -0
- package/dist/neutral/telemetry-exporter.mjs +1 -0
- package/dist/neutral/telemetry.d.ts +1 -0
- package/dist/neutral/telemetry.mjs +1 -0
- package/dist/neutral/telemetry.model.d.ts +1 -0
- package/dist/neutral/telemetry.model.mjs +1 -0
- package/dist/neutral/timer.d.ts +1 -0
- package/dist/neutral/timer.mjs +1 -0
- package/dist/neutral/typeof.d.ts +1 -0
- package/dist/neutral/typeof.mjs +1 -0
- package/dist/neutral/typeof.model.d.ts +1 -0
- package/dist/neutral/typeof.model.mjs +1 -0
- package/dist/neutral/url.d.ts +1 -0
- package/dist/neutral/url.mjs +1 -0
- package/dist/neutral/zod.d.ts +1 -0
- package/dist/neutral/zod.mjs +1 -0
- package/dist/neutral/zod.model.d.ts +1 -0
- package/dist/neutral/zod.model.mjs +1 -0
- package/dist/node/index.d.ts +32 -0
- package/dist/node/index.mjs +32 -0
- package/dist/node/platform.d.ts +1 -0
- package/dist/node/platform.mjs +1 -0
- package/dist/node/url.d.ts +1 -0
- package/dist/node/url.mjs +1 -0
- package/package.json +339 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// src/span.ts
|
|
2
|
+
import { isDefined } from "../../typeof/neutral/index.mjs";
|
|
3
|
+
import {
|
|
4
|
+
context,
|
|
5
|
+
propagation,
|
|
6
|
+
ROOT_CONTEXT,
|
|
7
|
+
SpanStatusCode,
|
|
8
|
+
trace as TRACE_API
|
|
9
|
+
} from "@opentelemetry/api";
|
|
10
|
+
|
|
11
|
+
// src/timeBudget.ts
|
|
12
|
+
async function timeBudget(name, logger, func, budget, status = false) {
|
|
13
|
+
const start = Date.now();
|
|
14
|
+
const timer = status ? setInterval(() => {
|
|
15
|
+
const duration2 = Date.now() - start;
|
|
16
|
+
if (budget > 0 && duration2 > budget) {
|
|
17
|
+
logger?.warn(`Function [${name}] execution is exceeding budget: ${duration2}ms > ${budget}ms`);
|
|
18
|
+
}
|
|
19
|
+
}, Math.max(100, budget)) : void 0;
|
|
20
|
+
const result = await func();
|
|
21
|
+
const duration = Date.now() - start;
|
|
22
|
+
if (timer === void 0 && budget > 0 && duration > budget) {
|
|
23
|
+
logger?.warn(`Function [${name}] execution exceeded budget: ${duration}ms > ${budget}ms`);
|
|
24
|
+
}
|
|
25
|
+
if (timer !== void 0) {
|
|
26
|
+
clearInterval(timer);
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/span.ts
|
|
32
|
+
function cloneContextWithoutSpan(activeCtx, configKeys = []) {
|
|
33
|
+
let newCtx = ROOT_CONTEXT;
|
|
34
|
+
const baggage = propagation.getBaggage(activeCtx);
|
|
35
|
+
if (baggage) {
|
|
36
|
+
newCtx = propagation.setBaggage(newCtx, baggage);
|
|
37
|
+
}
|
|
38
|
+
for (const key of configKeys) {
|
|
39
|
+
const value = activeCtx.getValue(key);
|
|
40
|
+
if (value !== void 0) {
|
|
41
|
+
newCtx = newCtx.setValue(key, value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return newCtx;
|
|
45
|
+
}
|
|
46
|
+
function span(name, fn, traceProvider = TRACE_API) {
|
|
47
|
+
const activeTracer = traceProvider.getTracer(name);
|
|
48
|
+
if (isDefined(activeTracer)) {
|
|
49
|
+
const span2 = activeTracer.startSpan(name);
|
|
50
|
+
return context.with(TRACE_API.setSpan(context.active(), span2), () => {
|
|
51
|
+
try {
|
|
52
|
+
const result = fn();
|
|
53
|
+
span2.setStatus({ code: SpanStatusCode.OK });
|
|
54
|
+
return result;
|
|
55
|
+
} catch (ex) {
|
|
56
|
+
const error = ex;
|
|
57
|
+
span2.recordException(error);
|
|
58
|
+
span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
59
|
+
throw ex;
|
|
60
|
+
} finally {
|
|
61
|
+
span2.end();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return fn();
|
|
66
|
+
}
|
|
67
|
+
function spanRoot(name, fn, tracer) {
|
|
68
|
+
const activeTracer = tracer ?? TRACE_API.getTracer(name);
|
|
69
|
+
if (isDefined(activeTracer)) {
|
|
70
|
+
const activeContext = context.active();
|
|
71
|
+
const noSpanContext = cloneContextWithoutSpan(activeContext);
|
|
72
|
+
const span2 = activeTracer.startSpan(name, {}, noSpanContext);
|
|
73
|
+
return context.with(TRACE_API.setSpan(noSpanContext, span2), () => {
|
|
74
|
+
try {
|
|
75
|
+
const result = fn();
|
|
76
|
+
span2.setStatus({ code: SpanStatusCode.OK });
|
|
77
|
+
return result;
|
|
78
|
+
} catch (ex) {
|
|
79
|
+
const error = ex;
|
|
80
|
+
span2.recordException(error);
|
|
81
|
+
span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
82
|
+
throw ex;
|
|
83
|
+
} finally {
|
|
84
|
+
span2.end();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return fn();
|
|
89
|
+
}
|
|
90
|
+
async function spanAsync(name, fn, {
|
|
91
|
+
timeBudgetLimit,
|
|
92
|
+
logger,
|
|
93
|
+
tracer
|
|
94
|
+
} = {}) {
|
|
95
|
+
const activeTracer = tracer ?? TRACE_API.getTracer(name);
|
|
96
|
+
const funcToRun = isDefined(timeBudgetLimit) ? () => timeBudget(name, logger ?? console, fn, timeBudgetLimit) : fn;
|
|
97
|
+
if (isDefined(activeTracer)) {
|
|
98
|
+
const span2 = activeTracer.startSpan(name);
|
|
99
|
+
return await context.with(TRACE_API.setSpan(context.active(), span2), async () => {
|
|
100
|
+
try {
|
|
101
|
+
const result = await funcToRun();
|
|
102
|
+
span2.setStatus({ code: SpanStatusCode.OK });
|
|
103
|
+
return result;
|
|
104
|
+
} catch (ex) {
|
|
105
|
+
const error = ex;
|
|
106
|
+
span2.recordException(error);
|
|
107
|
+
span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
108
|
+
throw ex;
|
|
109
|
+
} finally {
|
|
110
|
+
span2.end();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return await funcToRun();
|
|
115
|
+
}
|
|
116
|
+
async function spanRootAsync(name, fn, {
|
|
117
|
+
timeBudgetLimit,
|
|
118
|
+
logger,
|
|
119
|
+
tracer
|
|
120
|
+
} = {}) {
|
|
121
|
+
const funcToRun = isDefined(timeBudgetLimit) ? () => timeBudget(name, logger ?? console, fn, timeBudgetLimit) : fn;
|
|
122
|
+
const activeTracer = tracer ?? TRACE_API.getTracer(name);
|
|
123
|
+
if (isDefined(activeTracer)) {
|
|
124
|
+
const activeContext = context.active();
|
|
125
|
+
const noSpanContext = cloneContextWithoutSpan(activeContext);
|
|
126
|
+
const span2 = activeTracer.startSpan(name, {}, noSpanContext);
|
|
127
|
+
return await context.with(TRACE_API.setSpan(noSpanContext, span2), async () => {
|
|
128
|
+
try {
|
|
129
|
+
const result = await funcToRun();
|
|
130
|
+
span2.setStatus({ code: SpanStatusCode.OK });
|
|
131
|
+
return result;
|
|
132
|
+
} catch (ex) {
|
|
133
|
+
const error = ex;
|
|
134
|
+
span2.recordException(error);
|
|
135
|
+
span2.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
|
|
136
|
+
throw ex;
|
|
137
|
+
} finally {
|
|
138
|
+
span2.end();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
return await funcToRun();
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
cloneContextWithoutSpan,
|
|
146
|
+
span,
|
|
147
|
+
spanAsync,
|
|
148
|
+
spanRoot,
|
|
149
|
+
spanRootAsync,
|
|
150
|
+
timeBudget
|
|
151
|
+
};
|
|
152
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=model.mjs.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Logger } from '../../logger/neutral/index.ts';
|
|
2
|
+
import type { Context, Tracer, TracerProvider } from '@opentelemetry/api';
|
|
3
|
+
/** Configuration options for span creation and execution. */
|
|
4
|
+
export interface SpanConfig {
|
|
5
|
+
/** Optional logger for time budget warnings. Falls back to console if not provided. */
|
|
6
|
+
logger?: Logger | null;
|
|
7
|
+
/** Maximum allowed execution time in milliseconds before logging a warning. */
|
|
8
|
+
timeBudgetLimit?: number;
|
|
9
|
+
/** OpenTelemetry tracer to use. Defaults to a tracer named after the span. */
|
|
10
|
+
tracer?: Tracer;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new OpenTelemetry context that preserves baggage and custom keys but has no active span.
|
|
14
|
+
* @param activeCtx - The context to clone from.
|
|
15
|
+
* @param configKeys - Additional context keys to copy.
|
|
16
|
+
* @returns A new context with baggage but no parent span.
|
|
17
|
+
*/
|
|
18
|
+
export declare function cloneContextWithoutSpan(activeCtx: Context, configKeys?: symbol[]): Context;
|
|
19
|
+
/**
|
|
20
|
+
* Executes a synchronous function within an OpenTelemetry span, recording status and exceptions.
|
|
21
|
+
* @param name - The span name.
|
|
22
|
+
* @param fn - The function to execute.
|
|
23
|
+
* @param tracer - Optional tracer to use.
|
|
24
|
+
* @returns The return value of `fn`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function span<T>(name: string, fn: () => T, traceProvider?: TracerProvider): T;
|
|
27
|
+
/**
|
|
28
|
+
* Executes a synchronous function within a new root span that has no parent, even if a span is already active.
|
|
29
|
+
* @param name - The span name.
|
|
30
|
+
* @param fn - The function to execute.
|
|
31
|
+
* @param tracer - Optional tracer to use.
|
|
32
|
+
* @returns The return value of `fn`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function spanRoot<T>(name: string, fn: () => T, tracer?: Tracer): T;
|
|
35
|
+
/**
|
|
36
|
+
* Executes an async function within an OpenTelemetry span, with optional time budget monitoring.
|
|
37
|
+
* @param name - The span name.
|
|
38
|
+
* @param fn - The async function to execute.
|
|
39
|
+
* @param config - Optional span configuration (tracer, logger, time budget).
|
|
40
|
+
* @returns The resolved value of `fn`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function spanAsync<T>(name: string, fn: () => Promise<T>, { timeBudgetLimit, logger, tracer, }?: SpanConfig): Promise<T>;
|
|
43
|
+
/**
|
|
44
|
+
* Executes an async function within a new root span (no parent), with optional time budget monitoring.
|
|
45
|
+
* @param name - The span name.
|
|
46
|
+
* @param fn - The async function to execute.
|
|
47
|
+
* @param config - Optional span configuration (tracer, logger, time budget).
|
|
48
|
+
* @returns The resolved value of `fn`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function spanRootAsync<T>(name: string, fn: () => Promise<T>, { timeBudgetLimit, logger, tracer, }?: SpanConfig): Promise<T>;
|
|
51
|
+
//# sourceMappingURL=span.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Logger } from '../../logger/neutral/index.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Executes an async function and logs a warning if it exceeds the given time budget.
|
|
4
|
+
* @param name - A label for the function, used in warning messages.
|
|
5
|
+
* @param logger - The logger to use for budget-exceeded warnings.
|
|
6
|
+
* @param func - The async function to execute.
|
|
7
|
+
* @param budget - The time budget in milliseconds.
|
|
8
|
+
* @param status - If true, logs periodic warnings while the function is still running.
|
|
9
|
+
* @returns The result of the executed function.
|
|
10
|
+
*/
|
|
11
|
+
export declare function timeBudget<TResult>(name: string, logger: Logger | undefined, func: () => Promise<TResult>, budget: number, status?: boolean): Promise<TResult>;
|
|
12
|
+
//# sourceMappingURL=timeBudget.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Logger } from '../../logger/neutral/index.ts';
|
|
2
|
+
import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import { ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
4
|
+
type LogColor = (value: string) => string;
|
|
5
|
+
/**
|
|
6
|
+
* Calculates the duration of a span in milliseconds from its high-resolution time tuple.
|
|
7
|
+
* @param span - The span to measure.
|
|
8
|
+
* @returns The span duration in milliseconds.
|
|
9
|
+
*/
|
|
10
|
+
export declare function spanDurationInMillis(span: ReadableSpan): number;
|
|
11
|
+
/**
|
|
12
|
+
* A console span exporter that formats spans with color-coded durations using chalk.
|
|
13
|
+
* Spans are filtered by a configurable log level based on their duration.
|
|
14
|
+
*/
|
|
15
|
+
export declare class XyConsoleSpanExporter extends ConsoleSpanExporter {
|
|
16
|
+
/** Duration thresholds (in ms) that map to increasing log levels. */
|
|
17
|
+
static readonly durationToLogLevel: number[];
|
|
18
|
+
/** Chalk color functions corresponding to each log level. */
|
|
19
|
+
static readonly logLevelToChalkColor: LogColor[];
|
|
20
|
+
logger: Logger;
|
|
21
|
+
private _logLevel;
|
|
22
|
+
constructor(logLevel?: number, logger?: Logger);
|
|
23
|
+
/** The minimum log level required for a span to be exported. */
|
|
24
|
+
get logLevel(): number;
|
|
25
|
+
export(spans: ReadableSpan[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Returns the chalk color function for the given log level.
|
|
28
|
+
* @param level - The log level index.
|
|
29
|
+
* @returns A chalk color function.
|
|
30
|
+
*/
|
|
31
|
+
logColor(level: number): LogColor;
|
|
32
|
+
/**
|
|
33
|
+
* Determines the log level of a span based on its duration.
|
|
34
|
+
* @param span - The span to evaluate.
|
|
35
|
+
* @returns The numeric log level (index into durationToLogLevel).
|
|
36
|
+
*/
|
|
37
|
+
spanLevel(span: ReadableSpan): number;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=XyConsoleSpanExporter.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// src/XyConsoleSpanExporter.ts
|
|
2
|
+
import { ConsoleSpanExporter } from "@opentelemetry/sdk-trace-base";
|
|
3
|
+
var color = (open, close = 39) => {
|
|
4
|
+
return (value) => `\x1B[${open}m${value}\x1B[${close}m`;
|
|
5
|
+
};
|
|
6
|
+
var logColors = {
|
|
7
|
+
green: color(32),
|
|
8
|
+
grey: color(90),
|
|
9
|
+
magenta: color(35),
|
|
10
|
+
red: color(31),
|
|
11
|
+
white: color(37),
|
|
12
|
+
yellow: color(33)
|
|
13
|
+
};
|
|
14
|
+
function spanDurationInMillis(span) {
|
|
15
|
+
return span.duration[0] * 1e3 + span.duration[1] / 1e6;
|
|
16
|
+
}
|
|
17
|
+
var XyConsoleSpanExporter = class _XyConsoleSpanExporter extends ConsoleSpanExporter {
|
|
18
|
+
/** Duration thresholds (in ms) that map to increasing log levels. */
|
|
19
|
+
static durationToLogLevel = [
|
|
20
|
+
0,
|
|
21
|
+
1,
|
|
22
|
+
10,
|
|
23
|
+
100,
|
|
24
|
+
1e3
|
|
25
|
+
];
|
|
26
|
+
/** Chalk color functions corresponding to each log level. */
|
|
27
|
+
static logLevelToChalkColor = [
|
|
28
|
+
logColors.grey,
|
|
29
|
+
logColors.white,
|
|
30
|
+
logColors.green,
|
|
31
|
+
logColors.yellow,
|
|
32
|
+
logColors.red
|
|
33
|
+
];
|
|
34
|
+
logger;
|
|
35
|
+
_logLevel;
|
|
36
|
+
constructor(logLevel = 0, logger = console) {
|
|
37
|
+
super();
|
|
38
|
+
this._logLevel = logLevel;
|
|
39
|
+
this.logger = logger;
|
|
40
|
+
}
|
|
41
|
+
/** The minimum log level required for a span to be exported. */
|
|
42
|
+
get logLevel() {
|
|
43
|
+
return this._logLevel;
|
|
44
|
+
}
|
|
45
|
+
export(spans) {
|
|
46
|
+
for (const span of spans) {
|
|
47
|
+
const spanLevel = this.spanLevel(span);
|
|
48
|
+
if (spanLevel < this.logLevel) {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const duration = spanDurationInMillis(span);
|
|
52
|
+
this.logger.log(logColors.grey([
|
|
53
|
+
`Span [${span.name}]`,
|
|
54
|
+
this.logColor(spanLevel)(`${duration}ms`),
|
|
55
|
+
`TraceId: ${span.spanContext().traceId}`
|
|
56
|
+
].join(", ")));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns the chalk color function for the given log level.
|
|
61
|
+
* @param level - The log level index.
|
|
62
|
+
* @returns A chalk color function.
|
|
63
|
+
*/
|
|
64
|
+
logColor(level) {
|
|
65
|
+
return _XyConsoleSpanExporter.logLevelToChalkColor[level] ?? logColors.magenta;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Determines the log level of a span based on its duration.
|
|
69
|
+
* @param span - The span to evaluate.
|
|
70
|
+
* @returns The numeric log level (index into durationToLogLevel).
|
|
71
|
+
*/
|
|
72
|
+
spanLevel(span) {
|
|
73
|
+
let logLevel = 0;
|
|
74
|
+
const duration = spanDurationInMillis(span);
|
|
75
|
+
for (let x = _XyConsoleSpanExporter.durationToLogLevel.length - 1; x >= 0; x--) {
|
|
76
|
+
if (duration > _XyConsoleSpanExporter.durationToLogLevel[x]) {
|
|
77
|
+
logLevel = x;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return logLevel;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
XyConsoleSpanExporter,
|
|
86
|
+
spanDurationInMillis
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/setTimeoutEx.ts
|
|
2
|
+
import { assertEx } from "../../assert/neutral/index.mjs";
|
|
3
|
+
var TimerScheduler = class {
|
|
4
|
+
currentTimeout;
|
|
5
|
+
interval = -1;
|
|
6
|
+
timeouts = [];
|
|
7
|
+
/**
|
|
8
|
+
* Cancels a timeout previously created with setTimeoutEx.
|
|
9
|
+
* @param id - The timeout ID returned by setTimeoutEx.
|
|
10
|
+
*/
|
|
11
|
+
clearTimeoutEx(id) {
|
|
12
|
+
this.timeouts = this.timeouts.filter((timeout) => timeout.id !== id);
|
|
13
|
+
this.update(this.timeouts);
|
|
14
|
+
}
|
|
15
|
+
/** Clears all scheduled timeouts and resets internal state. */
|
|
16
|
+
reset() {
|
|
17
|
+
this.interval = -1;
|
|
18
|
+
clearTimeout(this.currentTimeout);
|
|
19
|
+
this.currentTimeout = void 0;
|
|
20
|
+
this.timeouts = [];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sets a timeout using an optimized internal timer that coalesces multiple timeouts into a single native timer.
|
|
24
|
+
* @param func - The function to call after the delay.
|
|
25
|
+
* @param delay - The delay in milliseconds (must be >= 0).
|
|
26
|
+
* @returns A unique string ID that can be used with clearTimeoutEx to cancel the timeout.
|
|
27
|
+
*/
|
|
28
|
+
setTimeoutEx(func, delay) {
|
|
29
|
+
assertEx(delay >= 0, () => "delay must be >= 0");
|
|
30
|
+
const id = `${Date.now()}|${Math.random() * 9999999999}`;
|
|
31
|
+
this.timeouts.push({
|
|
32
|
+
delay,
|
|
33
|
+
func,
|
|
34
|
+
id
|
|
35
|
+
});
|
|
36
|
+
this.update();
|
|
37
|
+
return id;
|
|
38
|
+
}
|
|
39
|
+
timerFunc() {
|
|
40
|
+
const notFiring = this.timeouts.filter((timeout) => timeout.delay > this.interval);
|
|
41
|
+
const firing = this.timeouts.filter((timeout) => timeout.delay <= this.interval);
|
|
42
|
+
this.update(notFiring, this.interval);
|
|
43
|
+
for (const timeout of firing) {
|
|
44
|
+
timeout.func();
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
update(newTimeouts = this.timeouts, delayPassed = 0) {
|
|
48
|
+
if (newTimeouts.length === 0) {
|
|
49
|
+
this.reset();
|
|
50
|
+
} else {
|
|
51
|
+
const newInterval = Math.min(...newTimeouts.map((timeout) => timeout.delay));
|
|
52
|
+
if (newInterval === this.interval && this.currentTimeout !== void 0) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
clearTimeout(this.currentTimeout);
|
|
56
|
+
this.timeouts = newTimeouts.map((timeout) => ({
|
|
57
|
+
delay: timeout.delay - delayPassed,
|
|
58
|
+
func: timeout.func,
|
|
59
|
+
id: timeout.id
|
|
60
|
+
}));
|
|
61
|
+
this.interval = newInterval;
|
|
62
|
+
this.currentTimeout = setTimeout(() => this.timerFunc(), this.interval);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var defaultTimerScheduler = new TimerScheduler();
|
|
67
|
+
var setTimeoutEx = (func, delay) => defaultTimerScheduler.setTimeoutEx(func, delay);
|
|
68
|
+
var clearTimeoutEx = (id) => defaultTimerScheduler.clearTimeoutEx(id);
|
|
69
|
+
export {
|
|
70
|
+
TimerScheduler,
|
|
71
|
+
clearTimeoutEx,
|
|
72
|
+
defaultTimerScheduler,
|
|
73
|
+
setTimeoutEx
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Coalesces multiple logical timeouts into a single native timer. */
|
|
2
|
+
export declare class TimerScheduler {
|
|
3
|
+
private currentTimeout;
|
|
4
|
+
private interval;
|
|
5
|
+
private timeouts;
|
|
6
|
+
/**
|
|
7
|
+
* Cancels a timeout previously created with setTimeoutEx.
|
|
8
|
+
* @param id - The timeout ID returned by setTimeoutEx.
|
|
9
|
+
*/
|
|
10
|
+
clearTimeoutEx(id: string): void;
|
|
11
|
+
/** Clears all scheduled timeouts and resets internal state. */
|
|
12
|
+
reset(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Sets a timeout using an optimized internal timer that coalesces multiple timeouts into a single native timer.
|
|
15
|
+
* @param func - The function to call after the delay.
|
|
16
|
+
* @param delay - The delay in milliseconds (must be >= 0).
|
|
17
|
+
* @returns A unique string ID that can be used with clearTimeoutEx to cancel the timeout.
|
|
18
|
+
*/
|
|
19
|
+
setTimeoutEx(func: () => void, delay: number): string;
|
|
20
|
+
private timerFunc;
|
|
21
|
+
private update;
|
|
22
|
+
}
|
|
23
|
+
/** Default scheduler used by the module-level timeout helpers. */
|
|
24
|
+
export declare const defaultTimerScheduler: TimerScheduler;
|
|
25
|
+
/**
|
|
26
|
+
* Sets a timeout using an optimized internal timer that coalesces multiple timeouts into a single native timer.
|
|
27
|
+
* @param func - The function to call after the delay.
|
|
28
|
+
* @param delay - The delay in milliseconds (must be >= 0).
|
|
29
|
+
* @returns A unique string ID that can be used with clearTimeoutEx to cancel the timeout.
|
|
30
|
+
*/
|
|
31
|
+
export declare const setTimeoutEx: (func: () => void, delay: number) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Cancels a timeout previously created with setTimeoutEx.
|
|
34
|
+
* @param id - The timeout ID returned by setTimeoutEx.
|
|
35
|
+
*/
|
|
36
|
+
export declare const clearTimeoutEx: (id: string) => void;
|
|
37
|
+
//# sourceMappingURL=setTimeoutEx.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Union of string literals representing the possible types of an object field. */
|
|
2
|
+
export type FieldType = 'string' | 'number' | 'object' | 'symbol' | 'undefined' | 'null' | 'array' | 'function';
|
|
3
|
+
/** Describes the expected shape of an object by mapping each key to its expected field type. */
|
|
4
|
+
export type ObjectTypeShape = Record<string | number | symbol, FieldType>;
|
|
5
|
+
//# sourceMappingURL=ObjectTypeShape.d.ts.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/** Union of string literals representing the possible results of the extended `typeOf` function. */
|
|
2
|
+
export type TypeOfTypes = 'string' | 'number' | 'object' | 'array' | 'buffer' | 'null' | 'undefined' | 'bigint' | 'boolean' | 'function' | 'symbol';
|
|
3
|
+
//# sourceMappingURL=TypeOfTypes.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** A value that can appear in a typed object tree (primitives, objects, arrays, functions, and symbols). */
|
|
2
|
+
export type TypedValue = bigint | string | number | boolean | null | TypedObject | TypedArray | Function | symbol | undefined;
|
|
3
|
+
/** A valid key for a typed object. Defaults to string | number | symbol unless narrowed by T. */
|
|
4
|
+
export type TypedKey<T extends string | void = void> = T extends string ? T : string | number | symbol;
|
|
5
|
+
/** An object whose keys are TypedKey and whose values are TypedValue. */
|
|
6
|
+
export type TypedObject = object | {
|
|
7
|
+
[key: TypedKey]: TypedValue;
|
|
8
|
+
};
|
|
9
|
+
/** An array of TypedValue elements. */
|
|
10
|
+
export type TypedArray = TypedValue[];
|
|
11
|
+
/**
|
|
12
|
+
* Type guard that checks whether a value is a valid TypedKey (string, bigint, number, or symbol).
|
|
13
|
+
* @param value - The value to check.
|
|
14
|
+
* @returns True if the value is a valid TypedKey.
|
|
15
|
+
*/
|
|
16
|
+
export declare const isTypedKey: (value: unknown) => value is TypedKey;
|
|
17
|
+
/**
|
|
18
|
+
* Type guard that checks whether a value is a valid TypedValue.
|
|
19
|
+
* @param value - The value to check.
|
|
20
|
+
* @returns True if the value is a string, number, boolean, null, TypedObject, or TypedArray.
|
|
21
|
+
*/
|
|
22
|
+
export declare const isTypedValue: (value: unknown) => value is TypedValue;
|
|
23
|
+
/**
|
|
24
|
+
* Type guard that checks whether a value is a TypedArray (an array where every element is a TypedValue).
|
|
25
|
+
* @param value - The value to check.
|
|
26
|
+
* @returns True if the value is an array of TypedValue elements.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isTypedArray: (value: unknown) => value is TypedArray;
|
|
29
|
+
/**
|
|
30
|
+
* Type guard that checks whether a key-value pair has a valid TypedKey and TypedValue.
|
|
31
|
+
* @param pair - A tuple of [key, value] to validate.
|
|
32
|
+
* @returns True if the key is a TypedKey and the value is a TypedValue.
|
|
33
|
+
*/
|
|
34
|
+
export declare const isValidTypedFieldPair: (pair: [key: unknown, value: unknown]) => pair is [key: TypedKey, value: TypedValue];
|
|
35
|
+
/**
|
|
36
|
+
* Type guard that checks whether a value is a TypedObject (an object with TypedKey keys and TypedValue values).
|
|
37
|
+
* @param value - The value to check.
|
|
38
|
+
* @returns True if the value is a valid TypedObject.
|
|
39
|
+
*/
|
|
40
|
+
export declare const isTypedObject: (value: unknown) => value is TypedObject;
|
|
41
|
+
//# sourceMappingURL=Typed.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invokes the callback only if the value is neither null nor undefined.
|
|
3
|
+
* @param value - The value to check.
|
|
4
|
+
* @param func - The callback to invoke with the value if it is defined.
|
|
5
|
+
* @returns The value if defined, or undefined otherwise.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ifDefined: <T>(value: T, func: (value: T) => void) => T | undefined;
|
|
8
|
+
//# sourceMappingURL=ifDefined.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TypeOfTypes } from './TypeOfTypes.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Invokes the callback if the value matches the specified type, with an optional additional predicate.
|
|
4
|
+
* @param typeName - The expected type name to match against.
|
|
5
|
+
* @param value - The value to check.
|
|
6
|
+
* @param trueFunc - The callback to invoke if the type matches.
|
|
7
|
+
* @param isFunc - Optional additional predicate that must also return true.
|
|
8
|
+
* @returns The result of trueFunc if the type matches (and isFunc passes), or undefined.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ifTypeOf: <T, R>(typeName: TypeOfTypes, value: unknown, trueFunc: (value: T) => R, isFunc?: (value: T) => boolean) => R | undefined;
|
|
11
|
+
//# sourceMappingURL=ifTypeOf.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Brand.ts';
|
|
2
|
+
export * from './IdentityFunction.ts';
|
|
3
|
+
export * from './ifDefined.ts';
|
|
4
|
+
export * from './ifTypeOf.ts';
|
|
5
|
+
export * from './is.ts';
|
|
6
|
+
export * from './isType.ts';
|
|
7
|
+
export * from './ObjectTypeShape.ts';
|
|
8
|
+
export * from './Typed.ts';
|
|
9
|
+
export * from './typeOf.ts';
|
|
10
|
+
export * from './TypeOfTypes.ts';
|
|
11
|
+
export * from './validateType.ts';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|