@mionjs/core 0.8.0-alpha.0
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/.dist/cjs/index.cjs +245 -0
- package/.dist/cjs/index.cjs.map +1 -0
- package/.dist/cjs/index.d.ts +21 -0
- package/.dist/cjs/package.json +1 -0
- package/.dist/cjs/src/binary/bodyDeserializer.cjs +54 -0
- package/.dist/cjs/src/binary/bodyDeserializer.cjs.map +1 -0
- package/.dist/cjs/src/binary/bodyDeserializer.d.ts +5 -0
- package/.dist/cjs/src/binary/bodySerializer.cjs +49 -0
- package/.dist/cjs/src/binary/bodySerializer.cjs.map +1 -0
- package/.dist/cjs/src/binary/bodySerializer.d.ts +6 -0
- package/.dist/cjs/src/binary/dataView.cjs +212 -0
- package/.dist/cjs/src/binary/dataView.cjs.map +1 -0
- package/.dist/cjs/src/binary/dataView.d.ts +16 -0
- package/.dist/cjs/src/constants.cjs +84 -0
- package/.dist/cjs/src/constants.cjs.map +1 -0
- package/.dist/cjs/src/constants.d.ts +50 -0
- package/.dist/cjs/src/errors.cjs +170 -0
- package/.dist/cjs/src/errors.cjs.map +1 -0
- package/.dist/cjs/src/errors.d.ts +24 -0
- package/.dist/cjs/src/friendlyErrors.cjs +235 -0
- package/.dist/cjs/src/friendlyErrors.cjs.map +1 -0
- package/.dist/cjs/src/friendlyErrors.d.ts +4 -0
- package/.dist/cjs/src/headers.cjs +11 -0
- package/.dist/cjs/src/headers.cjs.map +1 -0
- package/.dist/cjs/src/headers.d.ts +12 -0
- package/.dist/cjs/src/jit/jitUtils.cjs +173 -0
- package/.dist/cjs/src/jit/jitUtils.cjs.map +1 -0
- package/.dist/cjs/src/jit/jitUtils.d.ts +30 -0
- package/.dist/cjs/src/pureFns/pureFn.cjs +80 -0
- package/.dist/cjs/src/pureFns/pureFn.cjs.map +1 -0
- package/.dist/cjs/src/pureFns/pureFn.d.ts +2 -0
- package/.dist/cjs/src/pureFns/pureServerFn.cjs +20 -0
- package/.dist/cjs/src/pureFns/pureServerFn.cjs.map +1 -0
- package/.dist/cjs/src/pureFns/pureServerFn.d.ts +4 -0
- package/.dist/cjs/src/pureFns/quickHash.cjs +62 -0
- package/.dist/cjs/src/pureFns/quickHash.cjs.map +1 -0
- package/.dist/cjs/src/pureFns/quickHash.d.ts +7 -0
- package/.dist/cjs/src/pureFns/restoreJitFns.cjs +88 -0
- package/.dist/cjs/src/pureFns/restoreJitFns.cjs.map +1 -0
- package/.dist/cjs/src/pureFns/restoreJitFns.d.ts +3 -0
- package/.dist/cjs/src/routerUtils.cjs +209 -0
- package/.dist/cjs/src/routerUtils.cjs.map +1 -0
- package/.dist/cjs/src/routerUtils.d.ts +24 -0
- package/.dist/cjs/src/types/formats/formatBrands.types.cjs +45 -0
- package/.dist/cjs/src/types/formats/formatBrands.types.cjs.map +1 -0
- package/.dist/cjs/src/types/formats/formatBrands.types.d.ts +45 -0
- package/.dist/cjs/src/types/formats/formats.types.cjs +27 -0
- package/.dist/cjs/src/types/formats/formats.types.cjs.map +1 -0
- package/.dist/cjs/src/types/formats/formats.types.d.ts +37 -0
- package/.dist/cjs/src/types/formats/formatsParams.types.cjs +60 -0
- package/.dist/cjs/src/types/formats/formatsParams.types.cjs.map +1 -0
- package/.dist/cjs/src/types/formats/formatsParams.types.d.ts +234 -0
- package/.dist/cjs/src/types/formats/friendlyErrors.types.cjs +53 -0
- package/.dist/cjs/src/types/formats/friendlyErrors.types.cjs.map +1 -0
- package/.dist/cjs/src/types/formats/friendlyErrors.types.d.ts +71 -0
- package/.dist/cjs/src/types/general.types.cjs +145 -0
- package/.dist/cjs/src/types/general.types.cjs.map +1 -0
- package/.dist/cjs/src/types/general.types.d.ts +246 -0
- package/.dist/cjs/src/types/method.types.cjs +26 -0
- package/.dist/cjs/src/types/method.types.cjs.map +1 -0
- package/.dist/cjs/src/types/method.types.d.ts +60 -0
- package/.dist/cjs/src/types/pureFunctions.types.cjs +39 -0
- package/.dist/cjs/src/types/pureFunctions.types.cjs.map +1 -0
- package/.dist/cjs/src/types/pureFunctions.types.d.ts +75 -0
- package/.dist/cjs/src/utils.cjs +47 -0
- package/.dist/cjs/src/utils.cjs.map +1 -0
- package/.dist/cjs/src/utils.d.ts +9 -0
- package/.dist/esm/index.d.ts +21 -0
- package/.dist/esm/index.js +245 -0
- package/.dist/esm/index.js.map +1 -0
- package/.dist/esm/src/binary/bodyDeserializer.d.ts +5 -0
- package/.dist/esm/src/binary/bodyDeserializer.js +54 -0
- package/.dist/esm/src/binary/bodyDeserializer.js.map +1 -0
- package/.dist/esm/src/binary/bodySerializer.d.ts +6 -0
- package/.dist/esm/src/binary/bodySerializer.js +49 -0
- package/.dist/esm/src/binary/bodySerializer.js.map +1 -0
- package/.dist/esm/src/binary/dataView.d.ts +16 -0
- package/.dist/esm/src/binary/dataView.js +212 -0
- package/.dist/esm/src/binary/dataView.js.map +1 -0
- package/.dist/esm/src/constants.d.ts +50 -0
- package/.dist/esm/src/constants.js +84 -0
- package/.dist/esm/src/constants.js.map +1 -0
- package/.dist/esm/src/errors.d.ts +24 -0
- package/.dist/esm/src/errors.js +170 -0
- package/.dist/esm/src/errors.js.map +1 -0
- package/.dist/esm/src/friendlyErrors.d.ts +4 -0
- package/.dist/esm/src/friendlyErrors.js +235 -0
- package/.dist/esm/src/friendlyErrors.js.map +1 -0
- package/.dist/esm/src/headers.d.ts +12 -0
- package/.dist/esm/src/headers.js +11 -0
- package/.dist/esm/src/headers.js.map +1 -0
- package/.dist/esm/src/jit/jitUtils.d.ts +30 -0
- package/.dist/esm/src/jit/jitUtils.js +173 -0
- package/.dist/esm/src/jit/jitUtils.js.map +1 -0
- package/.dist/esm/src/pureFns/pureFn.d.ts +2 -0
- package/.dist/esm/src/pureFns/pureFn.js +80 -0
- package/.dist/esm/src/pureFns/pureFn.js.map +1 -0
- package/.dist/esm/src/pureFns/pureServerFn.d.ts +4 -0
- package/.dist/esm/src/pureFns/pureServerFn.js +20 -0
- package/.dist/esm/src/pureFns/pureServerFn.js.map +1 -0
- package/.dist/esm/src/pureFns/quickHash.d.ts +7 -0
- package/.dist/esm/src/pureFns/quickHash.js +62 -0
- package/.dist/esm/src/pureFns/quickHash.js.map +1 -0
- package/.dist/esm/src/pureFns/restoreJitFns.d.ts +3 -0
- package/.dist/esm/src/pureFns/restoreJitFns.js +88 -0
- package/.dist/esm/src/pureFns/restoreJitFns.js.map +1 -0
- package/.dist/esm/src/routerUtils.d.ts +24 -0
- package/.dist/esm/src/routerUtils.js +209 -0
- package/.dist/esm/src/routerUtils.js.map +1 -0
- package/.dist/esm/src/types/formats/formatBrands.types.d.ts +45 -0
- package/.dist/esm/src/types/formats/formatBrands.types.js +45 -0
- package/.dist/esm/src/types/formats/formatBrands.types.js.map +1 -0
- package/.dist/esm/src/types/formats/formats.types.d.ts +37 -0
- package/.dist/esm/src/types/formats/formats.types.js +27 -0
- package/.dist/esm/src/types/formats/formats.types.js.map +1 -0
- package/.dist/esm/src/types/formats/formatsParams.types.d.ts +234 -0
- package/.dist/esm/src/types/formats/formatsParams.types.js +60 -0
- package/.dist/esm/src/types/formats/formatsParams.types.js.map +1 -0
- package/.dist/esm/src/types/formats/friendlyErrors.types.d.ts +71 -0
- package/.dist/esm/src/types/formats/friendlyErrors.types.js +53 -0
- package/.dist/esm/src/types/formats/friendlyErrors.types.js.map +1 -0
- package/.dist/esm/src/types/general.types.d.ts +246 -0
- package/.dist/esm/src/types/general.types.js +145 -0
- package/.dist/esm/src/types/general.types.js.map +1 -0
- package/.dist/esm/src/types/method.types.d.ts +60 -0
- package/.dist/esm/src/types/method.types.js +26 -0
- package/.dist/esm/src/types/method.types.js.map +1 -0
- package/.dist/esm/src/types/pureFunctions.types.d.ts +75 -0
- package/.dist/esm/src/types/pureFunctions.types.js +39 -0
- package/.dist/esm/src/types/pureFunctions.types.js.map +1 -0
- package/.dist/esm/src/utils.d.ts +9 -0
- package/.dist/esm/src/utils.js +47 -0
- package/.dist/esm/src/utils.js.map +1 -0
- package/LICENSE +21 -0
- package/README.md +32 -0
- package/package.json +58 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { SerializerModes, __ΩAnyClass, __ΩAnyErrorParams, __ΩAnyFn, __ΩAnyObject, __ΩBinaryInput, __ΩCoreRouterOptions, __ΩDataOnly, __ΩDataViewDeserializer, __ΩDataViewSerializer, __ΩDeserializeClassFn, __ΩFnsDataCache, __ΩFromBinaryFn, __ΩIsTypeFn, __ΩJSONString, __ΩJSONValue, __ΩJitCompiledFn, __ΩJitCompiledFnData, __ΩJitCompiledFunctions, __ΩJitFnArgs, __ΩJitFunctionsCache, __ΩJitFunctionsHashes, __ΩJsonStringifyFn, __ΩMapKeyPathSegment, __ΩMapValuePathSegment, __ΩMimeTypes, __ΩMutable, __ΩPathSegment, __ΩPersistedJitFn, __ΩPersistedJitFunctionsCache, __ΩPersistedPureFunctionsCache, __ΩPrepareForJsonFn, __ΩPrettify, __ΩPublicRpcError, __ΩPureFnsDataCache, __ΩPureFunctionsCache, __ΩRestoreFromJsonFn, __ΩRpcErrorParams, __ΩRpcErrorWithPrivate, __ΩRpcErrorWithPublic, __ΩRunTypeError, __ΩSerializableClass, __ΩSerializableJITFunctions, __ΩSerializerCode, __ΩSerializerMode, __ΩSetItemPathSegment, __ΩSrcCodeCompiledPureFunction, __ΩSrcCodeJITCompiledFnsCache, __ΩSrcCodeJitCompiledFn, __ΩSrcCodePureFunctionsCache, __ΩStrNumber, __ΩStrictArrayBuffer, __ΩToBinaryFn, __ΩToCodeFn, __ΩTypeErrorsFn, __ΩTypedErrorParams } from "./src/types/general.types.js";
|
|
2
|
+
import { __ΩHeadersMetaData, __ΩHeadersMethodWithJitFns, __ΩMethodMetadata, __ΩMethodWithJitFns, __ΩMethodWithOptions, __ΩMethodWithOptsAndJitFns, __ΩMethodsCache, __ΩRemoteMethodOpts, __ΩRouteOnlyOptions, __ΩSerializableMethodsData } from "./src/types/method.types.js";
|
|
3
|
+
import { __ΩCompiledPureFunction, __ΩErrorsPureFunction, __ΩGenericPureFunction, __ΩMapFromRef, __ΩMapFromServerFnRef, __ΩParsedFactoryFn, __ΩPersistedPureFunction, __ΩPureFnDef, __ΩPureFunction, __ΩPureFunctionData, __ΩPureFunctionDeps, __ΩPureFunctionFactory, __ΩPureServerFnRef, __ΩRoutesFlowMapping, __ΩRoutesFlowQuery } from "./src/types/pureFunctions.types.js";
|
|
4
|
+
import { __ΩAliasTypeAnnotation, __ΩAliasTypeFormat, __ΩExtractFormatParams, __ΩFormatParam, __ΩFormatParamLiteral, __ΩFormatParamMeta, __ΩTypeFormatError, __ΩTypeFormatParams, __ΩTypeFormatParsedParams, __ΩTypeFormatPrimitives, __ΩTypeFormatValue } from "./src/types/formats/formats.types.js";
|
|
5
|
+
import { __ΩAnyFormatParams, __ΩAnyStringFormatParam, __ΩDateFmt, __ΩFormatParam_Pattern, __ΩFormatParams_BigInt, __ΩFormatParams_Date, __ΩFormatParams_DateTime, __ΩFormatParams_Domain, __ΩFormatParams_DomainCore, __ΩFormatParams_DomainName, __ΩFormatParams_Email, __ΩFormatParams_EmailPattern, __ΩFormatParams_IP, __ΩFormatParams_Number, __ΩFormatParams_Time, __ΩFormatParams_Tld, __ΩFormatParams_UUID, __ΩFormatParams_Url, __ΩFormatParams_UrlPattern, __ΩSamples, __ΩStringParams, __ΩStringTransformers, __ΩStringValidators, __ΩTimeFmt } from "./src/types/formats/formatsParams.types.js";
|
|
6
|
+
import { __ΩAnyFriendlyErrorParams, __ΩBigIntErrorParams, __ΩDateErrorParams, __ΩDateTimeErrorParams, __ΩDomainErrorParams, __ΩEmailErrorParams, __ΩExtractErrorParams, __ΩFriendlyErrorHandler, __ΩFriendlyErrorParams, __ΩFriendlyErrors, __ΩFriendlyErrorsResult, __ΩIPErrorParams, __ΩMapErrorHandlers, __ΩMapErrorsResult, __ΩNumberErrorParams, __ΩSetErrorHandlers, __ΩSetErrorsResult, __ΩStringErrorParams, __ΩTimeErrorParams, __ΩTypeErrorParam, __ΩUUIDErrorParams, __ΩUrlErrorParams } from "./src/types/formats/friendlyErrors.types.js";
|
|
7
|
+
import { __ΩBrand, __ΩBrandDate, __ΩBrandDateTime, __ΩBrandDomain, __ΩBrandEmail, __ΩBrandFloat, __ΩBrandIP, __ΩBrandInt16, __ΩBrandInt32, __ΩBrandInt8, __ΩBrandInteger, __ΩBrandNegative, __ΩBrandNegativeInt, __ΩBrandPositive, __ΩBrandPositiveInt, __ΩBrandTime, __ΩBrandUInt16, __ΩBrandUInt32, __ΩBrandUInt8, __ΩBrandUUID, __ΩBrandUrl } from "./src/types/formats/formatBrands.types.js";
|
|
8
|
+
import { createDataViewDeserializer, createDataViewSerializer, setSerializationOptions } from "./src/binary/dataView.js";
|
|
9
|
+
import { serializeBinaryBody } from "./src/binary/bodySerializer.js";
|
|
10
|
+
import { deserializeBinaryBody } from "./src/binary/bodyDeserializer.js";
|
|
11
|
+
import { DEFAULT_CORE_OPTIONS, EMPTY_HASH, HandlerType, JIT_FUNCTION_IDS, MAX_STACK_DEPTH, MAX_UNKNOWN_KEYS, MIME_TYPES, MION_ROUTES, PATH_SEPARATOR, ROUTER_ITEM_SEPARATOR_CHAR, ROUTE_PATH_ROOT, StatusCodes } from "./src/constants.js";
|
|
12
|
+
import { RpcError, TypedError, __ΩValidationError, __ΩValidationErrorData, isAnyError, isRpcError, isTypedError, registerErrorDeserializers, setErrorOptions } from "./src/errors.js";
|
|
13
|
+
import { defaultErrorPrinter, getFriendlyErrors } from "./src/friendlyErrors.js";
|
|
14
|
+
import { addAOTCaches, addSerializedJitCaches, getJitFnCaches, getJitUtils, resetJitFnCaches } from "./src/jit/jitUtils.js";
|
|
15
|
+
import { addRoutesToCache, getHeaderJitFunctionsFromHash, getJitFnHashes, getJitFunctionsFromHash, getNoopJitFns, getRoutePath, getRouterItemId, methodOptsCache, resetJitFunctionsCache, resetRoutesCache, routesCache } from "./src/routerUtils.js";
|
|
16
|
+
import { fromBase64Url, getENV, initPureFunction, isMionAOTEmitMode, isMionCompileMode, isTestEnv, randomUUID_V7, toBase64Url } from "./src/utils.js";
|
|
17
|
+
import { HeadersSubset } from "./src/headers.js";
|
|
18
|
+
import { registerPureFnFactory } from "./src/pureFns/pureFn.js";
|
|
19
|
+
import { PURE_SERVER_FN_NAMESPACE, pureServerFn } from "./src/pureFns/pureServerFn.js";
|
|
20
|
+
import { createHashLiteral, createUniqueHash, defaultLiteralLength, hashDefaultLength, pureFnHashLength, quickHash, resetHashes } from "./src/pureFns/quickHash.js";
|
|
21
|
+
export {
|
|
22
|
+
DEFAULT_CORE_OPTIONS,
|
|
23
|
+
EMPTY_HASH,
|
|
24
|
+
HandlerType,
|
|
25
|
+
HeadersSubset,
|
|
26
|
+
JIT_FUNCTION_IDS,
|
|
27
|
+
MAX_STACK_DEPTH,
|
|
28
|
+
MAX_UNKNOWN_KEYS,
|
|
29
|
+
MIME_TYPES,
|
|
30
|
+
MION_ROUTES,
|
|
31
|
+
PATH_SEPARATOR,
|
|
32
|
+
PURE_SERVER_FN_NAMESPACE,
|
|
33
|
+
ROUTER_ITEM_SEPARATOR_CHAR,
|
|
34
|
+
ROUTE_PATH_ROOT,
|
|
35
|
+
RpcError,
|
|
36
|
+
SerializerModes,
|
|
37
|
+
StatusCodes,
|
|
38
|
+
TypedError,
|
|
39
|
+
__ΩAliasTypeAnnotation,
|
|
40
|
+
__ΩAliasTypeFormat,
|
|
41
|
+
__ΩAnyClass,
|
|
42
|
+
__ΩAnyErrorParams,
|
|
43
|
+
__ΩAnyFn,
|
|
44
|
+
__ΩAnyFormatParams,
|
|
45
|
+
__ΩAnyFriendlyErrorParams,
|
|
46
|
+
__ΩAnyObject,
|
|
47
|
+
__ΩAnyStringFormatParam,
|
|
48
|
+
__ΩBigIntErrorParams,
|
|
49
|
+
__ΩBinaryInput,
|
|
50
|
+
__ΩBrand,
|
|
51
|
+
__ΩBrandDate,
|
|
52
|
+
__ΩBrandDateTime,
|
|
53
|
+
__ΩBrandDomain,
|
|
54
|
+
__ΩBrandEmail,
|
|
55
|
+
__ΩBrandFloat,
|
|
56
|
+
__ΩBrandIP,
|
|
57
|
+
__ΩBrandInt16,
|
|
58
|
+
__ΩBrandInt32,
|
|
59
|
+
__ΩBrandInt8,
|
|
60
|
+
__ΩBrandInteger,
|
|
61
|
+
__ΩBrandNegative,
|
|
62
|
+
__ΩBrandNegativeInt,
|
|
63
|
+
__ΩBrandPositive,
|
|
64
|
+
__ΩBrandPositiveInt,
|
|
65
|
+
__ΩBrandTime,
|
|
66
|
+
__ΩBrandUInt16,
|
|
67
|
+
__ΩBrandUInt32,
|
|
68
|
+
__ΩBrandUInt8,
|
|
69
|
+
__ΩBrandUUID,
|
|
70
|
+
__ΩBrandUrl,
|
|
71
|
+
__ΩCompiledPureFunction,
|
|
72
|
+
__ΩCoreRouterOptions,
|
|
73
|
+
__ΩDataOnly,
|
|
74
|
+
__ΩDataViewDeserializer,
|
|
75
|
+
__ΩDataViewSerializer,
|
|
76
|
+
__ΩDateErrorParams,
|
|
77
|
+
__ΩDateFmt,
|
|
78
|
+
__ΩDateTimeErrorParams,
|
|
79
|
+
__ΩDeserializeClassFn,
|
|
80
|
+
__ΩDomainErrorParams,
|
|
81
|
+
__ΩEmailErrorParams,
|
|
82
|
+
__ΩErrorsPureFunction,
|
|
83
|
+
__ΩExtractErrorParams,
|
|
84
|
+
__ΩExtractFormatParams,
|
|
85
|
+
__ΩFnsDataCache,
|
|
86
|
+
__ΩFormatParam,
|
|
87
|
+
__ΩFormatParamLiteral,
|
|
88
|
+
__ΩFormatParamMeta,
|
|
89
|
+
__ΩFormatParam_Pattern,
|
|
90
|
+
__ΩFormatParams_BigInt,
|
|
91
|
+
__ΩFormatParams_Date,
|
|
92
|
+
__ΩFormatParams_DateTime,
|
|
93
|
+
__ΩFormatParams_Domain,
|
|
94
|
+
__ΩFormatParams_DomainCore,
|
|
95
|
+
__ΩFormatParams_DomainName,
|
|
96
|
+
__ΩFormatParams_Email,
|
|
97
|
+
__ΩFormatParams_EmailPattern,
|
|
98
|
+
__ΩFormatParams_IP,
|
|
99
|
+
__ΩFormatParams_Number,
|
|
100
|
+
__ΩFormatParams_Time,
|
|
101
|
+
__ΩFormatParams_Tld,
|
|
102
|
+
__ΩFormatParams_UUID,
|
|
103
|
+
__ΩFormatParams_Url,
|
|
104
|
+
__ΩFormatParams_UrlPattern,
|
|
105
|
+
__ΩFriendlyErrorHandler,
|
|
106
|
+
__ΩFriendlyErrorParams,
|
|
107
|
+
__ΩFriendlyErrors,
|
|
108
|
+
__ΩFriendlyErrorsResult,
|
|
109
|
+
__ΩFromBinaryFn,
|
|
110
|
+
__ΩGenericPureFunction,
|
|
111
|
+
__ΩHeadersMetaData,
|
|
112
|
+
__ΩHeadersMethodWithJitFns,
|
|
113
|
+
__ΩIPErrorParams,
|
|
114
|
+
__ΩIsTypeFn,
|
|
115
|
+
__ΩJSONString,
|
|
116
|
+
__ΩJSONValue,
|
|
117
|
+
__ΩJitCompiledFn,
|
|
118
|
+
__ΩJitCompiledFnData,
|
|
119
|
+
__ΩJitCompiledFunctions,
|
|
120
|
+
__ΩJitFnArgs,
|
|
121
|
+
__ΩJitFunctionsCache,
|
|
122
|
+
__ΩJitFunctionsHashes,
|
|
123
|
+
__ΩJsonStringifyFn,
|
|
124
|
+
__ΩMapErrorHandlers,
|
|
125
|
+
__ΩMapErrorsResult,
|
|
126
|
+
__ΩMapFromRef,
|
|
127
|
+
__ΩMapFromServerFnRef,
|
|
128
|
+
__ΩMapKeyPathSegment,
|
|
129
|
+
__ΩMapValuePathSegment,
|
|
130
|
+
__ΩMethodMetadata,
|
|
131
|
+
__ΩMethodWithJitFns,
|
|
132
|
+
__ΩMethodWithOptions,
|
|
133
|
+
__ΩMethodWithOptsAndJitFns,
|
|
134
|
+
__ΩMethodsCache,
|
|
135
|
+
__ΩMimeTypes,
|
|
136
|
+
__ΩMutable,
|
|
137
|
+
__ΩNumberErrorParams,
|
|
138
|
+
__ΩParsedFactoryFn,
|
|
139
|
+
__ΩPathSegment,
|
|
140
|
+
__ΩPersistedJitFn,
|
|
141
|
+
__ΩPersistedJitFunctionsCache,
|
|
142
|
+
__ΩPersistedPureFunction,
|
|
143
|
+
__ΩPersistedPureFunctionsCache,
|
|
144
|
+
__ΩPrepareForJsonFn,
|
|
145
|
+
__ΩPrettify,
|
|
146
|
+
__ΩPublicRpcError,
|
|
147
|
+
__ΩPureFnDef,
|
|
148
|
+
__ΩPureFnsDataCache,
|
|
149
|
+
__ΩPureFunction,
|
|
150
|
+
__ΩPureFunctionData,
|
|
151
|
+
__ΩPureFunctionDeps,
|
|
152
|
+
__ΩPureFunctionFactory,
|
|
153
|
+
__ΩPureFunctionsCache,
|
|
154
|
+
__ΩPureServerFnRef,
|
|
155
|
+
__ΩRemoteMethodOpts,
|
|
156
|
+
__ΩRestoreFromJsonFn,
|
|
157
|
+
__ΩRouteOnlyOptions,
|
|
158
|
+
__ΩRoutesFlowMapping,
|
|
159
|
+
__ΩRoutesFlowQuery,
|
|
160
|
+
__ΩRpcErrorParams,
|
|
161
|
+
__ΩRpcErrorWithPrivate,
|
|
162
|
+
__ΩRpcErrorWithPublic,
|
|
163
|
+
__ΩRunTypeError,
|
|
164
|
+
__ΩSamples,
|
|
165
|
+
__ΩSerializableClass,
|
|
166
|
+
__ΩSerializableJITFunctions,
|
|
167
|
+
__ΩSerializableMethodsData,
|
|
168
|
+
__ΩSerializerCode,
|
|
169
|
+
__ΩSerializerMode,
|
|
170
|
+
__ΩSetErrorHandlers,
|
|
171
|
+
__ΩSetErrorsResult,
|
|
172
|
+
__ΩSetItemPathSegment,
|
|
173
|
+
__ΩSrcCodeCompiledPureFunction,
|
|
174
|
+
__ΩSrcCodeJITCompiledFnsCache,
|
|
175
|
+
__ΩSrcCodeJitCompiledFn,
|
|
176
|
+
__ΩSrcCodePureFunctionsCache,
|
|
177
|
+
__ΩStrNumber,
|
|
178
|
+
__ΩStrictArrayBuffer,
|
|
179
|
+
__ΩStringErrorParams,
|
|
180
|
+
__ΩStringParams,
|
|
181
|
+
__ΩStringTransformers,
|
|
182
|
+
__ΩStringValidators,
|
|
183
|
+
__ΩTimeErrorParams,
|
|
184
|
+
__ΩTimeFmt,
|
|
185
|
+
__ΩToBinaryFn,
|
|
186
|
+
__ΩToCodeFn,
|
|
187
|
+
__ΩTypeErrorParam,
|
|
188
|
+
__ΩTypeErrorsFn,
|
|
189
|
+
__ΩTypeFormatError,
|
|
190
|
+
__ΩTypeFormatParams,
|
|
191
|
+
__ΩTypeFormatParsedParams,
|
|
192
|
+
__ΩTypeFormatPrimitives,
|
|
193
|
+
__ΩTypeFormatValue,
|
|
194
|
+
__ΩTypedErrorParams,
|
|
195
|
+
__ΩUUIDErrorParams,
|
|
196
|
+
__ΩUrlErrorParams,
|
|
197
|
+
__ΩValidationError,
|
|
198
|
+
__ΩValidationErrorData,
|
|
199
|
+
addAOTCaches,
|
|
200
|
+
addRoutesToCache,
|
|
201
|
+
addSerializedJitCaches,
|
|
202
|
+
createDataViewDeserializer,
|
|
203
|
+
createDataViewSerializer,
|
|
204
|
+
createHashLiteral,
|
|
205
|
+
createUniqueHash,
|
|
206
|
+
defaultErrorPrinter,
|
|
207
|
+
defaultLiteralLength,
|
|
208
|
+
deserializeBinaryBody,
|
|
209
|
+
fromBase64Url,
|
|
210
|
+
getENV,
|
|
211
|
+
getFriendlyErrors,
|
|
212
|
+
getHeaderJitFunctionsFromHash,
|
|
213
|
+
getJitFnCaches,
|
|
214
|
+
getJitFnHashes,
|
|
215
|
+
getJitFunctionsFromHash,
|
|
216
|
+
getJitUtils,
|
|
217
|
+
getNoopJitFns,
|
|
218
|
+
getRoutePath,
|
|
219
|
+
getRouterItemId,
|
|
220
|
+
hashDefaultLength,
|
|
221
|
+
initPureFunction,
|
|
222
|
+
isAnyError,
|
|
223
|
+
isMionAOTEmitMode,
|
|
224
|
+
isMionCompileMode,
|
|
225
|
+
isRpcError,
|
|
226
|
+
isTestEnv,
|
|
227
|
+
isTypedError,
|
|
228
|
+
methodOptsCache,
|
|
229
|
+
pureFnHashLength,
|
|
230
|
+
pureServerFn,
|
|
231
|
+
quickHash,
|
|
232
|
+
randomUUID_V7,
|
|
233
|
+
registerErrorDeserializers,
|
|
234
|
+
registerPureFnFactory,
|
|
235
|
+
resetHashes,
|
|
236
|
+
resetJitFnCaches,
|
|
237
|
+
resetJitFunctionsCache,
|
|
238
|
+
resetRoutesCache,
|
|
239
|
+
routesCache,
|
|
240
|
+
serializeBinaryBody,
|
|
241
|
+
setErrorOptions,
|
|
242
|
+
setSerializationOptions,
|
|
243
|
+
toBase64Url
|
|
244
|
+
};
|
|
245
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { createDataViewDeserializer } from "./dataView.js";
|
|
2
|
+
import { StatusCodes } from "../constants.js";
|
|
3
|
+
import { RpcError } from "../errors.js";
|
|
4
|
+
import { routesCache } from "../routerUtils.js";
|
|
5
|
+
function deserializeBinaryBody(path, buffer, isResponse) {
|
|
6
|
+
try {
|
|
7
|
+
const deserializer = createDataViewDeserializer(path, buffer);
|
|
8
|
+
const body = {};
|
|
9
|
+
const itemsLength = deserializer.view.getUint32(0, true);
|
|
10
|
+
deserializer.index += 4;
|
|
11
|
+
for (let i = 0; i < itemsLength; i++) {
|
|
12
|
+
const key = deserializer.desString();
|
|
13
|
+
const method = routesCache.getMethodJitFns(key);
|
|
14
|
+
if (!method) {
|
|
15
|
+
throw new RpcError({
|
|
16
|
+
statusCode: StatusCodes.UNEXPECTED_ERROR,
|
|
17
|
+
type: isResponse ? "binary-response-method-Deserialization-error" : "binary-request-method-Deserialization-error",
|
|
18
|
+
publicMessage: `Unknown method key in binary body: ${key}`,
|
|
19
|
+
errorData: { methodId: key }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const value = deserializeMethod(key, method, deserializer, isResponse);
|
|
23
|
+
body[key] = value;
|
|
24
|
+
}
|
|
25
|
+
deserializer.markAsEnded();
|
|
26
|
+
return { deserializer, body };
|
|
27
|
+
} catch (err) {
|
|
28
|
+
if (err instanceof RpcError) throw err;
|
|
29
|
+
throw new RpcError({
|
|
30
|
+
statusCode: StatusCodes.UNEXPECTED_ERROR,
|
|
31
|
+
type: isResponse ? "binary-response-Deserialize-error" : "binary-request-Deserialization-error",
|
|
32
|
+
publicMessage: `Failed to deserialize body from binary: ${err?.message || "unknown error"}`,
|
|
33
|
+
originalError: err
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function deserializeMethod(key, method, deserializer, isResponse) {
|
|
38
|
+
const jitFns = isResponse ? method.returnJitFns : method.paramsJitFns;
|
|
39
|
+
try {
|
|
40
|
+
return jitFns.fromBinary.fn(void 0, deserializer);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
throw new RpcError({
|
|
43
|
+
statusCode: StatusCodes.UNEXPECTED_ERROR,
|
|
44
|
+
type: isResponse ? "binary-response-method-Deserialization-error" : "binary-request-method-Deserialization-error",
|
|
45
|
+
publicMessage: `Failed to deserialize method ${key} from binary`,
|
|
46
|
+
originalError: e,
|
|
47
|
+
errorData: { methodId: key }
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
deserializeBinaryBody
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=bodyDeserializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodyDeserializer.js","sources":["../../../../src/binary/bodyDeserializer.ts"],"sourcesContent":["import {createDataViewDeserializer} from './dataView.ts';\nimport {StatusCodes} from '../constants.ts';\nimport {RpcError} from '../errors.ts';\nimport type {BinaryInput, DataViewDeserializer} from '../types/general.types.ts';\nimport type {MethodWithJitFns} from '../types/method.types.ts';\nimport {routesCache} from '../routerUtils.ts';\n\n/**\n * Deserializes API body from binary format using JIT-compiled deserialization functions.\n * Reads the binary buffer and reconstructs the body record.\n * Method metadata is looked up from routesCache automatically.\n */\nexport function deserializeBinaryBody(\n path: string,\n buffer: BinaryInput,\n /** If true, the body is a response body, otherwise it's a request body */\n isResponse: boolean\n): {\n deserializer: DataViewDeserializer;\n body: Record<string, any>;\n} {\n try {\n // Create deserializer from buffer\n const deserializer = createDataViewDeserializer(path, buffer);\n const body: Record<string, any> = {};\n\n // Read items length from first 32 bits\n const itemsLength = deserializer.view.getUint32(0, true);\n deserializer.index += 4;\n\n // Deserialize each item\n for (let i = 0; i < itemsLength; i++) {\n // Deserialize key (method id)\n const key = deserializer.desString();\n\n // Find the corresponding method from routesCache\n const method = routesCache.getMethodJitFns(key);\n if (!method) {\n throw new RpcError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: isResponse\n ? 'binary-response-method-Deserialization-error'\n : 'binary-request-method-Deserialization-error',\n publicMessage: `Unknown method key in binary body: ${key}`,\n errorData: {methodId: key},\n });\n }\n\n // Deserialize value using the appropriate JIT function\n const value = deserializeMethod(key, method, deserializer, isResponse);\n body[key] = value;\n }\n\n deserializer.markAsEnded();\n return {deserializer, body};\n } catch (err: any) {\n if (err instanceof RpcError) throw err;\n throw new RpcError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: isResponse ? 'binary-response-Deserialize-error' : 'binary-request-Deserialization-error',\n publicMessage: `Failed to deserialize body from binary: ${err?.message || 'unknown error'}`,\n originalError: err,\n });\n }\n}\n\n/** Deserializes a single method's value from binary format */\nfunction deserializeMethod(key: string, method: MethodWithJitFns, deserializer: DataViewDeserializer, isResponse: boolean): any {\n const jitFns = isResponse ? method.returnJitFns : method.paramsJitFns;\n try {\n return jitFns.fromBinary.fn(undefined, deserializer);\n } catch (e: any) {\n throw new RpcError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: isResponse ? 'binary-response-method-Deserialization-error' : 'binary-request-method-Deserialization-error',\n publicMessage: `Failed to deserialize method ${key} from binary`,\n originalError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,UAAU,IAAA;AAAA,IAAG,CAC5B;AAAA,EACL;AACJ;"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { DataViewSerializer } from '../types/general.types.ts';
|
|
2
|
+
import { MethodWithJitFns } from '../types/method.types.ts';
|
|
3
|
+
export declare function serializeBinaryBody(path: string, executionChain: MethodWithJitFns[], body: Record<string, any>, isResponse: boolean, workflowRouteIds?: string[]): {
|
|
4
|
+
serializer: DataViewSerializer;
|
|
5
|
+
buffer: ReturnType<DataViewSerializer['getBuffer']>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createDataViewSerializer } from "./dataView.js";
|
|
2
|
+
import { StatusCodes, MION_ROUTES } from "../constants.js";
|
|
3
|
+
import { RpcError } from "../errors.js";
|
|
4
|
+
function serializeBinaryBody(path, executionChain, body, isResponse, workflowRouteIds) {
|
|
5
|
+
try {
|
|
6
|
+
const serializer = createDataViewSerializer(path, workflowRouteIds);
|
|
7
|
+
const itemsLengthIndex = serializer.index;
|
|
8
|
+
serializer.index += 4;
|
|
9
|
+
let itemsLength = 0;
|
|
10
|
+
for (let i = 0; i < executionChain.length; i++) {
|
|
11
|
+
const method = executionChain[i];
|
|
12
|
+
const key = method.id;
|
|
13
|
+
const value = body[key];
|
|
14
|
+
if (serializeMethod(key, method, value, serializer, isResponse)) {
|
|
15
|
+
itemsLength++;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
serializer.view.setUint32(itemsLengthIndex, itemsLength, true);
|
|
19
|
+
serializer.markAsEnded();
|
|
20
|
+
return { serializer, buffer: serializer.getBuffer() };
|
|
21
|
+
} catch (err) {
|
|
22
|
+
if (err instanceof RpcError) throw err;
|
|
23
|
+
throw new RpcError({
|
|
24
|
+
statusCode: StatusCodes.UNEXPECTED_ERROR,
|
|
25
|
+
type: isResponse ? "binary-response-Serialization-error" : "binary-request-Serialization-error",
|
|
26
|
+
publicMessage: `Failed to serialize body to binary: ${err?.message || "unknown error"}`,
|
|
27
|
+
originalError: err
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function serializeMethod(key, method, value, serializer, isResponse) {
|
|
32
|
+
const toBinary = isResponse ? method.returnJitFns.toBinary : method.paramsJitFns.toBinary;
|
|
33
|
+
if (!toBinary?.fn)
|
|
34
|
+
throw new RpcError({
|
|
35
|
+
type: "missing-toBinary-jit-fn",
|
|
36
|
+
publicMessage: `Missing toBinary JIT function for method ${method.id}`
|
|
37
|
+
});
|
|
38
|
+
if (toBinary.isNoop) return false;
|
|
39
|
+
if (key === MION_ROUTES.thrownErrors) return false;
|
|
40
|
+
if (isResponse && (!method.hasReturnData || typeof value === "undefined")) return false;
|
|
41
|
+
if (!isResponse && typeof value === "undefined") return false;
|
|
42
|
+
serializer.serString(key);
|
|
43
|
+
toBinary.fn(value, serializer);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
serializeBinaryBody
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=bodySerializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bodySerializer.js","sources":["../../../../src/binary/bodySerializer.ts"],"sourcesContent":["import {createDataViewSerializer} from './dataView.ts';\nimport {MION_ROUTES, StatusCodes} from '../constants.ts';\nimport {RpcError} from '../errors.ts';\nimport type {DataViewSerializer} from '../types/general.types.ts';\nimport type {MethodWithJitFns} from '../types/method.types.ts';\n\n/**\n * Serializes API body to binary format using JIT-compiled serialization functions.\n * Combines the results of all body methods into a single binary buffer.\n *\n * Note: This function assumes all methods in executionChain have valid JIT functions.\n * Methods with noop JIT functions or undefined values should be filtered out before calling this function,\n * or handled by the caller. Any serialization errors will be thrown as RpcError.\n *\n */\nexport function serializeBinaryBody(\n path: string,\n executionChain: MethodWithJitFns[],\n body: Record<string, any>,\n isResponse: boolean,\n workflowRouteIds?: string[]\n): {\n serializer: DataViewSerializer;\n buffer: ReturnType<DataViewSerializer['getBuffer']>;\n} {\n try {\n const serializer = createDataViewSerializer(path, workflowRouteIds);\n\n // Reserve space for items length at index 0 (will be written after counting)\n const itemsLengthIndex = serializer.index;\n serializer.index += 4;\n\n let itemsLength = 0;\n // serialize each method's value (return value for responses, params for requests)\n for (let i = 0; i < executionChain.length; i++) {\n const method = executionChain[i];\n const key = method.id;\n const value = body[key];\n if (serializeMethod(key, method, value, serializer, isResponse)) {\n itemsLength++;\n }\n }\n // Write items length at reserved index 0\n serializer.view.setUint32(itemsLengthIndex, itemsLength, true);\n serializer.markAsEnded();\n\n return {serializer, buffer: serializer.getBuffer()};\n } catch (err: any) {\n if (err instanceof RpcError) throw err;\n throw new RpcError({\n statusCode: StatusCodes.UNEXPECTED_ERROR,\n type: isResponse ? 'binary-response-Serialization-error' : 'binary-request-Serialization-error',\n publicMessage: `Failed to serialize body to binary: ${err?.message || 'unknown error'}`,\n originalError: err,\n });\n }\n}\n\n/**\n * Serializes a single method's value to binary format.\n * Returns true if the method was serialized, false if it was skipped.\n */\nfunction serializeMethod(\n key: string,\n method: MethodWithJitFns,\n value: any,\n serializer: DataViewSerializer,\n isResponse: boolean\n): boolean {\n const toBinary = isResponse ? method.returnJitFns.toBinary : method.paramsJitFns.toBinary;\n if (!toBinary?.fn)\n throw new RpcError({\n type: 'missing-toBinary-jit-fn',\n publicMessage: `Missing toBinary JIT function for method ${method.id}`,\n });\n if (toBinary.isNoop) return false;\n // skip @thrownErrors - should be handled separately by the caller if needed\n if (key === MION_ROUTES.thrownErrors) return false;\n // skip methods without return data or undefined values (for responses)\n if (isResponse && (!method.hasReturnData || typeof value === 'undefined')) return false;\n // skip methods with no params (for requests) or noop serialization\n if (!isResponse && typeof value === 'undefined') return false;\n // serialize key\n serializer.serString(key);\n // serialize value\n toBinary.fn(value, serializer);\n return true;\n}\n"],"names":[],"mappings":";;;AAeO,SAAS,oBACZ,MACA,gBACA,MACA,YACA,kBAIF;AACE,MAAI;AACA,UAAM,aAAa,yBAAyB,MAAM,gBAAgB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
+
maxPoolItems: number;
|
|
4
|
+
maxStrCacheLength: number;
|
|
5
|
+
maxCacheSize: number;
|
|
6
|
+
bufferSize: number;
|
|
7
|
+
averageResponseSizeMultiplier: number;
|
|
8
|
+
responseAverageSizes: Map<string, number>;
|
|
9
|
+
stringBytesCache: Map<string, Uint8Array<ArrayBufferLike>>;
|
|
10
|
+
};
|
|
11
|
+
export type SerializationOptions = typeof DEFAULT_OPTIONS;
|
|
12
|
+
export declare function setSerializationOptions(options: Partial<SerializationOptions>): void;
|
|
13
|
+
export declare function createDataViewSerializer(routeId: string, workflowRouteIds?: string[]): DataViewSerializer;
|
|
14
|
+
export declare function createDataViewDeserializer(routeId: string, input: BinaryInput): DataViewDeserializer;
|
|
15
|
+
export {};
|
|
16
|
+
export declare type __ΩSerializationOptions = any[];
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
const STR = 1;
|
|
2
|
+
const NUM = 2;
|
|
3
|
+
const POW_2_32 = 2 ** 32;
|
|
4
|
+
const LE = true;
|
|
5
|
+
const DEFAULT_OPTIONS = {
|
|
6
|
+
maxPoolItems: 100,
|
|
7
|
+
maxStrCacheLength: 64,
|
|
8
|
+
maxCacheSize: 1e3,
|
|
9
|
+
bufferSize: 2 ** 24,
|
|
10
|
+
averageResponseSizeMultiplier: 2,
|
|
11
|
+
responseAverageSizes: /* @__PURE__ */ new Map(),
|
|
12
|
+
stringBytesCache: /* @__PURE__ */ new Map()
|
|
13
|
+
};
|
|
14
|
+
const textEncoder = new TextEncoder();
|
|
15
|
+
const textDecoder = new TextDecoder();
|
|
16
|
+
let opts = { ...DEFAULT_OPTIONS };
|
|
17
|
+
function setSerializationOptions(options) {
|
|
18
|
+
opts = { ...opts, ...options };
|
|
19
|
+
}
|
|
20
|
+
function createDataViewSerializer(routeId, workflowRouteIds) {
|
|
21
|
+
const size = calculateBufferSizeForRequest(routeId, workflowRouteIds);
|
|
22
|
+
if (size >= POW_2_32) throw new Error("bufferSize option must be strictly less than 2 ** 32");
|
|
23
|
+
return new DataViewSerializerImpl(routeId, size);
|
|
24
|
+
}
|
|
25
|
+
function createDataViewDeserializer(routeId, input) {
|
|
26
|
+
if (ArrayBuffer.isView(input)) {
|
|
27
|
+
const buffer = input.buffer;
|
|
28
|
+
return new DataViewDeserializerImpl(routeId, buffer, input.byteOffset, input.byteLength);
|
|
29
|
+
}
|
|
30
|
+
return new DataViewDeserializerImpl(routeId, input);
|
|
31
|
+
}
|
|
32
|
+
class DataViewSerializerImpl {
|
|
33
|
+
buffer;
|
|
34
|
+
uint8View;
|
|
35
|
+
// Reusable view
|
|
36
|
+
routeId;
|
|
37
|
+
index = 0;
|
|
38
|
+
// byte offset
|
|
39
|
+
view;
|
|
40
|
+
hasEnded = false;
|
|
41
|
+
constructor(routeId, size) {
|
|
42
|
+
this.routeId = routeId;
|
|
43
|
+
this.buffer = new ArrayBuffer(size);
|
|
44
|
+
this.view = new DataView(this.buffer);
|
|
45
|
+
this.uint8View = new Uint8Array(this.buffer);
|
|
46
|
+
}
|
|
47
|
+
reset() {
|
|
48
|
+
this.index = 0;
|
|
49
|
+
this.hasEnded = false;
|
|
50
|
+
}
|
|
51
|
+
resize(size) {
|
|
52
|
+
this.buffer = new ArrayBuffer(size);
|
|
53
|
+
this.view = new DataView(this.buffer);
|
|
54
|
+
this.uint8View = new Uint8Array(this.buffer);
|
|
55
|
+
}
|
|
56
|
+
getBuffer() {
|
|
57
|
+
const buff = this.buffer.slice(0, this.index);
|
|
58
|
+
return buff;
|
|
59
|
+
}
|
|
60
|
+
getBufferView() {
|
|
61
|
+
return new Uint8Array(this.buffer, 0, this.index);
|
|
62
|
+
}
|
|
63
|
+
markAsEnded() {
|
|
64
|
+
this.hasEnded = true;
|
|
65
|
+
updateResponseSize(this.routeId, this.index);
|
|
66
|
+
}
|
|
67
|
+
getLength() {
|
|
68
|
+
return this.index;
|
|
69
|
+
}
|
|
70
|
+
serString(str, skipCache) {
|
|
71
|
+
if (str.length >= opts.maxStrCacheLength || skipCache) {
|
|
72
|
+
const targetView2 = this.uint8View.subarray(this.index + 4);
|
|
73
|
+
const result2 = textEncoder.encodeInto(str, targetView2);
|
|
74
|
+
this.view.setUint32(this.index, result2.written, LE);
|
|
75
|
+
this.index += 4 + result2.written;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const cached = opts.stringBytesCache.get(str);
|
|
79
|
+
if (cached) {
|
|
80
|
+
this.uint8View.set(cached, this.index + 4);
|
|
81
|
+
this.view.setUint32(this.index, cached.length, LE);
|
|
82
|
+
this.index += 4 + cached.length;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const targetView = this.uint8View.subarray(this.index + 4);
|
|
86
|
+
const result = textEncoder.encodeInto(str, targetView);
|
|
87
|
+
const written = result.written;
|
|
88
|
+
this.view.setUint32(this.index, written, LE);
|
|
89
|
+
this.index += 4 + written;
|
|
90
|
+
if (opts.stringBytesCache.size >= opts.maxCacheSize) evictStringBytesCache();
|
|
91
|
+
opts.stringBytesCache.set(str, this.uint8View.slice(this.index - written, this.index));
|
|
92
|
+
}
|
|
93
|
+
serFloat64(n) {
|
|
94
|
+
this.view.setFloat64(this.index, n, LE);
|
|
95
|
+
this.index += 8;
|
|
96
|
+
}
|
|
97
|
+
serEnum(n) {
|
|
98
|
+
if (typeof n === "number") {
|
|
99
|
+
this.view.setUint32(this.index, NUM, LE);
|
|
100
|
+
this.index += 4;
|
|
101
|
+
this.view.setUint32(this.index, n, LE);
|
|
102
|
+
this.index += 4;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.view.setUint32(this.index, STR, LE);
|
|
106
|
+
this.index += 4;
|
|
107
|
+
this.serString(n);
|
|
108
|
+
}
|
|
109
|
+
setBitMask(bitMaskIndex, bitIndex) {
|
|
110
|
+
const newBitmask = this.view.getUint8(bitMaskIndex) | 1 << bitIndex;
|
|
111
|
+
this.view.setUint8(bitMaskIndex, newBitmask);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
class DataViewDeserializerImpl {
|
|
115
|
+
buffer;
|
|
116
|
+
uint8View;
|
|
117
|
+
// Reusable view
|
|
118
|
+
routeId;
|
|
119
|
+
index = 0;
|
|
120
|
+
view;
|
|
121
|
+
hasEnded = false;
|
|
122
|
+
constructor(routeId, buffer, byteOffset, byteLength) {
|
|
123
|
+
this.routeId = routeId;
|
|
124
|
+
this.buffer = buffer;
|
|
125
|
+
this.index = 0;
|
|
126
|
+
this.view = new DataView(buffer, byteOffset, byteLength);
|
|
127
|
+
this.uint8View = new Uint8Array(buffer, byteOffset, byteLength);
|
|
128
|
+
}
|
|
129
|
+
reset() {
|
|
130
|
+
this.index = 0;
|
|
131
|
+
this.hasEnded = false;
|
|
132
|
+
}
|
|
133
|
+
setBuffer(buffer, byteOffset, byteLength) {
|
|
134
|
+
this.index = 0;
|
|
135
|
+
this.buffer = buffer;
|
|
136
|
+
this.view = new DataView(buffer, byteOffset, byteLength);
|
|
137
|
+
this.uint8View = new Uint8Array(buffer, byteOffset, byteLength);
|
|
138
|
+
this.hasEnded = false;
|
|
139
|
+
}
|
|
140
|
+
markAsEnded() {
|
|
141
|
+
this.hasEnded = true;
|
|
142
|
+
}
|
|
143
|
+
getLength() {
|
|
144
|
+
return this.index;
|
|
145
|
+
}
|
|
146
|
+
desString() {
|
|
147
|
+
const len = this.view.getUint32(this.index, LE);
|
|
148
|
+
this.index += 4;
|
|
149
|
+
const decoded = textDecoder.decode(this.uint8View.subarray(this.index, this.index + len));
|
|
150
|
+
this.index += len;
|
|
151
|
+
return decoded;
|
|
152
|
+
}
|
|
153
|
+
/** Deserialize a string that will be used as a property name, with prototype pollution protection */
|
|
154
|
+
desSafePropName() {
|
|
155
|
+
const key = this.desString();
|
|
156
|
+
const len = key.length;
|
|
157
|
+
if (len === 9) {
|
|
158
|
+
if (key === "__proto__" || key === "prototype") throw new Error(`Unsafe property name: ${key}`);
|
|
159
|
+
} else if (len === 11) {
|
|
160
|
+
if (key === "constructor") throw new Error(`Unsafe property name: ${key}`);
|
|
161
|
+
}
|
|
162
|
+
return key;
|
|
163
|
+
}
|
|
164
|
+
desFloat64() {
|
|
165
|
+
const value = this.view.getFloat64(this.index, LE);
|
|
166
|
+
this.index += 8;
|
|
167
|
+
return value;
|
|
168
|
+
}
|
|
169
|
+
desEnum() {
|
|
170
|
+
const type = this.view.getUint32(this.index, LE);
|
|
171
|
+
this.index += 4;
|
|
172
|
+
if (type === NUM) {
|
|
173
|
+
const value = this.view.getUint32(this.index, LE);
|
|
174
|
+
this.index += 4;
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
return this.desString();
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function calculateBufferSizeForRequest(routeId, workflowRouteIds) {
|
|
181
|
+
if (!workflowRouteIds || workflowRouteIds.length === 0) {
|
|
182
|
+
return calculateDefaultBufferSize(routeId);
|
|
183
|
+
}
|
|
184
|
+
let totalSize = 0;
|
|
185
|
+
for (const id of workflowRouteIds) {
|
|
186
|
+
totalSize += calculateDefaultBufferSize(id);
|
|
187
|
+
}
|
|
188
|
+
return totalSize;
|
|
189
|
+
}
|
|
190
|
+
function calculateDefaultBufferSize(routeId) {
|
|
191
|
+
const size = opts.responseAverageSizes.get(routeId);
|
|
192
|
+
if (!size) return opts.bufferSize;
|
|
193
|
+
return size * opts.averageResponseSizeMultiplier;
|
|
194
|
+
}
|
|
195
|
+
function updateResponseSize(routeId, responseSize) {
|
|
196
|
+
const currentSize = opts.responseAverageSizes.get(routeId) || opts.bufferSize;
|
|
197
|
+
const average = (currentSize + responseSize) / 2;
|
|
198
|
+
opts.responseAverageSizes.set(routeId, Math.floor(average));
|
|
199
|
+
}
|
|
200
|
+
function evictStringBytesCache() {
|
|
201
|
+
const entries = Array.from(opts.stringBytesCache.entries());
|
|
202
|
+
opts.stringBytesCache.clear();
|
|
203
|
+
for (let i = Math.floor(entries.length / 2); i < entries.length; i++) {
|
|
204
|
+
opts.stringBytesCache.set(entries[i][0], entries[i][1]);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
export {
|
|
208
|
+
createDataViewDeserializer,
|
|
209
|
+
createDataViewSerializer,
|
|
210
|
+
setSerializationOptions
|
|
211
|
+
};
|
|
212
|
+
//# sourceMappingURL=dataView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataView.js","sources":["../../../../src/binary/dataView.ts"],"sourcesContent":["/* ########\n * 2025 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\n// this code is based on from seqproto library https://github.com/oramasearch/seqproto\n\nimport type {StrictArrayBuffer, BinaryInput, DataViewSerializer, DataViewDeserializer} from '../types/general.types.ts';\n\nconst STR = 1;\nconst NUM = 2;\nconst POW_2_32 = 2 ** 32;\nconst LE = true; // always use little endian\n\n// ############## create serializer & deserializer ##############\n\nconst DEFAULT_OPTIONS = {\n maxPoolItems: 100,\n maxStrCacheLength: 64,\n maxCacheSize: 1000,\n bufferSize: 2 ** 24,\n averageResponseSizeMultiplier: 2,\n responseAverageSizes: new Map<string, number>(),\n stringBytesCache: new Map<string, Uint8Array>(),\n};\n\nexport type SerializationOptions = typeof DEFAULT_OPTIONS;\n\n// ############## DataView-based serializer & deserializer ##############\n// Uses byte-level precision (1-byte minimum unit) instead of 4-byte units\n\nconst textEncoder = new TextEncoder();\nconst textDecoder = new TextDecoder();\n\nlet opts = {...DEFAULT_OPTIONS};\n\nexport function setSerializationOptions(options: Partial<SerializationOptions>) {\n opts = {...opts, ...options};\n}\n\n/**\n * Creates a DataView-based serializer for binary serialization.\n * @param routeId - The route ID for buffer size calculation and tracking\n * @param workflowRouteIds - Optional array of route IDs for routesFlow requests.\n * When provided, buffer size is calculated by summing sizes for each route.\n */\nexport function createDataViewSerializer(routeId: string, workflowRouteIds?: string[]): DataViewSerializer {\n const size = calculateBufferSizeForRequest(routeId, workflowRouteIds);\n if (size >= POW_2_32) throw new Error('bufferSize option must be strictly less than 2 ** 32');\n return new DataViewSerializerImpl(routeId, size);\n}\n\n/** Creates a deserializer from ArrayBuffer or any typed array view (including Node.js Buffer) */\nexport function createDataViewDeserializer(routeId: string, input: BinaryInput): DataViewDeserializer {\n // Extract ArrayBuffer and offset/length from typed array views (Uint8Array, Buffer, etc.)\n if (ArrayBuffer.isView(input)) {\n const buffer = input.buffer as StrictArrayBuffer;\n return new DataViewDeserializerImpl(routeId, buffer, input.byteOffset, input.byteLength);\n }\n // Plain ArrayBuffer\n return new DataViewDeserializerImpl(routeId, input as StrictArrayBuffer);\n}\n\n// TODO: at the moment we do not resize the buffer, if data does not fit it will throw an error,\n// anything that uses the serializer should catch the error and resize the buffer\nclass DataViewSerializerImpl implements DataViewSerializer {\n readonly buffer: ArrayBuffer;\n private uint8View: Uint8Array; // Reusable view\n readonly routeId: string;\n index: number = 0; // byte offset\n view: DataView;\n hasEnded: boolean = false;\n constructor(routeId: string, size: number) {\n this.routeId = routeId;\n this.buffer = new ArrayBuffer(size);\n this.view = new DataView(this.buffer);\n this.uint8View = new Uint8Array(this.buffer);\n }\n reset(): void {\n this.index = 0;\n this.hasEnded = false;\n }\n resize(size: number): void {\n (this as any).buffer = new ArrayBuffer(size);\n this.view = new DataView(this.buffer);\n this.uint8View = new Uint8Array(this.buffer);\n }\n getBuffer(): StrictArrayBuffer {\n const buff = this.buffer.slice(0, this.index);\n return buff;\n }\n getBufferView(): Uint8Array {\n return new Uint8Array(this.buffer, 0, this.index);\n }\n markAsEnded(): void {\n this.hasEnded = true;\n updateResponseSize(this.routeId, this.index);\n }\n getLength(): number {\n return this.index;\n }\n serString(str: string, skipCache?: boolean): void {\n if (str.length >= opts.maxStrCacheLength || skipCache) {\n const targetView = this.uint8View.subarray(this.index + 4);\n const result = textEncoder.encodeInto(str, targetView);\n this.view.setUint32(this.index, result.written, LE);\n this.index += 4 + result.written;\n return;\n }\n const cached = opts.stringBytesCache.get(str);\n if (cached) {\n this.uint8View.set(cached, this.index + 4);\n this.view.setUint32(this.index, cached.length, LE);\n this.index += 4 + cached.length;\n return;\n }\n\n // Encode directly into working view\n const targetView = this.uint8View.subarray(this.index + 4);\n const result = textEncoder.encodeInto(str, targetView);\n const written = result.written!;\n\n this.view.setUint32(this.index, written, LE);\n this.index += 4 + written;\n\n // Cache the encoded bytes (create slice only for caching)\n if (opts.stringBytesCache.size >= opts.maxCacheSize) evictStringBytesCache();\n opts.stringBytesCache.set(str, this.uint8View.slice(this.index - written, this.index));\n }\n serFloat64(n: number): void {\n this.view.setFloat64(this.index, n, LE);\n this.index += 8;\n }\n serEnum(n: number | string): void {\n if (typeof n === 'number') {\n this.view.setUint32(this.index, NUM, LE);\n this.index += 4;\n this.view.setUint32(this.index, n, LE);\n this.index += 4;\n return;\n }\n this.view.setUint32(this.index, STR, LE);\n this.index += 4;\n this.serString(n);\n }\n setBitMask(bitMaskIndex: number, bitIndex: number): void {\n const newBitmask = this.view.getUint8(bitMaskIndex) | (1 << bitIndex);\n this.view.setUint8(bitMaskIndex, newBitmask);\n }\n}\n\nclass DataViewDeserializerImpl implements DataViewDeserializer {\n readonly buffer: StrictArrayBuffer;\n private uint8View: Uint8Array; // Reusable view\n readonly routeId: string;\n index: number = 0;\n view: DataView;\n hasEnded: boolean = false;\n constructor(routeId: string, buffer: StrictArrayBuffer, byteOffset?: number, byteLength?: number) {\n this.routeId = routeId;\n this.buffer = buffer;\n // index should always start at 0 because DataView/Uint8Array already account for byteOffset\n this.index = 0;\n this.view = new DataView(buffer, byteOffset, byteLength);\n this.uint8View = new Uint8Array(buffer, byteOffset, byteLength);\n }\n reset(): void {\n this.index = 0;\n this.hasEnded = false;\n }\n setBuffer(buffer: StrictArrayBuffer, byteOffset?: number, byteLength?: number): void {\n // index should always start at 0 because DataView/Uint8Array already account for byteOffset\n this.index = 0;\n (this as any).buffer = buffer;\n this.view = new DataView(buffer, byteOffset, byteLength);\n this.uint8View = new Uint8Array(buffer, byteOffset, byteLength); // Update working view\n this.hasEnded = false;\n }\n markAsEnded(): void {\n this.hasEnded = true;\n }\n getLength(): number {\n return this.index;\n }\n desString(): string {\n const len = this.view.getUint32(this.index, LE);\n this.index += 4;\n\n const decoded = textDecoder.decode(this.uint8View.subarray(this.index, this.index + len));\n this.index += len;\n return decoded;\n }\n /** Deserialize a string that will be used as a property name, with prototype pollution protection */\n desSafePropName(): string {\n const key = this.desString();\n const len = key.length;\n if (len === 9) {\n if (key === '__proto__' || key === 'prototype') throw new Error(`Unsafe property name: ${key}`);\n } else if (len === 11) {\n if (key === 'constructor') throw new Error(`Unsafe property name: ${key}`);\n }\n return key;\n }\n desFloat64(): number {\n const value = this.view.getFloat64(this.index, LE);\n this.index += 8;\n return value;\n }\n desEnum(): number | string {\n const type = this.view.getUint32(this.index, LE);\n this.index += 4;\n if (type === NUM) {\n const value = this.view.getUint32(this.index, LE);\n this.index += 4;\n return value;\n }\n return this.desString();\n }\n}\n\n/**\n * Calculates buffer size for a request, handling both single routes and routesFlows.\n * For routesFlows, sums up the buffer sizes for each individual route.\n */\nfunction calculateBufferSizeForRequest(routeId: string, workflowRouteIds?: string[]): number {\n if (!workflowRouteIds || workflowRouteIds.length === 0) {\n return calculateDefaultBufferSize(routeId);\n }\n\n // For routesFlows, sum up the buffer sizes for each individual route\n let totalSize = 0;\n for (const id of workflowRouteIds) {\n totalSize += calculateDefaultBufferSize(id);\n }\n return totalSize;\n}\n\n/** Returns the average response size for the given route, multiplied by a factor for safety margin */\nfunction calculateDefaultBufferSize(routeId: string): number {\n const size = opts.responseAverageSizes.get(routeId);\n if (!size) return opts.bufferSize;\n return size * opts.averageResponseSizeMultiplier;\n}\n\nfunction updateResponseSize(routeId: string, responseSize: number) {\n const currentSize = opts.responseAverageSizes.get(routeId) || opts.bufferSize;\n const average = (currentSize + responseSize) / 2;\n opts.responseAverageSizes.set(routeId, Math.floor(average));\n}\n\nfunction evictStringBytesCache(): void {\n const entries = Array.from(opts.stringBytesCache.entries());\n opts.stringBytesCache.clear();\n for (let i = Math.floor(entries.length / 2); i < entries.length; i++) {\n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