@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.
Files changed (136) hide show
  1. package/.dist/cjs/index.cjs +245 -0
  2. package/.dist/cjs/index.cjs.map +1 -0
  3. package/.dist/cjs/index.d.ts +21 -0
  4. package/.dist/cjs/package.json +1 -0
  5. package/.dist/cjs/src/binary/bodyDeserializer.cjs +54 -0
  6. package/.dist/cjs/src/binary/bodyDeserializer.cjs.map +1 -0
  7. package/.dist/cjs/src/binary/bodyDeserializer.d.ts +5 -0
  8. package/.dist/cjs/src/binary/bodySerializer.cjs +49 -0
  9. package/.dist/cjs/src/binary/bodySerializer.cjs.map +1 -0
  10. package/.dist/cjs/src/binary/bodySerializer.d.ts +6 -0
  11. package/.dist/cjs/src/binary/dataView.cjs +212 -0
  12. package/.dist/cjs/src/binary/dataView.cjs.map +1 -0
  13. package/.dist/cjs/src/binary/dataView.d.ts +16 -0
  14. package/.dist/cjs/src/constants.cjs +84 -0
  15. package/.dist/cjs/src/constants.cjs.map +1 -0
  16. package/.dist/cjs/src/constants.d.ts +50 -0
  17. package/.dist/cjs/src/errors.cjs +170 -0
  18. package/.dist/cjs/src/errors.cjs.map +1 -0
  19. package/.dist/cjs/src/errors.d.ts +24 -0
  20. package/.dist/cjs/src/friendlyErrors.cjs +235 -0
  21. package/.dist/cjs/src/friendlyErrors.cjs.map +1 -0
  22. package/.dist/cjs/src/friendlyErrors.d.ts +4 -0
  23. package/.dist/cjs/src/headers.cjs +11 -0
  24. package/.dist/cjs/src/headers.cjs.map +1 -0
  25. package/.dist/cjs/src/headers.d.ts +12 -0
  26. package/.dist/cjs/src/jit/jitUtils.cjs +173 -0
  27. package/.dist/cjs/src/jit/jitUtils.cjs.map +1 -0
  28. package/.dist/cjs/src/jit/jitUtils.d.ts +30 -0
  29. package/.dist/cjs/src/pureFns/pureFn.cjs +80 -0
  30. package/.dist/cjs/src/pureFns/pureFn.cjs.map +1 -0
  31. package/.dist/cjs/src/pureFns/pureFn.d.ts +2 -0
  32. package/.dist/cjs/src/pureFns/pureServerFn.cjs +20 -0
  33. package/.dist/cjs/src/pureFns/pureServerFn.cjs.map +1 -0
  34. package/.dist/cjs/src/pureFns/pureServerFn.d.ts +4 -0
  35. package/.dist/cjs/src/pureFns/quickHash.cjs +62 -0
  36. package/.dist/cjs/src/pureFns/quickHash.cjs.map +1 -0
  37. package/.dist/cjs/src/pureFns/quickHash.d.ts +7 -0
  38. package/.dist/cjs/src/pureFns/restoreJitFns.cjs +88 -0
  39. package/.dist/cjs/src/pureFns/restoreJitFns.cjs.map +1 -0
  40. package/.dist/cjs/src/pureFns/restoreJitFns.d.ts +3 -0
  41. package/.dist/cjs/src/routerUtils.cjs +209 -0
  42. package/.dist/cjs/src/routerUtils.cjs.map +1 -0
  43. package/.dist/cjs/src/routerUtils.d.ts +24 -0
  44. package/.dist/cjs/src/types/formats/formatBrands.types.cjs +45 -0
  45. package/.dist/cjs/src/types/formats/formatBrands.types.cjs.map +1 -0
  46. package/.dist/cjs/src/types/formats/formatBrands.types.d.ts +45 -0
  47. package/.dist/cjs/src/types/formats/formats.types.cjs +27 -0
  48. package/.dist/cjs/src/types/formats/formats.types.cjs.map +1 -0
  49. package/.dist/cjs/src/types/formats/formats.types.d.ts +37 -0
  50. package/.dist/cjs/src/types/formats/formatsParams.types.cjs +60 -0
  51. package/.dist/cjs/src/types/formats/formatsParams.types.cjs.map +1 -0
  52. package/.dist/cjs/src/types/formats/formatsParams.types.d.ts +234 -0
  53. package/.dist/cjs/src/types/formats/friendlyErrors.types.cjs +53 -0
  54. package/.dist/cjs/src/types/formats/friendlyErrors.types.cjs.map +1 -0
  55. package/.dist/cjs/src/types/formats/friendlyErrors.types.d.ts +71 -0
  56. package/.dist/cjs/src/types/general.types.cjs +145 -0
  57. package/.dist/cjs/src/types/general.types.cjs.map +1 -0
  58. package/.dist/cjs/src/types/general.types.d.ts +246 -0
  59. package/.dist/cjs/src/types/method.types.cjs +26 -0
  60. package/.dist/cjs/src/types/method.types.cjs.map +1 -0
  61. package/.dist/cjs/src/types/method.types.d.ts +60 -0
  62. package/.dist/cjs/src/types/pureFunctions.types.cjs +39 -0
  63. package/.dist/cjs/src/types/pureFunctions.types.cjs.map +1 -0
  64. package/.dist/cjs/src/types/pureFunctions.types.d.ts +75 -0
  65. package/.dist/cjs/src/utils.cjs +47 -0
  66. package/.dist/cjs/src/utils.cjs.map +1 -0
  67. package/.dist/cjs/src/utils.d.ts +9 -0
  68. package/.dist/esm/index.d.ts +21 -0
  69. package/.dist/esm/index.js +245 -0
  70. package/.dist/esm/index.js.map +1 -0
  71. package/.dist/esm/src/binary/bodyDeserializer.d.ts +5 -0
  72. package/.dist/esm/src/binary/bodyDeserializer.js +54 -0
  73. package/.dist/esm/src/binary/bodyDeserializer.js.map +1 -0
  74. package/.dist/esm/src/binary/bodySerializer.d.ts +6 -0
  75. package/.dist/esm/src/binary/bodySerializer.js +49 -0
  76. package/.dist/esm/src/binary/bodySerializer.js.map +1 -0
  77. package/.dist/esm/src/binary/dataView.d.ts +16 -0
  78. package/.dist/esm/src/binary/dataView.js +212 -0
  79. package/.dist/esm/src/binary/dataView.js.map +1 -0
  80. package/.dist/esm/src/constants.d.ts +50 -0
  81. package/.dist/esm/src/constants.js +84 -0
  82. package/.dist/esm/src/constants.js.map +1 -0
  83. package/.dist/esm/src/errors.d.ts +24 -0
  84. package/.dist/esm/src/errors.js +170 -0
  85. package/.dist/esm/src/errors.js.map +1 -0
  86. package/.dist/esm/src/friendlyErrors.d.ts +4 -0
  87. package/.dist/esm/src/friendlyErrors.js +235 -0
  88. package/.dist/esm/src/friendlyErrors.js.map +1 -0
  89. package/.dist/esm/src/headers.d.ts +12 -0
  90. package/.dist/esm/src/headers.js +11 -0
  91. package/.dist/esm/src/headers.js.map +1 -0
  92. package/.dist/esm/src/jit/jitUtils.d.ts +30 -0
  93. package/.dist/esm/src/jit/jitUtils.js +173 -0
  94. package/.dist/esm/src/jit/jitUtils.js.map +1 -0
  95. package/.dist/esm/src/pureFns/pureFn.d.ts +2 -0
  96. package/.dist/esm/src/pureFns/pureFn.js +80 -0
  97. package/.dist/esm/src/pureFns/pureFn.js.map +1 -0
  98. package/.dist/esm/src/pureFns/pureServerFn.d.ts +4 -0
  99. package/.dist/esm/src/pureFns/pureServerFn.js +20 -0
  100. package/.dist/esm/src/pureFns/pureServerFn.js.map +1 -0
  101. package/.dist/esm/src/pureFns/quickHash.d.ts +7 -0
  102. package/.dist/esm/src/pureFns/quickHash.js +62 -0
  103. package/.dist/esm/src/pureFns/quickHash.js.map +1 -0
  104. package/.dist/esm/src/pureFns/restoreJitFns.d.ts +3 -0
  105. package/.dist/esm/src/pureFns/restoreJitFns.js +88 -0
  106. package/.dist/esm/src/pureFns/restoreJitFns.js.map +1 -0
  107. package/.dist/esm/src/routerUtils.d.ts +24 -0
  108. package/.dist/esm/src/routerUtils.js +209 -0
  109. package/.dist/esm/src/routerUtils.js.map +1 -0
  110. package/.dist/esm/src/types/formats/formatBrands.types.d.ts +45 -0
  111. package/.dist/esm/src/types/formats/formatBrands.types.js +45 -0
  112. package/.dist/esm/src/types/formats/formatBrands.types.js.map +1 -0
  113. package/.dist/esm/src/types/formats/formats.types.d.ts +37 -0
  114. package/.dist/esm/src/types/formats/formats.types.js +27 -0
  115. package/.dist/esm/src/types/formats/formats.types.js.map +1 -0
  116. package/.dist/esm/src/types/formats/formatsParams.types.d.ts +234 -0
  117. package/.dist/esm/src/types/formats/formatsParams.types.js +60 -0
  118. package/.dist/esm/src/types/formats/formatsParams.types.js.map +1 -0
  119. package/.dist/esm/src/types/formats/friendlyErrors.types.d.ts +71 -0
  120. package/.dist/esm/src/types/formats/friendlyErrors.types.js +53 -0
  121. package/.dist/esm/src/types/formats/friendlyErrors.types.js.map +1 -0
  122. package/.dist/esm/src/types/general.types.d.ts +246 -0
  123. package/.dist/esm/src/types/general.types.js +145 -0
  124. package/.dist/esm/src/types/general.types.js.map +1 -0
  125. package/.dist/esm/src/types/method.types.d.ts +60 -0
  126. package/.dist/esm/src/types/method.types.js +26 -0
  127. package/.dist/esm/src/types/method.types.js.map +1 -0
  128. package/.dist/esm/src/types/pureFunctions.types.d.ts +75 -0
  129. package/.dist/esm/src/types/pureFunctions.types.js +39 -0
  130. package/.dist/esm/src/types/pureFunctions.types.js.map +1 -0
  131. package/.dist/esm/src/utils.d.ts +9 -0
  132. package/.dist/esm/src/utils.js +47 -0
  133. package/.dist/esm/src/utils.js.map +1 -0
  134. package/LICENSE +21 -0
  135. package/README.md +32 -0
  136. package/package.json +58 -0
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const src_types_general_types = require("./src/types/general.types.cjs");
4
+ const src_types_method_types = require("./src/types/method.types.cjs");
5
+ const src_types_pureFunctions_types = require("./src/types/pureFunctions.types.cjs");
6
+ const src_types_formats_formats_types = require("./src/types/formats/formats.types.cjs");
7
+ const src_types_formats_formatsParams_types = require("./src/types/formats/formatsParams.types.cjs");
8
+ const src_types_formats_friendlyErrors_types = require("./src/types/formats/friendlyErrors.types.cjs");
9
+ const src_types_formats_formatBrands_types = require("./src/types/formats/formatBrands.types.cjs");
10
+ const src_binary_dataView = require("./src/binary/dataView.cjs");
11
+ const src_binary_bodySerializer = require("./src/binary/bodySerializer.cjs");
12
+ const src_binary_bodyDeserializer = require("./src/binary/bodyDeserializer.cjs");
13
+ const src_constants = require("./src/constants.cjs");
14
+ const src_errors = require("./src/errors.cjs");
15
+ const src_friendlyErrors = require("./src/friendlyErrors.cjs");
16
+ const src_jit_jitUtils = require("./src/jit/jitUtils.cjs");
17
+ const src_routerUtils = require("./src/routerUtils.cjs");
18
+ const src_utils = require("./src/utils.cjs");
19
+ const src_headers = require("./src/headers.cjs");
20
+ const src_pureFns_pureFn = require("./src/pureFns/pureFn.cjs");
21
+ const src_pureFns_pureServerFn = require("./src/pureFns/pureServerFn.cjs");
22
+ const src_pureFns_quickHash = require("./src/pureFns/quickHash.cjs");
23
+ exports.SerializerModes = src_types_general_types.SerializerModes;
24
+ exports.__ΩAnyClass = src_types_general_types.__ΩAnyClass;
25
+ exports.__ΩAnyErrorParams = src_types_general_types.__ΩAnyErrorParams;
26
+ exports.__ΩAnyFn = src_types_general_types.__ΩAnyFn;
27
+ exports.__ΩAnyObject = src_types_general_types.__ΩAnyObject;
28
+ exports.__ΩBinaryInput = src_types_general_types.__ΩBinaryInput;
29
+ exports.__ΩCoreRouterOptions = src_types_general_types.__ΩCoreRouterOptions;
30
+ exports.__ΩDataOnly = src_types_general_types.__ΩDataOnly;
31
+ exports.__ΩDataViewDeserializer = src_types_general_types.__ΩDataViewDeserializer;
32
+ exports.__ΩDataViewSerializer = src_types_general_types.__ΩDataViewSerializer;
33
+ exports.__ΩDeserializeClassFn = src_types_general_types.__ΩDeserializeClassFn;
34
+ exports.__ΩFnsDataCache = src_types_general_types.__ΩFnsDataCache;
35
+ exports.__ΩFromBinaryFn = src_types_general_types.__ΩFromBinaryFn;
36
+ exports.__ΩIsTypeFn = src_types_general_types.__ΩIsTypeFn;
37
+ exports.__ΩJSONString = src_types_general_types.__ΩJSONString;
38
+ exports.__ΩJSONValue = src_types_general_types.__ΩJSONValue;
39
+ exports.__ΩJitCompiledFn = src_types_general_types.__ΩJitCompiledFn;
40
+ exports.__ΩJitCompiledFnData = src_types_general_types.__ΩJitCompiledFnData;
41
+ exports.__ΩJitCompiledFunctions = src_types_general_types.__ΩJitCompiledFunctions;
42
+ exports.__ΩJitFnArgs = src_types_general_types.__ΩJitFnArgs;
43
+ exports.__ΩJitFunctionsCache = src_types_general_types.__ΩJitFunctionsCache;
44
+ exports.__ΩJitFunctionsHashes = src_types_general_types.__ΩJitFunctionsHashes;
45
+ exports.__ΩJsonStringifyFn = src_types_general_types.__ΩJsonStringifyFn;
46
+ exports.__ΩMapKeyPathSegment = src_types_general_types.__ΩMapKeyPathSegment;
47
+ exports.__ΩMapValuePathSegment = src_types_general_types.__ΩMapValuePathSegment;
48
+ exports.__ΩMimeTypes = src_types_general_types.__ΩMimeTypes;
49
+ exports.__ΩMutable = src_types_general_types.__ΩMutable;
50
+ exports.__ΩPathSegment = src_types_general_types.__ΩPathSegment;
51
+ exports.__ΩPersistedJitFn = src_types_general_types.__ΩPersistedJitFn;
52
+ exports.__ΩPersistedJitFunctionsCache = src_types_general_types.__ΩPersistedJitFunctionsCache;
53
+ exports.__ΩPersistedPureFunctionsCache = src_types_general_types.__ΩPersistedPureFunctionsCache;
54
+ exports.__ΩPrepareForJsonFn = src_types_general_types.__ΩPrepareForJsonFn;
55
+ exports.__ΩPrettify = src_types_general_types.__ΩPrettify;
56
+ exports.__ΩPublicRpcError = src_types_general_types.__ΩPublicRpcError;
57
+ exports.__ΩPureFnsDataCache = src_types_general_types.__ΩPureFnsDataCache;
58
+ exports.__ΩPureFunctionsCache = src_types_general_types.__ΩPureFunctionsCache;
59
+ exports.__ΩRestoreFromJsonFn = src_types_general_types.__ΩRestoreFromJsonFn;
60
+ exports.__ΩRpcErrorParams = src_types_general_types.__ΩRpcErrorParams;
61
+ exports.__ΩRpcErrorWithPrivate = src_types_general_types.__ΩRpcErrorWithPrivate;
62
+ exports.__ΩRpcErrorWithPublic = src_types_general_types.__ΩRpcErrorWithPublic;
63
+ exports.__ΩRunTypeError = src_types_general_types.__ΩRunTypeError;
64
+ exports.__ΩSerializableClass = src_types_general_types.__ΩSerializableClass;
65
+ exports.__ΩSerializableJITFunctions = src_types_general_types.__ΩSerializableJITFunctions;
66
+ exports.__ΩSerializerCode = src_types_general_types.__ΩSerializerCode;
67
+ exports.__ΩSerializerMode = src_types_general_types.__ΩSerializerMode;
68
+ exports.__ΩSetItemPathSegment = src_types_general_types.__ΩSetItemPathSegment;
69
+ exports.__ΩSrcCodeCompiledPureFunction = src_types_general_types.__ΩSrcCodeCompiledPureFunction;
70
+ exports.__ΩSrcCodeJITCompiledFnsCache = src_types_general_types.__ΩSrcCodeJITCompiledFnsCache;
71
+ exports.__ΩSrcCodeJitCompiledFn = src_types_general_types.__ΩSrcCodeJitCompiledFn;
72
+ exports.__ΩSrcCodePureFunctionsCache = src_types_general_types.__ΩSrcCodePureFunctionsCache;
73
+ exports.__ΩStrNumber = src_types_general_types.__ΩStrNumber;
74
+ exports.__ΩStrictArrayBuffer = src_types_general_types.__ΩStrictArrayBuffer;
75
+ exports.__ΩToBinaryFn = src_types_general_types.__ΩToBinaryFn;
76
+ exports.__ΩToCodeFn = src_types_general_types.__ΩToCodeFn;
77
+ exports.__ΩTypeErrorsFn = src_types_general_types.__ΩTypeErrorsFn;
78
+ exports.__ΩTypedErrorParams = src_types_general_types.__ΩTypedErrorParams;
79
+ exports.__ΩHeadersMetaData = src_types_method_types.__ΩHeadersMetaData;
80
+ exports.__ΩHeadersMethodWithJitFns = src_types_method_types.__ΩHeadersMethodWithJitFns;
81
+ exports.__ΩMethodMetadata = src_types_method_types.__ΩMethodMetadata;
82
+ exports.__ΩMethodWithJitFns = src_types_method_types.__ΩMethodWithJitFns;
83
+ exports.__ΩMethodWithOptions = src_types_method_types.__ΩMethodWithOptions;
84
+ exports.__ΩMethodWithOptsAndJitFns = src_types_method_types.__ΩMethodWithOptsAndJitFns;
85
+ exports.__ΩMethodsCache = src_types_method_types.__ΩMethodsCache;
86
+ exports.__ΩRemoteMethodOpts = src_types_method_types.__ΩRemoteMethodOpts;
87
+ exports.__ΩRouteOnlyOptions = src_types_method_types.__ΩRouteOnlyOptions;
88
+ exports.__ΩSerializableMethodsData = src_types_method_types.__ΩSerializableMethodsData;
89
+ exports.__ΩCompiledPureFunction = src_types_pureFunctions_types.__ΩCompiledPureFunction;
90
+ exports.__ΩErrorsPureFunction = src_types_pureFunctions_types.__ΩErrorsPureFunction;
91
+ exports.__ΩGenericPureFunction = src_types_pureFunctions_types.__ΩGenericPureFunction;
92
+ exports.__ΩMapFromRef = src_types_pureFunctions_types.__ΩMapFromRef;
93
+ exports.__ΩMapFromServerFnRef = src_types_pureFunctions_types.__ΩMapFromServerFnRef;
94
+ exports.__ΩParsedFactoryFn = src_types_pureFunctions_types.__ΩParsedFactoryFn;
95
+ exports.__ΩPersistedPureFunction = src_types_pureFunctions_types.__ΩPersistedPureFunction;
96
+ exports.__ΩPureFnDef = src_types_pureFunctions_types.__ΩPureFnDef;
97
+ exports.__ΩPureFunction = src_types_pureFunctions_types.__ΩPureFunction;
98
+ exports.__ΩPureFunctionData = src_types_pureFunctions_types.__ΩPureFunctionData;
99
+ exports.__ΩPureFunctionDeps = src_types_pureFunctions_types.__ΩPureFunctionDeps;
100
+ exports.__ΩPureFunctionFactory = src_types_pureFunctions_types.__ΩPureFunctionFactory;
101
+ exports.__ΩPureServerFnRef = src_types_pureFunctions_types.__ΩPureServerFnRef;
102
+ exports.__ΩRoutesFlowMapping = src_types_pureFunctions_types.__ΩRoutesFlowMapping;
103
+ exports.__ΩRoutesFlowQuery = src_types_pureFunctions_types.__ΩRoutesFlowQuery;
104
+ exports.__ΩAliasTypeAnnotation = src_types_formats_formats_types.__ΩAliasTypeAnnotation;
105
+ exports.__ΩAliasTypeFormat = src_types_formats_formats_types.__ΩAliasTypeFormat;
106
+ exports.__ΩExtractFormatParams = src_types_formats_formats_types.__ΩExtractFormatParams;
107
+ exports.__ΩFormatParam = src_types_formats_formats_types.__ΩFormatParam;
108
+ exports.__ΩFormatParamLiteral = src_types_formats_formats_types.__ΩFormatParamLiteral;
109
+ exports.__ΩFormatParamMeta = src_types_formats_formats_types.__ΩFormatParamMeta;
110
+ exports.__ΩTypeFormatError = src_types_formats_formats_types.__ΩTypeFormatError;
111
+ exports.__ΩTypeFormatParams = src_types_formats_formats_types.__ΩTypeFormatParams;
112
+ exports.__ΩTypeFormatParsedParams = src_types_formats_formats_types.__ΩTypeFormatParsedParams;
113
+ exports.__ΩTypeFormatPrimitives = src_types_formats_formats_types.__ΩTypeFormatPrimitives;
114
+ exports.__ΩTypeFormatValue = src_types_formats_formats_types.__ΩTypeFormatValue;
115
+ exports.__ΩAnyFormatParams = src_types_formats_formatsParams_types.__ΩAnyFormatParams;
116
+ exports.__ΩAnyStringFormatParam = src_types_formats_formatsParams_types.__ΩAnyStringFormatParam;
117
+ exports.__ΩDateFmt = src_types_formats_formatsParams_types.__ΩDateFmt;
118
+ exports.__ΩFormatParam_Pattern = src_types_formats_formatsParams_types.__ΩFormatParam_Pattern;
119
+ exports.__ΩFormatParams_BigInt = src_types_formats_formatsParams_types.__ΩFormatParams_BigInt;
120
+ exports.__ΩFormatParams_Date = src_types_formats_formatsParams_types.__ΩFormatParams_Date;
121
+ exports.__ΩFormatParams_DateTime = src_types_formats_formatsParams_types.__ΩFormatParams_DateTime;
122
+ exports.__ΩFormatParams_Domain = src_types_formats_formatsParams_types.__ΩFormatParams_Domain;
123
+ exports.__ΩFormatParams_DomainCore = src_types_formats_formatsParams_types.__ΩFormatParams_DomainCore;
124
+ exports.__ΩFormatParams_DomainName = src_types_formats_formatsParams_types.__ΩFormatParams_DomainName;
125
+ exports.__ΩFormatParams_Email = src_types_formats_formatsParams_types.__ΩFormatParams_Email;
126
+ exports.__ΩFormatParams_EmailPattern = src_types_formats_formatsParams_types.__ΩFormatParams_EmailPattern;
127
+ exports.__ΩFormatParams_IP = src_types_formats_formatsParams_types.__ΩFormatParams_IP;
128
+ exports.__ΩFormatParams_Number = src_types_formats_formatsParams_types.__ΩFormatParams_Number;
129
+ exports.__ΩFormatParams_Time = src_types_formats_formatsParams_types.__ΩFormatParams_Time;
130
+ exports.__ΩFormatParams_Tld = src_types_formats_formatsParams_types.__ΩFormatParams_Tld;
131
+ exports.__ΩFormatParams_UUID = src_types_formats_formatsParams_types.__ΩFormatParams_UUID;
132
+ exports.__ΩFormatParams_Url = src_types_formats_formatsParams_types.__ΩFormatParams_Url;
133
+ exports.__ΩFormatParams_UrlPattern = src_types_formats_formatsParams_types.__ΩFormatParams_UrlPattern;
134
+ exports.__ΩSamples = src_types_formats_formatsParams_types.__ΩSamples;
135
+ exports.__ΩStringParams = src_types_formats_formatsParams_types.__ΩStringParams;
136
+ exports.__ΩStringTransformers = src_types_formats_formatsParams_types.__ΩStringTransformers;
137
+ exports.__ΩStringValidators = src_types_formats_formatsParams_types.__ΩStringValidators;
138
+ exports.__ΩTimeFmt = src_types_formats_formatsParams_types.__ΩTimeFmt;
139
+ exports.__ΩAnyFriendlyErrorParams = src_types_formats_friendlyErrors_types.__ΩAnyFriendlyErrorParams;
140
+ exports.__ΩBigIntErrorParams = src_types_formats_friendlyErrors_types.__ΩBigIntErrorParams;
141
+ exports.__ΩDateErrorParams = src_types_formats_friendlyErrors_types.__ΩDateErrorParams;
142
+ exports.__ΩDateTimeErrorParams = src_types_formats_friendlyErrors_types.__ΩDateTimeErrorParams;
143
+ exports.__ΩDomainErrorParams = src_types_formats_friendlyErrors_types.__ΩDomainErrorParams;
144
+ exports.__ΩEmailErrorParams = src_types_formats_friendlyErrors_types.__ΩEmailErrorParams;
145
+ exports.__ΩExtractErrorParams = src_types_formats_friendlyErrors_types.__ΩExtractErrorParams;
146
+ exports.__ΩFriendlyErrorHandler = src_types_formats_friendlyErrors_types.__ΩFriendlyErrorHandler;
147
+ exports.__ΩFriendlyErrorParams = src_types_formats_friendlyErrors_types.__ΩFriendlyErrorParams;
148
+ exports.__ΩFriendlyErrors = src_types_formats_friendlyErrors_types.__ΩFriendlyErrors;
149
+ exports.__ΩFriendlyErrorsResult = src_types_formats_friendlyErrors_types.__ΩFriendlyErrorsResult;
150
+ exports.__ΩIPErrorParams = src_types_formats_friendlyErrors_types.__ΩIPErrorParams;
151
+ exports.__ΩMapErrorHandlers = src_types_formats_friendlyErrors_types.__ΩMapErrorHandlers;
152
+ exports.__ΩMapErrorsResult = src_types_formats_friendlyErrors_types.__ΩMapErrorsResult;
153
+ exports.__ΩNumberErrorParams = src_types_formats_friendlyErrors_types.__ΩNumberErrorParams;
154
+ exports.__ΩSetErrorHandlers = src_types_formats_friendlyErrors_types.__ΩSetErrorHandlers;
155
+ exports.__ΩSetErrorsResult = src_types_formats_friendlyErrors_types.__ΩSetErrorsResult;
156
+ exports.__ΩStringErrorParams = src_types_formats_friendlyErrors_types.__ΩStringErrorParams;
157
+ exports.__ΩTimeErrorParams = src_types_formats_friendlyErrors_types.__ΩTimeErrorParams;
158
+ exports.__ΩTypeErrorParam = src_types_formats_friendlyErrors_types.__ΩTypeErrorParam;
159
+ exports.__ΩUUIDErrorParams = src_types_formats_friendlyErrors_types.__ΩUUIDErrorParams;
160
+ exports.__ΩUrlErrorParams = src_types_formats_friendlyErrors_types.__ΩUrlErrorParams;
161
+ exports.__ΩBrand = src_types_formats_formatBrands_types.__ΩBrand;
162
+ exports.__ΩBrandDate = src_types_formats_formatBrands_types.__ΩBrandDate;
163
+ exports.__ΩBrandDateTime = src_types_formats_formatBrands_types.__ΩBrandDateTime;
164
+ exports.__ΩBrandDomain = src_types_formats_formatBrands_types.__ΩBrandDomain;
165
+ exports.__ΩBrandEmail = src_types_formats_formatBrands_types.__ΩBrandEmail;
166
+ exports.__ΩBrandFloat = src_types_formats_formatBrands_types.__ΩBrandFloat;
167
+ exports.__ΩBrandIP = src_types_formats_formatBrands_types.__ΩBrandIP;
168
+ exports.__ΩBrandInt16 = src_types_formats_formatBrands_types.__ΩBrandInt16;
169
+ exports.__ΩBrandInt32 = src_types_formats_formatBrands_types.__ΩBrandInt32;
170
+ exports.__ΩBrandInt8 = src_types_formats_formatBrands_types.__ΩBrandInt8;
171
+ exports.__ΩBrandInteger = src_types_formats_formatBrands_types.__ΩBrandInteger;
172
+ exports.__ΩBrandNegative = src_types_formats_formatBrands_types.__ΩBrandNegative;
173
+ exports.__ΩBrandNegativeInt = src_types_formats_formatBrands_types.__ΩBrandNegativeInt;
174
+ exports.__ΩBrandPositive = src_types_formats_formatBrands_types.__ΩBrandPositive;
175
+ exports.__ΩBrandPositiveInt = src_types_formats_formatBrands_types.__ΩBrandPositiveInt;
176
+ exports.__ΩBrandTime = src_types_formats_formatBrands_types.__ΩBrandTime;
177
+ exports.__ΩBrandUInt16 = src_types_formats_formatBrands_types.__ΩBrandUInt16;
178
+ exports.__ΩBrandUInt32 = src_types_formats_formatBrands_types.__ΩBrandUInt32;
179
+ exports.__ΩBrandUInt8 = src_types_formats_formatBrands_types.__ΩBrandUInt8;
180
+ exports.__ΩBrandUUID = src_types_formats_formatBrands_types.__ΩBrandUUID;
181
+ exports.__ΩBrandUrl = src_types_formats_formatBrands_types.__ΩBrandUrl;
182
+ exports.createDataViewDeserializer = src_binary_dataView.createDataViewDeserializer;
183
+ exports.createDataViewSerializer = src_binary_dataView.createDataViewSerializer;
184
+ exports.setSerializationOptions = src_binary_dataView.setSerializationOptions;
185
+ exports.serializeBinaryBody = src_binary_bodySerializer.serializeBinaryBody;
186
+ exports.deserializeBinaryBody = src_binary_bodyDeserializer.deserializeBinaryBody;
187
+ exports.DEFAULT_CORE_OPTIONS = src_constants.DEFAULT_CORE_OPTIONS;
188
+ exports.EMPTY_HASH = src_constants.EMPTY_HASH;
189
+ exports.HandlerType = src_constants.HandlerType;
190
+ exports.JIT_FUNCTION_IDS = src_constants.JIT_FUNCTION_IDS;
191
+ exports.MAX_STACK_DEPTH = src_constants.MAX_STACK_DEPTH;
192
+ exports.MAX_UNKNOWN_KEYS = src_constants.MAX_UNKNOWN_KEYS;
193
+ exports.MIME_TYPES = src_constants.MIME_TYPES;
194
+ exports.MION_ROUTES = src_constants.MION_ROUTES;
195
+ exports.PATH_SEPARATOR = src_constants.PATH_SEPARATOR;
196
+ exports.ROUTER_ITEM_SEPARATOR_CHAR = src_constants.ROUTER_ITEM_SEPARATOR_CHAR;
197
+ exports.ROUTE_PATH_ROOT = src_constants.ROUTE_PATH_ROOT;
198
+ exports.StatusCodes = src_constants.StatusCodes;
199
+ exports.RpcError = src_errors.RpcError;
200
+ exports.TypedError = src_errors.TypedError;
201
+ exports.__ΩValidationError = src_errors.__ΩValidationError;
202
+ exports.__ΩValidationErrorData = src_errors.__ΩValidationErrorData;
203
+ exports.isAnyError = src_errors.isAnyError;
204
+ exports.isRpcError = src_errors.isRpcError;
205
+ exports.isTypedError = src_errors.isTypedError;
206
+ exports.registerErrorDeserializers = src_errors.registerErrorDeserializers;
207
+ exports.setErrorOptions = src_errors.setErrorOptions;
208
+ exports.defaultErrorPrinter = src_friendlyErrors.defaultErrorPrinter;
209
+ exports.getFriendlyErrors = src_friendlyErrors.getFriendlyErrors;
210
+ exports.addAOTCaches = src_jit_jitUtils.addAOTCaches;
211
+ exports.addSerializedJitCaches = src_jit_jitUtils.addSerializedJitCaches;
212
+ exports.getJitFnCaches = src_jit_jitUtils.getJitFnCaches;
213
+ exports.getJitUtils = src_jit_jitUtils.getJitUtils;
214
+ exports.resetJitFnCaches = src_jit_jitUtils.resetJitFnCaches;
215
+ exports.addRoutesToCache = src_routerUtils.addRoutesToCache;
216
+ exports.getHeaderJitFunctionsFromHash = src_routerUtils.getHeaderJitFunctionsFromHash;
217
+ exports.getJitFnHashes = src_routerUtils.getJitFnHashes;
218
+ exports.getJitFunctionsFromHash = src_routerUtils.getJitFunctionsFromHash;
219
+ exports.getNoopJitFns = src_routerUtils.getNoopJitFns;
220
+ exports.getRoutePath = src_routerUtils.getRoutePath;
221
+ exports.getRouterItemId = src_routerUtils.getRouterItemId;
222
+ exports.methodOptsCache = src_routerUtils.methodOptsCache;
223
+ exports.resetJitFunctionsCache = src_routerUtils.resetJitFunctionsCache;
224
+ exports.resetRoutesCache = src_routerUtils.resetRoutesCache;
225
+ exports.routesCache = src_routerUtils.routesCache;
226
+ exports.fromBase64Url = src_utils.fromBase64Url;
227
+ exports.getENV = src_utils.getENV;
228
+ exports.initPureFunction = src_utils.initPureFunction;
229
+ exports.isMionAOTEmitMode = src_utils.isMionAOTEmitMode;
230
+ exports.isMionCompileMode = src_utils.isMionCompileMode;
231
+ exports.isTestEnv = src_utils.isTestEnv;
232
+ exports.randomUUID_V7 = src_utils.randomUUID_V7;
233
+ exports.toBase64Url = src_utils.toBase64Url;
234
+ exports.HeadersSubset = src_headers.HeadersSubset;
235
+ exports.registerPureFnFactory = src_pureFns_pureFn.registerPureFnFactory;
236
+ exports.PURE_SERVER_FN_NAMESPACE = src_pureFns_pureServerFn.PURE_SERVER_FN_NAMESPACE;
237
+ exports.pureServerFn = src_pureFns_pureServerFn.pureServerFn;
238
+ exports.createHashLiteral = src_pureFns_quickHash.createHashLiteral;
239
+ exports.createUniqueHash = src_pureFns_quickHash.createUniqueHash;
240
+ exports.defaultLiteralLength = src_pureFns_quickHash.defaultLiteralLength;
241
+ exports.hashDefaultLength = src_pureFns_quickHash.hashDefaultLength;
242
+ exports.pureFnHashLength = src_pureFns_quickHash.pureFnHashLength;
243
+ exports.quickHash = src_pureFns_quickHash.quickHash;
244
+ exports.resetHashes = src_pureFns_quickHash.resetHashes;
245
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,21 @@
1
+ export * from './src/types/general.types.ts';
2
+ export * from './src/types/method.types.ts';
3
+ export * from './src/types/pureFunctions.types.ts';
4
+ export * from './src/types/formats/formats.types.ts';
5
+ export * from './src/types/formats/formatsParams.types.ts';
6
+ export * from './src/types/formats/friendlyErrors.types.ts';
7
+ export * from './src/types/formats/formatBrands.types.ts';
8
+ export * from './src/binary/dataView.ts';
9
+ export * from './src/binary/bodySerializer.ts';
10
+ export * from './src/binary/bodyDeserializer.ts';
11
+ export * from './src/binary/bodyDeserializer.ts';
12
+ export * from './src/constants.ts';
13
+ export * from './src/errors.ts';
14
+ export * from './src/friendlyErrors.ts';
15
+ export * from './src/jit/jitUtils.ts';
16
+ export * from './src/routerUtils.ts';
17
+ export * from './src/utils.ts';
18
+ export * from './src/headers.ts';
19
+ export * from './src/pureFns/pureFn.ts';
20
+ export * from './src/pureFns/pureServerFn.ts';
21
+ export * from './src/pureFns/quickHash.ts';
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const src_binary_dataView = require("./dataView.cjs");
4
+ const src_constants = require("../constants.cjs");
5
+ const src_errors = require("../errors.cjs");
6
+ const src_routerUtils = require("../routerUtils.cjs");
7
+ function deserializeBinaryBody(path, buffer, isResponse) {
8
+ try {
9
+ const deserializer = src_binary_dataView.createDataViewDeserializer(path, buffer);
10
+ const body = {};
11
+ const itemsLength = deserializer.view.getUint32(0, true);
12
+ deserializer.index += 4;
13
+ for (let i = 0; i < itemsLength; i++) {
14
+ const key = deserializer.desString();
15
+ const method = src_routerUtils.routesCache.getMethodJitFns(key);
16
+ if (!method) {
17
+ throw new src_errors.RpcError({
18
+ statusCode: src_constants.StatusCodes.UNEXPECTED_ERROR,
19
+ type: isResponse ? "binary-response-method-Deserialization-error" : "binary-request-method-Deserialization-error",
20
+ publicMessage: `Unknown method key in binary body: ${key}`,
21
+ errorData: { methodId: key }
22
+ });
23
+ }
24
+ const value = deserializeMethod(key, method, deserializer, isResponse);
25
+ body[key] = value;
26
+ }
27
+ deserializer.markAsEnded();
28
+ return { deserializer, body };
29
+ } catch (err) {
30
+ if (err instanceof src_errors.RpcError) throw err;
31
+ throw new src_errors.RpcError({
32
+ statusCode: src_constants.StatusCodes.UNEXPECTED_ERROR,
33
+ type: isResponse ? "binary-response-Deserialize-error" : "binary-request-Deserialization-error",
34
+ publicMessage: `Failed to deserialize body from binary: ${err?.message || "unknown error"}`,
35
+ originalError: err
36
+ });
37
+ }
38
+ }
39
+ function deserializeMethod(key, method, deserializer, isResponse) {
40
+ const jitFns = isResponse ? method.returnJitFns : method.paramsJitFns;
41
+ try {
42
+ return jitFns.fromBinary.fn(void 0, deserializer);
43
+ } catch (e) {
44
+ throw new src_errors.RpcError({
45
+ statusCode: src_constants.StatusCodes.UNEXPECTED_ERROR,
46
+ type: isResponse ? "binary-response-method-Deserialization-error" : "binary-request-method-Deserialization-error",
47
+ publicMessage: `Failed to deserialize method ${key} from binary`,
48
+ originalError: e,
49
+ errorData: { methodId: key }
50
+ });
51
+ }
52
+ }
53
+ exports.deserializeBinaryBody = deserializeBinaryBody;
54
+ //# sourceMappingURL=bodyDeserializer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bodyDeserializer.cjs","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: e,\n errorData: {methodId: key},\n });\n }\n}\n"],"names":["createDataViewDeserializer","routesCache","RpcError","StatusCodes"],"mappings":";;;;;;AAYO,SAAS,sBACZ,MACA,QAEA,YAIF;AACE,MAAI;AAEA,UAAM,eAAeA,oBAAAA,2BAA2B,MAAM,MAAM;AAC5D,UAAM,OAA4B,CAAA;AAGlC,UAAM,cAAc,aAAa,KAAK,UAAU,GAAG,IAAI;AACvD,iBAAa,SAAS;AAGtB,aAAS,IAAI,GAAG,IAAI,aAAa,KAAK;AAElC,YAAM,MAAM,aAAa,UAAA;AAGzB,YAAM,SAASC,gBAAAA,YAAY,gBAAgB,GAAG;AAC9C,UAAI,CAAC,QAAQ;AACT,cAAM,IAAIC,WAAAA,SAAS;AAAA,UACf,YAAYC,cAAAA,YAAY;AAAA,UACxB,MAAM,aACA,iDACA;AAAA,UACN,eAAe,sCAAsC,GAAG;AAAA,UACxD,WAAW,EAAC,UAAU,IAAA;AAAA,QAAG,CAC5B;AAAA,MACL;AAGA,YAAM,QAAQ,kBAAkB,KAAK,QAAQ,cAAc,UAAU;AACrE,WAAK,GAAG,IAAI;AAAA,IAChB;AAEA,iBAAa,YAAA;AACb,WAAO,EAAC,cAAc,KAAA;AAAA,EAC1B,SAAS,KAAU;AACf,QAAI,eAAeD,WAAAA,SAAU,OAAM;AACnC,UAAM,IAAIA,WAAAA,SAAS;AAAA,MACf,YAAYC,cAAAA,YAAY;AAAA,MACxB,MAAM,aAAa,sCAAsC;AAAA,MACzD,eAAe,2CAA2C,KAAK,WAAW,eAAe;AAAA,MACzF,eAAe;AAAA,IAAA,CAClB;AAAA,EACL;AACJ;AAGA,SAAS,kBAAkB,KAAa,QAA0B,cAAoC,YAA0B;AAC5H,QAAM,SAAS,aAAa,OAAO,eAAe,OAAO;AACzD,MAAI;AACA,WAAO,OAAO,WAAW,GAAG,QAAW,YAAY;AAAA,EACvD,SAAS,GAAQ;AACb,UAAM,IAAID,WAAAA,SAAS;AAAA,MACf,YAAYC,cAAAA,YAAY;AAAA,MACxB,MAAM,aAAa,iDAAiD;AAAA,MACpE,eAAe,gCAAgC,GAAG;AAAA,MAClD,eAAe;AAAA,MACf,WAAW,EAAC,UAAU,IAAA;AAAA,IAAG,CAC5B;AAAA,EACL;AACJ;;"}
@@ -0,0 +1,5 @@
1
+ import { BinaryInput, DataViewDeserializer } from '../types/general.types.ts';
2
+ export declare function deserializeBinaryBody(path: string, buffer: BinaryInput, isResponse: boolean): {
3
+ deserializer: DataViewDeserializer;
4
+ body: Record<string, any>;
5
+ };
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const src_binary_dataView = require("./dataView.cjs");
4
+ const src_constants = require("../constants.cjs");
5
+ const src_errors = require("../errors.cjs");
6
+ function serializeBinaryBody(path, executionChain, body, isResponse, workflowRouteIds) {
7
+ try {
8
+ const serializer = src_binary_dataView.createDataViewSerializer(path, workflowRouteIds);
9
+ const itemsLengthIndex = serializer.index;
10
+ serializer.index += 4;
11
+ let itemsLength = 0;
12
+ for (let i = 0; i < executionChain.length; i++) {
13
+ const method = executionChain[i];
14
+ const key = method.id;
15
+ const value = body[key];
16
+ if (serializeMethod(key, method, value, serializer, isResponse)) {
17
+ itemsLength++;
18
+ }
19
+ }
20
+ serializer.view.setUint32(itemsLengthIndex, itemsLength, true);
21
+ serializer.markAsEnded();
22
+ return { serializer, buffer: serializer.getBuffer() };
23
+ } catch (err) {
24
+ if (err instanceof src_errors.RpcError) throw err;
25
+ throw new src_errors.RpcError({
26
+ statusCode: src_constants.StatusCodes.UNEXPECTED_ERROR,
27
+ type: isResponse ? "binary-response-Serialization-error" : "binary-request-Serialization-error",
28
+ publicMessage: `Failed to serialize body to binary: ${err?.message || "unknown error"}`,
29
+ originalError: err
30
+ });
31
+ }
32
+ }
33
+ function serializeMethod(key, method, value, serializer, isResponse) {
34
+ const toBinary = isResponse ? method.returnJitFns.toBinary : method.paramsJitFns.toBinary;
35
+ if (!toBinary?.fn)
36
+ throw new src_errors.RpcError({
37
+ type: "missing-toBinary-jit-fn",
38
+ publicMessage: `Missing toBinary JIT function for method ${method.id}`
39
+ });
40
+ if (toBinary.isNoop) return false;
41
+ if (key === src_constants.MION_ROUTES.thrownErrors) return false;
42
+ if (isResponse && (!method.hasReturnData || typeof value === "undefined")) return false;
43
+ if (!isResponse && typeof value === "undefined") return false;
44
+ serializer.serString(key);
45
+ toBinary.fn(value, serializer);
46
+ return true;
47
+ }
48
+ exports.serializeBinaryBody = serializeBinaryBody;
49
+ //# sourceMappingURL=bodySerializer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bodySerializer.cjs","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":["createDataViewSerializer","RpcError","StatusCodes","MION_ROUTES"],"mappings":";;;;;AAeO,SAAS,oBACZ,MACA,gBACA,MACA,YACA,kBAIF;AACE,MAAI;AACA,UAAM,aAAaA,oBAAAA,yBAAyB,MAAM,gBAAgB;AAGlE,UAAM,mBAAmB,WAAW;AACpC,eAAW,SAAS;AAEpB,QAAI,cAAc;AAElB,aAAS,IAAI,GAAG,IAAI,eAAe,QAAQ,KAAK;AAC5C,YAAM,SAAS,eAAe,CAAC;AAC/B,YAAM,MAAM,OAAO;AACnB,YAAM,QAAQ,KAAK,GAAG;AACtB,UAAI,gBAAgB,KAAK,QAAQ,OAAO,YAAY,UAAU,GAAG;AAC7D;AAAA,MACJ;AAAA,IACJ;AAEA,eAAW,KAAK,UAAU,kBAAkB,aAAa,IAAI;AAC7D,eAAW,YAAA;AAEX,WAAO,EAAC,YAAY,QAAQ,WAAW,YAAU;AAAA,EACrD,SAAS,KAAU;AACf,QAAI,eAAeC,WAAAA,SAAU,OAAM;AACnC,UAAM,IAAIA,WAAAA,SAAS;AAAA,MACf,YAAYC,cAAAA,YAAY;AAAA,MACxB,MAAM,aAAa,wCAAwC;AAAA,MAC3D,eAAe,uCAAuC,KAAK,WAAW,eAAe;AAAA,MACrF,eAAe;AAAA,IAAA,CAClB;AAAA,EACL;AACJ;AAMA,SAAS,gBACL,KACA,QACA,OACA,YACA,YACO;AACP,QAAM,WAAW,aAAa,OAAO,aAAa,WAAW,OAAO,aAAa;AACjF,MAAI,CAAC,UAAU;AACX,UAAM,IAAID,WAAAA,SAAS;AAAA,MACf,MAAM;AAAA,MACN,eAAe,4CAA4C,OAAO,EAAE;AAAA,IAAA,CACvE;AACL,MAAI,SAAS,OAAQ,QAAO;AAE5B,MAAI,QAAQE,cAAAA,YAAY,aAAc,QAAO;AAE7C,MAAI,eAAe,CAAC,OAAO,iBAAiB,OAAO,UAAU,aAAc,QAAO;AAElF,MAAI,CAAC,cAAc,OAAO,UAAU,YAAa,QAAO;AAExD,aAAW,UAAU,GAAG;AAExB,WAAS,GAAG,OAAO,UAAU;AAC7B,SAAO;AACX;;"}
@@ -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,212 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const STR = 1;
4
+ const NUM = 2;
5
+ const POW_2_32 = 2 ** 32;
6
+ const LE = true;
7
+ const DEFAULT_OPTIONS = {
8
+ maxPoolItems: 100,
9
+ maxStrCacheLength: 64,
10
+ maxCacheSize: 1e3,
11
+ bufferSize: 2 ** 24,
12
+ averageResponseSizeMultiplier: 2,
13
+ responseAverageSizes: /* @__PURE__ */ new Map(),
14
+ stringBytesCache: /* @__PURE__ */ new Map()
15
+ };
16
+ const textEncoder = new TextEncoder();
17
+ const textDecoder = new TextDecoder();
18
+ let opts = { ...DEFAULT_OPTIONS };
19
+ function setSerializationOptions(options) {
20
+ opts = { ...opts, ...options };
21
+ }
22
+ function createDataViewSerializer(routeId, workflowRouteIds) {
23
+ const size = calculateBufferSizeForRequest(routeId, workflowRouteIds);
24
+ if (size >= POW_2_32) throw new Error("bufferSize option must be strictly less than 2 ** 32");
25
+ return new DataViewSerializerImpl(routeId, size);
26
+ }
27
+ function createDataViewDeserializer(routeId, input) {
28
+ if (ArrayBuffer.isView(input)) {
29
+ const buffer = input.buffer;
30
+ return new DataViewDeserializerImpl(routeId, buffer, input.byteOffset, input.byteLength);
31
+ }
32
+ return new DataViewDeserializerImpl(routeId, input);
33
+ }
34
+ class DataViewSerializerImpl {
35
+ buffer;
36
+ uint8View;
37
+ // Reusable view
38
+ routeId;
39
+ index = 0;
40
+ // byte offset
41
+ view;
42
+ hasEnded = false;
43
+ constructor(routeId, size) {
44
+ this.routeId = routeId;
45
+ this.buffer = new ArrayBuffer(size);
46
+ this.view = new DataView(this.buffer);
47
+ this.uint8View = new Uint8Array(this.buffer);
48
+ }
49
+ reset() {
50
+ this.index = 0;
51
+ this.hasEnded = false;
52
+ }
53
+ resize(size) {
54
+ this.buffer = new ArrayBuffer(size);
55
+ this.view = new DataView(this.buffer);
56
+ this.uint8View = new Uint8Array(this.buffer);
57
+ }
58
+ getBuffer() {
59
+ const buff = this.buffer.slice(0, this.index);
60
+ return buff;
61
+ }
62
+ getBufferView() {
63
+ return new Uint8Array(this.buffer, 0, this.index);
64
+ }
65
+ markAsEnded() {
66
+ this.hasEnded = true;
67
+ updateResponseSize(this.routeId, this.index);
68
+ }
69
+ getLength() {
70
+ return this.index;
71
+ }
72
+ serString(str, skipCache) {
73
+ if (str.length >= opts.maxStrCacheLength || skipCache) {
74
+ const targetView2 = this.uint8View.subarray(this.index + 4);
75
+ const result2 = textEncoder.encodeInto(str, targetView2);
76
+ this.view.setUint32(this.index, result2.written, LE);
77
+ this.index += 4 + result2.written;
78
+ return;
79
+ }
80
+ const cached = opts.stringBytesCache.get(str);
81
+ if (cached) {
82
+ this.uint8View.set(cached, this.index + 4);
83
+ this.view.setUint32(this.index, cached.length, LE);
84
+ this.index += 4 + cached.length;
85
+ return;
86
+ }
87
+ const targetView = this.uint8View.subarray(this.index + 4);
88
+ const result = textEncoder.encodeInto(str, targetView);
89
+ const written = result.written;
90
+ this.view.setUint32(this.index, written, LE);
91
+ this.index += 4 + written;
92
+ if (opts.stringBytesCache.size >= opts.maxCacheSize) evictStringBytesCache();
93
+ opts.stringBytesCache.set(str, this.uint8View.slice(this.index - written, this.index));
94
+ }
95
+ serFloat64(n) {
96
+ this.view.setFloat64(this.index, n, LE);
97
+ this.index += 8;
98
+ }
99
+ serEnum(n) {
100
+ if (typeof n === "number") {
101
+ this.view.setUint32(this.index, NUM, LE);
102
+ this.index += 4;
103
+ this.view.setUint32(this.index, n, LE);
104
+ this.index += 4;
105
+ return;
106
+ }
107
+ this.view.setUint32(this.index, STR, LE);
108
+ this.index += 4;
109
+ this.serString(n);
110
+ }
111
+ setBitMask(bitMaskIndex, bitIndex) {
112
+ const newBitmask = this.view.getUint8(bitMaskIndex) | 1 << bitIndex;
113
+ this.view.setUint8(bitMaskIndex, newBitmask);
114
+ }
115
+ }
116
+ class DataViewDeserializerImpl {
117
+ buffer;
118
+ uint8View;
119
+ // Reusable view
120
+ routeId;
121
+ index = 0;
122
+ view;
123
+ hasEnded = false;
124
+ constructor(routeId, buffer, byteOffset, byteLength) {
125
+ this.routeId = routeId;
126
+ this.buffer = buffer;
127
+ this.index = 0;
128
+ this.view = new DataView(buffer, byteOffset, byteLength);
129
+ this.uint8View = new Uint8Array(buffer, byteOffset, byteLength);
130
+ }
131
+ reset() {
132
+ this.index = 0;
133
+ this.hasEnded = false;
134
+ }
135
+ setBuffer(buffer, byteOffset, byteLength) {
136
+ this.index = 0;
137
+ this.buffer = buffer;
138
+ this.view = new DataView(buffer, byteOffset, byteLength);
139
+ this.uint8View = new Uint8Array(buffer, byteOffset, byteLength);
140
+ this.hasEnded = false;
141
+ }
142
+ markAsEnded() {
143
+ this.hasEnded = true;
144
+ }
145
+ getLength() {
146
+ return this.index;
147
+ }
148
+ desString() {
149
+ const len = this.view.getUint32(this.index, LE);
150
+ this.index += 4;
151
+ const decoded = textDecoder.decode(this.uint8View.subarray(this.index, this.index + len));
152
+ this.index += len;
153
+ return decoded;
154
+ }
155
+ /** Deserialize a string that will be used as a property name, with prototype pollution protection */
156
+ desSafePropName() {
157
+ const key = this.desString();
158
+ const len = key.length;
159
+ if (len === 9) {
160
+ if (key === "__proto__" || key === "prototype") throw new Error(`Unsafe property name: ${key}`);
161
+ } else if (len === 11) {
162
+ if (key === "constructor") throw new Error(`Unsafe property name: ${key}`);
163
+ }
164
+ return key;
165
+ }
166
+ desFloat64() {
167
+ const value = this.view.getFloat64(this.index, LE);
168
+ this.index += 8;
169
+ return value;
170
+ }
171
+ desEnum() {
172
+ const type = this.view.getUint32(this.index, LE);
173
+ this.index += 4;
174
+ if (type === NUM) {
175
+ const value = this.view.getUint32(this.index, LE);
176
+ this.index += 4;
177
+ return value;
178
+ }
179
+ return this.desString();
180
+ }
181
+ }
182
+ function calculateBufferSizeForRequest(routeId, workflowRouteIds) {
183
+ if (!workflowRouteIds || workflowRouteIds.length === 0) {
184
+ return calculateDefaultBufferSize(routeId);
185
+ }
186
+ let totalSize = 0;
187
+ for (const id of workflowRouteIds) {
188
+ totalSize += calculateDefaultBufferSize(id);
189
+ }
190
+ return totalSize;
191
+ }
192
+ function calculateDefaultBufferSize(routeId) {
193
+ const size = opts.responseAverageSizes.get(routeId);
194
+ if (!size) return opts.bufferSize;
195
+ return size * opts.averageResponseSizeMultiplier;
196
+ }
197
+ function updateResponseSize(routeId, responseSize) {
198
+ const currentSize = opts.responseAverageSizes.get(routeId) || opts.bufferSize;
199
+ const average = (currentSize + responseSize) / 2;
200
+ opts.responseAverageSizes.set(routeId, Math.floor(average));
201
+ }
202
+ function evictStringBytesCache() {
203
+ const entries = Array.from(opts.stringBytesCache.entries());
204
+ opts.stringBytesCache.clear();
205
+ for (let i = Math.floor(entries.length / 2); i < entries.length; i++) {
206
+ opts.stringBytesCache.set(entries[i][0], entries[i][1]);
207
+ }
208
+ }
209
+ exports.createDataViewDeserializer = createDataViewDeserializer;
210
+ exports.createDataViewSerializer = createDataViewSerializer;
211
+ exports.setSerializationOptions = setSerializationOptions;
212
+ //# sourceMappingURL=dataView.cjs.map