@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,396 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
4
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
5
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
6
|
+
if (decorator = decorators[i])
|
|
7
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
8
|
+
if (kind && result) __defProp(target, key, result);
|
|
9
|
+
return result;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// src/AbstractCreatable.ts
|
|
13
|
+
import { assertEx } from "../../assert/neutral/index.mjs";
|
|
14
|
+
import { BaseEmitter } from "../../events/neutral/index.mjs";
|
|
15
|
+
import { spanRoot, spanRootAsync } from "../../telemetry/neutral/index.mjs";
|
|
16
|
+
import {
|
|
17
|
+
isError,
|
|
18
|
+
isNumber as isNumber2,
|
|
19
|
+
isString,
|
|
20
|
+
isUndefined
|
|
21
|
+
} from "../../typeof/neutral/index.mjs";
|
|
22
|
+
import { Mutex } from "async-mutex";
|
|
23
|
+
|
|
24
|
+
// src/Creatable.ts
|
|
25
|
+
function creatable() {
|
|
26
|
+
return (constructor) => {
|
|
27
|
+
constructor;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function creatableFactory() {
|
|
31
|
+
return (constructor) => {
|
|
32
|
+
constructor;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/Factory.ts
|
|
37
|
+
var Factory = class _Factory {
|
|
38
|
+
/** The Creatable class this factory delegates creation to. */
|
|
39
|
+
creatable;
|
|
40
|
+
/** Default parameters merged into every `create` call. */
|
|
41
|
+
defaultParams;
|
|
42
|
+
/** Labels identifying resources created by this factory. */
|
|
43
|
+
labels;
|
|
44
|
+
constructor(creatable2, params, labels = {}) {
|
|
45
|
+
this.creatable = creatable2;
|
|
46
|
+
this.defaultParams = params;
|
|
47
|
+
this.labels = Object.assign({}, creatable2.labels ?? {}, labels ?? {});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Creates a new Factory instance with the given default params and labels.
|
|
51
|
+
* @param creatableModule - The Creatable class to wrap
|
|
52
|
+
* @param params - Default parameters for new instances
|
|
53
|
+
* @param labels - Labels to assign to created instances
|
|
54
|
+
*/
|
|
55
|
+
static withParams(creatableModule, params, labels = {}) {
|
|
56
|
+
return new _Factory(creatableModule, params, labels);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Creates a new instance, merging the provided params over the factory defaults.
|
|
60
|
+
* @param params - Optional parameters to override the factory defaults
|
|
61
|
+
*/
|
|
62
|
+
create(params) {
|
|
63
|
+
const mergedParams = {
|
|
64
|
+
...this.defaultParams,
|
|
65
|
+
...params
|
|
66
|
+
};
|
|
67
|
+
return this.creatable.create(mergedParams);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// src/lib/getFunctionName.ts
|
|
72
|
+
import { isNumber } from "../../typeof/neutral/index.mjs";
|
|
73
|
+
function getFunctionName(depth = 2) {
|
|
74
|
+
const error = new Error("Stack");
|
|
75
|
+
let newIndex;
|
|
76
|
+
const stackParts = error.stack?.split("\n")[depth]?.split(" ");
|
|
77
|
+
const funcName = stackParts?.find((item, index) => {
|
|
78
|
+
if (!(item.length > 0 && item !== "at")) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (item === "new") {
|
|
82
|
+
newIndex = index;
|
|
83
|
+
}
|
|
84
|
+
return true;
|
|
85
|
+
}) ?? "<unknown>";
|
|
86
|
+
return isNumber(newIndex) ? `${funcName} ${stackParts?.[newIndex + 1]}` : funcName;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// src/lib/getRootFunction.ts
|
|
90
|
+
var getPrototype = (value) => {
|
|
91
|
+
const prototype = Object.getPrototypeOf(value);
|
|
92
|
+
return typeof prototype === "object" ? prototype : null;
|
|
93
|
+
};
|
|
94
|
+
function getRootFunction(obj, funcName) {
|
|
95
|
+
if (obj === null || typeof obj !== "object") return void 0;
|
|
96
|
+
let current = obj;
|
|
97
|
+
let prototype = getPrototype(current);
|
|
98
|
+
while (prototype !== null && prototype[funcName] !== void 0) {
|
|
99
|
+
current = prototype;
|
|
100
|
+
prototype = getPrototype(current);
|
|
101
|
+
}
|
|
102
|
+
return current[funcName];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// src/AbstractCreatable.ts
|
|
106
|
+
var AbstractCreatableConstructorKey = /* @__PURE__ */ Symbol.for("AbstractCreatableConstructor");
|
|
107
|
+
var CREATABLE_NOT_STARTED = "Creatable not Started";
|
|
108
|
+
var AbstractCreatable = class extends BaseEmitter {
|
|
109
|
+
/** Optional default logger for this instance. */
|
|
110
|
+
defaultLogger;
|
|
111
|
+
_startPromise;
|
|
112
|
+
_status = null;
|
|
113
|
+
_statusMutex = new Mutex();
|
|
114
|
+
_validatedParams;
|
|
115
|
+
constructor(key, params) {
|
|
116
|
+
assertEx(key === AbstractCreatableConstructorKey, () => "AbstractCreatable should not be instantiated directly, use the static create method instead");
|
|
117
|
+
super(params);
|
|
118
|
+
}
|
|
119
|
+
/** The name identifier for this creatable instance. */
|
|
120
|
+
get name() {
|
|
121
|
+
return this.params.name;
|
|
122
|
+
}
|
|
123
|
+
/** The validated and merged parameters for this instance. */
|
|
124
|
+
get params() {
|
|
125
|
+
this._validatedParams ??= this.paramsValidator(super.params);
|
|
126
|
+
return this._validatedParams;
|
|
127
|
+
}
|
|
128
|
+
/** Whether this instance can be started (must be in 'created' or 'stopped' status). */
|
|
129
|
+
get startable() {
|
|
130
|
+
return this.status === "created" || this.status === "stopped";
|
|
131
|
+
}
|
|
132
|
+
/** The current lifecycle status of this instance, or null if not yet initialized. */
|
|
133
|
+
get status() {
|
|
134
|
+
return this._status;
|
|
135
|
+
}
|
|
136
|
+
/** The status reporter used to broadcast lifecycle changes. */
|
|
137
|
+
get statusReporter() {
|
|
138
|
+
return this.params.statusReporter;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Asynchronously creates a new instance by processing params, constructing,
|
|
142
|
+
* and running both static and instance createHandlers.
|
|
143
|
+
* @param inParams - Optional partial parameters to configure the instance
|
|
144
|
+
* @returns The fully initialized instance
|
|
145
|
+
*/
|
|
146
|
+
static async create(inParams = {}) {
|
|
147
|
+
const params = await this.paramsHandler(inParams);
|
|
148
|
+
const name = params.name ?? this.name;
|
|
149
|
+
try {
|
|
150
|
+
const [Constructor] = [this];
|
|
151
|
+
const instance = new Constructor(AbstractCreatableConstructorKey, params);
|
|
152
|
+
instance.setStatus("creating");
|
|
153
|
+
const initializedInstance = await this.createHandler(instance);
|
|
154
|
+
await instance.createHandler();
|
|
155
|
+
instance.setStatus("created");
|
|
156
|
+
return initializedInstance;
|
|
157
|
+
} catch (ex) {
|
|
158
|
+
params.statusReporter?.report(name, "error", isError(ex) ? ex : new Error(`Error creating: ${name}`));
|
|
159
|
+
params.logger?.error(`Error creating creatable [${name}]: ${isError(ex) ? `${ex.message} ${ex.stack}` : String(ex)}`);
|
|
160
|
+
throw isError(ex) ? ex : new Error(`Error creating: ${name}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Static hook called during creation to perform additional initialization.
|
|
165
|
+
* Override in subclasses to customize post-construction setup.
|
|
166
|
+
* @param instance - The newly constructed instance
|
|
167
|
+
* @returns The instance, potentially modified
|
|
168
|
+
*/
|
|
169
|
+
static createHandler(instance) {
|
|
170
|
+
return instance;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Static hook called during creation to validate and transform params.
|
|
174
|
+
* Override in subclasses to add default values or validation.
|
|
175
|
+
* @param params - The raw partial params provided to `create`
|
|
176
|
+
* @returns The processed params ready for construction
|
|
177
|
+
*/
|
|
178
|
+
static paramsHandler(params = {}) {
|
|
179
|
+
return { ...params };
|
|
180
|
+
}
|
|
181
|
+
/** Instance-level creation hook. Override in subclasses to perform setup after construction. */
|
|
182
|
+
createHandler() {
|
|
183
|
+
assertEx(this._status === "creating", () => `createHandler can not be called [status = ${this.status}]`);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Validates and returns the merged params, ensuring required fields are present.
|
|
187
|
+
* Override in subclasses to add custom validation logic.
|
|
188
|
+
* @param params - The raw partial params to validate
|
|
189
|
+
* @returns The validated params
|
|
190
|
+
*/
|
|
191
|
+
paramsValidator(params) {
|
|
192
|
+
return { ...params, name: params.name };
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Executes a function within a telemetry span.
|
|
196
|
+
* @param name - The span name
|
|
197
|
+
* @param fn - The function to execute within the span
|
|
198
|
+
*/
|
|
199
|
+
span(name, fn) {
|
|
200
|
+
return spanRoot(name, fn, this.tracer);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Executes an async function within a telemetry span.
|
|
204
|
+
* @param name - The span name
|
|
205
|
+
* @param fn - The async function to execute within the span
|
|
206
|
+
* @param config - Optional span configuration
|
|
207
|
+
*/
|
|
208
|
+
async spanAsync(name, fn, config = {}) {
|
|
209
|
+
return await spanRootAsync(name, fn, {
|
|
210
|
+
...config,
|
|
211
|
+
tracer: config.tracer ?? this.tracer,
|
|
212
|
+
logger: config.logger ?? this.defaultLogger
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Starts the instance, transitioning through 'starting' to 'started' status.
|
|
217
|
+
* Thread-safe via mutex. Returns true if already started or started successfully.
|
|
218
|
+
*/
|
|
219
|
+
async start() {
|
|
220
|
+
this._noOverride("start");
|
|
221
|
+
if (this.status === "started") {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
return await this._statusMutex.runExclusive(async () => {
|
|
225
|
+
try {
|
|
226
|
+
if (this.status === "started") {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
assertEx(this.startable, () => `Creatable [${this.name}] is not startable in status [${this.status}]`);
|
|
230
|
+
this.setStatus("starting");
|
|
231
|
+
await this.startHandler();
|
|
232
|
+
this.setStatus("started");
|
|
233
|
+
return true;
|
|
234
|
+
} catch (ex) {
|
|
235
|
+
this.setStatus("error", isError(ex) ? ex : new Error(`Error starting: ${String(ex)}`));
|
|
236
|
+
this.logger?.error(`Error starting creatable [${this.name}]: ${isError(ex) ? `${ex.message} ${ex.stack}` : String(ex)}`);
|
|
237
|
+
return false;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Checks whether this instance is currently started.
|
|
243
|
+
* Takes an action if not started, based on the notStartedAction parameter.
|
|
244
|
+
* @param notStartedAction - What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent
|
|
245
|
+
* @returns True if started, false otherwise
|
|
246
|
+
*/
|
|
247
|
+
started(notStartedAction = "log") {
|
|
248
|
+
if (isString(this.status) && this.status === "started") {
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
const message = () => `${CREATABLE_NOT_STARTED} [${this.name}] current state: ${this.status}`;
|
|
252
|
+
switch (notStartedAction) {
|
|
253
|
+
case "error": {
|
|
254
|
+
throw new Error(message());
|
|
255
|
+
}
|
|
256
|
+
case "throw": {
|
|
257
|
+
throw new Error(message());
|
|
258
|
+
}
|
|
259
|
+
case "warn": {
|
|
260
|
+
this.logger?.warn(message());
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case "log": {
|
|
264
|
+
this.logger?.log(message());
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
case "none": {
|
|
268
|
+
break;
|
|
269
|
+
}
|
|
270
|
+
default: {
|
|
271
|
+
throw new Error(`Unknown notStartedAction: ${notStartedAction}`);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Async version of `started` that can optionally auto-start the instance.
|
|
278
|
+
* @param notStartedAction - What to do if not started and auto-start is disabled
|
|
279
|
+
* @param tryStart - If true, attempts to start the instance automatically
|
|
280
|
+
* @returns True if the instance is or becomes started
|
|
281
|
+
*/
|
|
282
|
+
async startedAsync(notStartedAction = "log", tryStart = true) {
|
|
283
|
+
if (isString(this.status) && this.status === "started") {
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
if (this.status !== null && ["created", "stopped", "starting"].includes(this.status)) {
|
|
287
|
+
this._startPromise ??= (async () => {
|
|
288
|
+
if (tryStart) {
|
|
289
|
+
try {
|
|
290
|
+
return await this.start();
|
|
291
|
+
} finally {
|
|
292
|
+
this._startPromise = void 0;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
return this.started(notStartedAction);
|
|
296
|
+
})();
|
|
297
|
+
} else {
|
|
298
|
+
const message = `${CREATABLE_NOT_STARTED} [${this.name}] current state: ${this.status}`;
|
|
299
|
+
throw new Error(message);
|
|
300
|
+
}
|
|
301
|
+
if (isUndefined(this._startPromise)) {
|
|
302
|
+
throw new Error(`Failed to create start promise: ${this.status}`);
|
|
303
|
+
}
|
|
304
|
+
return await this._startPromise;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Stops the instance, transitioning through 'stopping' to 'stopped' status.
|
|
308
|
+
* Thread-safe via mutex. Returns true if already stopped or stopped successfully.
|
|
309
|
+
*/
|
|
310
|
+
async stop() {
|
|
311
|
+
this._noOverride("stop");
|
|
312
|
+
if (this.status === "stopped") {
|
|
313
|
+
return true;
|
|
314
|
+
}
|
|
315
|
+
return await this._statusMutex.runExclusive(async () => {
|
|
316
|
+
try {
|
|
317
|
+
if (this.status === "stopped") {
|
|
318
|
+
return true;
|
|
319
|
+
}
|
|
320
|
+
assertEx(this.status === "started", () => `Creatable [${this.name}] is not stoppable in status [${this.status}]`);
|
|
321
|
+
this.setStatus("stopping");
|
|
322
|
+
await this.stopHandler();
|
|
323
|
+
this.setStatus("stopped");
|
|
324
|
+
return true;
|
|
325
|
+
} catch (ex) {
|
|
326
|
+
this.setStatus("error", isError(ex) ? ex : new Error(`Error stopping: ${String(ex)}`));
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Asserts that the given function has not been overridden in a subclass.
|
|
333
|
+
* Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
334
|
+
*/
|
|
335
|
+
_noOverride(functionName = getFunctionName(3)) {
|
|
336
|
+
const thisFunc = this[functionName];
|
|
337
|
+
const rootFunc = getRootFunction(this, functionName);
|
|
338
|
+
assertEx(thisFunc === rootFunc, () => `Override not allowed for [${functionName}] - override ${functionName}Handler instead`);
|
|
339
|
+
}
|
|
340
|
+
setStatus(value, progressOrError) {
|
|
341
|
+
this._status = value;
|
|
342
|
+
if (value !== null) {
|
|
343
|
+
if (value === "error") {
|
|
344
|
+
if (isError(progressOrError)) {
|
|
345
|
+
this.statusReporter?.report(this.name, value, progressOrError);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
} else {
|
|
349
|
+
if (isNumber2(progressOrError)) {
|
|
350
|
+
this.statusReporter?.report(this.name, value, progressOrError);
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
this.statusReporter?.report(this.name, value);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
/** Override in subclasses to define start behavior. Throw an error on failure. */
|
|
358
|
+
startHandler() {
|
|
359
|
+
}
|
|
360
|
+
/** Override in subclasses to define stop behavior. Throw an error on failure. */
|
|
361
|
+
stopHandler() {
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
AbstractCreatable = __decorateClass([
|
|
365
|
+
creatable()
|
|
366
|
+
], AbstractCreatable);
|
|
367
|
+
var AbstractCreatableWithFactory = class extends AbstractCreatable {
|
|
368
|
+
/**
|
|
369
|
+
* Creates a factory that produces instances of this class with pre-configured params and labels.
|
|
370
|
+
* @param params - Default parameters for instances created by the factory
|
|
371
|
+
* @param labels - Labels to assign to created instances
|
|
372
|
+
*/
|
|
373
|
+
static factory(params, labels) {
|
|
374
|
+
return Factory.withParams(this, params, labels);
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
AbstractCreatableWithFactory = __decorateClass([
|
|
378
|
+
creatable()
|
|
379
|
+
], AbstractCreatableWithFactory);
|
|
380
|
+
|
|
381
|
+
// src/model/Labels.ts
|
|
382
|
+
var hasAllLabels = (source, required) => {
|
|
383
|
+
if (!required) return true;
|
|
384
|
+
return Object.entries(required).every(([key, value]) => {
|
|
385
|
+
return Object.hasOwn(source ?? {}, key) && source?.[key] === value;
|
|
386
|
+
});
|
|
387
|
+
};
|
|
388
|
+
export {
|
|
389
|
+
AbstractCreatable,
|
|
390
|
+
AbstractCreatableWithFactory,
|
|
391
|
+
Factory,
|
|
392
|
+
creatable,
|
|
393
|
+
creatableFactory,
|
|
394
|
+
hasAllLabels
|
|
395
|
+
};
|
|
396
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extracts the function name from the call stack at the given depth.
|
|
3
|
+
* @param depth - The stack frame depth to inspect (default: 2)
|
|
4
|
+
* @returns The function name, or '\<unknown\>' if it cannot be determined
|
|
5
|
+
*/
|
|
6
|
+
export declare function getFunctionName(depth?: number): string;
|
|
7
|
+
//# sourceMappingURL=getFunctionName.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Walks the prototype chain to find the root (base-most) definition of a named function.
|
|
3
|
+
* @param obj - The object to start searching from
|
|
4
|
+
* @param funcName - The name of the function to locate
|
|
5
|
+
* @returns The function from the highest prototype in the chain that defines it
|
|
6
|
+
*/
|
|
7
|
+
export declare function getRootFunction(obj: unknown, funcName: string): unknown;
|
|
8
|
+
//# sourceMappingURL=getRootFunction.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EventData, EventEmitter } from '../../../events/neutral/index.ts';
|
|
2
|
+
import type { CreatableName, CreatableParams } from './CreatableParams.ts';
|
|
3
|
+
/** Represents a created instance with a managed lifecycle (start/stop) and event emission. */
|
|
4
|
+
export interface CreatableInstance<TParams extends CreatableParams = CreatableParams, TEventData extends EventData = EventData> extends EventEmitter<TEventData> {
|
|
5
|
+
/** The event data type associated with this instance. */
|
|
6
|
+
eventData: TEventData;
|
|
7
|
+
/** The name identifier for this instance. */
|
|
8
|
+
name: CreatableName;
|
|
9
|
+
/** The parameters used to configure this instance. */
|
|
10
|
+
params: TParams;
|
|
11
|
+
/** Starts the instance. Resolves to true if started successfully. */
|
|
12
|
+
start: () => Promise<boolean>;
|
|
13
|
+
/** Stops the instance. Resolves to true if stopped successfully. */
|
|
14
|
+
stop: () => Promise<boolean>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=CreatableInstance.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BaseClassName } from '../../../base/neutral/index.ts';
|
|
2
|
+
import type { BaseEmitterParams } from '../../../events/neutral/index.ts';
|
|
3
|
+
import type { CreatableStatus, CreatableStatusReporter } from './CreatableStatusReporter.ts';
|
|
4
|
+
/** A branded string type used as the name identifier for creatables. */
|
|
5
|
+
export type CreatableName = Exclude<string, 'creatable-name-reserved-32546239486'> & BaseClassName;
|
|
6
|
+
/** The minimum required parameters for constructing a creatable. */
|
|
7
|
+
export interface RequiredCreatableParams<TAdditionalStatus extends CreatableStatus | void = void> extends BaseEmitterParams {
|
|
8
|
+
/** Optional name identifying this creatable instance. */
|
|
9
|
+
name?: CreatableName;
|
|
10
|
+
/** Optional reporter for broadcasting status changes. */
|
|
11
|
+
statusReporter?: CreatableStatusReporter<TAdditionalStatus>;
|
|
12
|
+
}
|
|
13
|
+
/** Parameters for creating a creatable instance, combining required params with emitter params. */
|
|
14
|
+
export interface CreatableParams extends RequiredCreatableParams, BaseEmitterParams {
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=CreatableParams.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { BaseClassName } from '../../../base/neutral/index.ts';
|
|
2
|
+
/** The standard lifecycle statuses a creatable can transition through. */
|
|
3
|
+
export type StandardCreatableStatus = 'creating' | 'created' | 'starting' | 'started' | 'stopping' | 'stopped' | 'error';
|
|
4
|
+
/** A creatable's status, optionally extended with additional custom status values. */
|
|
5
|
+
export type CreatableStatus<TAdditionalStatus extends void | string = void> = StandardCreatableStatus | (TAdditionalStatus extends void ? StandardCreatableStatus : TAdditionalStatus);
|
|
6
|
+
/** Reports status changes for a creatable, supporting progress tracking and error reporting. */
|
|
7
|
+
export interface CreatableStatusReporter<TAdditionalStatus extends void | string = void> {
|
|
8
|
+
/** Report a non-error status with a numeric progress value. */
|
|
9
|
+
report(name: BaseClassName, status: Exclude<CreatableStatus<TAdditionalStatus>, 'error'>, progress: number): void;
|
|
10
|
+
/** Report an error status with the associated Error. */
|
|
11
|
+
report(name: BaseClassName, status: Extract<CreatableStatus<TAdditionalStatus>, 'error'>, error: Error): void;
|
|
12
|
+
/** Report a status change without progress or error details. */
|
|
13
|
+
report(name: BaseClassName, status: CreatableStatus<TAdditionalStatus>): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=CreatableStatusReporter.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Object used to represent labels identifying a resource.
|
|
3
|
+
*/
|
|
4
|
+
export type Labels = Record<string, string | undefined>;
|
|
5
|
+
/**
|
|
6
|
+
* Interface for objects that have labels.
|
|
7
|
+
*/
|
|
8
|
+
export interface WithLabels<T extends Labels = Labels> {
|
|
9
|
+
labels: T;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface for objects that have labels.
|
|
13
|
+
*/
|
|
14
|
+
export interface WithOptionalLabels<T extends Labels = Labels> {
|
|
15
|
+
labels?: T;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns true if the source object has all the labels from the required set
|
|
19
|
+
* @param source Source object to check against
|
|
20
|
+
* @param required Set of labels to check for in source
|
|
21
|
+
* @returns True of the source object has all the labels from the required set
|
|
22
|
+
*/
|
|
23
|
+
export declare const hasAllLabels: (source?: Labels, required?: Labels) => boolean;
|
|
24
|
+
//# sourceMappingURL=Labels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=model.mjs.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a fixed-point bigint back to a whole-number bigint by dividing out the decimal places.
|
|
3
|
+
* @param value - The fixed-point bigint value to convert
|
|
4
|
+
* @param places - Number of decimal places (default 18)
|
|
5
|
+
* @returns The whole-number bigint result
|
|
6
|
+
*/
|
|
7
|
+
export declare const fromFixedPoint: (value: bigint, places?: number) => bigint;
|
|
8
|
+
//# sourceMappingURL=fromFixedPoint.d.ts.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// src/fromFixedPoint.ts
|
|
2
|
+
var fromFixedPoint = (value, places = 18) => {
|
|
3
|
+
if (!Number.isSafeInteger(places)) throw new Error(`places (${places}) must be an Integer`);
|
|
4
|
+
return value / 10n ** BigInt(places);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
// src/toDecimalPrecision.ts
|
|
8
|
+
var toDecimalPrecision = (value, digits) => {
|
|
9
|
+
let fixed = 0;
|
|
10
|
+
const result = Number(value.toPrecision(digits));
|
|
11
|
+
while (Number(result.toFixed(fixed)) !== result && fixed < 20) {
|
|
12
|
+
fixed++;
|
|
13
|
+
}
|
|
14
|
+
return result.toFixed(fixed);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// src/toFixedPoint.ts
|
|
18
|
+
var toFixedPoint = (value, places = 18) => {
|
|
19
|
+
if (!Number.isSafeInteger(places)) throw new Error(`places (${places}) must be an Integer`);
|
|
20
|
+
if (typeof value === "string") {
|
|
21
|
+
const parts = value.split(".");
|
|
22
|
+
if (parts.length > 2) {
|
|
23
|
+
throw new Error("Too many decimals in value");
|
|
24
|
+
}
|
|
25
|
+
if (parts.length === 1) {
|
|
26
|
+
return BigInt(value) * 10n ** BigInt(places);
|
|
27
|
+
}
|
|
28
|
+
const [whole, fraction] = parts;
|
|
29
|
+
const trimmed = fraction.slice(0, places);
|
|
30
|
+
return BigInt(whole + trimmed.padEnd(Number(places), "0"));
|
|
31
|
+
}
|
|
32
|
+
return value * 10n ** BigInt(places);
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
fromFixedPoint,
|
|
36
|
+
toDecimalPrecision,
|
|
37
|
+
toFixedPoint
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formats a number to the specified number of significant digits, returning a string with minimal trailing zeros.
|
|
3
|
+
* @param value - The number to format
|
|
4
|
+
* @param digits - The number of significant digits
|
|
5
|
+
* @returns A string representation of the number with the specified precision
|
|
6
|
+
*/
|
|
7
|
+
export declare const toDecimalPrecision: (value: number, digits: number) => string;
|
|
8
|
+
//# sourceMappingURL=toDecimalPrecision.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a bigint or decimal string to a fixed-point bigint representation.
|
|
3
|
+
* @param value - The value to convert (bigint or string with optional decimal point)
|
|
4
|
+
* @param places - Number of decimal places (default 18)
|
|
5
|
+
* @returns A bigint representing the value scaled by 10^places
|
|
6
|
+
*/
|
|
7
|
+
export declare const toFixedPoint: (value: bigint | string, places?: number) => bigint;
|
|
8
|
+
//# sourceMappingURL=toFixedPoint.d.ts.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a promise that resolves after the specified number of milliseconds.
|
|
3
|
+
* @param ms - The number of milliseconds to delay.
|
|
4
|
+
* @returns A promise that resolves after the delay.
|
|
5
|
+
*/
|
|
6
|
+
export declare const delay: (ms: number) => Promise<void>;
|
|
7
|
+
//# sourceMappingURL=delay.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Truncates a string to show the first and last `length` characters separated by an ellipsis.
|
|
3
|
+
* @param value - The string to ellipsize
|
|
4
|
+
* @param length - Number of characters to keep at each end (default 2)
|
|
5
|
+
* @returns The ellipsized string
|
|
6
|
+
*/
|
|
7
|
+
export declare const ellipsize: (value: string, length?: number) => string;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|