@mionjs/core 0.8.3-alpha.0 → 0.8.4
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 +4 -0
- package/.dist/cjs/index.cjs.map +1 -1
- package/.dist/cjs/src/aot/emptyServerPureFns.cjs +5 -0
- package/.dist/cjs/src/aot/emptyServerPureFns.cjs.map +1 -0
- package/.dist/cjs/src/aot/emptyServerPureFns.d.ts +1 -0
- package/.dist/cjs/src/aot/serverPureFnsCaches.cjs +5 -0
- package/.dist/cjs/src/aot/serverPureFnsCaches.cjs.map +1 -0
- package/.dist/cjs/src/aot/serverPureFnsCaches.d.ts +2 -0
- package/.dist/cjs/src/binary/bodyDeserializer.cjs +5 -0
- package/.dist/cjs/src/binary/bodyDeserializer.cjs.map +1 -1
- package/.dist/cjs/src/binary/bodySerializer.cjs +1 -6
- package/.dist/cjs/src/binary/bodySerializer.cjs.map +1 -1
- package/.dist/cjs/src/constants.cjs +5 -3
- package/.dist/cjs/src/constants.cjs.map +1 -1
- package/.dist/cjs/src/constants.d.ts +1 -1
- package/.dist/cjs/src/errors.cjs.map +1 -1
- package/.dist/cjs/src/headers.cjs.map +1 -1
- package/.dist/cjs/src/pureFns/pureFn.cjs +6 -4
- package/.dist/cjs/src/pureFns/pureFn.cjs.map +1 -1
- package/.dist/cjs/src/pureFns/pureServerFn.cjs.map +1 -1
- package/.dist/cjs/src/pureFns/restoreJitFns.cjs +3 -3
- package/.dist/cjs/src/pureFns/restoreJitFns.cjs.map +1 -1
- package/.dist/cjs/src/routerUtils.cjs +16 -17
- package/.dist/cjs/src/routerUtils.cjs.map +1 -1
- package/.dist/cjs/src/routerUtils.d.ts +1 -1
- package/.dist/cjs/src/types/general.types.cjs +15 -5
- package/.dist/cjs/src/types/general.types.cjs.map +1 -1
- package/.dist/cjs/src/types/general.types.d.ts +17 -8
- package/.dist/cjs/src/types/method.types.cjs +1 -1
- package/.dist/cjs/src/types/method.types.d.ts +1 -0
- package/.dist/cjs/src/types/pureFunctions.types.cjs +1 -1
- package/.dist/cjs/src/types/pureFunctions.types.d.ts +1 -1
- package/.dist/cjs/src/utils.cjs +2 -2
- package/.dist/cjs/src/utils.cjs.map +1 -1
- package/.dist/esm/index.js +5 -1
- package/.dist/esm/src/aot/emptyServerPureFns.d.ts +1 -0
- package/.dist/esm/src/aot/emptyServerPureFns.js +5 -0
- package/.dist/esm/src/aot/emptyServerPureFns.js.map +1 -0
- package/.dist/esm/src/aot/serverPureFnsCaches.d.ts +2 -0
- package/.dist/esm/src/aot/serverPureFnsCaches.js +5 -0
- package/.dist/esm/src/aot/serverPureFnsCaches.js.map +1 -0
- package/.dist/esm/src/binary/bodyDeserializer.js +5 -0
- package/.dist/esm/src/binary/bodyDeserializer.js.map +1 -1
- package/.dist/esm/src/binary/bodySerializer.js +1 -6
- package/.dist/esm/src/binary/bodySerializer.js.map +1 -1
- package/.dist/esm/src/constants.d.ts +1 -1
- package/.dist/esm/src/constants.js +5 -3
- package/.dist/esm/src/constants.js.map +1 -1
- package/.dist/esm/src/errors.js.map +1 -1
- package/.dist/esm/src/headers.js.map +1 -1
- package/.dist/esm/src/pureFns/pureFn.js +6 -4
- package/.dist/esm/src/pureFns/pureFn.js.map +1 -1
- package/.dist/esm/src/pureFns/pureServerFn.js.map +1 -1
- package/.dist/esm/src/pureFns/restoreJitFns.js +3 -3
- package/.dist/esm/src/pureFns/restoreJitFns.js.map +1 -1
- package/.dist/esm/src/routerUtils.d.ts +1 -1
- package/.dist/esm/src/routerUtils.js +16 -17
- package/.dist/esm/src/routerUtils.js.map +1 -1
- package/.dist/esm/src/types/general.types.d.ts +17 -8
- package/.dist/esm/src/types/general.types.js +16 -6
- package/.dist/esm/src/types/general.types.js.map +1 -1
- package/.dist/esm/src/types/method.types.d.ts +1 -0
- package/.dist/esm/src/types/method.types.js +1 -1
- package/.dist/esm/src/types/pureFunctions.types.d.ts +1 -1
- package/.dist/esm/src/types/pureFunctions.types.js +1 -1
- package/.dist/esm/src/utils.js +2 -2
- package/.dist/esm/src/utils.js.map +1 -1
- package/package.json +8 -2
|
@@ -102,33 +102,36 @@ function addRoutesToCache(newCache) {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
function getJitFnHashes(jitHash) {
|
|
105
|
+
function getJitFnHashes(jitHash, needsBinary = false) {
|
|
106
106
|
return {
|
|
107
107
|
isType: `${JIT_FUNCTION_IDS.isType}_${jitHash}`,
|
|
108
108
|
typeErrors: `${JIT_FUNCTION_IDS.typeErrors}_${jitHash}`,
|
|
109
109
|
prepareForJson: `${JIT_FUNCTION_IDS.prepareForJson}_${jitHash}`,
|
|
110
110
|
restoreFromJson: `${JIT_FUNCTION_IDS.restoreFromJson}_${jitHash}`,
|
|
111
111
|
stringifyJson: `${JIT_FUNCTION_IDS.stringifyJson}_${jitHash}`,
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
...needsBinary ? {
|
|
113
|
+
toBinary: `${JIT_FUNCTION_IDS.toBinary}_${jitHash}`,
|
|
114
|
+
fromBinary: `${JIT_FUNCTION_IDS.fromBinary}_${jitHash}`
|
|
115
|
+
} : {}
|
|
114
116
|
};
|
|
115
117
|
}
|
|
116
118
|
function getJitFunctionsFromHash(jitHash) {
|
|
117
119
|
if (jitHash === EMPTY_HASH) return noopJitFns;
|
|
118
120
|
const cached = jitFunctionsCache.get(jitHash);
|
|
119
121
|
if (cached) return cached;
|
|
120
|
-
const hashes = getJitFnHashes(jitHash);
|
|
121
122
|
const jUtils = getJitUtils();
|
|
122
123
|
const jitFns = {
|
|
123
|
-
isType: jUtils.getJIT(
|
|
124
|
-
typeErrors: jUtils.getJIT(
|
|
125
|
-
prepareForJson: jUtils.getJIT(
|
|
126
|
-
restoreFromJson: jUtils.getJIT(
|
|
127
|
-
stringifyJson: jUtils.getJIT(
|
|
128
|
-
toBinary: jUtils.getJIT(hashes.toBinary),
|
|
129
|
-
fromBinary: jUtils.getJIT(hashes.fromBinary)
|
|
124
|
+
isType: jUtils.getJIT(`${JIT_FUNCTION_IDS.isType}_${jitHash}`),
|
|
125
|
+
typeErrors: jUtils.getJIT(`${JIT_FUNCTION_IDS.typeErrors}_${jitHash}`),
|
|
126
|
+
prepareForJson: jUtils.getJIT(`${JIT_FUNCTION_IDS.prepareForJson}_${jitHash}`),
|
|
127
|
+
restoreFromJson: jUtils.getJIT(`${JIT_FUNCTION_IDS.restoreFromJson}_${jitHash}`),
|
|
128
|
+
stringifyJson: jUtils.getJIT(`${JIT_FUNCTION_IDS.stringifyJson}_${jitHash}`)
|
|
130
129
|
};
|
|
131
|
-
|
|
130
|
+
const toBinaryJit = jUtils.getJIT(`${JIT_FUNCTION_IDS.toBinary}_${jitHash}`);
|
|
131
|
+
const fromBinaryJit = jUtils.getJIT(`${JIT_FUNCTION_IDS.fromBinary}_${jitHash}`);
|
|
132
|
+
if (toBinaryJit) jitFns.toBinary = toBinaryJit;
|
|
133
|
+
if (fromBinaryJit) jitFns.fromBinary = fromBinaryJit;
|
|
134
|
+
for (const key of ["isType", "typeErrors", "prepareForJson", "restoreFromJson", "stringifyJson"]) {
|
|
132
135
|
if (!jitFns[key]) throw new Error(`Jit function ${key} not found for jitHash ${jitHash}`);
|
|
133
136
|
}
|
|
134
137
|
jitFunctionsCache.set(jitHash, jitFns);
|
|
@@ -167,9 +170,7 @@ const noopJitFns = {
|
|
|
167
170
|
typeErrors: fakeJitFn(JIT_FUNCTION_IDS.typeErrors),
|
|
168
171
|
prepareForJson: fakeJitFn(JIT_FUNCTION_IDS.prepareForJson),
|
|
169
172
|
restoreFromJson: fakeJitFn(JIT_FUNCTION_IDS.restoreFromJson),
|
|
170
|
-
stringifyJson: fakeJitFn(JIT_FUNCTION_IDS.stringifyJson)
|
|
171
|
-
toBinary: fakeJitFn(JIT_FUNCTION_IDS.toBinary),
|
|
172
|
-
fromBinary: fakeJitFn(JIT_FUNCTION_IDS.fromBinary)
|
|
173
|
+
stringifyJson: fakeJitFn(JIT_FUNCTION_IDS.stringifyJson)
|
|
173
174
|
};
|
|
174
175
|
function fakeJitFn(fnID) {
|
|
175
176
|
return {
|
|
@@ -180,8 +181,6 @@ function fakeJitFn(fnID) {
|
|
|
180
181
|
defaultParamValues: { vλl: "v" },
|
|
181
182
|
isNoop: true,
|
|
182
183
|
code: "",
|
|
183
|
-
jitDependencies: [],
|
|
184
|
-
pureFnDependencies: [],
|
|
185
184
|
createJitFn: () => {
|
|
186
185
|
throw new Error("isNoop JIT functions should not be called, this is a function when jit is never used");
|
|
187
186
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerUtils.js","sources":["../../../src/routerUtils.ts"],"sourcesContent":["/* ########\n * 2023 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {JIT_FUNCTION_IDS, PATH_SEPARATOR, ROUTER_ITEM_SEPARATOR_CHAR, ROUTE_PATH_ROOT, EMPTY_HASH} from './constants.ts';\nimport type {RemoteMethodOpts, MethodWithOptions, MethodsCache, MethodWithOptsAndJitFns} from './types/method.types.ts';\nimport type {CoreRouterOptions, JitCompiledFn, JitCompiledFunctions, JitFunctionsHashes} from './types/general.types.ts';\nimport {getJitUtils} from './jit/jitUtils.ts';\n\nconst methodsCache: MethodsCache = {};\nconst methodsOptionsCache: Record<string, RemoteMethodOpts> = {};\n\n// Cache for JitCompiledFunctions objects keyed by jitHash\nconst jitFunctionsCache = new Map<string, JitCompiledFunctions>();\nconst headerJitFunctionsCache = new Map<string, Pick<JitCompiledFunctions, 'isType' | 'typeErrors'>>();\n\n/**\n * Utilities for accessing and modifying the router cache.\n * The router cache stores method metadata for routes registered via addRoutesToCache() or virtual modules.\n */\nexport const routesCache = {\n /**\n * Get method metadata from the router cache by id.\n * @param id - The method id\n * @returns The method metadata or undefined if not found\n */\n getMetadata(id: string): MethodWithOptions | undefined {\n return methodsCache[id] as MethodWithOptions | undefined;\n },\n\n /**\n * Set method metadata in the router cache\n * @param id - The method id\n * @param methodData - The method metadata\n */\n setMetadata(id: string, methodData: MethodWithOptions): void {\n methodsCache[id] = methodData as any;\n },\n\n /**\n * Check if the router cache contains a method by id.\n * @param id - The method id\n * @returns True if the method exists in the cache\n */\n hasMetadata(id: string): boolean {\n return id in methodsCache;\n },\n\n /**\n * Get the raw router cache object.\n * Use with caution - prefer using get/set/has methods.\n * @returns The router cache object\n */\n getCache(): MethodsCache {\n return methodsCache;\n },\n\n /**\n * Get method metadata with JIT functions restored from the router cache by id.\n * This augments the MethodWithOptions with paramsJitFns and returnJitFns.\n * JIT functions are cached in the entry after first access for performance.\n * @param id - The method id\n * @returns The method metadata with JIT functions or undefined if not found\n */\n getMethodJitFns(id: string): MethodWithOptsAndJitFns | undefined {\n if (id in methodsCache) {\n const cached = methodsCache[id] as any;\n if (cached.paramsJitFns && cached.returnJitFns) {\n return cached as MethodWithOptsAndJitFns;\n }\n }\n\n const metadata = this.getMetadata(id);\n if (!metadata) return undefined;\n\n const paramsJitFns = getJitFunctionsFromHash(metadata.paramsJitHash);\n const returnJitFns = getJitFunctionsFromHash(metadata.returnJitHash);\n const headersParam = metadata.headersParam\n ? {...metadata.headersParam, jitFns: getHeaderJitFunctionsFromHash(metadata.headersParam.jitHash)}\n : undefined;\n const headersReturn = metadata.headersReturn\n ? {...metadata.headersReturn, jitFns: getHeaderJitFunctionsFromHash(metadata.headersReturn.jitHash)}\n : undefined;\n\n const result: MethodWithOptsAndJitFns = {\n ...metadata,\n paramsJitFns,\n returnJitFns,\n headersParam,\n headersReturn,\n };\n\n methodsCache[id] = result;\n return result as MethodWithOptsAndJitFns;\n },\n\n /**\n * Get method metadata with JIT functions restored from the router cache by id.\n * @param id\n * @returns\n */\n useMethodJitFns(id: string): MethodWithOptsAndJitFns {\n const MethodWithOptsAndJitFns = this.getMethodJitFns(id);\n if (!MethodWithOptsAndJitFns) throw new Error(`Metadata for remote method ${id} not found`);\n return MethodWithOptsAndJitFns;\n },\n\n /**\n * Set method metadata with JIT functions in the router cache.\n * This stores the complete MethodWithOptsAndJitFns object directly.\n * @param id - The method id\n * @param MethodWithOptsAndJitFns - The method metadata with JIT functions\n */\n setMethodJitFns(id: string, MethodWithOptsAndJitFns: MethodWithOptsAndJitFns): void {\n methodsCache[id] = MethodWithOptsAndJitFns as any;\n },\n};\n\nexport const methodOptsCache = {\n getMethodOptions(id: string): RemoteMethodOpts | undefined {\n return methodsOptionsCache[id];\n },\n setMethodOptions(id: string, options: RemoteMethodOpts): void {\n methodsOptionsCache[id] = options;\n },\n};\n\n/**\n * Adds new routes to the router cache.\n * This is the public API for registering routes - called by virtual modules or directly.\n * @param newCache\n */\nexport function addRoutesToCache(newCache: MethodsCache) {\n for (const key in newCache) {\n if (!(key in methodsCache)) {\n // Clone the cache entry to avoid mutating the original\n methodsCache[key] = {...newCache[key]} as MethodWithOptions;\n }\n }\n}\n\nexport function getJitFnHashes(jitHash: string): JitFunctionsHashes {\n return {\n isType: `${JIT_FUNCTION_IDS.isType}_${jitHash}`,\n typeErrors: `${JIT_FUNCTION_IDS.typeErrors}_${jitHash}`,\n prepareForJson: `${JIT_FUNCTION_IDS.prepareForJson}_${jitHash}`,\n restoreFromJson: `${JIT_FUNCTION_IDS.restoreFromJson}_${jitHash}`,\n stringifyJson: `${JIT_FUNCTION_IDS.stringifyJson}_${jitHash}`,\n toBinary: `${JIT_FUNCTION_IDS.toBinary}_${jitHash}`,\n fromBinary: `${JIT_FUNCTION_IDS.fromBinary}_${jitHash}`,\n };\n}\n\n/**\n * Helper function to get JIT functions from a JIT hash\n * Returns nullJitFns for empty hash (handlers with no params or void return)\n * Results are cached to avoid creating duplicate objects.\n */\nexport function getJitFunctionsFromHash(jitHash: string): JitCompiledFunctions {\n // Empty hash means no JIT functions were generated (optimization for no params or void return)\n if (jitHash === EMPTY_HASH) return noopJitFns;\n\n // Check cache first\n const cached = jitFunctionsCache.get(jitHash);\n if (cached) return cached;\n\n const hashes = getJitFnHashes(jitHash);\n const jUtils = getJitUtils();\n const jitFns = {\n isType: jUtils.getJIT(hashes.isType),\n typeErrors: jUtils.getJIT(hashes.typeErrors),\n prepareForJson: jUtils.getJIT(hashes.prepareForJson),\n restoreFromJson: jUtils.getJIT(hashes.restoreFromJson),\n stringifyJson: jUtils.getJIT(hashes.stringifyJson),\n toBinary: jUtils.getJIT(hashes.toBinary),\n fromBinary: jUtils.getJIT(hashes.fromBinary),\n } as JitCompiledFunctions;\n for (const key in jitFns) {\n if (!jitFns[key]) throw new Error(`Jit function ${key} not found for jitHash ${jitHash}`);\n }\n\n // Cache for future calls\n jitFunctionsCache.set(jitHash, jitFns);\n return jitFns;\n}\n\n/**\n * Helper function to get header JIT functions from a JIT hash\n * Results are cached to avoid creating duplicate objects.\n */\nexport function getHeaderJitFunctionsFromHash(jitHash: string): Pick<JitCompiledFunctions, 'isType' | 'typeErrors'> {\n // Check cache first\n const cached = headerJitFunctionsCache.get(jitHash);\n if (cached) return cached;\n\n const hashes = getJitFnHashes(jitHash);\n const jUtils = getJitUtils();\n const jitFns = {\n isType: jUtils.getJIT(hashes.isType),\n typeErrors: jUtils.getJIT(hashes.typeErrors),\n } as Pick<JitCompiledFunctions, 'isType' | 'typeErrors'>;\n\n // Cache for future calls\n headerJitFunctionsCache.set(jitHash, jitFns);\n return jitFns;\n}\n\n/**\n * Get the router id for Routes or MiddleFns\n * @param itemPointer - The pointer to the item within the Routes object\n * i.e:\n * const routes = {\n * auth: () => {},\n * users: {\n * getUser: () => {}\n * }\n * login: () => {}\n * }\n *\n * then the pointer for getUser is => ['users', 'getUser']\n */\nexport function getRouterItemId(itemPointer: string[]) {\n return itemPointer.join(ROUTER_ITEM_SEPARATOR_CHAR);\n}\n\n/** Gets a route path from a route pointer */\nexport function getRoutePath(pathPointer: string[], routerOptions: CoreRouterOptions) {\n const pathId = getRouterItemId(pathPointer);\n const basePath = routerOptions.basePath.startsWith(ROUTE_PATH_ROOT)\n ? routerOptions.basePath\n : `${ROUTE_PATH_ROOT}${routerOptions.basePath}`;\n const routePath = basePath.endsWith(PATH_SEPARATOR) ? `${basePath}${pathId}` : `${basePath}${PATH_SEPARATOR}${pathId}`;\n return routerOptions.suffix ? routePath + routerOptions.suffix : routePath;\n}\n\nexport function resetRoutesCache() {\n for (const k in methodsCache) delete methodsCache[k];\n}\n\n/** Resets the JIT functions cache. Useful for testing purposes only. */\nexport function resetJitFunctionsCache(): void {\n jitFunctionsCache.clear();\n headerJitFunctionsCache.clear();\n}\n\n// Noop JIT functions used for handlers with no params or void return\n// prettier-ignore\nconst noopJitFns: JitCompiledFunctions = {\n isType: fakeJitFn(JIT_FUNCTION_IDS.isType),\n typeErrors: fakeJitFn(JIT_FUNCTION_IDS.typeErrors),\n prepareForJson: fakeJitFn(JIT_FUNCTION_IDS.prepareForJson),\n restoreFromJson: fakeJitFn(JIT_FUNCTION_IDS.restoreFromJson),\n stringifyJson: fakeJitFn(JIT_FUNCTION_IDS.stringifyJson),\n toBinary: fakeJitFn(JIT_FUNCTION_IDS.toBinary),\n fromBinary: fakeJitFn(JIT_FUNCTION_IDS.fromBinary),\n} as any;\n\n/** Creates a fake JIT function with isNoop=true for handlers with no params or void return */\nfunction fakeJitFn(fnID: string): JitCompiledFn<any> {\n return {\n typeName: 'mionNoopJit',\n fnID,\n jitFnHash: EMPTY_HASH,\n args: {vλl: 'v'},\n defaultParamValues: {vλl: 'v'},\n isNoop: true,\n code: '',\n jitDependencies: [],\n pureFnDependencies: [],\n createJitFn: () => {\n throw new Error('isNoop JIT functions should not be called, this is a function when jit is never used');\n },\n fn: () => {\n throw new Error('isNoop JIT functions should not be called, this is a function when jit is never used');\n },\n };\n}\n\nexport function getNoopJitFns(): JitCompiledFunctions {\n return noopJitFns;\n}\n"],"names":[],"mappings":";;AAYA,MAAM,eAA6B,CAAA;AACnC,MAAM,sBAAwD,CAAA;AAG9D,MAAM,wCAAwB,IAAA;AAC9B,MAAM,8CAA8B,IAAA;AAM7B,MAAM,cAAc;AAAA;AAAA;AAAA;AA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ACjD,gBAAgB,UAAU,iBAAiB,cAAc;AAAA,EACzD,iBAAiB,UAAU,iBAAiB,eAAe;AAAA,EAC3D,eAAe,UAAU,iBAAiB,aAAa;AAAA,EACvD,UAAU,UAAU,iBAAiB,QAAQ;AAAA,EAC7C,YAAY,UAAU,iBAAiB,UAAU;AACrD;AAGA,SAAS,UAAU,MAAkC;AACjD,SAAO;AAAA,IACH,UAAU;AAAA,IACV;AAAA,IACA,WAAW;AAAA,IACX,MAAM,EAAC,KAAK,IAAA;AAAA,IACZ,oBAAoB,EAAC,KAAK,IAAA;AAAA,IAC1B,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,iBAAiB,CAAA;AAAA,IACjB,oBAAoB,CAAA;AAAA,IACpB,aAAa,MAAM;AACf,YAAM,IAAI,MAAM,sFAAsF;AAAA,IAC1G;AAAA,IACA,IAAI,MAAM;AACN,YAAM,IAAI,MAAM,sFAAsF;AAAA,IAC1G;AAAA,EAAA;AAER;AAEO,SAAS,gBAAsC;AAClD,SAAO;AACX;"}
|
|
1
|
+
{"version":3,"file":"routerUtils.js","sources":["../../../src/routerUtils.ts"],"sourcesContent":["/* ########\n * 2023 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {JIT_FUNCTION_IDS, PATH_SEPARATOR, ROUTER_ITEM_SEPARATOR_CHAR, ROUTE_PATH_ROOT, EMPTY_HASH} from './constants.ts';\nimport type {RemoteMethodOpts, MethodWithOptions, MethodsCache, MethodWithOptsAndJitFns} from './types/method.types.ts';\nimport type {CoreRouterOptions, JitCompiledFn, JitCompiledFunctions, JitFunctionsHashes} from './types/general.types.ts';\nimport {getJitUtils} from './jit/jitUtils.ts';\n\nconst methodsCache: MethodsCache = {};\nconst methodsOptionsCache: Record<string, RemoteMethodOpts> = {};\n\n// Cache for JitCompiledFunctions objects keyed by jitHash\nconst jitFunctionsCache = new Map<string, JitCompiledFunctions>();\nconst headerJitFunctionsCache = new Map<string, Pick<JitCompiledFunctions, 'isType' | 'typeErrors'>>();\n\n/**\n * Utilities for accessing and modifying the router cache.\n * The router cache stores method metadata for routes registered via addRoutesToCache() or virtual modules.\n */\nexport const routesCache = {\n /**\n * Get method metadata from the router cache by id.\n * @param id - The method id\n * @returns The method metadata or undefined if not found\n */\n getMetadata(id: string): MethodWithOptions | undefined {\n return methodsCache[id] as MethodWithOptions | undefined;\n },\n\n /**\n * Set method metadata in the router cache\n * @param id - The method id\n * @param methodData - The method metadata\n */\n setMetadata(id: string, methodData: MethodWithOptions): void {\n methodsCache[id] = methodData as any;\n },\n\n /**\n * Check if the router cache contains a method by id.\n * @param id - The method id\n * @returns True if the method exists in the cache\n */\n hasMetadata(id: string): boolean {\n return id in methodsCache;\n },\n\n /**\n * Get the raw router cache object.\n * Use with caution - prefer using get/set/has methods.\n * @returns The router cache object\n */\n getCache(): MethodsCache {\n return methodsCache;\n },\n\n /**\n * Get method metadata with JIT functions restored from the router cache by id.\n * This augments the MethodWithOptions with paramsJitFns and returnJitFns.\n * JIT functions are cached in the entry after first access for performance.\n * @param id - The method id\n * @returns The method metadata with JIT functions or undefined if not found\n */\n getMethodJitFns(id: string): MethodWithOptsAndJitFns | undefined {\n if (id in methodsCache) {\n const cached = methodsCache[id] as any;\n if (cached.paramsJitFns && cached.returnJitFns) {\n return cached as MethodWithOptsAndJitFns;\n }\n }\n\n const metadata = this.getMetadata(id);\n if (!metadata) return undefined;\n\n const paramsJitFns = getJitFunctionsFromHash(metadata.paramsJitHash);\n const returnJitFns = getJitFunctionsFromHash(metadata.returnJitHash);\n const headersParam = metadata.headersParam\n ? {...metadata.headersParam, jitFns: getHeaderJitFunctionsFromHash(metadata.headersParam.jitHash)}\n : undefined;\n const headersReturn = metadata.headersReturn\n ? {...metadata.headersReturn, jitFns: getHeaderJitFunctionsFromHash(metadata.headersReturn.jitHash)}\n : undefined;\n\n const result: MethodWithOptsAndJitFns = {\n ...metadata,\n paramsJitFns,\n returnJitFns,\n headersParam,\n headersReturn,\n };\n\n methodsCache[id] = result;\n return result as MethodWithOptsAndJitFns;\n },\n\n /**\n * Get method metadata with JIT functions restored from the router cache by id.\n * @param id\n * @returns\n */\n useMethodJitFns(id: string): MethodWithOptsAndJitFns {\n const MethodWithOptsAndJitFns = this.getMethodJitFns(id);\n if (!MethodWithOptsAndJitFns) throw new Error(`Metadata for remote method ${id} not found`);\n return MethodWithOptsAndJitFns;\n },\n\n /**\n * Set method metadata with JIT functions in the router cache.\n * This stores the complete MethodWithOptsAndJitFns object directly.\n * @param id - The method id\n * @param MethodWithOptsAndJitFns - The method metadata with JIT functions\n */\n setMethodJitFns(id: string, MethodWithOptsAndJitFns: MethodWithOptsAndJitFns): void {\n methodsCache[id] = MethodWithOptsAndJitFns as any;\n },\n};\n\nexport const methodOptsCache = {\n getMethodOptions(id: string): RemoteMethodOpts | undefined {\n return methodsOptionsCache[id];\n },\n setMethodOptions(id: string, options: RemoteMethodOpts): void {\n methodsOptionsCache[id] = options;\n },\n};\n\n/**\n * Adds new routes to the router cache.\n * This is the public API for registering routes - called by virtual modules or directly.\n * @param newCache\n */\nexport function addRoutesToCache(newCache: MethodsCache) {\n for (const key in newCache) {\n if (!(key in methodsCache)) {\n // Clone the cache entry to avoid mutating the original\n methodsCache[key] = {...newCache[key]} as MethodWithOptions;\n }\n }\n}\n\nexport function getJitFnHashes(jitHash: string, needsBinary: boolean = false): JitFunctionsHashes {\n return {\n isType: `${JIT_FUNCTION_IDS.isType}_${jitHash}`,\n typeErrors: `${JIT_FUNCTION_IDS.typeErrors}_${jitHash}`,\n prepareForJson: `${JIT_FUNCTION_IDS.prepareForJson}_${jitHash}`,\n restoreFromJson: `${JIT_FUNCTION_IDS.restoreFromJson}_${jitHash}`,\n stringifyJson: `${JIT_FUNCTION_IDS.stringifyJson}_${jitHash}`,\n ...(needsBinary\n ? {\n toBinary: `${JIT_FUNCTION_IDS.toBinary}_${jitHash}`,\n fromBinary: `${JIT_FUNCTION_IDS.fromBinary}_${jitHash}`,\n }\n : {}),\n };\n}\n\n/**\n * Helper function to get JIT functions from a JIT hash\n * Returns nullJitFns for empty hash (handlers with no params or void return)\n * Results are cached to avoid creating duplicate objects.\n */\nexport function getJitFunctionsFromHash(jitHash: string): JitCompiledFunctions {\n // Empty hash means no JIT functions were generated (optimization for no params or void return)\n if (jitHash === EMPTY_HASH) return noopJitFns;\n\n // Check cache first\n const cached = jitFunctionsCache.get(jitHash);\n if (cached) return cached;\n\n const jUtils = getJitUtils();\n const jitFns = {\n isType: jUtils.getJIT(`${JIT_FUNCTION_IDS.isType}_${jitHash}`),\n typeErrors: jUtils.getJIT(`${JIT_FUNCTION_IDS.typeErrors}_${jitHash}`),\n prepareForJson: jUtils.getJIT(`${JIT_FUNCTION_IDS.prepareForJson}_${jitHash}`),\n restoreFromJson: jUtils.getJIT(`${JIT_FUNCTION_IDS.restoreFromJson}_${jitHash}`),\n stringifyJson: jUtils.getJIT(`${JIT_FUNCTION_IDS.stringifyJson}_${jitHash}`),\n } as JitCompiledFunctions;\n // Only include binary functions if they exist in the store\n const toBinaryJit = jUtils.getJIT(`${JIT_FUNCTION_IDS.toBinary}_${jitHash}`);\n const fromBinaryJit = jUtils.getJIT(`${JIT_FUNCTION_IDS.fromBinary}_${jitHash}`);\n if (toBinaryJit) jitFns.toBinary = toBinaryJit;\n if (fromBinaryJit) jitFns.fromBinary = fromBinaryJit;\n\n for (const key of ['isType', 'typeErrors', 'prepareForJson', 'restoreFromJson', 'stringifyJson'] as const) {\n if (!jitFns[key]) throw new Error(`Jit function ${key} not found for jitHash ${jitHash}`);\n }\n\n // Cache for future calls\n jitFunctionsCache.set(jitHash, jitFns);\n return jitFns;\n}\n\n/**\n * Helper function to get header JIT functions from a JIT hash\n * Results are cached to avoid creating duplicate objects.\n */\nexport function getHeaderJitFunctionsFromHash(jitHash: string): Pick<JitCompiledFunctions, 'isType' | 'typeErrors'> {\n // Check cache first\n const cached = headerJitFunctionsCache.get(jitHash);\n if (cached) return cached;\n\n const hashes = getJitFnHashes(jitHash);\n const jUtils = getJitUtils();\n const jitFns = {\n isType: jUtils.getJIT(hashes.isType),\n typeErrors: jUtils.getJIT(hashes.typeErrors),\n } as Pick<JitCompiledFunctions, 'isType' | 'typeErrors'>;\n\n // Cache for future calls\n headerJitFunctionsCache.set(jitHash, jitFns);\n return jitFns;\n}\n\n/**\n * Get the router id for Routes or MiddleFns\n * @param itemPointer - The pointer to the item within the Routes object\n * i.e:\n * const routes = {\n * auth: () => {},\n * users: {\n * getUser: () => {}\n * }\n * login: () => {}\n * }\n *\n * then the pointer for getUser is => ['users', 'getUser']\n */\nexport function getRouterItemId(itemPointer: string[]) {\n return itemPointer.join(ROUTER_ITEM_SEPARATOR_CHAR);\n}\n\n/** Gets a route path from a route pointer */\nexport function getRoutePath(pathPointer: string[], routerOptions: CoreRouterOptions) {\n const pathId = getRouterItemId(pathPointer);\n const basePath = routerOptions.basePath.startsWith(ROUTE_PATH_ROOT)\n ? routerOptions.basePath\n : `${ROUTE_PATH_ROOT}${routerOptions.basePath}`;\n const routePath = basePath.endsWith(PATH_SEPARATOR) ? `${basePath}${pathId}` : `${basePath}${PATH_SEPARATOR}${pathId}`;\n return routerOptions.suffix ? routePath + routerOptions.suffix : routePath;\n}\n\nexport function resetRoutesCache() {\n for (const k in methodsCache) delete methodsCache[k];\n}\n\n/** Resets the JIT functions cache. Useful for testing purposes only. */\nexport function resetJitFunctionsCache(): void {\n jitFunctionsCache.clear();\n headerJitFunctionsCache.clear();\n}\n\n// Noop JIT functions used for handlers with no params or void return\n// prettier-ignore\nconst noopJitFns: JitCompiledFunctions = {\n isType: fakeJitFn(JIT_FUNCTION_IDS.isType),\n typeErrors: fakeJitFn(JIT_FUNCTION_IDS.typeErrors),\n prepareForJson: fakeJitFn(JIT_FUNCTION_IDS.prepareForJson),\n restoreFromJson: fakeJitFn(JIT_FUNCTION_IDS.restoreFromJson),\n stringifyJson: fakeJitFn(JIT_FUNCTION_IDS.stringifyJson),\n} as any;\n\n/** Creates a fake JIT function with isNoop=true for handlers with no params or void return */\nfunction fakeJitFn(fnID: string): JitCompiledFn<any> {\n return {\n typeName: 'mionNoopJit',\n fnID,\n jitFnHash: EMPTY_HASH,\n args: {vλl: 'v'},\n defaultParamValues: {vλl: 'v'},\n isNoop: true,\n code: '',\n createJitFn: () => {\n throw new Error('isNoop JIT functions should not be called, this is a function when jit is never used');\n },\n fn: () => {\n throw new Error('isNoop JIT functions should not be called, this is a function when jit is never used');\n },\n };\n}\n\nexport function getNoopJitFns(): JitCompiledFunctions {\n return noopJitFns;\n}\n"],"names":[],"mappings":";;AAYA,MAAM,eAA6B,CAAA;AACnC,MAAM,sBAAwD,CAAA;AAG9D,MAAM,wCAAwB,IAAA;AAC9B,MAAM,8CAA8B,IAAA;AAM7B,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvB,YAAY,IAA2C;AACnD,WAAO,aAAa,EAAE;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAY,IAAY,YAAqC;AACzD,iBAAa,EAAE,IAAI;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,YAAY,IAAqB;AAC7B,WAAO,MAAM;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,WAAyB;AACrB,WAAO;AAAA,EACX;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,gBAAgB,IAAiD;AAC7D,QAAI,MAAM,cAAc;AACpB,YAAM,SAAS,aAAa,EAAE;AAC9B,UAAI,OAAO,gBAAgB,OAAO,cAAc;AAC5C,eAAO;AAAA,MACX;AAAA,IACJ;AAEA,UAAM,WAAW,KAAK,YAAY,EAAE;AACpC,QAAI,CAAC,SAAU,QAAO;AAEtB,UAAM,eAAe,wBAAwB,SAAS,aAAa;AACnE,UAAM,eAAe,wBAAwB,SAAS,aAAa;AACnE,UAAM,eAAe,SAAS,eACxB,EAAC,GAAG,SA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M;AACN,YAAM,IAAI,MAAM,sFAAsF;AAAA,IAC1G;AAAA,EAAA;AAER;AAEO,SAAS,gBAAsC;AAClD,SAAO;AACX;"}
|
|
@@ -6,6 +6,7 @@ export declare const SerializerModes: {
|
|
|
6
6
|
readonly json: 1;
|
|
7
7
|
readonly binary: 2;
|
|
8
8
|
readonly stringifyJson: 3;
|
|
9
|
+
readonly optimistic: 4;
|
|
9
10
|
};
|
|
10
11
|
export type SerializerMode = keyof typeof SerializerModes;
|
|
11
12
|
export type SerializerCode = (typeof SerializerModes)[SerializerMode];
|
|
@@ -73,8 +74,8 @@ export interface JitCompiledFnData {
|
|
|
73
74
|
readonly defaultParamValues: JitFnArgs;
|
|
74
75
|
readonly isNoop?: boolean;
|
|
75
76
|
readonly code: string;
|
|
76
|
-
readonly jitDependencies
|
|
77
|
-
readonly pureFnDependencies
|
|
77
|
+
readonly jitDependencies?: Array<string>;
|
|
78
|
+
readonly pureFnDependencies?: Array<string>;
|
|
78
79
|
paramNames?: string[];
|
|
79
80
|
}
|
|
80
81
|
export interface JitCompiledFn<Fn extends AnyFn = AnyFn> extends JitCompiledFnData {
|
|
@@ -90,8 +91,8 @@ export interface JitCompiledFunctions {
|
|
|
90
91
|
prepareForJson: JitCompiledFn<PrepareForJsonFn>;
|
|
91
92
|
restoreFromJson: JitCompiledFn<RestoreFromJsonFn>;
|
|
92
93
|
stringifyJson: JitCompiledFn<JsonStringifyFn>;
|
|
93
|
-
toBinary
|
|
94
|
-
fromBinary
|
|
94
|
+
toBinary?: JitCompiledFn<ToBinaryFn>;
|
|
95
|
+
fromBinary?: JitCompiledFn<FromBinaryFn>;
|
|
95
96
|
}
|
|
96
97
|
export interface SerializableJITFunctions {
|
|
97
98
|
isType: JitCompiledFnData;
|
|
@@ -99,8 +100,8 @@ export interface SerializableJITFunctions {
|
|
|
99
100
|
prepareForJson: JitCompiledFnData;
|
|
100
101
|
restoreFromJson: JitCompiledFnData;
|
|
101
102
|
stringifyJson: JitCompiledFnData;
|
|
102
|
-
toBinary
|
|
103
|
-
fromBinary
|
|
103
|
+
toBinary?: JitCompiledFnData;
|
|
104
|
+
fromBinary?: JitCompiledFnData;
|
|
104
105
|
}
|
|
105
106
|
export interface JitFunctionsHashes {
|
|
106
107
|
isType: string;
|
|
@@ -108,8 +109,8 @@ export interface JitFunctionsHashes {
|
|
|
108
109
|
prepareForJson: string;
|
|
109
110
|
restoreFromJson: string;
|
|
110
111
|
stringifyJson: string;
|
|
111
|
-
toBinary
|
|
112
|
-
fromBinary
|
|
112
|
+
toBinary?: string;
|
|
113
|
+
fromBinary?: string;
|
|
113
114
|
}
|
|
114
115
|
export type JsonStringifyFn = (value: any) => JSONString;
|
|
115
116
|
export type RestoreFromJsonFn = (value: JSONValue) => any;
|
|
@@ -135,6 +136,10 @@ export interface SrcCodeCompiledPureFunction extends PureFunctionData {
|
|
|
135
136
|
}
|
|
136
137
|
export type SrcCodeJITCompiledFnsCache = Record<string, SrcCodeJitCompiledFn>;
|
|
137
138
|
export type SrcCodePureFunctionsCache = Record<string, Record<string, SrcCodeCompiledPureFunction>>;
|
|
139
|
+
export type ClientSrcCodeJitCompiledFn = Omit<SrcCodeJitCompiledFn, 'code' | 'args' | 'defaultParamValues' | 'fnID' | 'paramNames'>;
|
|
140
|
+
export type ClientSrcCodeCompiledPureFunction = Omit<SrcCodeCompiledPureFunction, 'code' | 'paramNames'>;
|
|
141
|
+
export type ClientSrcCodeJITCompiledFnsCache = Record<string, ClientSrcCodeJitCompiledFn>;
|
|
142
|
+
export type ClientSrcCodePureFunctionsCache = Record<string, Record<string, ClientSrcCodeCompiledPureFunction>>;
|
|
138
143
|
export type StrNumber = string | number;
|
|
139
144
|
export type AnyFn = (...args: any[]) => any;
|
|
140
145
|
export type AnyObject = Record<string, unknown>;
|
|
@@ -228,6 +233,10 @@ export declare type __ΩSrcCodeJitCompiledFn = any[];
|
|
|
228
233
|
export declare type __ΩSrcCodeCompiledPureFunction = any[];
|
|
229
234
|
export declare type __ΩSrcCodeJITCompiledFnsCache = any[];
|
|
230
235
|
export declare type __ΩSrcCodePureFunctionsCache = any[];
|
|
236
|
+
export declare type __ΩClientSrcCodeJitCompiledFn = any[];
|
|
237
|
+
export declare type __ΩClientSrcCodeCompiledPureFunction = any[];
|
|
238
|
+
export declare type __ΩClientSrcCodeJITCompiledFnsCache = any[];
|
|
239
|
+
export declare type __ΩClientSrcCodePureFunctionsCache = any[];
|
|
231
240
|
export declare type __ΩStrNumber = any[];
|
|
232
241
|
export declare type __ΩAnyFn = any[];
|
|
233
242
|
export declare type __ΩAnyObject = any[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MIME_TYPES } from "../constants.js";
|
|
2
2
|
import { __ΩTypeFormatError as ___TypeFormatError } from "./formats/formats.types.js";
|
|
3
|
-
import { __Ω
|
|
3
|
+
import { __ΩPureFunctionData as ___PureFunctionData, __ΩPersistedPureFunction as ___PersistedPureFunction, __ΩCompiledPureFunction as ___CompiledPureFunction } from "./pureFunctions.types.js";
|
|
4
4
|
const __ΩError = ["name", "message", "stack", "Error", 'P&4!&4"&4#8Mw$y'];
|
|
5
5
|
const __ΩOmit = ["T", "K", () => __ΩPick, () => __ΩExclude, "Omit", 'b!b"e!!e!!ge!"o$#o##w%y'];
|
|
6
6
|
const __ΩRecord = ["K", "T", "Record", `l'e#"Rb!b"Pde"!N#!w#y`];
|
|
@@ -26,7 +26,9 @@ const SerializerModes = {
|
|
|
26
26
|
/** Use toBinary JIT function for binary serialization */
|
|
27
27
|
binary: 2,
|
|
28
28
|
/** Use stringifyJson JIT function that do not mutates objects. */
|
|
29
|
-
stringifyJson: 3
|
|
29
|
+
stringifyJson: 3,
|
|
30
|
+
/** Client-only: sends plain JSON without JIT, fetches metadata in the same response */
|
|
31
|
+
optimistic: 4
|
|
30
32
|
};
|
|
31
33
|
const __ΩSerializerMode = [() => SerializerModes, "SerializerMode", 'i!gw"y'];
|
|
32
34
|
const __ΩSerializerCode = [() => SerializerModes, () => __ΩSerializerMode, "SerializerCode", 'i!n"fw#y'];
|
|
@@ -43,12 +45,12 @@ const __ΩSetItemPathSegment = ["key", "index", "SetItemPathSegment", `P#4!'4"Mw
|
|
|
43
45
|
const __ΩPathSegment = [() => __ΩStrNumber, () => __ΩMapKeyPathSegment, () => __ΩMapValuePathSegment, () => __ΩSetItemPathSegment, "PathSegment", 'Pn!n"n#n$Jw%y'];
|
|
44
46
|
const __ΩRunTypeError = [() => __ΩPathSegment, "path", "expected", () => ___TypeFormatError, "format", "RunTypeError", 'Pn!F4"&4#n$4%8Mw&y'];
|
|
45
47
|
const __ΩJitFnArgs = ["vλl", "JitFnArgs", 'P&4!&&LMw"y'];
|
|
46
|
-
const __ΩJitCompiledFnData = ["typeName", "fnID", "jitFnHash", () => __ΩJitFnArgs, "args", () => __ΩJitFnArgs, "defaultParamValues", "isNoop", "code", "jitDependencies", "pureFnDependencies", "paramNames", "JitCompiledFnData", `P&4!9&4"9&4#9n$4%9n&4'9)4(89&4)9&F4*
|
|
48
|
+
const __ΩJitCompiledFnData = ["typeName", "fnID", "jitFnHash", () => __ΩJitFnArgs, "args", () => __ΩJitFnArgs, "defaultParamValues", "isNoop", "code", "jitDependencies", "pureFnDependencies", "paramNames", "JitCompiledFnData", `P&4!9&4"9&4#9n$4%9n&4'9)4(89&4)9&F4*89&F4+89&F4,8Mw-y`];
|
|
47
49
|
const __ΩJitCompiledFn = [() => __ΩAnyFn, "Fn", () => __ΩJitCompiledFnData, "JITUtils", "utl", "", "createJitFn", "fn", "JitCompiledFn", `n!c"Pn#P"w$2%e#!/&4'9e"!4(9Mw)y`];
|
|
48
50
|
const __ΩPersistedJitFn = [() => __ΩOmit, () => __ΩJitCompiledFn, "fn", "fn", "PersistedJitFn", 'Pn".#o!#-4$9Mw%y'];
|
|
49
|
-
const __ΩJitCompiledFunctions = [() => __ΩJitCompiledFn, () => __ΩIsTypeFn, "isType", () => __ΩJitCompiledFn, () => __ΩTypeErrorsFn, "typeErrors", () => __ΩJitCompiledFn, () => __ΩPrepareForJsonFn, "prepareForJson", () => __ΩJitCompiledFn, () => __ΩRestoreFromJsonFn, "restoreFromJson", () => __ΩJitCompiledFn, () => __ΩJsonStringifyFn, "stringifyJson", () => __ΩJitCompiledFn, () => __ΩToBinaryFn, "toBinary", () => __ΩJitCompiledFn, () => __ΩFromBinaryFn, "fromBinary", "JitCompiledFunctions", `Pn"o!"4#n%o$"4&n(o'"4)n+o*"4,n.o-"4/n1o0"
|
|
50
|
-
const __ΩSerializableJITFunctions = [() => __ΩJitCompiledFnData, "isType", () => __ΩJitCompiledFnData, "typeErrors", () => __ΩJitCompiledFnData, "prepareForJson", () => __ΩJitCompiledFnData, "restoreFromJson", () => __ΩJitCompiledFnData, "stringifyJson", () => __ΩJitCompiledFnData, "toBinary", () => __ΩJitCompiledFnData, "fromBinary", "SerializableJITFunctions", `Pn!4"n#4$n%4&n'4(n)4*n+4,
|
|
51
|
-
const __ΩJitFunctionsHashes = ["isType", "typeErrors", "prepareForJson", "restoreFromJson", "stringifyJson", "toBinary", "fromBinary", "JitFunctionsHashes", `P&4!&4"&4#&4$&4%&4
|
|
51
|
+
const __ΩJitCompiledFunctions = [() => __ΩJitCompiledFn, () => __ΩIsTypeFn, "isType", () => __ΩJitCompiledFn, () => __ΩTypeErrorsFn, "typeErrors", () => __ΩJitCompiledFn, () => __ΩPrepareForJsonFn, "prepareForJson", () => __ΩJitCompiledFn, () => __ΩRestoreFromJsonFn, "restoreFromJson", () => __ΩJitCompiledFn, () => __ΩJsonStringifyFn, "stringifyJson", () => __ΩJitCompiledFn, () => __ΩToBinaryFn, "toBinary", () => __ΩJitCompiledFn, () => __ΩFromBinaryFn, "fromBinary", "JitCompiledFunctions", `Pn"o!"4#n%o$"4&n(o'"4)n+o*"4,n.o-"4/n1o0"428n4o3"458Mw6y`];
|
|
52
|
+
const __ΩSerializableJITFunctions = [() => __ΩJitCompiledFnData, "isType", () => __ΩJitCompiledFnData, "typeErrors", () => __ΩJitCompiledFnData, "prepareForJson", () => __ΩJitCompiledFnData, "restoreFromJson", () => __ΩJitCompiledFnData, "stringifyJson", () => __ΩJitCompiledFnData, "toBinary", () => __ΩJitCompiledFnData, "fromBinary", "SerializableJITFunctions", `Pn!4"n#4$n%4&n'4(n)4*n+4,8n-4.8Mw/y`];
|
|
53
|
+
const __ΩJitFunctionsHashes = ["isType", "typeErrors", "prepareForJson", "restoreFromJson", "stringifyJson", "toBinary", "fromBinary", "JitFunctionsHashes", `P&4!&4"&4#&4$&4%&4&8&4'8Mw(y`];
|
|
52
54
|
const __ΩJsonStringifyFn = ["value", () => __ΩJSONString, "", "JsonStringifyFn", 'P"2!n"/#w$y'];
|
|
53
55
|
const __ΩRestoreFromJsonFn = [() => __ΩJSONValue, "value", "", "RestoreFromJsonFn", 'Pn!2""/#w$y'];
|
|
54
56
|
const __ΩPrepareForJsonFn = ["value", () => __ΩJSONValue, "", "PrepareForJsonFn", 'P"2!n"/#w$y'];
|
|
@@ -67,6 +69,10 @@ const __ΩSrcCodeJitCompiledFn = [() => __ΩJitCompiledFnData, "JITUtils", "utl"
|
|
|
67
69
|
const __ΩSrcCodeCompiledPureFunction = [() => ___PureFunctionData, "JITUtils", "utl", () => __ΩAnyFn, "", "createPureFn", "fn", "SrcCodeCompiledPureFunction", `Pn!P"w"2#n$/%4&9-4'9Mw(y`];
|
|
68
70
|
const __ΩSrcCodeJITCompiledFnsCache = [() => __ΩRecord, () => __ΩSrcCodeJitCompiledFn, "SrcCodeJITCompiledFnsCache", '&n"o!#w#y'];
|
|
69
71
|
const __ΩSrcCodePureFunctionsCache = [() => __ΩRecord, () => __ΩRecord, () => __ΩSrcCodeCompiledPureFunction, "SrcCodePureFunctionsCache", '&&n#o"#o!#w$y'];
|
|
72
|
+
const __ΩClientSrcCodeJitCompiledFn = [() => __ΩOmit, () => __ΩSrcCodeJitCompiledFn, "code", "args", "defaultParamValues", "fnID", "paramNames", "ClientSrcCodeJitCompiledFn", `n"P.#.$.%.&.'Jo!#w(y`];
|
|
73
|
+
const __ΩClientSrcCodeCompiledPureFunction = [() => __ΩOmit, () => __ΩSrcCodeCompiledPureFunction, "code", "paramNames", "ClientSrcCodeCompiledPureFunction", 'n"P.#.$Jo!#w%y'];
|
|
74
|
+
const __ΩClientSrcCodeJITCompiledFnsCache = [() => __ΩRecord, () => __ΩClientSrcCodeJitCompiledFn, "ClientSrcCodeJITCompiledFnsCache", '&n"o!#w#y'];
|
|
75
|
+
const __ΩClientSrcCodePureFunctionsCache = [() => __ΩRecord, () => __ΩRecord, () => __ΩClientSrcCodeCompiledPureFunction, "ClientSrcCodePureFunctionsCache", '&&n#o"#o!#w$y'];
|
|
70
76
|
const __ΩStrNumber = ["StrNumber", "P&'Jw!y"];
|
|
71
77
|
const __ΩAnyFn = ["args", "", "AnyFn", 'P"@2!"/"w#y'];
|
|
72
78
|
const __ΩAnyObject = [() => __ΩRecord, "AnyObject", '&#o!#w"y'];
|
|
@@ -91,6 +97,10 @@ export {
|
|
|
91
97
|
__ΩAnyFn,
|
|
92
98
|
__ΩAnyObject,
|
|
93
99
|
__ΩBinaryInput,
|
|
100
|
+
__ΩClientSrcCodeCompiledPureFunction,
|
|
101
|
+
__ΩClientSrcCodeJITCompiledFnsCache,
|
|
102
|
+
__ΩClientSrcCodeJitCompiledFn,
|
|
103
|
+
__ΩClientSrcCodePureFunctionsCache,
|
|
94
104
|
__ΩCoreRouterOptions,
|
|
95
105
|
__ΩDataOnly,
|
|
96
106
|
__ΩDataViewDeserializer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.types.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"general.types.js","sources":["../../../../src/types/general.types.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-function-type */\n/* ###############\n * 2022 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ############### */\n\nimport {MIME_TYPES} from '../constants.ts';\nimport {TypeFormatError} from './formats/formats.types.ts';\nimport type {JITUtils} from '../jit/jitUtils.ts';\nimport {CompiledPureFunction, PersistedPureFunction, PureFunctionData} from './pureFunctions.types.ts';\n\n// ########################################## Serialization Modes ##########################################\n\nexport const SerializerModes = {\n /** Use prepareForJson (mutates original objects), and leaves JSON.stringify to the platform adapter */\n json: 1,\n /** Use toBinary JIT function for binary serialization */\n binary: 2,\n /** Use stringifyJson JIT function that do not mutates objects. */\n stringifyJson: 3,\n /** Client-only: sends plain JSON without JIT, fetches metadata in the same response */\n optimistic: 4,\n} as const;\n\n/**\n * Serializer mode for response body serialization.\n * - 'json': Use prepareForJson, platform adapter handles JSON.stringify\n * - 'binary': Use toBinary JIT function for binary serialization\n * - 'stringifyJson': Use stringifyJson JIT function that do not mutates objects.\n */\nexport type SerializerMode = keyof typeof SerializerModes;\nexport type SerializerCode = (typeof SerializerModes)[SerializerMode];\n\n// ########################################## Options ##########################################\n\nexport type CoreRouterOptions = {\n /** automatically generate and uuid */\n autoGenerateErrorId: boolean;\n /** basePath for all routes */\n basePath: string;\n /** suffix for all routes, ie file extension etc */\n suffix: string;\n};\n\n// ########################################## Errors ##########################################\n\n/** Base parameters for TypedError */\nexport interface TypedErrorParams<ErrType extends StrNumber> {\n /** Error type, can be used as discriminator in union types switch, etc*/\n type: ErrType;\n /** the error message */\n message?: string;\n /** original error used to create the TypedError */\n originalError?: Error;\n}\n\n/** Any error triggered by middleFns or routes must follow this interface, returned errors in the body also follows this interface */\nexport interface RpcErrorParams<ErrType extends StrNumber, ErrData = any> {\n /** Error type, can be used as discriminator in union types switch, etc*/\n type: ErrType;\n /** id of the error. */\n id?: number | string;\n /** the message that will be returned in the response */\n publicMessage?: string;\n /**\n * the error message, it is private and wont be returned in the response.\n * If not defined, it is assigned from originalError.message or publicMessage.\n */\n message?: string;\n /** options data related to the error, ie validation data */\n errorData?: ErrData;\n /** original error used to create the RpcError */\n originalError?: Error;\n /** optional http status code */\n statusCode?: number;\n}\n\nexport interface RpcErrorWithPublic<ErrType extends StrNumber, ErrData = any> extends RpcErrorParams<ErrType, ErrData> {\n publicMessage: string;\n}\n\nexport interface RpcErrorWithPrivate<ErrType extends StrNumber, ErrData = any> extends RpcErrorParams<ErrType, ErrData> {\n message: string;\n}\n\n/** Error data returned to the clients */\nexport interface PublicRpcError<ErrType extends StrNumber, ErrData = any> extends Omit<\n RpcErrorParams<ErrType, ErrData>,\n 'message' | 'originalError'\n> {\n readonly 'mion@isΣrrθr': true;\n type: ErrType;\n errorData?: ErrData;\n /**\n * When a RpcError gets sent to client only publicMessage is set.\n * */\n publicMessage: string;\n}\n\nexport type AnyErrorParams<ErrType extends StrNumber, ErrData = any> =\n | RpcErrorWithPublic<ErrType, ErrData>\n | RpcErrorWithPrivate<ErrType, ErrData>;\n\n/** Path segment for Map key errors */\nexport type MapKeyPathSegment = {key: unknown; index: number; failed: 'mapKey'};\n\n/** Path segment for Map value errors */\nexport type MapValuePathSegment = {key: unknown; index: number; failed: 'mapVal'};\n\n/** Path segment for Set item errors */\nexport type SetItemPathSegment = {key: unknown; index: number};\n\n/** Any path segment in a RunTypeError path */\nexport type PathSegment = StrNumber | MapKeyPathSegment | MapValuePathSegment | SetItemPathSegment;\n\nexport interface RunTypeError {\n /**\n * Path to the property that failed validation if the validated item was an object class, etc..\n * Index if item that failed validation was in an array.\n * For Maps: contains {key, index, failed: 'mapKey'|'mapVal'} objects.\n * For Sets: contains {key, index} objects.\n * Empty array if validated item was a single property */\n path: PathSegment[];\n /** the type of the expected data */\n expected: string;\n format?: TypeFormatError;\n // typeName?: string; // tyeName can not be included as two types could Have the same typeID and different names\n}\n\n// ########################################### JIT FUNCTIONS ###########################################\n\n/**\n * The argument names of the function to be compiled. The order of properties is important as must the same as the function args.\n * ie: {vλl: 'val', arg1: 'arg1', error: 'newRunTypeErr'} for the function (vλl, arg1, eArr) => any\n */\nexport type JitFnArgs = {\n /** The name of the value of to be */\n vλl: string;\n /** Other argument names */\n [key: string]: string;\n};\n\nexport interface JitCompiledFnData {\n readonly typeName: string;\n /** The id of the function (operation) to be compiled (isType, typeErrors, prepareForJson, restoreFromJson, etc) */\n readonly fnID: string;\n /** Unique id of the function */\n readonly jitFnHash: string;\n /** The names of the arguments of the function */\n readonly args: JitFnArgs;\n /** Default values for the arguments */\n readonly defaultParamValues: JitFnArgs;\n /**\n * This flag is set to true when the result of a jit compilation is a no operation (empty function).\n * if this flag is set to true, the function should not be called as it will not do anything.\n */\n readonly isNoop?: boolean;\n /** Code for the jit function. after the operation has been compiled */\n readonly code: string;\n /** The list of all jit functions that are used by this function and it's children. */\n readonly jitDependencies?: Array<string>;\n /** Pure function dependencies in format \"namespace::fnHash\" */\n readonly pureFnDependencies?: Array<string>;\n /** function param names if the compiled type is function params */\n paramNames?: string[];\n}\n\nexport interface JitCompiledFn<Fn extends AnyFn = AnyFn> extends JitCompiledFnData {\n /** The closure function that contains the jit function, this one contains the context code */\n readonly createJitFn: (utl: JITUtils) => Fn;\n /** The Jit Generated function once the compilation is finished */\n readonly fn: Fn;\n}\n\n/** Jit Functions serialized to src code file, it contains the create jit function\n * but not the actual fn as this one can not be serialized to code.\n */\nexport interface PersistedJitFn extends Omit<JitCompiledFn, 'fn'> {\n /** The Jit Generated function once the compilation is finished */\n readonly fn: undefined;\n}\n\nexport interface JitCompiledFunctions {\n isType: JitCompiledFn<IsTypeFn>;\n typeErrors: JitCompiledFn<TypeErrorsFn>;\n prepareForJson: JitCompiledFn<PrepareForJsonFn>;\n restoreFromJson: JitCompiledFn<RestoreFromJsonFn>;\n stringifyJson: JitCompiledFn<JsonStringifyFn>;\n toBinary?: JitCompiledFn<ToBinaryFn>;\n fromBinary?: JitCompiledFn<FromBinaryFn>;\n}\nexport interface SerializableJITFunctions {\n isType: JitCompiledFnData;\n typeErrors: JitCompiledFnData;\n prepareForJson: JitCompiledFnData;\n restoreFromJson: JitCompiledFnData;\n stringifyJson: JitCompiledFnData;\n toBinary?: JitCompiledFnData;\n fromBinary?: JitCompiledFnData;\n}\nexport interface JitFunctionsHashes {\n isType: string;\n typeErrors: string;\n prepareForJson: string;\n restoreFromJson: string;\n stringifyJson: string;\n toBinary?: string;\n fromBinary?: string;\n}\nexport type JsonStringifyFn = (value: any) => JSONString;\nexport type RestoreFromJsonFn = (value: JSONValue) => any;\nexport type PrepareForJsonFn = (value: any) => JSONValue;\nexport type TypeErrorsFn = (value: any) => RunTypeError[];\nexport type IsTypeFn = (value: any) => boolean;\nexport type ToCodeFn = (value: any) => string;\n/** Binary serialization function - serializes value to the serializer context */\nexport type ToBinaryFn = (value: any, serializer: DataViewSerializer) => void;\n/** Binary deserialization function - deserializes from the deserializer context and returns the value */\nexport type FromBinaryFn = (value: undefined, deserializer: DataViewDeserializer) => any;\n\n// ############################# JIT CACHES ###################################\n\n// jit and pure functions at runtime, contains both createJitFn and fn\nexport type JitFunctionsCache = Record<string, JitCompiledFn>;\n/** Namespaced cache structure for pure functions: { namespace: { fnHash: CompiledPureFunction } } */\nexport type PureFunctionsCache = Record<string, Record<string, CompiledPureFunction>>;\n\n// jit and pure functions persisted to src code, contains createJitFn but not fn\n// this allow usage in environments that can not use eval or new Function()\nexport type PersistedJitFunctionsCache = Record<string, PersistedJitFn>;\n/** Namespaced cache structure for persisted pure functions */\nexport type PersistedPureFunctionsCache = Record<string, Record<string, PersistedPureFunction>>;\n\n// jit and pure functions data, does not contain createJitFn or fn\n// this is used to serialize over the network, but requires using new Function() to restore functionality\nexport type FnsDataCache = Record<string, JitCompiledFnData>;\n/** Namespaced cache structure for pure function data */\nexport type PureFnsDataCache = Record<string, Record<string, PureFunctionData>>;\n\n// ########################################### JIT SRC CODE ####################################\n\nexport interface SrcCodeJitCompiledFn extends JitCompiledFnData {\n /** The closure function that contains the jit function, this one contains the context code */\n readonly createJitFn: (utl: JITUtils) => AnyFn;\n /** The Jit Generated function once the compilation is finished */\n readonly fn: undefined;\n}\nexport interface SrcCodeCompiledPureFunction extends PureFunctionData {\n /** The closure function that contains the pure function, this one contains the context code */\n readonly createPureFn: (utl: JITUtils) => AnyFn;\n /** The Jit Generated function once the compilation is finished */\n readonly fn: undefined;\n}\nexport type SrcCodeJITCompiledFnsCache = Record<string, SrcCodeJitCompiledFn>;\nexport type SrcCodePureFunctionsCache = Record<string, Record<string, SrcCodeCompiledPureFunction>>;\n\n/** Client version of SrcCodeJitCompiledFn - strips unused properties to reduce bundle size */\nexport type ClientSrcCodeJitCompiledFn = Omit<\n SrcCodeJitCompiledFn,\n 'code' | 'args' | 'defaultParamValues' | 'fnID' | 'paramNames'\n>;\n/** Client version of SrcCodeCompiledPureFunction - strips unused properties to reduce bundle size */\nexport type ClientSrcCodeCompiledPureFunction = Omit<SrcCodeCompiledPureFunction, 'code' | 'paramNames'>;\nexport type ClientSrcCodeJITCompiledFnsCache = Record<string, ClientSrcCodeJitCompiledFn>;\nexport type ClientSrcCodePureFunctionsCache = Record<string, Record<string, ClientSrcCodeCompiledPureFunction>>;\n\n// ########################################## other #########################################\n\nexport type StrNumber = string | number;\nexport type AnyFn = (...args: any[]) => any;\nexport type AnyObject = Record<string, unknown>;\nexport interface AnyClass<T = any> {\n new (...args: any[]): T;\n}\n\nexport interface SerializableClass<T = any> {\n new (): T;\n}\n\nexport type DeserializeClassFn<C extends InstanceType<AnyClass>> = (deserialized: DataOnly<C>) => C;\n\nexport type Mutable<T> = {\n -readonly [P in keyof T]: T[P];\n};\n\nexport type Prettify<T> = {\n [P in keyof T]: T[P];\n} & {};\n\n// StrNumber is already defined at the top of the file\nexport type JSONValue = StrNumber | boolean | null | {[key: string]: JSONValue} | Array<JSONValue>;\nexport type JSONString = string;\n\n// prettier-ignore\ntype Native = Date | RegExp | URL | URLSearchParams | Blob | File | FileList | FormData | ArrayBuffer | SharedArrayBuffer | DataView | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;\n\n/** Typescript mapping type that stripes methods and only keep properties.\n * it takes into account, dates, objects, classes, arrays, maps and sets.\n */\nexport type DataOnly<T> = T extends object\n ? T extends Native\n ? T\n : T extends Function\n ? never\n : T extends new (...args: any[]) => any\n ? never\n : T extends Array<infer U>\n ? Array<DataOnly<U>>\n : T extends Map<infer K, infer V>\n ? Map<DataOnly<K>, DataOnly<V>>\n : T extends Set<infer U>\n ? Set<DataOnly<U>>\n : {[K in keyof T as T[K] extends Function ? never : K]: DataOnly<T[K]>}\n : T;\n\n// TEST TYPES FOR PlainObject\n\n// class A {\n// n1?: number;\n// s?: string;\n// d?: Date;\n// map?: Map<string, RegExp>;\n// set?: Set<URL>;\n// arr?: A[];\n// method() {\n// return 'hello';\n// }\n// arrow = () => 'hello';\n// }\n\n// type PlainInterface = PlainObject<{\n// n1: number;\n// s: string;\n// d: Date;\n// a: A;\n// map: Map<string, A>;\n// set: Set<A>;\n// arr: A[];\n// method(): string;\n// arrow: () => string;\n// }>;\n\n// type PlainClass = PlainObject<A>;\n// type PlainSet = PlainObject<Set<A>>;\n// type PlainMap = PlainObject<Map<string, A>>;\n\n// ################# BINARY SERIALIZATION - IMPORTANT NOTE ##################################\n// DO NOT CHANGE THE INTERFACE NAMES AS THEY ARE HARDCODED IN THE JIT GENERATED CODE\n// ##########################################################################################\n\nexport type StrictArrayBuffer = ArrayBuffer & {buffer?: undefined};\n/** Input type for binary deserialization - accepts ArrayBuffer or any typed array view (including Node.js Buffer) */\nexport type BinaryInput = ArrayBuffer | ArrayBufferView;\nexport interface DataViewSerializer {\n index: number; // byte offset\n view: DataView;\n reset: () => void;\n getBuffer: () => StrictArrayBuffer;\n getBufferView: () => Uint8Array;\n markAsEnded: () => void;\n getLength(): number;\n // serialization functions\n serString(str: string): void;\n serFloat64(n: number): void;\n serEnum(n: number | string): void;\n setBitMask(bitMaskIndex: number, bitIndex: number): void;\n}\n\nexport interface DataViewDeserializer {\n index: number; // byte offset\n view: DataView;\n reset: () => void;\n setBuffer: (buffer: StrictArrayBuffer, byteOffset?: number, byteLength?: number) => void;\n markAsEnded: () => void;\n getLength(): number;\n // deserialization functions\n desString(): string;\n desFloat64(): number;\n desEnum(): number | string;\n}\n\nexport type MimeTypes = (typeof MIME_TYPES)[keyof typeof MIME_TYPES];\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAeO,MAAM,kBAAkB;AAAA;AAAA,EAE3B,MAAM;AAAA;AAAA,EAEN,QAAQ;AAAA;AAAA,EAER,eAAe;AAAA;AAAA,EAEf,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -2,7 +2,7 @@ import { __ΩJitCompiledFunctions as ___JitCompiledFunctions, __ΩSerializerMode
|
|
|
2
2
|
const __ΩRecord = ["K", "T", "Record", `l'e#"Rb!b"Pde"!N#!w#y`];
|
|
3
3
|
const __ΩPick = ["T", "K", "Pick", 'l+e#!e"!fRb!b"Pde""N#!w#y'];
|
|
4
4
|
const __ΩMethodMetadata = ["type", "id", "isAsync", "hasReturnData", "paramNames", "paramsJitHash", "returnJitHash", () => __ΩHeadersMetaData, "headersParam", () => __ΩHeadersMetaData, "headersReturn", "middleFnIds", "pointer", "nestLevel", "MethodMetadata", `P'4!&4")4#)4$&F4%8&4&&4'n(4)8n*4+8&F4,8&F4-'4.Mw/y`];
|
|
5
|
-
const __ΩRemoteMethodOpts = ["runOnError", "validateParams", "validateReturn", "description", () => ___SerializerMode, "serializer", "isMutation", "RemoteMethodOpts", `P)4!8)4"8)4#8&4$8n%4&8P)-J4'8Mw
|
|
5
|
+
const __ΩRemoteMethodOpts = ["runOnError", "validateParams", "validateReturn", "description", () => ___SerializerMode, "serializer", "isMutation", "strictTypes", "RemoteMethodOpts", `P)4!8)4"8)4#8&4$8n%4&8P)-J4'8)4(8Mw)y`];
|
|
6
6
|
const __ΩRouteOnlyOptions = [() => __ΩRemoteMethodOpts, false, "runOnError", () => ___SerializerMode, "serializer", "RouteOnlyOptions", 'Pn!."4#n$4%Mw&y'];
|
|
7
7
|
const __ΩMethodWithOptions = [() => __ΩMethodMetadata, () => __ΩRemoteMethodOpts, "options", "MethodWithOptions", 'Pn!n"4#Mw$y'];
|
|
8
8
|
const __ΩMethodsCache = [() => __ΩRecord, () => __ΩMethodWithOptions, "MethodsCache", '&n"o!#w#y'];
|
|
@@ -13,7 +13,7 @@ export interface PureFunctionData {
|
|
|
13
13
|
readonly code: string;
|
|
14
14
|
readonly fnName: string;
|
|
15
15
|
readonly bodyHash: string;
|
|
16
|
-
readonly pureFnDependencies
|
|
16
|
+
readonly pureFnDependencies?: Array<string>;
|
|
17
17
|
}
|
|
18
18
|
export interface CompiledPureFunction extends PureFunctionData {
|
|
19
19
|
createPureFn: PureFunctionFactory;
|
|
@@ -9,7 +9,7 @@ const __ΩGenericPureFunction = ["P", "val", "formatParams", () => __ΩPureFunct
|
|
|
9
9
|
const __ΩErrorsPureFunction = ["P", "val", () => __ΩStrNumber, "pλth", () => ___RunTypeError, "εrr", "expected", "formatName", "formatParams", () => __ΩStrNumber, "formatPath", () => __ΩPureFunctionDeps, "deps", () => __ΩStrNumber, "accessPath", () => __ΩStrNumber, "fmtAccessPath", () => ___RunTypeError, "", "ErrorsPureFunction", `b!P"2"n#F2$n%F2&&2'&2(e"!2)n*F2+n,2-n.F2/8n0F218n2F/3w4y`];
|
|
10
10
|
const __ΩPureFunction = ["args", "", "PureFunction", 'P"@2!"/"w#y'];
|
|
11
11
|
const __ΩPureFunctionFactory = ["JITUtils", "jitUtils", () => __ΩPureFunction, "", "PureFunctionFactory", 'P"w!2"n#/$w%y'];
|
|
12
|
-
const __ΩPureFunctionData = ["namespace", "paramNames", "code", "fnName", "bodyHash", "pureFnDependencies", "PureFunctionData", `P&4!9&F4"9&4#9&4$9&4%9&F4&
|
|
12
|
+
const __ΩPureFunctionData = ["namespace", "paramNames", "code", "fnName", "bodyHash", "pureFnDependencies", "PureFunctionData", `P&4!9&F4"9&4#9&4$9&4%9&F4&89Mw'y`];
|
|
13
13
|
const __ΩCompiledPureFunction = [() => __ΩPureFunctionData, () => __ΩPureFunctionFactory, "createPureFn", () => __ΩPureFunction, "fn", "CompiledPureFunction", 'Pn!n"4#n$4%8Mw&y'];
|
|
14
14
|
const __ΩPersistedPureFunction = [() => __ΩCompiledPureFunction, "fn", "PersistedPureFunction", 'Pn!-4"Mw#y'];
|
|
15
15
|
const __ΩPureFnDef = ["args", "", "F", "namespace", "fnName", "isFactory", "pureFn", "PureFnDef", `P"@2!"/"c#P&4$89&4%89)4&8e"!4'9Mw(y`];
|
package/.dist/esm/src/utils.js
CHANGED
|
@@ -19,11 +19,11 @@ function fromBase64Url(encoded) {
|
|
|
19
19
|
let isTest = void 0;
|
|
20
20
|
function isMionCompileMode() {
|
|
21
21
|
const val = getENV("MION_COMPILE");
|
|
22
|
-
return val === "
|
|
22
|
+
return val === "buildOnly" || val === "middleware";
|
|
23
23
|
}
|
|
24
24
|
function isMionAOTEmitMode() {
|
|
25
25
|
const val = getENV("MION_COMPILE");
|
|
26
|
-
return val === "
|
|
26
|
+
return val === "buildOnly" || val === "middleware" || val === "childProcess";
|
|
27
27
|
}
|
|
28
28
|
function isTestEnv() {
|
|
29
29
|
if (isTest !== void 0) return isTest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/utils.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\nimport {getJitUtils} from './jit/jitUtils.ts';\nimport type {CompiledPureFunction} from './types/pureFunctions.types.ts';\n\n/** Generates a random UUID V7 (RFC 9562),\n * uses crypto.randomUUID() (v4) as random source as it's a native C++ binding that batches entropy,\n * might be faster than allocating typed arrays via crypto.getRandomValues */\nexport function randomUUID_V7(): string {\n const uuid = crypto.randomUUID();\n const tHex = Date.now().toString(16).padStart(12, '0');\n return `${tHex.substring(0, 8)}-${tHex.substring(8)}-7${uuid.substring(15)}`;\n}\n\n/**\n * Browser-safe function to access environment variables.\n * Returns undefined when running in browser environments where process is not available.\n * @param key - The environment variable key to retrieve\n * @returns The environment variable value or undefined if not available/in browser\n */\nexport function getENV(key: string): string | undefined {\n if (typeof process !== 'undefined' && process.env) {\n return process.env[key];\n }\n return undefined;\n}\n\n// ############# Base64 URL #############\n\n/** Encodes a string to URL-safe base64 (RFC 4648 §5) without padding */\nexport function toBase64Url(str: string): string {\n return btoa(str).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}\n\n/** Decodes a URL-safe base64 string (RFC 4648 §5) back to a string */\nexport function fromBase64Url(encoded: string): string {\n return atob(encoded.replace(/-/g, '+').replace(/_/g, '/'));\n}\n\nlet isTest: boolean | undefined = undefined;\n/** Whether the process is in mion compile mode (
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/utils.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\nimport {getJitUtils} from './jit/jitUtils.ts';\nimport type {CompiledPureFunction} from './types/pureFunctions.types.ts';\n\n/** Generates a random UUID V7 (RFC 9562),\n * uses crypto.randomUUID() (v4) as random source as it's a native C++ binding that batches entropy,\n * might be faster than allocating typed arrays via crypto.getRandomValues */\nexport function randomUUID_V7(): string {\n const uuid = crypto.randomUUID();\n const tHex = Date.now().toString(16).padStart(12, '0');\n return `${tHex.substring(0, 8)}-${tHex.substring(8)}-7${uuid.substring(15)}`;\n}\n\n/**\n * Browser-safe function to access environment variables.\n * Returns undefined when running in browser environments where process is not available.\n * @param key - The environment variable key to retrieve\n * @returns The environment variable value or undefined if not available/in browser\n */\nexport function getENV(key: string): string | undefined {\n if (typeof process !== 'undefined' && process.env) {\n return process.env[key];\n }\n return undefined;\n}\n\n// ############# Base64 URL #############\n\n/** Encodes a string to URL-safe base64 (RFC 4648 §5) without padding */\nexport function toBase64Url(str: string): string {\n return btoa(str).replace(/\\+/g, '-').replace(/\\//g, '_').replace(/=+$/, '');\n}\n\n/** Decodes a URL-safe base64 string (RFC 4648 §5) back to a string */\nexport function fromBase64Url(encoded: string): string {\n return atob(encoded.replace(/-/g, '+').replace(/_/g, '/'));\n}\n\nlet isTest: boolean | undefined = undefined;\n/** Whether the process is in mion compile mode (buildOnly or middleware).\n * In these modes platform adapters skip server.listen() — the server does NOT start. */\nexport function isMionCompileMode(): boolean {\n const val = getENV('MION_COMPILE');\n return val === 'buildOnly' || val === 'middleware';\n}\n\n/** Whether AOT caches should be generated and emitted (buildOnly, middleware, or childProcess).\n * Unlike isMionCompileMode(), this also includes 'childProcess' mode where the server DOES start\n * and keeps running after emitting AOT caches via IPC. */\nexport function isMionAOTEmitMode(): boolean {\n const val = getENV('MION_COMPILE');\n return val === 'buildOnly' || val === 'middleware' || val === 'childProcess';\n}\n\nexport function isTestEnv() {\n if (isTest !== undefined) return isTest;\n isTest = getENV('VITEST') !== undefined || getENV('NODE_ENV') === 'test';\n return isTest;\n}\n\n/**\n * Restores the full state of a compiled pure function,\n * The pure function itself can't be compiled to code as it contains references to context code and jitUtils.\n * So we need to restore it manually by invoking the closure function.\n * */\nexport function initPureFunction(compiled: CompiledPureFunction): asserts compiled is Required<CompiledPureFunction> {\n if (compiled.fn) return;\n compiled.fn = compiled.createPureFn(getJitUtils());\n}\n"],"names":[],"mappings":";AAaO,SAAS,gBAAwB;AACpC,QAAM,OAAO,OAAO,WAAA;AACpB,QAAM,OAAO,KAAK,MAAM,SAAS,EAAE,EAAE,SAAS,IAAI,GAAG;AACrD,SAAO,GAAG,KAAK,UAAU,GAAG,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;AAC9E;AAQO,SAAS,OAAO,KAAiC;AACpD,MAAI,OAAO,YAAY,eAAe,QAAQ,KAAK;AAC/C,WAAO,QAAQ,IAAI,GAAG;AAAA,EAC1B;AACA,SAAO;AACX;AAKO,SAAS,YAAY,KAAqB;AAC7C,SAAO,KAAK,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,EAAE;AAC9E;AAGO,SAAS,cAAc,SAAyB;AACnD,SAAO,KAAK,QAAQ,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG,CAAC;AAC7D;AAEA,IAAI,SAA8B;AAG3B,SAAS,oBAA6B;AACzC,QAAM,MAAM,OAAO,cAAc;AACjC,SAAO,QAAQ,eAAe,QAAQ;AAC1C;AAKO,SAAS,oBAA6B;AACzC,QAAM,MAAM,OAAO,cAAc;AACjC,SAAO,QAAQ,eAAe,QAAQ,gBAAgB,QAAQ;AAClE;AAEO,SAAS,YAAY;AACxB,MAAI,WAAW,OAAW,QAAO;AACjC,WAAS,OAAO,QAAQ,MAAM,UAAa,OAAO,UAAU,MAAM;AAClE,SAAO;AACX;AAOO,SAAS,iBAAiB,UAAoF;AACjH,MAAI,SAAS,GAAI;AACjB,WAAS,KAAK,SAAS,aAAa,YAAA,CAAa;AACrD;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mionjs/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core functionality required across multiple mion packages",
|
|
6
6
|
"keywords": [
|
|
@@ -32,6 +32,12 @@
|
|
|
32
32
|
"types": "./.dist/esm/src/aot/aotCaches.d.ts",
|
|
33
33
|
"require": "./.dist/cjs/src/aot/aotCaches.cjs",
|
|
34
34
|
"default": "./.dist/esm/src/aot/aotCaches.js"
|
|
35
|
+
},
|
|
36
|
+
"./server-pure-fns": {
|
|
37
|
+
"source": "./src/aot/serverPureFnsCaches.ts",
|
|
38
|
+
"types": "./.dist/esm/src/aot/serverPureFnsCaches.d.ts",
|
|
39
|
+
"require": "./.dist/cjs/src/aot/serverPureFnsCaches.cjs",
|
|
40
|
+
"default": "./.dist/esm/src/aot/serverPureFnsCaches.js"
|
|
35
41
|
}
|
|
36
42
|
},
|
|
37
43
|
"directories": {
|
|
@@ -60,5 +66,5 @@
|
|
|
60
66
|
"bugs": {
|
|
61
67
|
"url": "https://github.com/MionKit/mion/issues"
|
|
62
68
|
},
|
|
63
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "c53dbf8bc494d950876e0bf171cb15078356a6cf"
|
|
64
70
|
}
|