@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,11 @@
|
|
|
1
|
+
export type { FetchClientConfig, FetchClientRequestConfig } from './FetchClient.ts';
|
|
2
|
+
export { FetchClient, FetchClientError } from './FetchClient.ts';
|
|
3
|
+
export type { FetchCompressOptions } from './fetchCompress.ts';
|
|
4
|
+
export { fetchCompress } from './fetchCompress.ts';
|
|
5
|
+
export type { FetchErrorContext, FetchErrorJson, FetchErrorType, } from './FetchError.ts';
|
|
6
|
+
export { classifyFetchError, FetchError, isFetchError, toFetchError, } from './FetchError.ts';
|
|
7
|
+
export { fetchJson } from './fetchJson.ts';
|
|
8
|
+
export { FetchJsonClient, fetchJsonClient } from './FetchJsonClient.ts';
|
|
9
|
+
export { fetchJsonDelete, fetchJsonGet, fetchJsonPatch, fetchJsonPost, fetchJsonPut, } from './methods.ts';
|
|
10
|
+
export type { FetchJsonOptions, FetchJsonResponse } from './types.ts';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
// src/FetchError.ts
|
|
2
|
+
var fetchErrorMarker = "$$xylabs-fetch-error";
|
|
3
|
+
var codeTypes = {
|
|
4
|
+
ENOTFOUND: "dns",
|
|
5
|
+
EAI_AGAIN: "dns",
|
|
6
|
+
ECONNREFUSED: "connection-refused",
|
|
7
|
+
ECONNRESET: "connection-reset",
|
|
8
|
+
EPIPE: "connection-reset",
|
|
9
|
+
ETIMEDOUT: "connection-timeout",
|
|
10
|
+
UND_ERR_CONNECT_TIMEOUT: "connection-timeout",
|
|
11
|
+
UND_ERR_HEADERS_TIMEOUT: "timeout",
|
|
12
|
+
UND_ERR_BODY_TIMEOUT: "timeout",
|
|
13
|
+
EHOSTUNREACH: "unreachable",
|
|
14
|
+
ENETUNREACH: "unreachable",
|
|
15
|
+
CERT_HAS_EXPIRED: "tls",
|
|
16
|
+
DEPTH_ZERO_SELF_SIGNED_CERT: "tls",
|
|
17
|
+
UNABLE_TO_VERIFY_LEAF_SIGNATURE: "tls",
|
|
18
|
+
SELF_SIGNED_CERT_IN_CHAIN: "tls",
|
|
19
|
+
ERR_TLS_CERT_ALTNAME_INVALID: "tls"
|
|
20
|
+
};
|
|
21
|
+
function findErrorCode(error) {
|
|
22
|
+
let current = error;
|
|
23
|
+
for (let depth = 0; depth < 8 && current instanceof Error; depth++) {
|
|
24
|
+
const code = current.code;
|
|
25
|
+
if (typeof code === "string") return code;
|
|
26
|
+
current = current.cause;
|
|
27
|
+
}
|
|
28
|
+
return void 0;
|
|
29
|
+
}
|
|
30
|
+
function typeFromCode(code) {
|
|
31
|
+
if (Object.hasOwn(codeTypes, code)) return codeTypes[code];
|
|
32
|
+
if (code.startsWith("CERT_") || code.startsWith("ERR_TLS_")) return "tls";
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
function classifyFetchError(error) {
|
|
36
|
+
if (error instanceof Error) {
|
|
37
|
+
if (error.name === "TimeoutError") return { type: "timeout" };
|
|
38
|
+
if (error.name === "AbortError") return { type: "aborted" };
|
|
39
|
+
}
|
|
40
|
+
const code = findErrorCode(error);
|
|
41
|
+
if (code !== void 0) {
|
|
42
|
+
const type = typeFromCode(code);
|
|
43
|
+
if (type !== void 0) return { type, code };
|
|
44
|
+
return { type: "unknown", code };
|
|
45
|
+
}
|
|
46
|
+
if (error instanceof TypeError && /fetch failed|failed to fetch|network/i.test(error.message)) {
|
|
47
|
+
return { type: "network" };
|
|
48
|
+
}
|
|
49
|
+
return { type: "unknown" };
|
|
50
|
+
}
|
|
51
|
+
var FetchError = class extends Error {
|
|
52
|
+
__fetchErrorMarker = fetchErrorMarker;
|
|
53
|
+
body;
|
|
54
|
+
code;
|
|
55
|
+
method;
|
|
56
|
+
response;
|
|
57
|
+
status;
|
|
58
|
+
statusText;
|
|
59
|
+
type;
|
|
60
|
+
url;
|
|
61
|
+
constructor(message, context = {}) {
|
|
62
|
+
super(message, { cause: context.cause });
|
|
63
|
+
this.name = "FetchError";
|
|
64
|
+
this.type = context.type ?? "unknown";
|
|
65
|
+
this.code = context.code;
|
|
66
|
+
this.url = context.url;
|
|
67
|
+
this.method = context.method;
|
|
68
|
+
this.status = context.status;
|
|
69
|
+
this.statusText = context.statusText;
|
|
70
|
+
this.response = context.response;
|
|
71
|
+
this.body = context.body;
|
|
72
|
+
}
|
|
73
|
+
toJSON() {
|
|
74
|
+
return {
|
|
75
|
+
name: this.name,
|
|
76
|
+
message: this.message,
|
|
77
|
+
type: this.type,
|
|
78
|
+
code: this.code,
|
|
79
|
+
url: this.url,
|
|
80
|
+
method: this.method,
|
|
81
|
+
status: this.status,
|
|
82
|
+
statusText: this.statusText
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
function isFetchError(value) {
|
|
87
|
+
return value instanceof FetchError || typeof value === "object" && value !== null && value.__fetchErrorMarker === fetchErrorMarker;
|
|
88
|
+
}
|
|
89
|
+
function toFetchError(error, context = {}) {
|
|
90
|
+
if (isFetchError(error)) return error;
|
|
91
|
+
const { type, code } = classifyFetchError(error);
|
|
92
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
93
|
+
return new FetchError(message, {
|
|
94
|
+
...context,
|
|
95
|
+
type,
|
|
96
|
+
code,
|
|
97
|
+
cause: error
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/fetchCompress.ts
|
|
102
|
+
async function gzipString(body) {
|
|
103
|
+
const blob = new Blob([body]);
|
|
104
|
+
const stream = blob.stream().pipeThrough(new CompressionStream("gzip"));
|
|
105
|
+
const response = new Response(stream);
|
|
106
|
+
return response.arrayBuffer();
|
|
107
|
+
}
|
|
108
|
+
async function fetchCompress(url, options = {}) {
|
|
109
|
+
const { compressMinLength = 1024, ...init } = options;
|
|
110
|
+
try {
|
|
111
|
+
if (init.body !== void 0 && init.body !== null) {
|
|
112
|
+
const bodyStr = typeof init.body === "string" ? init.body : JSON.stringify(init.body);
|
|
113
|
+
if (bodyStr.length > compressMinLength) {
|
|
114
|
+
const headers = new Headers(init.headers);
|
|
115
|
+
headers.set("Content-Encoding", "gzip");
|
|
116
|
+
return await fetch(url, {
|
|
117
|
+
...init,
|
|
118
|
+
body: await gzipString(bodyStr),
|
|
119
|
+
headers
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return await fetch(url, init);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
throw toFetchError(error, { url: url.toString(), method: init.method });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// src/parseJson.ts
|
|
130
|
+
async function parseJsonResponse(response, context = {}) {
|
|
131
|
+
let text;
|
|
132
|
+
try {
|
|
133
|
+
text = await response.text();
|
|
134
|
+
} catch (error) {
|
|
135
|
+
throw toFetchError(error, context);
|
|
136
|
+
}
|
|
137
|
+
if (text.trim() === "") return null;
|
|
138
|
+
try {
|
|
139
|
+
return JSON.parse(text);
|
|
140
|
+
} catch (error) {
|
|
141
|
+
throw new FetchError("Failed to parse response body as JSON", {
|
|
142
|
+
type: "parse",
|
|
143
|
+
url: context.url,
|
|
144
|
+
method: context.method,
|
|
145
|
+
status: response.status,
|
|
146
|
+
statusText: response.statusText,
|
|
147
|
+
body: text,
|
|
148
|
+
cause: error
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
async function tryParseJson(response) {
|
|
153
|
+
try {
|
|
154
|
+
const text = await response.text();
|
|
155
|
+
if (text.trim() === "") return null;
|
|
156
|
+
return JSON.parse(text);
|
|
157
|
+
} catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/FetchClient.ts
|
|
163
|
+
var FetchClientError = class extends FetchError {
|
|
164
|
+
config;
|
|
165
|
+
constructor(message, response, config) {
|
|
166
|
+
super(message, {
|
|
167
|
+
type: "http-status",
|
|
168
|
+
url: config.url,
|
|
169
|
+
method: config.method,
|
|
170
|
+
status: response.status,
|
|
171
|
+
statusText: response.statusText,
|
|
172
|
+
response
|
|
173
|
+
});
|
|
174
|
+
this.name = "FetchClientError";
|
|
175
|
+
this.config = config;
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
function buildHeaders(custom, includeContentType = false) {
|
|
179
|
+
const headers = new Headers();
|
|
180
|
+
headers.set("Accept", "application/json, text/plain, *.*");
|
|
181
|
+
if (includeContentType) {
|
|
182
|
+
headers.set("Content-Type", "application/json");
|
|
183
|
+
}
|
|
184
|
+
if (custom) {
|
|
185
|
+
const merged = new Headers(custom);
|
|
186
|
+
for (const [key, value] of merged.entries()) headers.set(key, value);
|
|
187
|
+
}
|
|
188
|
+
return headers;
|
|
189
|
+
}
|
|
190
|
+
function buildURL(config) {
|
|
191
|
+
const base = config.baseURL ?? "";
|
|
192
|
+
const path = config.url ?? "";
|
|
193
|
+
const url = base === "" ? new URL(path) : new URL(path, base);
|
|
194
|
+
if (config.params) {
|
|
195
|
+
for (const [key, value] of Object.entries(config.params)) {
|
|
196
|
+
url.searchParams.set(key, value);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return url.href;
|
|
200
|
+
}
|
|
201
|
+
var FetchClient = class _FetchClient {
|
|
202
|
+
defaults;
|
|
203
|
+
constructor(defaults = {}) {
|
|
204
|
+
this.defaults = defaults;
|
|
205
|
+
}
|
|
206
|
+
static create(config) {
|
|
207
|
+
return new _FetchClient(config);
|
|
208
|
+
}
|
|
209
|
+
delete(url, config) {
|
|
210
|
+
return this.request({
|
|
211
|
+
...config,
|
|
212
|
+
url,
|
|
213
|
+
method: "DELETE"
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
get(url, config) {
|
|
217
|
+
return this.request({
|
|
218
|
+
...config,
|
|
219
|
+
url,
|
|
220
|
+
method: "GET"
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
patch(url, data, config) {
|
|
224
|
+
return this.request({
|
|
225
|
+
...config,
|
|
226
|
+
url,
|
|
227
|
+
data,
|
|
228
|
+
method: "PATCH"
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
post(url, data, config) {
|
|
232
|
+
return this.request({
|
|
233
|
+
...config,
|
|
234
|
+
url,
|
|
235
|
+
data,
|
|
236
|
+
method: "POST"
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
put(url, data, config) {
|
|
240
|
+
return this.request({
|
|
241
|
+
...config,
|
|
242
|
+
url,
|
|
243
|
+
data,
|
|
244
|
+
method: "PUT"
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
async request(config) {
|
|
248
|
+
const merged = { ...this.defaults, ...config };
|
|
249
|
+
const url = buildURL(merged);
|
|
250
|
+
const init = {
|
|
251
|
+
method: merged.method ?? "GET",
|
|
252
|
+
headers: buildHeaders(merged.headers, merged.data !== void 0),
|
|
253
|
+
compressMinLength: merged.compressMinLength,
|
|
254
|
+
signal: merged.timeout !== void 0 && merged.timeout !== 0 ? AbortSignal.timeout(merged.timeout) : merged.signal
|
|
255
|
+
};
|
|
256
|
+
if (merged.data !== void 0) {
|
|
257
|
+
init.body = JSON.stringify(merged.data);
|
|
258
|
+
}
|
|
259
|
+
const response = await fetchCompress(url, init);
|
|
260
|
+
const data = response.ok ? await parseJsonResponse(response, { url, method: merged.method }) : await tryParseJson(response);
|
|
261
|
+
const result = {
|
|
262
|
+
data,
|
|
263
|
+
headers: response.headers,
|
|
264
|
+
response,
|
|
265
|
+
status: response.status,
|
|
266
|
+
statusText: response.statusText
|
|
267
|
+
};
|
|
268
|
+
const validateStatus = merged.validateStatus === void 0 ? (s) => s >= 200 && s < 300 : merged.validateStatus;
|
|
269
|
+
if (validateStatus && !validateStatus(response.status)) {
|
|
270
|
+
throw new FetchClientError(
|
|
271
|
+
`Request failed with status ${response.status} ${response.statusText}`,
|
|
272
|
+
result,
|
|
273
|
+
{ ...merged, url }
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// src/fetchJson.ts
|
|
281
|
+
function buildHeaders2(custom, includeContentType = false) {
|
|
282
|
+
const headers = new Headers();
|
|
283
|
+
headers.set("Accept", "application/json, text/plain, *.*");
|
|
284
|
+
if (includeContentType) {
|
|
285
|
+
headers.set("Content-Type", "application/json");
|
|
286
|
+
}
|
|
287
|
+
if (custom) {
|
|
288
|
+
const merged = new Headers(custom);
|
|
289
|
+
for (const [key, value] of merged.entries()) headers.set(key, value);
|
|
290
|
+
}
|
|
291
|
+
return headers;
|
|
292
|
+
}
|
|
293
|
+
async function fetchJson(url, options = {}) {
|
|
294
|
+
const { headers: customHeaders, ...rest } = options;
|
|
295
|
+
const response = await fetchCompress(url, {
|
|
296
|
+
...rest,
|
|
297
|
+
headers: buildHeaders2(customHeaders, rest.body !== void 0 && rest.body !== null)
|
|
298
|
+
});
|
|
299
|
+
const data = response.ok ? await parseJsonResponse(response, { url, method: rest.method }) : await tryParseJson(response);
|
|
300
|
+
return {
|
|
301
|
+
data,
|
|
302
|
+
headers: response.headers,
|
|
303
|
+
response,
|
|
304
|
+
status: response.status,
|
|
305
|
+
statusText: response.statusText
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
// src/FetchJsonClient.ts
|
|
310
|
+
var FetchJsonClient = class _FetchJsonClient extends FetchClient {
|
|
311
|
+
constructor(config) {
|
|
312
|
+
super(config);
|
|
313
|
+
}
|
|
314
|
+
static create(config) {
|
|
315
|
+
return new _FetchJsonClient(config);
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
var fetchJsonClient = new FetchJsonClient();
|
|
319
|
+
|
|
320
|
+
// src/methods.ts
|
|
321
|
+
function fetchJsonGet(url, options) {
|
|
322
|
+
return fetchJson(url, { ...options, method: "GET" });
|
|
323
|
+
}
|
|
324
|
+
function fetchJsonPost(url, data, options) {
|
|
325
|
+
return fetchJson(url, {
|
|
326
|
+
...options,
|
|
327
|
+
body: JSON.stringify(data),
|
|
328
|
+
method: "POST"
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
function fetchJsonPut(url, data, options) {
|
|
332
|
+
return fetchJson(url, {
|
|
333
|
+
...options,
|
|
334
|
+
body: JSON.stringify(data),
|
|
335
|
+
method: "PUT"
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
function fetchJsonPatch(url, data, options) {
|
|
339
|
+
return fetchJson(url, {
|
|
340
|
+
...options,
|
|
341
|
+
body: JSON.stringify(data),
|
|
342
|
+
method: "PATCH"
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
function fetchJsonDelete(url, options) {
|
|
346
|
+
return fetchJson(url, { ...options, method: "DELETE" });
|
|
347
|
+
}
|
|
348
|
+
export {
|
|
349
|
+
FetchClient,
|
|
350
|
+
FetchClientError,
|
|
351
|
+
FetchError,
|
|
352
|
+
FetchJsonClient,
|
|
353
|
+
classifyFetchError,
|
|
354
|
+
fetchCompress,
|
|
355
|
+
fetchJson,
|
|
356
|
+
fetchJsonClient,
|
|
357
|
+
fetchJsonDelete,
|
|
358
|
+
fetchJsonGet,
|
|
359
|
+
fetchJsonPatch,
|
|
360
|
+
fetchJsonPost,
|
|
361
|
+
fetchJsonPut,
|
|
362
|
+
isFetchError,
|
|
363
|
+
toFetchError
|
|
364
|
+
};
|
|
365
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FetchJsonOptions, FetchJsonResponse } from './types.ts';
|
|
2
|
+
/** JSON GET request. */
|
|
3
|
+
export declare function fetchJsonGet<T>(url: string, options?: FetchJsonOptions): Promise<FetchJsonResponse<T>>;
|
|
4
|
+
/** JSON POST request with a body. */
|
|
5
|
+
export declare function fetchJsonPost<T>(url: string, data?: unknown, options?: FetchJsonOptions): Promise<FetchJsonResponse<T>>;
|
|
6
|
+
/** JSON PUT request with a body. */
|
|
7
|
+
export declare function fetchJsonPut<T>(url: string, data?: unknown, options?: FetchJsonOptions): Promise<FetchJsonResponse<T>>;
|
|
8
|
+
/** JSON PATCH request with a body. */
|
|
9
|
+
export declare function fetchJsonPatch<T>(url: string, data?: unknown, options?: FetchJsonOptions): Promise<FetchJsonResponse<T>>;
|
|
10
|
+
/** JSON DELETE request. */
|
|
11
|
+
export declare function fetchJsonDelete<T>(url: string, options?: FetchJsonOptions): Promise<FetchJsonResponse<T>>;
|
|
12
|
+
//# sourceMappingURL=methods.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { FetchClientConfig, FetchClientRequestConfig, } from './FetchClient.ts';
|
|
2
|
+
export type { FetchCompressOptions } from './fetchCompress.ts';
|
|
3
|
+
export type { FetchErrorContext, FetchErrorJson, FetchErrorType, } from './FetchError.ts';
|
|
4
|
+
export type * from './types.ts';
|
|
5
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=model.mjs.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads and JSON-parses a response body. An empty or whitespace-only body resolves to `null`
|
|
3
|
+
* (so 204/304/HEAD and other empty responses are not treated as failures). A non-empty body that
|
|
4
|
+
* cannot be parsed throws a FetchError of type `parse` carrying the raw body and status. A failure
|
|
5
|
+
* while reading the body stream (e.g. a dropped connection) is classified as a network FetchError.
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseJsonResponse<T>(response: Response, context?: {
|
|
8
|
+
method?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
}): Promise<T | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Best-effort JSON parse for non-success responses: returns `null` on any failure
|
|
13
|
+
* (empty body, malformed body, or read error) so the response can still be surfaced for inspection.
|
|
14
|
+
*/
|
|
15
|
+
export declare function tryParseJson<T>(response: Response): Promise<T | null>;
|
|
16
|
+
//# sourceMappingURL=parseJson.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FetchCompressOptions } from './fetchCompress.ts';
|
|
2
|
+
/** Fetch request options extended with an optional gzip compression threshold. */
|
|
3
|
+
export type FetchJsonOptions = FetchCompressOptions;
|
|
4
|
+
/** Structured response from a fetchJson call. */
|
|
5
|
+
export interface FetchJsonResponse<T> {
|
|
6
|
+
data: T | null;
|
|
7
|
+
headers: Headers;
|
|
8
|
+
response: Response;
|
|
9
|
+
status: number;
|
|
10
|
+
statusText: string;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for fire-and-forget promises.
|
|
3
|
+
*/
|
|
4
|
+
export interface ForgetConfig<T = any> {
|
|
5
|
+
/** Optional name for identifying the forgotten promise in logs. */
|
|
6
|
+
name?: string;
|
|
7
|
+
/** Called when the configured timeout elapses before the promise settles. The promise keeps running. */
|
|
8
|
+
onCancel?: () => void;
|
|
9
|
+
/** Called when the promise completes, with a tuple of [result, error]. */
|
|
10
|
+
onComplete?: (result: [T | undefined, Error | undefined]) => void;
|
|
11
|
+
/** Called when an exception occurs outside the promise itself. */
|
|
12
|
+
onException?: (error: Error) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Timeout in milliseconds after which `onCancel` and `timeoutHandler` run.
|
|
15
|
+
* This does not abort the promise; `activeForgets` stays elevated until it settles.
|
|
16
|
+
*/
|
|
17
|
+
timeout?: number;
|
|
18
|
+
}
|
|
19
|
+
/** Default forget configuration with a 30-second timeout. */
|
|
20
|
+
export declare const defaultForgetConfig: ForgetConfig<unknown>;
|
|
21
|
+
//# sourceMappingURL=ForgetConfig.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ForgetConfig } from './ForgetConfig.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Node.js-specific forget configuration that extends ForgetConfig with process termination options.
|
|
4
|
+
*/
|
|
5
|
+
export interface ForgetNodeConfig<T = any> extends ForgetConfig<T> {
|
|
6
|
+
/** Terminate the process on an exception that happens outside of the promise being forgotten. */
|
|
7
|
+
terminateOnException?: boolean;
|
|
8
|
+
/** Terminate the process if the promise times out. */
|
|
9
|
+
terminateOnTimeout?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** Default Node.js forget configuration with termination disabled. */
|
|
12
|
+
export declare const defaultForgetNodeConfig: ForgetNodeConfig<unknown>;
|
|
13
|
+
//# sourceMappingURL=ForgetNodeConfig.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Logger } from '../../logger/neutral/index.ts';
|
|
2
|
+
import type { Promisable, PromiseEx } from '../../promise/neutral/index.ts';
|
|
3
|
+
import { type ForgetConfig } from './ForgetConfig.ts';
|
|
4
|
+
/** A function that returns a promisable value. */
|
|
5
|
+
type PromisableFunction<T> = () => Promisable<T>;
|
|
6
|
+
/**
|
|
7
|
+
* Manages fire-and-forget promises with tracking, timeouts, and error handling.
|
|
8
|
+
*
|
|
9
|
+
* Timeouts are observability hooks only: they invoke `onCancel` and `timeoutHandler` but do not
|
|
10
|
+
* abort or await-cleanup the underlying promise. `activeForgets` therefore counts promises that
|
|
11
|
+
* are still running (unsettled), not promises still inside their configured timeout window.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ForgetPromise {
|
|
14
|
+
/**
|
|
15
|
+
* Number of forgotten promises still running (not yet settled).
|
|
16
|
+
* Decremented only when the underlying promise fulfills or rejects — not when a timeout fires.
|
|
17
|
+
*/
|
|
18
|
+
static activeForgets: number;
|
|
19
|
+
/** Number of forgotten promises that threw exceptions. */
|
|
20
|
+
static exceptedForgets: number;
|
|
21
|
+
/** Logger instance used for error and warning output. */
|
|
22
|
+
static logger: Logger;
|
|
23
|
+
/** Whether any forgotten promises are still running, including any that have exceeded their timeout. */
|
|
24
|
+
static get active(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Waits until all forgotten promises have settled.
|
|
27
|
+
* @param interval - Polling interval in milliseconds.
|
|
28
|
+
* @param timeout - Optional maximum wait time in milliseconds.
|
|
29
|
+
* @returns `0` when every forgotten promise has settled; otherwise the number still running.
|
|
30
|
+
* A non-zero return after `timeout` elapses can include promises whose timeout callback already
|
|
31
|
+
* ran but whose work is still in flight.
|
|
32
|
+
*/
|
|
33
|
+
static awaitInactive(interval?: number, timeout?: number): Promise<number>;
|
|
34
|
+
/** Handles exceptions from forgotten promises by logging error details. */
|
|
35
|
+
static exceptionHandler(error: Error, { name }: ForgetConfig, externalStackTrace?: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Used to explicitly launch an async function (or Promise) with awaiting it
|
|
38
|
+
* @param promise The promise to forget
|
|
39
|
+
* @param config Configuration of forget settings
|
|
40
|
+
*/
|
|
41
|
+
static forget<T>(promise: Promise<T> | PromiseEx<T> | PromisableFunction<T> | T, config?: ForgetConfig<T>): void;
|
|
42
|
+
/**
|
|
43
|
+
* Handles timeout events for forgotten promises by logging timeout details.
|
|
44
|
+
* Does not terminate the underlying promise; it may continue running after this is called.
|
|
45
|
+
*/
|
|
46
|
+
static timeoutHandler(time: number, { name }: ForgetConfig, externalStackTrace?: string): void;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=ForgetPromise.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Promisable } from '../../promise/neutral/index.ts';
|
|
2
|
+
import { type ForgetNodeConfig } from './ForgetNodeConfig.ts';
|
|
3
|
+
import { ForgetPromise } from './ForgetPromise.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Node.js extension of ForgetPromise that can terminate the process on exceptions or timeouts.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ForgetPromiseNode extends ForgetPromise {
|
|
8
|
+
/** Handles exceptions, optionally terminating the process based on config. */
|
|
9
|
+
static exceptionHandler(error: Error, config: ForgetNodeConfig, externalStackTrace?: string): void;
|
|
10
|
+
/** Forgets a promise using Node.js-specific configuration with process termination support. */
|
|
11
|
+
static forget<T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>): void;
|
|
12
|
+
/** Handles timeouts, optionally terminating the process based on config. */
|
|
13
|
+
static timeoutHandler(time: number, config: ForgetNodeConfig, externalStackTrace?: string): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ForgetPromiseNode.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Promisable } from '../../promise/neutral/index.ts';
|
|
2
|
+
import type { ForgetConfig } from './ForgetConfig.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Explicitly launches an async function or promise without awaiting it (fire-and-forget).
|
|
5
|
+
* @param promise - The promise or promisable value to forget.
|
|
6
|
+
* @param config - Optional configuration for timeout notification, error handling, and completion callbacks.
|
|
7
|
+
* Timeouts notify via `onCancel` but do not stop the underlying work; see `ForgetPromise.activeForgets`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const forget: <T>(promise: Promisable<T>, config?: ForgetConfig<T>) => void;
|
|
10
|
+
//# sourceMappingURL=forget.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Promisable } from '../../promise/neutral/index.ts';
|
|
2
|
+
import type { ForgetNodeConfig } from './ForgetNodeConfig.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Node.js variant of forget that can optionally terminate the process on exceptions or timeouts.
|
|
5
|
+
* @param promise - The promise or promisable value to forget.
|
|
6
|
+
* @param config - Optional Node.js-specific configuration including process termination options.
|
|
7
|
+
*/
|
|
8
|
+
export declare const forgetNode: <T>(promise: Promisable<T>, config?: ForgetNodeConfig<T>) => void;
|
|
9
|
+
//# sourceMappingURL=forgetNode.d.ts.map
|