@mionjs/run-types 0.8.0-alpha.0 → 0.8.4-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 (105) hide show
  1. package/.dist/cjs/src/constants.cjs.map +1 -1
  2. package/.dist/cjs/src/constants.functions.cjs.map +1 -1
  3. package/.dist/cjs/src/constants.kind.cjs.map +1 -1
  4. package/.dist/cjs/src/createRunType.cjs.map +1 -1
  5. package/.dist/cjs/src/createRunTypeFunctions.cjs.map +1 -1
  6. package/.dist/cjs/src/lib/baseRunTypes.cjs +0 -31
  7. package/.dist/cjs/src/lib/baseRunTypes.cjs.map +1 -1
  8. package/.dist/cjs/src/lib/baseRunTypes.d.ts +0 -2
  9. package/.dist/cjs/src/nodes/atomic/any.cjs.map +1 -1
  10. package/.dist/cjs/src/nodes/atomic/bigInt.cjs.map +1 -1
  11. package/.dist/cjs/src/nodes/atomic/boolean.cjs.map +1 -1
  12. package/.dist/cjs/src/nodes/atomic/date.cjs.map +1 -1
  13. package/.dist/cjs/src/nodes/atomic/enum.cjs.map +1 -1
  14. package/.dist/cjs/src/nodes/atomic/enumMember.cjs.map +1 -1
  15. package/.dist/cjs/src/nodes/atomic/literal.cjs.map +1 -1
  16. package/.dist/cjs/src/nodes/atomic/never.cjs.map +1 -1
  17. package/.dist/cjs/src/nodes/atomic/null.cjs.map +1 -1
  18. package/.dist/cjs/src/nodes/atomic/number.cjs.map +1 -1
  19. package/.dist/cjs/src/nodes/atomic/object.cjs.map +1 -1
  20. package/.dist/cjs/src/nodes/atomic/regexp.cjs.map +1 -1
  21. package/.dist/cjs/src/nodes/atomic/string.cjs.map +1 -1
  22. package/.dist/cjs/src/nodes/atomic/symbol.cjs.map +1 -1
  23. package/.dist/cjs/src/nodes/atomic/undefined.cjs.map +1 -1
  24. package/.dist/cjs/src/nodes/atomic/unknown.cjs.map +1 -1
  25. package/.dist/cjs/src/nodes/atomic/void.cjs.map +1 -1
  26. package/.dist/cjs/src/nodes/collection/class.cjs.map +1 -1
  27. package/.dist/cjs/src/nodes/collection/functionParams.cjs.map +1 -1
  28. package/.dist/cjs/src/nodes/collection/interface.cjs +24 -4
  29. package/.dist/cjs/src/nodes/collection/interface.cjs.map +1 -1
  30. package/.dist/cjs/src/nodes/collection/intersection.cjs.map +1 -1
  31. package/.dist/cjs/src/nodes/collection/tuple.cjs.map +1 -1
  32. package/.dist/cjs/src/nodes/collection/union.cjs.map +1 -1
  33. package/.dist/cjs/src/nodes/collection/unionDiscriminator.cjs.map +1 -1
  34. package/.dist/cjs/src/nodes/function/function.cjs.map +1 -1
  35. package/.dist/cjs/src/nodes/member/array.cjs.map +1 -1
  36. package/.dist/cjs/src/nodes/member/callSignature.cjs.map +1 -1
  37. package/.dist/cjs/src/nodes/member/genericMember.cjs.map +1 -1
  38. package/.dist/cjs/src/nodes/member/indexProperty.cjs.map +1 -1
  39. package/.dist/cjs/src/nodes/member/method.cjs.map +1 -1
  40. package/.dist/cjs/src/nodes/member/methodSignature.cjs.map +1 -1
  41. package/.dist/cjs/src/nodes/member/param.cjs.map +1 -1
  42. package/.dist/cjs/src/nodes/member/property.cjs.map +1 -1
  43. package/.dist/cjs/src/nodes/member/restParams.cjs.map +1 -1
  44. package/.dist/cjs/src/nodes/member/tupleMember.cjs.map +1 -1
  45. package/.dist/cjs/src/nodes/native/Iterable.cjs.map +1 -1
  46. package/.dist/cjs/src/nodes/native/map.cjs.map +1 -1
  47. package/.dist/cjs/src/nodes/native/nonSerializable.cjs.map +1 -1
  48. package/.dist/cjs/src/nodes/native/promise.cjs.map +1 -1
  49. package/.dist/cjs/src/nodes/native/set.cjs.map +1 -1
  50. package/.dist/cjs/src/run-types-pure-fns.cjs.map +1 -1
  51. package/.dist/cjs/src/types.cjs +1 -1
  52. package/.dist/cjs/src/types.d.ts +1 -0
  53. package/.dist/esm/src/constants.functions.js.map +1 -1
  54. package/.dist/esm/src/constants.js.map +1 -1
  55. package/.dist/esm/src/constants.kind.js.map +1 -1
  56. package/.dist/esm/src/createRunType.js.map +1 -1
  57. package/.dist/esm/src/createRunTypeFunctions.js.map +1 -1
  58. package/.dist/esm/src/lib/baseRunTypes.d.ts +0 -2
  59. package/.dist/esm/src/lib/baseRunTypes.js +1 -32
  60. package/.dist/esm/src/lib/baseRunTypes.js.map +1 -1
  61. package/.dist/esm/src/nodes/atomic/any.js.map +1 -1
  62. package/.dist/esm/src/nodes/atomic/bigInt.js.map +1 -1
  63. package/.dist/esm/src/nodes/atomic/boolean.js.map +1 -1
  64. package/.dist/esm/src/nodes/atomic/date.js.map +1 -1
  65. package/.dist/esm/src/nodes/atomic/enum.js.map +1 -1
  66. package/.dist/esm/src/nodes/atomic/enumMember.js.map +1 -1
  67. package/.dist/esm/src/nodes/atomic/literal.js.map +1 -1
  68. package/.dist/esm/src/nodes/atomic/never.js.map +1 -1
  69. package/.dist/esm/src/nodes/atomic/null.js.map +1 -1
  70. package/.dist/esm/src/nodes/atomic/number.js.map +1 -1
  71. package/.dist/esm/src/nodes/atomic/object.js.map +1 -1
  72. package/.dist/esm/src/nodes/atomic/regexp.js.map +1 -1
  73. package/.dist/esm/src/nodes/atomic/string.js.map +1 -1
  74. package/.dist/esm/src/nodes/atomic/symbol.js.map +1 -1
  75. package/.dist/esm/src/nodes/atomic/undefined.js.map +1 -1
  76. package/.dist/esm/src/nodes/atomic/unknown.js.map +1 -1
  77. package/.dist/esm/src/nodes/atomic/void.js.map +1 -1
  78. package/.dist/esm/src/nodes/collection/class.js.map +1 -1
  79. package/.dist/esm/src/nodes/collection/functionParams.js.map +1 -1
  80. package/.dist/esm/src/nodes/collection/interface.js +24 -4
  81. package/.dist/esm/src/nodes/collection/interface.js.map +1 -1
  82. package/.dist/esm/src/nodes/collection/intersection.js.map +1 -1
  83. package/.dist/esm/src/nodes/collection/tuple.js.map +1 -1
  84. package/.dist/esm/src/nodes/collection/union.js.map +1 -1
  85. package/.dist/esm/src/nodes/collection/unionDiscriminator.js.map +1 -1
  86. package/.dist/esm/src/nodes/function/function.js.map +1 -1
  87. package/.dist/esm/src/nodes/member/array.js.map +1 -1
  88. package/.dist/esm/src/nodes/member/callSignature.js.map +1 -1
  89. package/.dist/esm/src/nodes/member/genericMember.js.map +1 -1
  90. package/.dist/esm/src/nodes/member/indexProperty.js.map +1 -1
  91. package/.dist/esm/src/nodes/member/method.js.map +1 -1
  92. package/.dist/esm/src/nodes/member/methodSignature.js.map +1 -1
  93. package/.dist/esm/src/nodes/member/param.js.map +1 -1
  94. package/.dist/esm/src/nodes/member/property.js.map +1 -1
  95. package/.dist/esm/src/nodes/member/restParams.js.map +1 -1
  96. package/.dist/esm/src/nodes/member/tupleMember.js.map +1 -1
  97. package/.dist/esm/src/nodes/native/Iterable.js.map +1 -1
  98. package/.dist/esm/src/nodes/native/map.js.map +1 -1
  99. package/.dist/esm/src/nodes/native/nonSerializable.js.map +1 -1
  100. package/.dist/esm/src/nodes/native/promise.js.map +1 -1
  101. package/.dist/esm/src/nodes/native/set.js.map +1 -1
  102. package/.dist/esm/src/run-types-pure-fns.js.map +1 -1
  103. package/.dist/esm/src/types.d.ts +1 -0
  104. package/.dist/esm/src/types.js +1 -1
  105. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"constants.cjs","sources":["../../../src/constants.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\n// native javascript objects that are not serializable\nexport const nonSerializableClasses = [\n // TODO: decide what to do with native errors, they should be easily serializable\n Error,\n EvalError,\n RangeError,\n ReferenceError,\n SyntaxError,\n TypeError,\n URIError,\n AggregateError,\n // Promise, // Promise has it's own RunType\n // data types\n WeakMap,\n WeakSet,\n DataView,\n ArrayBuffer,\n SharedArrayBuffer,\n Float32Array,\n Float64Array,\n Int8Array,\n Int16Array,\n Int32Array,\n Uint8Array,\n Uint8ClampedArray,\n Uint16Array,\n Uint32Array,\n BigInt64Array,\n BigUint64Array,\n];\n\n// these are global objects that are not serializable.\n// values are repeated from nonSerializableClasses, as if they are classes or global object depends in typescript stn lib types and these can change\nexport const nonSerializableGlobals = [\n // TODO: decide what to do with native errors, they should be easily serializable\n 'Error',\n 'EvalError',\n 'RangeError',\n 'ReferenceError',\n 'SyntaxError',\n 'TypeError',\n 'URIError',\n 'AggregateError',\n // data types\n 'WeakMap',\n 'WeakSet',\n 'DataView',\n 'ArrayBuffer',\n 'SharedArrayBuffer',\n 'Float32Array',\n 'Float64Array',\n 'Int8Array',\n 'Int16Array',\n 'Int32Array',\n 'Uint8Array',\n 'Uint8ClampedArray',\n 'Uint16Array',\n 'Uint32Array',\n 'BigInt64Array',\n 'BigUint64Array',\n // bellow are common interface names from standard libraries, they added here but not tested\n 'Generator',\n 'GeneratorFunction',\n 'AsyncGenerator',\n 'Iterator',\n 'AsyncGeneratorFunction',\n 'AsyncIterator',\n];\n\n// typescript utility types\nexport const nativeUtilityStringTypes = ['Uppercase', 'Lowercase', 'Capitalize', 'Uncapitalize'];\n\n// other constants\nexport const validPropertyNameRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/;\nexport const maxStackErrorMessage =\n 'Max compilation nested level reached, either you have a very deeply nested type or there is an error related to circular references un the types.';\nexport const JIT_STACK_TRACE_MESSAGE = '\\nJIT runType trace => ';\nexport const MAX_UNION_ITEMS = 2 ** 16 - 1;\n"],"names":[],"mappings":";;AAQO,MAAM,yBAAyB;AAAA;AAAA,EAElC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;AAKG,MAAM,yBAAyB;AAAA;AAAA,EAElC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;;AAIG,MAAM,2BAA2B,CAAC,aAAa,aAAa,cAAc,cAAc;AAGxF,MAAM,0BAA0B;AAChC,MAAM,uBACT;AACG,MAAM,0BAA0B;AAChC,MAAM,kBAAkB,KAAK,KAAK;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.functions.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"constants.functions.cjs","sources":["../../../src/constants.functions.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 {type JitFnArgs, JIT_FUNCTION_IDS} from '@mionjs/core';\n\n/** Javascript code types */\nexport const CodeTypes = {\n expression: 'E', // single expression, that could be concatenated using js operators like + - * && || etc...\n statement: 'S', // one or multiple statements, that could be concatenated using ; to ensure correct syntax\n returnBlock: 'RB', // code block, it can not be concatenated with other code, it has an explicit return statement and needs to be wrapped in a function\n} as const;\nexport type CodeType = (typeof CodeTypes)[keyof typeof CodeTypes];\n\nexport interface JitFnSettings {\n id: string;\n name: string;\n /** dynamically imports a single compiler function that is capable of compiling any node\n * @see {@link ./jitCompilers/stringifyJson.ts#visitJsonStringify} as example of compiler function\n */\n import?: () => Promise<(...args: any[]) => any>;\n jitArgs: JitFnArgs;\n jitDefaultArgs: JitFnArgs;\n returnName: string;\n /**\n * When no initial vλl is required by the function.\n * This is typically used by deserializers, that do not transform the input value but create a new one from other params.\n * an the initial vλl is used as a variable initialization for the returned values.\n * ie binary deserialization\n */\n noInitialVλl?: true;\n runTimeOptions?: Record<string, {keyName: string; type: 'boolean' | 'number' | 'string'; defaultValue: any}>;\n /**\n * When set to true, the format code should replace the jit code for the function.\n * This is used when the format code is more efficient than the default code.\n */\n formatShouldReplaceJitCode?: true;\n} // list of available jit functions\n\n// variable names used in jit functions\n// JitUtils is passed with the name 'utl'. it is hardcoded in all jit code to avoid string interpolation\nexport const jitArgs = {vλl: 'v'} as const;\nexport const jitDefaultArgs = {vλl: ''} as const;\nexport const jitErrorArgs = {vλl: 'v', pλth: 'pth', εrr: 'er'} as const;\nexport const jitDefaultErrorArgs = {vλl: '', pλth: '[]', εrr: '[]'} as const;\nexport const jitArgsWithOptions = {vλl: 'v', θpts: 'opts'} as const;\nexport const jitDefaultArgsWithOptions = {vλl: '', θpts: '{}'} as const;\nexport const jitBinarySerializerArgs = {vλl: 'v', sεr: 'Ser'} as const; // vλl = js value to serialize ser = serializer,\nexport const jitBinaryDeserializerArgs = {vλl: 'ret', dεs: 'Des'} as const; // vλl is used as return variable ans is assigned the deserialized value, des = deserializer\nexport const jitDefaultBinarySerializerArgs = {vλl: '', sεr: ''} as const;\nexport const jitDefaultBinaryDeserializerArgs = {vλl: '', dεs: ''} as const;\n\n// ######## !IMPORTANT: ALL JIT FUNCTIONS IDs MUST BE UNIQUE and short ########\n\ntype JitFunctionsGroup = {[key: string]: JitFnSettings};\n\nexport const jitValidationFunctions = {\n isType: {\n id: JIT_FUNCTION_IDS.isType,\n name: 'isType',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n typeErrors: {\n id: JIT_FUNCTION_IDS.typeErrors,\n name: 'typeErrors',\n jitArgs: jitErrorArgs,\n jitDefaultArgs: jitDefaultErrorArgs,\n returnName: jitErrorArgs.εrr,\n },\n} as const satisfies JitFunctionsGroup;\n\nexport const jitSerializationFunctions = {\n prepareForJson: {\n id: JIT_FUNCTION_IDS.prepareForJson,\n name: 'prepareForJson',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n restoreFromJson: {\n id: JIT_FUNCTION_IDS.restoreFromJson,\n name: 'restoreFromJson',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n stringifyJson: {\n id: JIT_FUNCTION_IDS.stringifyJson,\n name: 'stringifyJson',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n // similar to json stringify but outputs js code, including pure functions, already imported as size is quite small\n toJSCode: {\n id: JIT_FUNCTION_IDS.toJSCode,\n name: 'toJSCode',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n // Binary serialization functions\n toBinary: {\n id: JIT_FUNCTION_IDS.toBinary,\n name: 'toBinary',\n jitArgs: jitBinarySerializerArgs,\n jitDefaultArgs: jitDefaultBinarySerializerArgs,\n // returns the serializer buffer\n returnName: jitBinarySerializerArgs.sεr,\n formatShouldReplaceJitCode: true,\n },\n fromBinary: {\n id: JIT_FUNCTION_IDS.fromBinary,\n name: 'fromBinary',\n jitArgs: jitBinaryDeserializerArgs,\n jitDefaultArgs: jitDefaultBinaryDeserializerArgs,\n // deserialized value is stored in vλl that is initially undefined\n returnName: jitBinaryDeserializerArgs.vλl,\n noInitialVλl: true,\n formatShouldReplaceJitCode: true,\n },\n // apply type formatters, ie: lowercase, uppercase, trim, etc\n format: {\n id: JIT_FUNCTION_IDS.format,\n name: 'format',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n} as const satisfies JitFunctionsGroup;\n\nexport const JitFunctions = {\n ...jitValidationFunctions,\n ...jitSerializationFunctions,\n unknownKeyErrors: {\n id: JIT_FUNCTION_IDS.unknownKeyErrors,\n name: 'unknownKeyErrors',\n jitArgs: jitErrorArgs,\n jitDefaultArgs: jitDefaultErrorArgs,\n returnName: jitErrorArgs.εrr,\n },\n hasUnknownKeys: {\n id: JIT_FUNCTION_IDS.hasUnknownKeys,\n name: 'hasUnknownKeys',\n jitArgs: jitArgsWithOptions,\n jitDefaultArgs: jitDefaultArgsWithOptions,\n runTimeOptions: {checkNonJitProps: {keyName: 'checkNonJitProps', type: 'boolean', defaultValue: false}},\n returnName: jitArgsWithOptions.vλl,\n },\n stripUnknownKeys: {\n id: JIT_FUNCTION_IDS.stripUnknownKeys,\n name: 'stripUnknownKeys',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n unknownKeysToUndefined: {\n id: JIT_FUNCTION_IDS.unknownKeysToUndefined,\n name: 'unknownKeysToUndefined',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n aux: {\n id: JIT_FUNCTION_IDS.aux,\n name: 'aux',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n // mock is not really a jit function but is used in a similar way, main difference is that it is not compiled\n mock: {\n id: JIT_FUNCTION_IDS.mock,\n name: 'mockType',\n import: () => import('./mocking/mockType.ts').then((m) => m.mockType),\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n // pure function are not jit compiled but we ensure we reserve a prefix to avoid collisions\n pureFunction: {\n id: JIT_FUNCTION_IDS.pureFunction,\n name: 'pureFunction',\n jitArgs,\n jitDefaultArgs,\n returnName: jitArgs.vλl,\n },\n} as const satisfies JitFunctionsGroup;\n\nexport const jitFunctionList: JitFnSettings[] = Object.values(JitFunctions);\nexport const jitFunct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;AAAA,IACd,IAAIA,KAAAA,iBAAiB;AAAA,IACrB,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,YAAY,QAAQ;AAAA,EAAA;AAAA,EAExB,wBAAwB;AAAA,IACpB,IAAIA,KAAAA,iBAAiB;AAAA,IACrB,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,YAAY,QAAQ;AAAA,EAAA;AAAA,EAExB,KAAK;AAAA,IACD,IAAIA,KAAAA,iBAAiB;AAAA,IACrB,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,YAAY,QAAQ;AAAA,EAAA;AAAA;AAAA,EAGxB,MAAM;AAAA,IACF,IAAIA,KAAAA,iBAAiB;AAAA,IACrB,MAAM;AAAA,IACN,QAAQ,MAAM,QAAA,QAAA,EAAA,KAAA,MAAA,QAAO,wBAAuB,CAAA,EAAE,KAAI,aAAC,CAAC,MAAM,EAAE,UAAQ,CAAA,KAAA,IAAA,SAAA,CAAA,CAAA;AAAA,IACpE;AAAA,IACA;AAAA,IACA,YAAY,QAAQ;AAAA,EAAA;AAAA;AAAA,EAGxB,cAAc;AAAA,IACV,IAAIA,KAAAA,iBAAiB;AAAA,IACrB,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA,YAAY,QAAQ;AAAA,EAAA;;AAIrB,MAAM,kBAAmC,OAAO,OAAO,YAAY;AACnE,MAAM,mBAAmB,OAAO,YAAY,gBAAgB,IAAG,aAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,GAAC,CAAA,KAAA,IAAA,SAAA,CAAA,CAAA,CAAC;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.kind.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"constants.kind.cjs","sources":["../../../src/constants.kind.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {ReflectionKind} from '@deepkit/type';\nimport {RunType} from './types.ts';\n\nexport const ReflectionKindName: {[key: number]: keyof typeof ReflectionKind} = {\n 0: 'never',\n 1: 'any',\n 2: 'unknown',\n 3: 'void',\n 4: 'objectLiteral', // name was changed from deepkit's 'object' to 'objectLiteral'\n 5: 'string',\n 6: 'number',\n 7: 'boolean',\n 8: 'symbol',\n 9: 'bigint',\n 10: 'null',\n 11: 'undefined',\n 12: 'regexp',\n 13: 'literal',\n 14: 'templateLiteral',\n 15: 'property',\n 16: 'method',\n 17: 'function',\n 18: 'parameter',\n 19: 'promise',\n 20: 'class',\n 21: 'typeParameter',\n 22: 'enum',\n 23: 'union',\n 24: 'intersection',\n 25: 'array',\n 26: 'tuple',\n 27: 'tupleMember',\n 28: 'enumMember',\n 29: 'rest',\n 30: 'object', // name was changed from deepkit's 'objectLiteral' to 'object' for better error messages\n 31: 'indexSignature',\n 32: 'propertySignature',\n 33: 'methodSignature',\n 34: 'infer',\n 35: 'callSignature',\n};\n\n// ReflectionKind from deepkit is extended with the following sub kinds\nexport const ReflectionSubKind = {\n // group of sub-kinds that extends ReflectionKind.class\n date: 20_01,\n map: 20_02,\n set: 20_03,\n nonSerializable: 20_04,\n\n params: 17_01,\n mapKey: 18_01,\n mapValue: 18_02,\n setItem: 18_03,\n} as const;\n\nexport const ReflectionSubNames: {[key: number]: keyof typeof ReflectionSubKind} = {\n 20_01: 'date',\n 20_02: 'map',\n 20_03: 'set',\n 17_01: 'params',\n} as const;\n\nexport type AnyKindName = keyof typeof ReflectionKind | keyof typeof ReflectionSubKind;\n\nexport function getReflectionName(rt: RunType): AnyKindName {\n if (rt.src.subKind) return ReflectionSubNames[rt.src.subKind];\n return ReflectionKindName[rt.src.kind];\n}\n"],"names":[],"mappings":";;;;AAUO,MAAM,qBAAmE;AAAA,EAC5E,GAAG;AAAA,EACH,GAAG;A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"createRunType.cjs","sources":["../../../src/createRunType.ts"],"sourcesContent":["/* eslint-disable no-case-declarations */\n/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {RunType, Mutable, SrcType} from './types.ts';\nimport type {BaseRunType} from './lib/baseRunTypes.ts';\nimport type {TypeClass, Type} from '@deepkit/type';\nimport {ReflectionKind, resolveReceiveType, ReceiveType, reflect, typeAnnotation, stringifyType} from '@deepkit/type';\nimport {\n hasArguments,\n hasExtendsArguments,\n hasImplements,\n hasIndexType,\n hasParameters,\n hasReturn,\n hasType,\n hasTypes,\n isNativeUtilityStringTypes,\n isNonSerializableClass,\n isNonSerializableObject,\n} from './lib/guards.ts';\nimport {StringRunType} from './nodes/atomic/string.ts';\nimport {DateRunType} from './nodes/atomic/date.ts';\nimport {NumberRunType} from './nodes/atomic/number.ts';\nimport {BooleanRunType} from './nodes/atomic/boolean.ts';\nimport {NullRunType} from './nodes/atomic/null.ts';\nimport {BigIntRunType} from './nodes/atomic/bigInt.ts';\nimport {AnyRunType} from './nodes/atomic/any.ts';\nimport {UndefinedRunType} from './nodes/atomic/undefined.ts';\nimport {UnknownRunType} from './nodes/atomic/unknown.ts';\nimport {VoidRunType} from './nodes/atomic/void.ts';\nimport {ArrayRunType} from './nodes/member/array.ts';\nimport {LiteralRunType} from './nodes/atomic/literal.ts';\nimport {RegexpRunType} from './nodes/atomic/regexp.ts';\nimport {NeverRunType} from './nodes/atomic/never.ts';\nimport {EnumRunType} from './nodes/atomic/enum.ts';\nimport {EnumMemberRunType} from './nodes/atomic/enumMember.ts';\nimport {UnionRunType} from './nodes/collection/union.ts';\nimport {TupleRunType} from './nodes/collection/tuple.ts';\nimport {FunctionParamsRunType} from './nodes/collection/functionParams.ts';\nimport {TupleMemberRunType} from './nodes/member/tupleMember.ts';\nimport {InterfaceRunType} from './nodes/collection/interface.ts';\nimport {PropertyRunType} from './nodes/member/property.ts';\nimport {IndexSignatureRunType} from './nodes/member/indexProperty.ts';\nimport {MethodSignatureRunType} from './nodes/member/methodSignature.ts';\nimport {CallSignatureRunType} from './nodes/member/callSignature.ts';\nimport {FunctionRunType} from './nodes/function/function.ts';\nimport {PromiseRunType} from './nodes/native/promise.ts';\nimport {ObjectRunType} from './nodes/atomic/object.ts';\nimport {IntersectionRunType} from './nodes/collection/intersection.ts';\nimport {ParameterRunType} from './nodes/member/param.ts';\nimport {MethodRunType} from './nodes/member/method.ts';\nimport {RestParamsRunType} from './nodes/member/restParams.ts';\nimport {ClassRunType} from './nodes/collection/class.ts';\nimport {MapRunType} from './nodes/native/map.ts';\nimport {ReflectionSubKind} from './constants.kind.ts';\nimport {SetRunType} from './nodes/native/set.ts';\nimport {SymbolRunType} from './nodes/atomic/symbol.ts';\nimport {NonSerializableRunType} from './nodes/native/nonSerializable.ts';\nimport {registerErrorDeserializers} from '@mionjs/core';\n\nexport function runType<T>(type?: ReceiveType<T>): RunType {\n const start = Date.now();\n const src = resolveReceiveType(type) as SrcType;\n const took0 = Date.now() - start;\n createRunTypes(src);\n const took1 = Date.now() - start;\n const diff = took1 - took0;\n // max RunType overhead 60 ms\n if (diff > 60) console.warn(`RunType overhead is very long: ${diff}ms for ${stringifyType(src)}`);\n return src._rt;\n}\n\nexport function reflectFunction<Fn extends (...args: any[]) => any>(fn: Fn): FunctionRunType {\n const src = reflect(fn) as SrcType;\n runType(src);\n return src._rt as FunctionRunType;\n}\n\n// We need to traverse all possible associated nodes to create all the runTypes\nfunction createRunTypes(src: SrcType): void {\n registerErrorDeserializers();\n const stack: Type[] = [src];\n\n while (stack.length > 0) {\n const current = stack.pop();\n if (!current || (current as SrcType)._rt) continue;\n\n try {\n createRunType(current as Mutable<SrcType>);\n } catch (error) {\n const typesStackMessage = '\\nTypes Stack: ' + stack.map((t) => t.typeName || t.kind).join(', ');\n (error as Error).message += typesStackMessage;\n throw error;\n }\n\n // single child type nodes\n if (hasType(current)) stack.push(current.type);\n if (hasReturn(current)) stack.push(current.return);\n if (hasIndexType(current)) stack.push(current.indexType);\n if (current.origin) stack.push(current.origin);\n if (current.indexAccessOrigin?.index) stack.push(current.indexAccessOrigin?.index);\n if (current.indexAccessOrigin?.container) stack.push(current.indexAccessOrigin?.container);\n\n // multiple child type nodes\n if (hasTypes(current)) pushToStack(current.types, stack);\n if (hasParameters(current)) pushToStack(current.parameters, stack);\n if (hasArguments(current)) pushToStack(current.arguments, stack);\n if (hasExtendsArguments(current)) pushToStack(current.extendsArguments, stack);\n if (hasImplements(current)) pushToStack(current.implements, stack);\n if (current.typeArguments) pushToStack(current.typeArguments, stack);\n if (current.decorators) pushToStack(current.decorators, stack);\n if (current.scheduleDecorators) pushToStack(current.scheduleDecorators, stack);\n\n // annotations\n if (current.annotations) {\n const annotations = typeAnnotation.getAnnotations(current);\n for (const annotation of annotations) stack.push(annotation.options);\n }\n\n // originTypes\n current.originTypes?.forEach((ot) => {\n if (ot.typeArguments) pushToStack(ot.typeArguments, stack);\n });\n\n // sometimes parent is an orphan so we need to explicitly add it to the stack\n if (current.parent && !(current.parent as SrcType)?._rt) stack.push(current.parent);\n }\n}\n\nfunction pushToStack(subTypes: Type[], stack: Type[]) {\n if (Array.isArray(subTypes)) stack.push(...subTypes);\n}\n\nfunction createRunType(deepkitType: Mutable<SrcType>): RunType {\n // console.log('deepkitType', deepkitType);\n\n /*\n RunType reference is stored in the deepkitType._runType so we can access both the deepkitType and the mion RunType,\n basically every runType stores a reference to a deepkit type and vice versa.\n This also relies on deepkit handling circular types to prevent infinite loop when we are generating RunTypes.\n */\n const existingType: RunType | undefined = deepkitType._rt;\n // TODO: IMPORTANT: seems like deepkit can generate multiple types objects for the same type, so we need to handle this\n // we are attaching the runType to the deepkit type (deepkitType._runType), to link the two types together\n // but as deepkit can generate multiple types that means existingType will be null and the markAsCircular function is not working as expected\n if (existingType) return existingType;\n\n let rt: BaseRunType;\n\n switch (deepkitType.kind) {\n // ###################### ATOMIC RUNTYPES ######################\n // Primitive types and other atomic types that don't contain other types\n case ReflectionKind.any:\n rt = new AnyRunType();\n break;\n case ReflectionKind.bigint:\n rt = new BigIntRunType();\n break;\n case ReflectionKind.boolean:\n rt = new BooleanRunType();\n break;\n case ReflectionKind.enum:\n rt = new EnumRunType();\n break;\n case ReflectionKind.enumMember:\n // enum members are resolved by the enum type, so this is not expected to be called\n rt = new EnumMemberRunType();\n break;\n case ReflectionKind.literal:\n rt = new LiteralRunType();\n break;\n case ReflectionKind.never:\n // TODO add the string format feature\n rt = isNativeUtilityStringTypes(deepkitType) ? new StringRunType() : new NeverRunType();\n break;\n case ReflectionKind.null:\n rt = new NullRunType();\n break;\n case ReflectionKind.number:\n rt = new NumberRunType();\n break;\n case ReflectionKind.object:\n rt = new ObjectRunType();\n break;\n case ReflectionKind.regexp:\n rt = new RegexpRunType();\n break;\n case ReflectionKind.string:\n rt = new StringRunType();\n break;\n case ReflectionKind.symbol:\n rt = new SymbolRunType();\n break;\n case ReflectionKind.templateLiteral:\n // deepkit automatically resolves template literals unions to literals\n // this is only called when you define the type of a template literal i.e: type T = `foo${string}`;\n // this is not supported at the moment but would be useful for type safe urls etc\n throw new Error(\n 'Template Literals are resolved by the compiler to Literals ie: const tl = `${string}World`. Template literal types are not supported. ie type TL = `${string}World`'\n );\n case ReflectionKind.undefined:\n rt = new UndefinedRunType();\n break;\n case ReflectionKind.unknown:\n rt = new UnknownRunType();\n break;\n case ReflectionKind.void:\n rt = new VoidRunType();\n break;\n\n // ###################### MEMBER RUNTYPES ######################\n // Types that represent members of collections or other structures\n case ReflectionKind.array:\n rt = new ArrayRunType();\n break;\n case ReflectionKind.callSignature:\n rt = new CallSignatureRunType();\n break;\n case ReflectionKind.function:\n if (deepkitType.subKind === ReflectionSubKind.params) {\n rt = new FunctionParamsRunType();\n } else {\n const frt = new FunctionRunType();\n // TODO review an change how we compile function parameters and return type\n // those should also be jit functions, no need to check for array\n // and maybe add option to target individual parameters\n (frt.parameterRunTypes as Mutable<RunType>).src = deepkitType;\n rt = frt;\n }\n break;\n case ReflectionKind.indexSignature:\n rt = new IndexSignatureRunType();\n break;\n case ReflectionKind.method:\n rt = new MethodRunType();\n break;\n case ReflectionKind.methodSignature:\n rt = new MethodSignatureRunType();\n break;\n case ReflectionKind.parameter:\n rt = new ParameterRunType();\n break;\n case ReflectionKind.property:\n case ReflectionKind.propertySignature:\n rt = new PropertyRunType();\n break;\n case ReflectionKind.rest:\n rt = new RestParamsRunType();\n break;\n case ReflectionKind.tupleMember:\n rt = new TupleMemberRunType();\n break;\n case ReflectionKind.promise:\n rt = new PromiseRunType();\n break;\n\n // ###################### COLLECTION RUNTYPES ######################\n case ReflectionKind.objectLiteral:\n if (isNonSerializableObject(deepkitType)) {\n rt = new NonSerializableRunType();\n } else {\n rt = new InterfaceRunType();\n }\n break;\n case ReflectionKind.class:\n rt = initClassRunType(deepkitType);\n break;\n // Types that contain other types as members\n case ReflectionKind.infer:\n throw new Error(\n 'Infer type not supported, ie: type MyType =Type<T> = T extends (...args: any[]) => infer R ? R : any; https://www.typescriptlang.org/docs/handbook/2/conditional-types.html'\n );\n\n case ReflectionKind.intersection:\n rt = new IntersectionRunType();\n break;\n\n case ReflectionKind.tuple:\n rt = new TupleRunType();\n break;\n case ReflectionKind.typeParameter:\n throw new Error(\n 'TypeParameter not implemented. Type parameters are the generic placeholders in type definitions (e.g., T in Array<T>, ErrType in TypedError<ErrType>). ' +\n 'Type parameters are typically resolved during type instantiation and should not appear in runtime type checking.' +\n 'This error is typically caused by a generic type missing type arguments, e.g.: TypedError instead of TypedError<\"my-error\">.'\n );\n // rType = resolveTypeParameter(deepkitType, opts, mapper);\n case ReflectionKind.union:\n rt = new UnionRunType();\n break;\n default:\n rt = new AnyRunType();\n break;\n }\n rt.onCreated(deepkitType);\n // console.log('rt', rt);\n return rt;\n}\n\nfunction initClassRunType(src: TypeClass & {subKind?: number}): BaseRunType {\n switch (src.classType) {\n case Date:\n src.subKind = ReflectionSubKind.date;\n return new DateRunType();\n case Map:\n src.subKind = ReflectionSubKind.map;\n return new MapRunType();\n case Set:\n src.subKind = ReflectionSubKind.set;\n return new SetRunType();\n default:\n if (isNonSerializableClass(src)) {\n src.subKind = ReflectionSubKind.nonSerializable;\n return new NonSerializableRunType();\n }\n return new ClassRunType();\n }\n}\n"],"names":["type","resolveReceiveType","stringifyType","reflect","registerErrorDeserializers","hasType","hasReturn","hasIndexType","hasTypes","hasParameters","hasArguments","hasExtendsArguments","hasImplements","typeAnnotation","ReflectionKind","AnyRunType","BigIntRunType","BooleanRunType","EnumRunType","EnumMemberRunType","LiteralRunType","isNativeUtilityStringTypes","StringRunType","NeverRunType","NullRunType","NumberRunType","ObjectRunType","RegexpRunType","SymbolRunType","UndefinedRunType","UnknownRunType","VoidRunType","ArrayRunType","CallSignatureRunType","ReflectionSubKind","FunctionParamsRunType","FunctionRunType","IndexSignatureRunType","MethodRunType","MethodSignatureRunType","ParameterRunType","PropertyRunType","RestParamsRunType","TupleMemberRunType","PromiseRunType","isNonSerializableObject","NonSerializableRunType","InterfaceRunType","IntersectionRunType","TupleRunType","UnionRunType","DateRunType","MapRunType","SetRunType","isNonSerializableClass","ClassRunType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiEM,SAAU,QAAWA,SAAX,QAAO,IAAA,CAAA,GAAyB;AAAhC,UAAO,IAAA;AACnB,QAAM,QAAQ,KAAK,IAAA;AACnB,QAAM,MAAMC,KAAAA,mBAAmBD,MAAI;AACnC,QAAM,QAAQ,KAAK,IAAA,IAAQ;AAC3B,iBAAe,GAAG;AAClB,QAAM,QAAQ,KAAK,IAAA,IAA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,KAAAA,eAAe;AAChB,WAAK,IAAIoC,2BAAAA,aAAA;AACT;AAAA,IACJ;AACI,WAAK,IAAInC,qBAAAA,WAAA;AACT;AAAA,EAAA;AAER,KAAG,UAAU,WAAW;AAExB,SAAO;AACX;;AAEA,SAAS,iBAAiB,KAAmC;AACzD,UAAQ,IAAI,WAAA;AAAA,IACR,KAAK;AACD,UAAI,UAAUmB,mBAAAA,kBAAkB;AAChC,aAAO,IAAIiB,sBAAAA,YAAA;AAAA,IACf,KAAK;AACD,UAAI,UAAUjB,mBAAAA,kBAAkB;AAChC,aAAO,IAAIkB,qBAAAA,WAAA;AAAA,IACf,KAAK;AACD,UAAI,UAAUlB,mBAAAA,kBAAkB;AAChC,aAAO,IAAImB,qBAAAA,WAAA;AAAA,IACf;AACI,UAAIC,eAAAA,uBAAuB,GAAG,GAAG;AAC7B,YAAI,UAAUpB,mBAAAA,kBAAkB;AAChC,eAAO,IAAIY,iCAAAA,uBAAA;AAAA,MACf;AACA,aAAO,IAAIS,2BAAAA,aAAA;AAAA,EAAY;AAEnC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"createRunTypeFunctions.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"createRunTypeFunctions.cjs","sources":["../../../src/createRunTypeFunctions.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 {JitFunctions} from './constants.functions.ts';\nimport {ReceiveType} from '@deepkit/type';\nimport {runType} from './createRunType.ts';\nimport {RunTypeOptions} from './types.ts';\nimport {\n FromBinaryFn,\n IsTypeFn,\n JsonStringifyFn,\n PrepareForJsonFn,\n RestoreFromJsonFn,\n ToBinaryFn,\n ToCodeFn,\n TypeErrorsFn,\n} from '@mionjs/core';\nimport {BaseRunType} from './lib/baseRunTypes.ts';\nimport {registerJitFunctionCompiler} from './lib/jitFnsRegistry.ts';\n\n// All these functions are async because they might need to compile the jit function first\n// At the moment they are compiled synchronously, but in the future they might be async\n// Also some the src code to compile or functionality of the JIT functions might be loaded dynamically\n// ie: mocking functionality is loaded only when mockTypeFn is called\n\n/** Returns a function that checks if the given value is of the specified type. */\nexport async function createIsTypeFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): Promise<IsTypeFn> {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.isType, opts);\n}\n\n/** Returns a function that get Type error data. */\nexport async function createTypeErrorsFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): Promise<TypeErrorsFn> {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.typeErrors, opts);\n}\n\n/**\n * Returns a function that prepares a javascript type to be compatible with json.stringify.\n * Allows json.stringify special types like dates, bigints, maps, set, etc... that are not supported by json.stringify\n */\nexport async function createPrepareForJsonFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): Promise<PrepareForJsonFn> {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.prepareForJson, opts);\n}\n\n/**\n * Returns a function that restores a javascript type from json.parse.\n * Allows restoring special types like dates, bigints, maps, set, etc... that are not supported by json.parse\n * */\nexport async function createRestoreFromJsonFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): Promise<RestoreFromJsonFn> {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.restoreFromJson, opts);\n}\n\n/**\n * Returns a function that stringifies a javascript value to a json string.\n * Stringifies special types like dates, bigints, maps, set, etc...\n * Is equivalent to calling prepareForJson and then json.stringify but more efficient.\n */\nexport async function createStringifyJsonFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): Promise<JsonStringifyFn> {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.stringifyJson, opts);\n}\n\n/** Returns a function that serializes any type value to a binary format. */\nexport async function createToBinaryFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): Promise<ToBinaryFn> {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.toBinary, opts);\n}\n\n/** Returns a function that deserializes a binary value to the specified type. */\nexport async function createFromBinaryFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): Promise<FromBinaryFn> {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.fromBinary, opts);\n}\n\n/** Returns a function that converts a value to javascript code, including set etc */\nexport function createToJavascriptFn<T>(opts?: RunTypeOptions, type?: ReceiveType<T>): ToCodeFn {\n const rt = runType(type);\n return rt.createJitFunction(JitFunctions.toJSCode, opts);\n}\n\n/** Returns a function that mocks a value of the specified type. */\nexport async function createMockTypeFn<T>(type?: ReceiveType<T>): Promise<(opts?: Partial<RunTypeOptions>) => T> {\n const rt = runType(type) as BaseRunType;\n await registerJitFunctionCompiler(JitFunctions.mock);\n return (opts?: Partial<RunTypeOptions>) => rt.mockType(opts) as T;\n}\n"],"names":["type","runType","JitFunctions","registerJitFunctionCompiler","__ΩRunTypeOptions"],"mappings":";;;;;;;;;;;;;AA8BA,eAAsB,eAAkB,MAAuBA,QAAzC,eAAc,IAAA,CAAA,GAAgD;AAA9D,iBAAc,IAAA;AAChC,QAAM,KAAKC,kBAAAA,QAAQD,KAAI;AACvB,SAAO,GAAG,kBAAkBE,qCAAa,QAAQ,IAAI;AACxD;;AAGD,eAAsB,mBAAsB,MAAuBF,QAA7C,mBAAkB,IAAA,CAAA,GAAgD;AAAlE,qBAAkB,IAAA;AACpC,QAAM,KAAKC,kBAAAA,QAAQD,KAAI;AACvB,SAAO,GAAG,kBAAkBE,qCAAa,YAAY,IAAI;AAC5D;;AAMD,eAAsB,uBAA0B,MAAuBF,QAAjD,uBAAsB,IAAA,CAAA,GAAgD;AAAtE,yBAAsB,IAAA;AACxC,QAAM,KAAKC,kBAAAA,QAAQD,KAAI;AACvB,SAAO,GAAG,kBAAkBE,qCAAa,gBAAgB,IAAI;AAChE;;AAMD,eAAsB,wBAA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2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const core = require("@mionjs/core");
4
- const src_constants = require("../constants.cjs");
5
4
  const src_constants_functions = require("../constants.functions.cjs");
6
5
  const type = require("@deepkit/type");
7
6
  const src_lib_utils = require("./utils.cjs");
@@ -206,22 +205,6 @@ class CollectionRunType extends BaseRunType {
206
205
  const codes = this.getJitChildren(comp).map((c) => comp.compileUnknownKeysToUndefined(c, S).code).filter((code) => !!code);
207
206
  return { code: codes.join(";"), type: S };
208
207
  }
209
- getChildrenTypeID = src_lib_utils.memorize((stack = []) => {
210
- if (stack.length > core.MAX_STACK_DEPTH) throw new Error(src_constants.maxStackErrorMessage);
211
- const circularJitConf = this.checkIsCircularAndGetRefId(stack);
212
- if (circularJitConf) return circularJitConf;
213
- stack.push(this);
214
- const childrenIds = [];
215
- const children = this.getChildRunTypes();
216
- for (const child of children) {
217
- childrenIds.push(child.getTypeID());
218
- }
219
- const isArray = this.src.kind === type.ReflectionKind.tuple || this.src.kind === type.ReflectionKind.array;
220
- const groupID = isArray ? `[${childrenIds.join(",")}]` : `{${childrenIds.join(",")}}`;
221
- const kind = this.src.subKind || this.src.kind;
222
- stack.pop();
223
- return `${kind}${groupID}`;
224
- });
225
208
  }
226
209
  class MemberRunType extends BaseRunType {
227
210
  /** used to compile json stringify */
@@ -286,20 +269,6 @@ class MemberRunType extends BaseRunType {
286
269
  if (!code?.code) return { code: void 0, type: S };
287
270
  return code;
288
271
  }
289
- getMemberTypeID = src_lib_utils.memorize((stack = []) => {
290
- if (stack.length > core.MAX_STACK_DEPTH) throw new Error(src_constants.maxStackErrorMessage);
291
- const optional = this.isOptional() ? "?" : "";
292
- const kind = this.src.name?.toString() || this.src.index?.kind || this.src.subKind || this.src.kind;
293
- const kindID = `${kind}${optional}`;
294
- const circularJitConf = this.checkIsCircularAndGetRefId(stack);
295
- if (circularJitConf) return `${kindID}:${circularJitConf}`;
296
- stack.push(this);
297
- const member = this.getMemberType();
298
- const memberTypeID = member.getTypeID();
299
- const typeID = `${kindID}:${memberTypeID}`;
300
- stack.pop();
301
- return typeID;
302
- });
303
272
  }
304
273
  exports.AtomicRunType = AtomicRunType;
305
274
  exports.BaseRunType = BaseRunType;
@@ -1 +1 @@
1
- {"version":3,"file":"baseRunTypes.cjs","sources":["../../../../src/lib/baseRunTypes.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\nimport {MAX_STACK_DEPTH, JitCompiledFn, createUniqueHash, getJitUtils, getENV} from '@mionjs/core';\nimport type {\n RunType,\n Mutable,\n RunTypeChildAccessor,\n JitFnID,\n SrcType,\n SrcCollection,\n CustomVλl,\n JitFn,\n JitCode,\n RunTypeOptions,\n StrNumber,\n DeepPartial,\n RunTypeFamily,\n} from '../types.ts';\nimport type {mockType} from '../mocking/mockType.ts';\nimport {maxStackErrorMessage} from '../constants.ts';\nimport {type CodeType, JitFunctions, CodeTypes} from '../constants.functions.ts';\nimport {ReflectionKind, stringifyType} from '@deepkit/type';\nimport type {TypeIndexSignature, TypeProperty, Type} from '@deepkit/type';\nimport {getPropIndex, memorize} from './utils.ts';\nimport {createJitCompiler, MockJitCompiler} from './jitFnCompiler.ts';\nimport {getJITFnHash} from './createJitFunction.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from './jitFnCompiler.ts';\nimport {type AnyKindName, getReflectionName} from '../constants.kind.ts';\nimport {initFormatAnnotations} from './formats.ts';\nimport {createTypeId} from './typeId.ts';\nimport {getJitFunctionCompiler, registerJitFunctionCompiler} from './jitFnsRegistry.ts';\nimport {defaultMockOptions} from '../mocking/constants.mock.ts';\n\nconst RB = CodeTypes.returnBlock;\nconst S = CodeTypes.statement;\nconst E = CodeTypes.expression;\n\nexport abstract class BaseRunType<T extends Type = Type> implements RunType {\n isCircular?: boolean;\n readonly src: SrcType<T> = null as any; // real value will be set after construction by the createRunType function\n abstract getFamily(): RunTypeFamily; // Atomic, Collection, Member, Function\n /**\n * This single functions controls whether or not the code for a type should be inlined into the parent function\n * or should create a separate jit function for it, add as a dependency and call it.\n * @returns\n */\n isJitInlined = (): boolean => {\n // if is circular, always create a separate jit function as need to self invoke\n if (this.isCircular) return false;\n if (getENV('DEBUG_JIT') === 'INLINED') return true;\n // all array are self invoked for isType and are usually repeated type like string[] or number[] so worth deduplicating\n if (this.src.kind === ReflectionKind.array) return false;\n // collection with name might be used in different places so worth deduplicating\n if (this.src.typeName && this.getFamily() === 'C') return false;\n return true;\n };\n getKindName = memorize((): AnyKindName => getReflectionName(this));\n getTypeName = (): string => this.src.typeName || this.getKindName();\n stringify = memorize((): string => stringifyType(this.src));\n skipJit(comp: JitFnCompiler): boolean {\n return false;\n }\n /** Returns the format portion of the type ID (cached in src._formatId), or undefined if no format. */\n getFormatTypeID(): string | undefined {\n // _formatId is cached by computeDeepkitFormatID during getDeepkitTypeId call\n // Empty string means no format, undefined means not computed yet\n const formatId = (this.src as any)._formatId;\n return formatId || undefined;\n }\n /** Returns the type ID which is cached in src._typeId by getDeepkitTypeId(). Format ID is already included. */\n getTypeID(): StrNumber {\n if (this.src._typeId === undefined) {\n throw new Error(`Missing cached type ID for ${this.getTypeName()}. Ensure getDeepkitTypeId() has been called.`);\n }\n return this.src._typeId;\n }\n getJitHash(opts: RunTypeOptions): string {\n const optsCopy = {...opts};\n // remove mock options as not relevant for jit functionality\n if (optsCopy.mock) delete optsCopy.mock;\n return createUniqueHash(this.getTypeID().toString() + JSON.stringify(optsCopy));\n }\n getParent = (): BaseRunType | undefined => (this.src.parent as SrcType)?._rt as BaseRunType;\n checkIsCircularAndGetRefId(stack: RunType[] = []): StrNumber | undefined {\n const inStackIndex = stack.findIndex((rt) => {\n if (rt === this) return true;\n // some nodes seems to be different objects in memory but are the same id, so we check by id as well\n return rt.src.id && this.src.id && rt.src.id === this.src.id;\n }); // cant use isSameJitType because it uses getTypeID and would loop forever\n const inStackSrcId = stack.findIndex((rt) => rt.src.id && this.src.id && rt.src.id === this.src.id);\n const isInStack = inStackIndex >= 0; // recursive reference\n if (isInStack) {\n this.isCircular = true;\n const name = this.src.typeName || ''; // todo: not sure if all the circular references will have a name\n const refId = '$' + this.src.kind + `_${inStackIndex}` + name; // ensures different circular types have different typeID\n return refId;\n }\n return undefined;\n }\n /**\n * Method that should be called Immediately after the RunType gets created to link the SrcType and RunType.\n * This is more flexible than passing params to the constructor helps to avoid circular dependencies, etc.\n * */\n onCreated(src: SrcType<any>): void {\n (this as Mutable<RunType>).src = src;\n (src as Mutable<SrcType>)._rt = this;\n initFormatAnnotations(this);\n // Cache the type ID on the src object - this includes format information\n createTypeId(src);\n }\n /**\n * Some elements might need a standalone name variable that ignores the vλl value of the parents.\n * returns a variable that is being compiled, ignores the parents variable names */\n getCustomVλl(comp: JitFnCompiler): CustomVλl | undefined {\n return undefined;\n }\n /**\n * Some elements might need a custom static path to be able to reference the source of an error.\n * ie: when validating a Map we need to differentiate if the value that failed is the key or the value of a map's entry.\n */\n getStaticPathLiteral(comp: JitFnCompiler): string | number | undefined {\n return undefined;\n }\n\n // ########## Mock ##########\n\n async mock(opts?: DeepPartial<RunTypeOptions>): Promise<any> {\n // although the mock function is not jit, it is also stored in the registry\n // this is because we don't want to load mock related functionality if not needed\n await registerJitFunctionCompiler(JitFunctions.mock);\n return this.mockType(opts);\n }\n\n /** synchronous version of mock, throws an error if the mock function has not been loaded */\n mockType(opts: DeepPartial<RunTypeOptions> = {}): any {\n const mockFn = getJitFunctionCompiler(JitFunctions.mock) as typeof mockType;\n if (!mockFn)\n throw new Error(\n `Function ${JitFunctions.mock.name} has not been loaded. make sure you have called loadJitCompilerFunction(JitFunctions.mock) before calling mockType.`\n );\n const fnID = JitFunctions.mock.id;\n // options sent to the compiler will be set to empty as mock options are handled separately from the compiler\n const mockingOpts = {...opts, mock: {...defaultMockOptions, ...(opts.mock || {})}} as RunTypeOptions;\n const hash = getJITFnHash(fnID, this, mockingOpts);\n const comp = new MockJitCompiler(this, mockingOpts, undefined, hash, this.getTypeID());\n return mockFn(this, comp);\n }\n\n // ########## Create Jit Functions ##########\n\n createJitFunction = (jitFn: JitFn, opts: RunTypeOptions = {}): ((...args: any[]) => any) => {\n return this.createJitCompiledFunction(jitFn.id, undefined, opts).fn;\n };\n\n createJitCompiledFunction(fnID: JitFnID, parentCop?: JitFnCompiler, opts: RunTypeOptions = {}): JitCompiledFn {\n const fnHash = getJITFnHash(fnID, this, opts);\n const jitCompiled = getJitUtils().getJIT(fnHash);\n if (jitCompiled) {\n if (getENV('DEBUG_JIT') === 'VERBOSE')\n console.log(`\\x1b[32m Using cached function: ${jitCompiled.jitFnHash} \\x1b[0m`);\n return jitCompiled;\n }\n const newJitCompiler: JitFnCompiler = createJitCompiler(\n this,\n fnID,\n parentCop,\n undefined,\n undefined,\n opts\n ) as JitFnCompiler;\n try {\n const codeType = this.getFamily() === 'A' ? E : S;\n newJitCompiler.compile(this, codeType, fnID);\n newJitCompiler.createJitFunction();\n } catch (e: any) {\n // if something goes wrong during compilation we want to remove the compiler from\n // the cache as this is automatically added to jitUtils cache during compilation\n newJitCompiler.removeFromJitCache();\n // TODO: we need to print the full path to the type that is causing the error\n // for this ideally we should add a parent Compiler and print the trace only from the root\n if (typeof e?.message === 'string' && !newJitCompiler.hasStackTrace(e.message))\n e.message += newJitCompiler.getStackTrace();\n throw e;\n }\n return newJitCompiler as JitCompiledFn;\n }\n\n // ########## emit Methods that generates src code ##########\n\n abstract emitIsType(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitTypeErrors(comp: JitErrorsFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitHasUnknownKeys(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitUnknownKeyErrors(comp: JitErrorsFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitStripUnknownKeys(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitUnknownKeysToUndefined(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n // todo: maybe we should move these two into a single file like the rest of serializers\n abstract emitPrepareForJson(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitRestoreFromJson(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n}\n\n/**\n * RunType that is atomic an does not contains any other child runTypes.\n * ie: string, number, boolean, any, null, undefined, void, never, bigint, etc.\n * */\nexport abstract class AtomicRunType<T extends Type> extends BaseRunType<T> {\n getFamily(): 'A' {\n return 'A';\n }\n emitPrepareForJson(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitHasUnknownKeys(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: E};\n }\n emitUnknownKeyErrors(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitStripUnknownKeys(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n}\n\n/**\n * RunType that contains a collection or child runTypes.\n * Collection RunTypes are the only ones that can have circular references. as a child of a collection RunType can be the parent of the collection RunType.\n * i.e: interface, child runTypes are it's properties\n * i.e: tuple, it's child runTypes are the tuple members\n */\nexport abstract class CollectionRunType<T extends Type> extends BaseRunType<T> {\n getFamily(): 'C' {\n return 'C';\n }\n getChildRunTypes = (): BaseRunType[] => {\n const childTypes = ((this.src as SrcCollection).types as SrcType[]) || []; // deepkit stores child types in the types property\n return childTypes.map((t) => t._rt as BaseRunType);\n };\n getJitChildren(comp: JitFnCompiler): BaseRunType[] {\n let skipIndex = false; // if there are multiple index signatures, only the first one will be used as they must be same type just different keys\n return this.getChildRunTypes().filter((c) => {\n if (c.skipJit(comp)) return false;\n const isIndex = c.src.kind === ReflectionKind.indexSignature;\n if (isIndex && skipIndex) return false;\n if (isIndex) skipIndex = true;\n return true;\n });\n }\n areAllChildrenOptional(children: BaseRunType[]) {\n return children.every(\n (prop) =>\n (prop as MemberRunType<any>)?.isOptional() ||\n (prop.src as TypeProperty)?.optional ||\n prop.src.kind === ReflectionKind.indexSignature\n );\n }\n emitHasUnknownKeys(comp: JitFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileHasUnknownKeys(c, E).code)\n .filter((code) => !!code);\n return {code: codes.join(' || '), type: E};\n }\n emitUnknownKeyErrors(comp: JitErrorsFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileUnknownKeyErrors(c, S).code)\n .filter((code) => !!code);\n return {code: codes.join(';'), type: S};\n }\n emitStripUnknownKeys(comp: JitFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileStripUnknownKeys(c, S).code)\n .filter((code) => !!code);\n return {code: codes.join(';'), type: S};\n }\n emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileUnknownKeysToUndefined(c, S).code)\n .filter((code) => !!code);\n return {code: codes.join(';'), type: S};\n }\n private getChildrenTypeID = memorize((stack: BaseRunType<any>[] = []): StrNumber => {\n if (stack.length > MAX_STACK_DEPTH) throw new Error(maxStackErrorMessage);\n const circularJitConf = this.checkIsCircularAndGetRefId(stack);\n if (circularJitConf) return circularJitConf;\n stack.push(this);\n const childrenIds: (string | number)[] = [];\n const children = this.getChildRunTypes();\n for (const child of children) {\n childrenIds.push(child.getTypeID());\n }\n const isArray = this.src.kind === ReflectionKind.tuple || this.src.kind === ReflectionKind.array;\n const groupID = isArray ? `[${childrenIds.join(',')}]` : `{${childrenIds.join(',')}}`;\n const kind = this.src.subKind || this.src.kind;\n stack.pop();\n return `${kind}${groupID}`;\n });\n}\n\n/**\n * RunType that contains a single member or child RunType. usually part of a collection RunType.\n * i.e object properties, {prop: memberType} where memberType is the child RunType\n */\nexport abstract class MemberRunType<T extends Type> extends BaseRunType<T> implements RunTypeChildAccessor {\n abstract isOptional(): boolean;\n abstract getChildVarName(comp: JitFnCompiler): string | number;\n abstract getChildLiteral(comp: JitFnCompiler): string | number;\n abstract useArrayAccessor(): boolean;\n /** used to compile json stringify */\n skipCommas?: boolean;\n /** used to compile json stringify */\n tempChildVλl?: string;\n getFamily(): 'M' {\n return 'M';\n }\n getMemberType(): BaseRunType {\n const memberType = (this.src as any).type as SrcType; // deepkit stores member types in the type property\n return memberType._rt as BaseRunType;\n }\n getChildIndex(comp: JitFnCompiler) {\n const start = comp?.opts?.paramsSlice?.start;\n if (start) return getPropIndex(this.src) - start;\n return getPropIndex(this.src);\n }\n getJitChild(comp: JitFnCompiler): BaseRunType | undefined {\n const member: BaseRunType = this.getMemberType();\n if (member.skipJit(comp)) return undefined;\n return member;\n }\n emitHasUnknownKeys(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileHasUnknownKeys(child, E);\n if (!codeResult?.code) return {code: undefined, type: E};\n const childName = comp.getChildVλl();\n const finalCode = this.isOptional() ? `(${childName} !== undefined && ${codeResult.code})` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n emitUnknownKeyErrors(comp: JitErrorsFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileUnknownKeyErrors(child, S);\n if (!codeResult?.code) return {code: undefined, type: S};\n const finalCode = this.isOptional() ? `if (${comp.getChildVλl()} !== undefined) {${codeResult.code}}` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n emitStripUnknownKeys(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileStripUnknownKeys(child, S);\n if (!codeResult?.code) return {code: undefined, type: S};\n const finalCode = this.isOptional() ? `if (${comp.getChildVλl()} !== undefined) {${codeResult.code}}` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileUnknownKeysToUndefined(child, S);\n if (!codeResult?.code) return {code: undefined, type: S};\n const finalCode = this.isOptional() ? `if (${comp.getChildVλl()} !== undefined) {${codeResult.code}}` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n visitToBinary(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const code = comp.compileToBinary(child, S);\n if (!code?.code) return {code: undefined, type: S};\n return this.isOptional()\n ? {code: `(${comp.getChildVλl()} !== undefined ? ${code.code} : utl.writeBinaryNull())`, type: S}\n : code;\n }\n visitFromBinary(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const code = comp.compileFromBinary(child, S);\n if (!code?.code) return {code: undefined, type: S};\n return code;\n }\n private getMemberTypeID = memorize((stack: BaseRunType<any>[] = []): StrNumber => {\n if (stack.length > MAX_STACK_DEPTH) throw new Error(maxStackErrorMessage);\n const optional = this.isOptional() ? '?' : '';\n const kind =\n (this.src as TypeProperty).name?.toString() ||\n (this.src as TypeIndexSignature).index?.kind ||\n this.src.subKind ||\n this.src.kind;\n const kindID = `${kind}${optional}`;\n const circularJitConf = this.checkIsCircularAndGetRefId(stack);\n if (circularJitConf) return `${kindID}:${circularJitConf}`;\n // TODO: some properties could be skipped from the JIT ID. so we could implement a mechanism to mark them to be skipped\n // ie: sample and sampleChars from StringFormat are too large but they do not affect jit code generation as those properties are only used during mocking\n stack.push(this);\n const member = this.getMemberType();\n const memberTypeID = member.getTypeID();\n const typeID = `${kindID}:${memberTypeID}`;\n stack.pop();\n return typeID;\n });\n}\n\n// ########## Load Composable Functions ##########\n"],"names":["CodeTypes","getENV","ReflectionKind","memorize","getReflectionName","stringifyType","createUniqueHash","initFormatAnnotations","createTypeId","registerJitFunctionCompiler","JitFunctions","getJitFunctionCompiler","defaultMockOptions","getJITFnHash","MockJitCompiler","getJitUtils","createJitCompiler","MAX_STACK_DEPTH","maxStackErrorMessage","getPropIndex"],"mappings":";;;;;;;;;;;;;;AAsCWA,wBAAAA,UAAU;AACrB,MAAM,IAAIA,wBAAAA,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,oBAAoB;AACxE,UAAM,WAAW,KAAK,WAAA,IAAe,MAAM;AAC3C,UAAM,OACD,KAAK,IAAqB,MAAM,cAChC,KAAK,IAA2B,OAAO,QACxC,KAAK,IAAI,WACT,KAAK,IAAI;AACb,UAAM,SAAS,GAAG,IAAI,GAAG,QAAQ;AACjC,UAAM,kBAAkB,KAAK,2BAA2B,KAAK;AAC7D,QAAI,gBAAiB,QAAO,GAAG,MAAM,IAAI,eAAe;AAGxD,UAAM,KAAK,IAAI;AACf,UAAM,SAAS,KAAK,cAAA;AACpB,UAAM,eAAe,OAAO,UAAA;AAC5B,UAAM,SAAS,GAAG,MAAM,IAAI,YAAY;AACxC,UAAM,IAAA;AACN,WAAO;AAAA,EACX,CAAC;AACL;;;;;"}
1
+ {"version":3,"file":"baseRunTypes.cjs","sources":["../../../../src/lib/baseRunTypes.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\nimport {MAX_STACK_DEPTH, JitCompiledFn, createUniqueHash, getJitUtils, getENV} from '@mionjs/core';\nimport type {\n RunType,\n Mutable,\n RunTypeChildAccessor,\n JitFnID,\n SrcType,\n SrcCollection,\n CustomVλl,\n JitFn,\n JitCode,\n RunTypeOptions,\n StrNumber,\n DeepPartial,\n RunTypeFamily,\n} from '../types.ts';\nimport type {mockType} from '../mocking/mockType.ts';\nimport {maxStackErrorMessage} from '../constants.ts';\nimport {type CodeType, JitFunctions, CodeTypes} from '../constants.functions.ts';\nimport {ReflectionKind, stringifyType} from '@deepkit/type';\nimport type {TypeIndexSignature, TypeProperty, Type} from '@deepkit/type';\nimport {getPropIndex, memorize} from './utils.ts';\nimport {createJitCompiler, MockJitCompiler} from './jitFnCompiler.ts';\nimport {getJITFnHash} from './createJitFunction.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from './jitFnCompiler.ts';\nimport {type AnyKindName, getReflectionName} from '../constants.kind.ts';\nimport {initFormatAnnotations} from './formats.ts';\nimport {createTypeId} from './typeId.ts';\nimport {getJitFunctionCompiler, registerJitFunctionCompiler} from './jitFnsRegistry.ts';\nimport {defaultMockOptions} from '../mocking/constants.mock.ts';\n\nconst RB = CodeTypes.returnBlock;\nconst S = CodeTypes.statement;\nconst E = CodeTypes.expression;\n\nexport abstract class BaseRunType<T extends Type = Type> implements RunType {\n isCircular?: boolean;\n readonly src: SrcType<T> = null as any; // real value will be set after construction by the createRunType function\n abstract getFamily(): RunTypeFamily; // Atomic, Collection, Member, Function\n /**\n * This single functions controls whether or not the code for a type should be inlined into the parent function\n * or should create a separate jit function for it, add as a dependency and call it.\n * @returns\n */\n isJitInlined = (): boolean => {\n // if is circular, always create a separate jit function as need to self invoke\n if (this.isCircular) return false;\n if (getENV('DEBUG_JIT') === 'INLINED') return true;\n // all array are self invoked for isType and are usually repeated type like string[] or number[] so worth deduplicating\n if (this.src.kind === ReflectionKind.array) return false;\n // collection with name might be used in different places so worth deduplicating\n if (this.src.typeName && this.getFamily() === 'C') return false;\n return true;\n };\n getKindName = memorize((): AnyKindName => getReflectionName(this));\n getTypeName = (): string => this.src.typeName || this.getKindName();\n stringify = memorize((): string => stringifyType(this.src));\n skipJit(comp: JitFnCompiler): boolean {\n return false;\n }\n /** Returns the format portion of the type ID (cached in src._formatId), or undefined if no format. */\n getFormatTypeID(): string | undefined {\n // _formatId is cached by computeDeepkitFormatID during getDeepkitTypeId call\n // Empty string means no format, undefined means not computed yet\n const formatId = (this.src as any)._formatId;\n return formatId || undefined;\n }\n /** Returns the type ID which is cached in src._typeId by getDeepkitTypeId(). Format ID is already included. */\n getTypeID(): StrNumber {\n if (this.src._typeId === undefined) {\n throw new Error(`Missing cached type ID for ${this.getTypeName()}. Ensure getDeepkitTypeId() has been called.`);\n }\n return this.src._typeId;\n }\n getJitHash(opts: RunTypeOptions): string {\n const optsCopy = {...opts};\n // remove mock options as not relevant for jit functionality\n if (optsCopy.mock) delete optsCopy.mock;\n return createUniqueHash(this.getTypeID().toString() + JSON.stringify(optsCopy));\n }\n getParent = (): BaseRunType | undefined => (this.src.parent as SrcType)?._rt as BaseRunType;\n checkIsCircularAndGetRefId(stack: RunType[] = []): StrNumber | undefined {\n const inStackIndex = stack.findIndex((rt) => {\n if (rt === this) return true;\n // some nodes seems to be different objects in memory but are the same id, so we check by id as well\n return rt.src.id && this.src.id && rt.src.id === this.src.id;\n }); // cant use isSameJitType because it uses getTypeID and would loop forever\n const inStackSrcId = stack.findIndex((rt) => rt.src.id && this.src.id && rt.src.id === this.src.id);\n const isInStack = inStackIndex >= 0; // recursive reference\n if (isInStack) {\n this.isCircular = true;\n const name = this.src.typeName || ''; // todo: not sure if all the circular references will have a name\n const refId = '$' + this.src.kind + `_${inStackIndex}` + name; // ensures different circular types have different typeID\n return refId;\n }\n return undefined;\n }\n /**\n * Method that should be called Immediately after the RunType gets created to link the SrcType and RunType.\n * This is more flexible than passing params to the constructor helps to avoid circular dependencies, etc.\n * */\n onCreated(src: SrcType<any>): void {\n (this as Mutable<RunType>).src = src;\n (src as Mutable<SrcType>)._rt = this;\n initFormatAnnotations(this);\n // Cache the type ID on the src object - this includes format information\n createTypeId(src);\n }\n /**\n * Some elements might need a standalone name variable that ignores the vλl value of the parents.\n * returns a variable that is being compiled, ignores the parents variable names */\n getCustomVλl(comp: JitFnCompiler): CustomVλl | undefined {\n return undefined;\n }\n /**\n * Some elements might need a custom static path to be able to reference the source of an error.\n * ie: when validating a Map we need to differentiate if the value that failed is the key or the value of a map's entry.\n */\n getStaticPathLiteral(comp: JitFnCompiler): string | number | undefined {\n return undefined;\n }\n\n // ########## Mock ##########\n\n async mock(opts?: DeepPartial<RunTypeOptions>): Promise<any> {\n // although the mock function is not jit, it is also stored in the registry\n // this is because we don't want to load mock related functionality if not needed\n await registerJitFunctionCompiler(JitFunctions.mock);\n return this.mockType(opts);\n }\n\n /** synchronous version of mock, throws an error if the mock function has not been loaded */\n mockType(opts: DeepPartial<RunTypeOptions> = {}): any {\n const mockFn = getJitFunctionCompiler(JitFunctions.mock) as typeof mockType;\n if (!mockFn)\n throw new Error(\n `Function ${JitFunctions.mock.name} has not been loaded. make sure you have called loadJitCompilerFunction(JitFunctions.mock) before calling mockType.`\n );\n const fnID = JitFunctions.mock.id;\n // options sent to the compiler will be set to empty as mock options are handled separately from the compiler\n const mockingOpts = {...opts, mock: {...defaultMockOptions, ...(opts.mock || {})}} as RunTypeOptions;\n const hash = getJITFnHash(fnID, this, mockingOpts);\n const comp = new MockJitCompiler(this, mockingOpts, undefined, hash, this.getTypeID());\n return mockFn(this, comp);\n }\n\n // ########## Create Jit Functions ##########\n\n createJitFunction = (jitFn: JitFn, opts: RunTypeOptions = {}): ((...args: any[]) => any) => {\n return this.createJitCompiledFunction(jitFn.id, undefined, opts).fn;\n };\n\n createJitCompiledFunction(fnID: JitFnID, parentCop?: JitFnCompiler, opts: RunTypeOptions = {}): JitCompiledFn {\n const fnHash = getJITFnHash(fnID, this, opts);\n const jitCompiled = getJitUtils().getJIT(fnHash);\n if (jitCompiled) {\n if (getENV('DEBUG_JIT') === 'VERBOSE')\n console.log(`\\x1b[32m Using cached function: ${jitCompiled.jitFnHash} \\x1b[0m`);\n return jitCompiled;\n }\n const newJitCompiler: JitFnCompiler = createJitCompiler(\n this,\n fnID,\n parentCop,\n undefined,\n undefined,\n opts\n ) as JitFnCompiler;\n try {\n const codeType = this.getFamily() === 'A' ? E : S;\n newJitCompiler.compile(this, codeType, fnID);\n newJitCompiler.createJitFunction();\n } catch (e: any) {\n // if something goes wrong during compilation we want to remove the compiler from\n // the cache as this is automatically added to jitUtils cache during compilation\n newJitCompiler.removeFromJitCache();\n // TODO: we need to print the full path to the type that is causing the error\n // for this ideally we should add a parent Compiler and print the trace only from the root\n if (typeof e?.message === 'string' && !newJitCompiler.hasStackTrace(e.message))\n e.message += newJitCompiler.getStackTrace();\n throw e;\n }\n return newJitCompiler as JitCompiledFn;\n }\n\n // ########## emit Methods that generates src code ##########\n\n abstract emitIsType(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitTypeErrors(comp: JitErrorsFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitHasUnknownKeys(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitUnknownKeyErrors(comp: JitErrorsFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitStripUnknownKeys(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitUnknownKeysToUndefined(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n // todo: maybe we should move these two into a single file like the rest of serializers\n abstract emitPrepareForJson(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n abstract emitRestoreFromJson(comp: JitFnCompiler, expectedCType: CodeType): JitCode;\n}\n\n/**\n * RunType that is atomic an does not contains any other child runTypes.\n * ie: string, number, boolean, any, null, undefined, void, never, bigint, etc.\n * */\nexport abstract class AtomicRunType<T extends Type> extends BaseRunType<T> {\n getFamily(): 'A' {\n return 'A';\n }\n emitPrepareForJson(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitHasUnknownKeys(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: E};\n }\n emitUnknownKeyErrors(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitStripUnknownKeys(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode {\n return {code: undefined, type: S};\n }\n}\n\n/**\n * RunType that contains a collection or child runTypes.\n * Collection RunTypes are the only ones that can have circular references. as a child of a collection RunType can be the parent of the collection RunType.\n * i.e: interface, child runTypes are it's properties\n * i.e: tuple, it's child runTypes are the tuple members\n */\nexport abstract class CollectionRunType<T extends Type> extends BaseRunType<T> {\n getFamily(): 'C' {\n return 'C';\n }\n getChildRunTypes = (): BaseRunType[] => {\n const childTypes = ((this.src as SrcCollection).types as SrcType[]) || []; // deepkit stores child types in the types property\n return childTypes.map((t) => t._rt as BaseRunType);\n };\n getJitChildren(comp: JitFnCompiler): BaseRunType[] {\n let skipIndex = false; // if there are multiple index signatures, only the first one will be used as they must be same type just different keys\n return this.getChildRunTypes().filter((c) => {\n if (c.skipJit(comp)) return false;\n const isIndex = c.src.kind === ReflectionKind.indexSignature;\n if (isIndex && skipIndex) return false;\n if (isIndex) skipIndex = true;\n return true;\n });\n }\n areAllChildrenOptional(children: BaseRunType[]) {\n return children.every(\n (prop) =>\n (prop as MemberRunType<any>)?.isOptional() ||\n (prop.src as TypeProperty)?.optional ||\n prop.src.kind === ReflectionKind.indexSignature\n );\n }\n emitHasUnknownKeys(comp: JitFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileHasUnknownKeys(c, E).code)\n .filter((code) => !!code);\n return {code: codes.join(' || '), type: E};\n }\n emitUnknownKeyErrors(comp: JitErrorsFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileUnknownKeyErrors(c, S).code)\n .filter((code) => !!code);\n return {code: codes.join(';'), type: S};\n }\n emitStripUnknownKeys(comp: JitFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileStripUnknownKeys(c, S).code)\n .filter((code) => !!code);\n return {code: codes.join(';'), type: S};\n }\n emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode {\n const codes = this.getJitChildren(comp)\n .map((c) => comp.compileUnknownKeysToUndefined(c, S).code)\n .filter((code) => !!code);\n return {code: codes.join(';'), type: S};\n }\n}\n\n/**\n * RunType that contains a single member or child RunType. usually part of a collection RunType.\n * i.e object properties, {prop: memberType} where memberType is the child RunType\n */\nexport abstract class MemberRunType<T extends Type> extends BaseRunType<T> implements RunTypeChildAccessor {\n abstract isOptional(): boolean;\n abstract getChildVarName(comp: JitFnCompiler): string | number;\n abstract getChildLiteral(comp: JitFnCompiler): string | number;\n abstract useArrayAccessor(): boolean;\n /** used to compile json stringify */\n skipCommas?: boolean;\n /** used to compile json stringify */\n tempChildVλl?: string;\n getFamily(): 'M' {\n return 'M';\n }\n getMemberType(): BaseRunType {\n const memberType = (this.src as any).type as SrcType; // deepkit stores member types in the type property\n return memberType._rt as BaseRunType;\n }\n getChildIndex(comp: JitFnCompiler) {\n const start = comp?.opts?.paramsSlice?.start;\n if (start) return getPropIndex(this.src) - start;\n return getPropIndex(this.src);\n }\n getJitChild(comp: JitFnCompiler): BaseRunType | undefined {\n const member: BaseRunType = this.getMemberType();\n if (member.skipJit(comp)) return undefined;\n return member;\n }\n emitHasUnknownKeys(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileHasUnknownKeys(child, E);\n if (!codeResult?.code) return {code: undefined, type: E};\n const childName = comp.getChildVλl();\n const finalCode = this.isOptional() ? `(${childName} !== undefined && ${codeResult.code})` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n emitUnknownKeyErrors(comp: JitErrorsFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileUnknownKeyErrors(child, S);\n if (!codeResult?.code) return {code: undefined, type: S};\n const finalCode = this.isOptional() ? `if (${comp.getChildVλl()} !== undefined) {${codeResult.code}}` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n emitStripUnknownKeys(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileStripUnknownKeys(child, S);\n if (!codeResult?.code) return {code: undefined, type: S};\n const finalCode = this.isOptional() ? `if (${comp.getChildVλl()} !== undefined) {${codeResult.code}}` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const codeResult = comp.compileUnknownKeysToUndefined(child, S);\n if (!codeResult?.code) return {code: undefined, type: S};\n const finalCode = this.isOptional() ? `if (${comp.getChildVλl()} !== undefined) {${codeResult.code}}` : codeResult.code;\n return {code: finalCode, type: codeResult.type};\n }\n visitToBinary(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const code = comp.compileToBinary(child, S);\n if (!code?.code) return {code: undefined, type: S};\n return this.isOptional()\n ? {code: `(${comp.getChildVλl()} !== undefined ? ${code.code} : utl.writeBinaryNull())`, type: S}\n : code;\n }\n visitFromBinary(comp: JitFnCompiler): JitCode {\n const child = this.getJitChild(comp);\n const code = comp.compileFromBinary(child, S);\n if (!code?.code) return {code: undefined, type: S};\n return code;\n }\n}\n\n// ########## Load Composable Functions ##########\n"],"names":["CodeTypes","getENV","ReflectionKind","memorize","getReflectionName","stringifyType","createUniqueHash","initFormatAnnotations","createTypeId","registerJitFunctionCompiler","JitFunctions","getJitFunctionCompiler","defaultMockOptions","getJITFnHash","MockJitCompiler","getJitUtils","createJitCompiler","getPropIndex"],"mappings":";;;;;;;;;;;;;AAsCWA,wBAAAA,UAAU;AACrB,MAAM,IAAIA,wBAAAA,UAAU;AACpB,MAAM,IAAIA,wBAAAA,UAAU;AAEb,MAAe,YAAsD;AAAA,EACxE;AAAA,EACS,MAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO3B,eAAe,MAAe;AAE1B,QAAI,KAAK,WAAY,QAAO;AAC5B,QAAIC,YAAO,WAAW,MAAM,UAAW,QAAO;AAE9C,QAAI,KAAK,IAAI,SAASC,KAAAA,eAAe,MAAO,QAAO;AAEnD,QAAI,KAAK,IAAI,YAAY,KAAK,UAAA,MAAgB,IAAK,QAAO;AAC1D,WAAO;AAAA,EACX;AAAA,EACA,cAAcC,cAAAA,SAAS,MAAmBC,mBAAAA,kBAAkB,IAAI,CAAC;AAAA,EACjE,cAAc,MAAc,KAAK,IAAI,YAAY,KAAK,YAAA;AAAA,EACtD,YAAYD,cAAAA,SAAS,MAAcE,KAAAA,cAAc,KAAK,GAAG,CAAC;AAAA,EAC1D,QAAQ,MAA8B;AAClC,WAAO;AAAA,EACX;AAAA;AAAA,EAE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AK,wBAAwB,OAAO,CAAC;AACxD,QAAI,CAAC,YAAY,KAAM,QAAO,EAAC,MAAM,QAAW,MAAM,EAAA;AACtD,UAAM,YAAY,KAAK,WAAA,IAAe,OAAO,KAAK,YAAA,CAAa,oBAAoB,WAAW,IAAI,MAAM,WAAW;AACnH,WAAO,EAAC,MAAM,WAAW,MAAM,WAAW,KAAA;AAAA,EAC9C;AAAA,EACA,2BAA2B,MAA8B;AACrD,UAAM,QAAQ,KAAK,YAAY,IAAI;AACnC,UAAM,aAAa,KAAK,8BAA8B,OAAO,CAAC;AAC9D,QAAI,CAAC,YAAY,KAAM,QAAO,EAAC,MAAM,QAAW,MAAM,EAAA;AACtD,UAAM,YAAY,KAAK,WAAA,IAAe,OAAO,KAAK,YAAA,CAAa,oBAAoB,WAAW,IAAI,MAAM,WAAW;AACnH,WAAO,EAAC,MAAM,WAAW,MAAM,WAAW,KAAA;AAAA,EAC9C;AAAA,EACA,cAAc,MAA8B;AACxC,UAAM,QAAQ,KAAK,YAAY,IAAI;AACnC,UAAM,OAAO,KAAK,gBAAgB,OAAO,CAAC;AAC1C,QAAI,CAAC,MAAM,KAAM,QAAO,EAAC,MAAM,QAAW,MAAM,EAAA;AAChD,WAAO,KAAK,WAAA,IACN,EAAC,MAAM,IAAI,KAAK,YAAA,CAAa,oBAAoB,KAAK,IAAI,6BAA6B,MAAM,MAC7F;AAAA,EACV;AAAA,EACA,gBAAgB,MAA8B;AAC1C,UAAM,QAAQ,KAAK,YAAY,IAAI;AACnC,UAAM,OAAO,KAAK,kBAAkB,OAAO,CAAC;AAC5C,QAAI,CAAC,MAAM,KAAM,QAAO,EAAC,MAAM,QAAW,MAAM,EAAA;AAChD,WAAO;AAAA,EACX;AACJ;;;;;"}
@@ -52,7 +52,6 @@ export declare abstract class CollectionRunType<T extends Type> extends BaseRunT
52
52
  emitUnknownKeyErrors(comp: JitErrorsFnCompiler): JitCode;
53
53
  emitStripUnknownKeys(comp: JitFnCompiler): JitCode;
54
54
  emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode;
55
- private getChildrenTypeID;
56
55
  }
57
56
  export declare abstract class MemberRunType<T extends Type> extends BaseRunType<T> implements RunTypeChildAccessor {
58
57
  abstract isOptional(): boolean;
@@ -71,5 +70,4 @@ export declare abstract class MemberRunType<T extends Type> extends BaseRunType<
71
70
  emitUnknownKeysToUndefined(comp: JitFnCompiler): JitCode;
72
71
  visitToBinary(comp: JitFnCompiler): JitCode;
73
72
  visitFromBinary(comp: JitFnCompiler): JitCode;
74
- private getMemberTypeID;
75
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"any.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"any.cjs","sources":["../../../../../src/nodes/atomic/any.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {type TypeAny, type TypeUnknown} from '@deepkit/type';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport type {JitCode} from '../../types.ts';\nimport {JitFnCompiler} from '../../lib/jitFnCompiler.ts';\n\nexport class AnyRunType extends AtomicRunType<TypeAny | TypeUnknown> {\n emitIsType(comp: JitFnCompiler): JitCode {\n const isRoot = comp.getNestLevel(this) === 0;\n if (isRoot) return {code: undefined, type: 'E'};\n return {code: 'true', type: 'E'};\n }\n emitTypeErrors(): JitCode {\n return {code: undefined, type: 'S'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;;AAYM,MAAO,mBAAmBA,qBAAAA,cAAoC;AAAA,EAChE,WAAW,MAAmB;AAC1B,UAAM,SAAS,KAAK,aAAa,IAAI,MAAM;AAC3C,QAAI;AAAQ,aAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAC3C,WAAO,EAAC,MAAM,QAAQ,MAAM,IAAA;AAAA,EAChC;AAAA,EACA,iBAAc;AACV,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"bigInt.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"bigInt.cjs","sources":["../../../../../src/nodes/atomic/bigInt.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeBigInt} from '@deepkit/type';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport type {JitCode} from '../../types.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\n\nexport class BigIntRunType extends AtomicRunType<TypeBigInt> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `typeof ${comp.vλl} === 'bigint'`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (typeof ${comp.vλl} !== 'bigint') ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(comp: JitFnCompiler): JitCode {\n return {code: `${comp.vλl}.toString()`, type: 'E'};\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return {code: `BigInt(${comp.vλl})`, type: 'E'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,sBAAsBA,qBAAAA,cAAyB;AAAA,EACxD,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,UAAU,KAAK,GAAG,iBAAiB,MAAM,IAAA;AAAA,EAC3D;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,cAAc,KAAK,GAAG,kBAAkB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACzF;AAAA,EACA,mBAAmB,MAAmB;AAClC,WAAO,EAAC,MAAM,GAAG,KAAK,GAAG,eAAe,MAAM,IAAA;AAAA,EAClD;AAAA,EACA,oBAAoB,MAAmB;AACnC,WAAO,EAAC,MAAM,UAAU,KAAK,GAAG,KAAK,MAAM,IAAA;AAAA,EAC/C;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"boolean.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"boolean.cjs","sources":["../../../../../src/nodes/atomic/boolean.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeBoolean} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\n\nexport class BooleanRunType extends AtomicRunType<TypeBoolean> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `typeof ${comp.vλl} === 'boolean'`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (typeof ${comp.vλl} !== 'boolean') ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(): JitCode {\n return {code: undefined, type: 'S'};\n }\n emitRestoreFromJson(): JitCode {\n return {code: undefined, type: 'S'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,uBAAuBA,qBAAAA,cAA0B;AAAA,EAC1D,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,UAAU,KAAK,GAAG,kBAAkB,MAAM,IAAA;AAAA,EAC5D;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,cAAc,KAAK,GAAG,mBAAmB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EAC1F;AAAA,EACA,qBAAkB;AACd,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA,EACA,sBAAmB;AACf,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"date.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"date.cjs","sources":["../../../../../src/nodes/atomic/date.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {type TypeClass} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\n\nexport class DateRunType extends AtomicRunType<TypeClass> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `(${comp.vλl} instanceof Date && !isNaN(${comp.vλl}.getTime()))`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (!(${comp.vλl} instanceof Date && !isNaN(${comp.vλl}.getTime()))) ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(): JitCode {\n return {code: undefined, type: 'S'};\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return {code: `new Date(${comp.vλl})`, type: 'E'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,oBAAoBA,qBAAAA,cAAwB;AAAA,EACrD,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,IAAI,KAAK,GAAG,8BAA8B,KAAK,GAAG,gBAAgB,MAAM,IAAA;AAAA,EAC1F;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,SAAS,KAAK,GAAG,8BAA8B,KAAK,GAAG,iBAAiB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACzH;AAAA,EACA,qBAAkB;AACd,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA,EACA,oBAAoB,MAAmB;AACnC,WAAO,EAAC,MAAM,YAAY,KAAK,GAAG,KAAK,MAAM,IAAA;AAAA,EACjD;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"enum.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"enum.cjs","sources":["../../../../../src/nodes/atomic/enum.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {TypeEnum} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport {toLiteral} from '../../lib/utils.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\n\nexport class EnumRunType extends AtomicRunType<TypeEnum> {\n emitIsType(comp: JitFnCompiler): JitCode {\n const items = this.src.values.map((v) => `${comp.vλl} === ${toLiteral(v)}`);\n return {code: `(${items.join(' || ')})`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n const items = this.src.values.map((v) => `${comp.vλl} === ${toLiteral(v)}`);\n return {code: `if (!(${items.join(' || ')})) ${comp.callJitErr(this)}`, type: 'S'};\n }\n}\n"],"names":["AtomicRunType","toLiteral"],"mappings":";;;;;;;;;AAaM,MAAO,oBAAoBA,qBAAAA,cAAuB;AAAA,EACpD,WAAW,MAAmB;AAC1B,UAAM,QAAQ,KAAK,IAAI,OAAO,IAAG,aAAC,CAAC,MAAM,GAAG,KAAK,GAAG,QAAQC,wBAAU,CAAC,CAAC,IAAE,CAAA,KAAA,IAAA,SAAA,CAAA,CAAA;AAC1E,WAAO,EAAC,MAAM,IAAI,MAAM,KAAK,MAAM,CAAC,KAAK,MAAM,IAAA;AAAA,EACnD;AAAA,EACA,eAAe,MAAyB;AACpC,UAAM,QAAQ,KAAK,IAAI,OAAO,IAAG,aAAC,CAAC,MAAM,GAAG,KAAK,GAAG,QAAQA,wBAAU,CAAC,CAAC,IAAE,CAAA,KAAA,IAAA,SAAA,CAAA,CAAA;AAC1E,WAAO,EAAC,MAAM,SAAS,MAAM,KAAK,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EAClF;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"enumMember.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"enumMember.cjs","sources":["../../../../../src/nodes/atomic/enumMember.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {type TypeEnum} from '@deepkit/type';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport {JitCode} from '../../types.ts';\n\n// TODO: not sure when run type will be generated but doesn't seem to be used when using reflection on enums\nexport class EnumMemberRunType extends AtomicRunType<TypeEnum> {\n skipJit() {\n return true;\n }\n emitIsType(): JitCode {\n throw new Error('Enum member operations are not supported');\n }\n emitTypeErrors(): JitCode {\n throw new Error('Enum member operations are not supported');\n }\n emitPrepareForJson(): JitCode {\n throw new Error('Enum member operations are not supported');\n }\n emitRestoreFromJson(): JitCode {\n throw new Error('Enum member operations are not supported');\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;;AAYM,MAAO,0BAA0BA,qBAAAA,cAAuB;AAAA,EAC1D,UAAO;AACH,WAAO;AAAA,EACX;AAAA,EACA,aAAU;AACN,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC9D;AAAA,EACA,iBAAc;AACV,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC9D;AAAA,EACA,qBAAkB;AACd,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC9D;AAAA,EACA,sBAAmB;AACf,UAAM,IAAI,MAAM,0CAA0C;AAAA,EAC9D;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"literal.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"literal.cjs","sources":["../../../../../src/nodes/atomic/literal.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {ReflectionKind, type TypeLiteral} from '@deepkit/type';\nimport type {JitCode, RunType} from '../../types.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport type {Mutable} from '@mionjs/core';\nimport {toLiteral} from '../../lib/utils.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport {BigIntRunType} from './bigInt.ts';\nimport {RegexpRunType} from './regexp.ts';\nimport {SymbolRunType} from './symbol.ts';\nimport {AnyKindName} from '../../constants.kind.ts';\nimport {StringRunType} from './string.ts';\nimport {NumberRunType} from './number.ts';\nimport {BooleanRunType} from './boolean.ts';\n\nconst stringRt = new StringRunType();\nconst numberRt = new NumberRunType();\nconst booleanRt = new BooleanRunType();\nconst symbolRt = new SymbolRunType();\nconst regexpRt = new RegexpRunType();\nconst bigIntRt = new BigIntRunType();\n\ntype AnyLiteralRunType = StringRunType | NumberRunType | BooleanRunType | SymbolRunType | RegexpRunType | BigIntRunType;\n\nexport class LiteralRunType extends AtomicRunType<TypeLiteral> {\n getRunTypeForLiteral(comp: JitFnCompiler): AnyLiteralRunType {\n const noLiterals = comp.opts.noLiterals;\n const lit = this.src.literal;\n let rt: AnyLiteralRunType;\n if (lit instanceof RegExp) {\n rt = regexpRt;\n (rt as Mutable<RunType>).src = this.src;\n if (noLiterals) (this.src as any).kind = ReflectionKind.regexp;\n return rt;\n }\n switch (typeof lit) {\n case 'string':\n rt = stringRt;\n if (noLiterals) (this.src as any).kind = ReflectionKind.string;\n break;\n case 'number':\n rt = numberRt;\n if (noLiterals) (this.src as any).kind = ReflectionKind.number;\n break;\n case 'boolean':\n rt = booleanRt;\n if (noLiterals) (this.src as any).kind = ReflectionKind.boolean;\n break;\n case 'bigint':\n rt = bigIntRt;\n if (noLiterals) (this.src as any).kind = ReflectionKind.bigint;\n break;\n case 'symbol':\n rt = symbolRt;\n if (noLiterals) (this.src as any).kind = ReflectionKind.symbol;\n break;\n default:\n throw new Error(`Unsupported literal type ${typeof lit}`);\n }\n (rt as Mutable<RunType>).src = this.src;\n return rt;\n }\n emitIsType(comp: JitFnCompiler): JitCode {\n if (comp.opts.noLiterals) return this.getRunTypeForLiteral(comp).emitIsType(comp);\n return {code: compileIsLiteral(comp, this.src.literal), type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n if (comp.opts.noLiterals) return this.getRunTypeForLiteral(comp).emitTypeErrors(comp);\n return {code: compileTypeErrorsLiteral(comp, this.src.literal, this.getKindName()), type: 'S'};\n }\n emitPrepareForJson(comp: JitFnCompiler): JitCode {\n return this.getRunTypeForLiteral(comp).emitPrepareForJson(comp);\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return this.getRunTypeForLiteral(comp).emitRestoreFromJson(comp);\n }\n getLiteralValue() {\n return this.src.literal;\n }\n}\n\nfunction compileIsLiteral(comp: JitFnCompiler, lit: TypeLiteral['literal']): string {\n const literalType = typeof lit;\n if (lit instanceof RegExp) return `${comp.vλl} instanceof RegExp && String(${comp.vλl}) === String(${lit})`;\n switch (literalType) {\n case 'string':\n return `${comp.vλl} === ${toLiteral(lit)}`;\n case 'number':\n return `${comp.vλl} === ${toLiteral(lit)}`;\n case 'boolean':\n return `${comp.vλl} === ${toLiteral(lit)}`;\n case 'bigint':\n return `${comp.vλl} === ${toLiteral(lit)}`;\n case 'symbol':\n return `typeof ${comp.vλl} === 'symbol' && ${comp.vλl}.description === ${toLiteral((lit as symbol).description)}`;\n default:\n throw new Error(`Unsupported literal type ${literalType}`);\n }\n}\n\nfunction compileTypeErrorsLiteral(comp: JitErrorsFnCompiler, lit: TypeLiteral['literal'], name: AnyKindName): string {\n const literalType = typeof lit;\n if (lit instanceof RegExp)\n return `if (!(${comp.vλl} instanceof RegExp) || String(${comp.vλl}) !== String(${lit})) ${comp.callJitErr(name)}`;\n switch (literalType) {\n case 'string':\n return `if (${comp.vλl} !== ${toLiteral(lit)}) ${comp.callJitErr(name)}`;\n case 'number':\n return `if (${comp.vλl} !== ${toLiteral(lit)}) ${comp.callJitErr(name)}`;\n case 'boolean':\n return `if (${comp.vλl} !== ${toLiteral(lit)}) ${comp.callJitErr(name)}`;\n case 'bigint':\n return `if (${comp.vλl} !== ${toLiteral(lit)}) ${comp.callJitErr(name)}`;\n case 'symbol':\n return `if (typeof ${comp.vλl} !== 'symbol' || ${comp.vλl}.description !== ${toLiteral((lit as symbol).description)}) {${comp.callJitErr(name)}}`;\n default:\n throw new Error(`Unsupported literal type ${literalType}`);\n }\n}\n"],"names":["StringRunType","NumberRunType","BooleanRunType","SymbolRunType","RegexpRunType","BigIntRunType","AtomicRunType","ReflectionKind","toLiteral"],"mappings":";;;;;;;;;;;;AAqBA,MAAM,WAAW,IAAIA,wBAAAA,cAAA;AACrB,MAAM,WAAW,IAAIC,wBAAAA,cAAA;AACrB,MAAM,YAAY,IAAIC,yBAAAA,eAAA;AACtB,MAAM,WAAW,IAAIC,wBAAAA,cAAA;AACrB,MAAM,WAAW,IAAIC,wBAAAA,cAAA;AACrB,MAAM,WAAW,IAAIC,wBAAAA,cAAA;;AAIf,MAAO,uBAAuBC,qBAAAA,cAA0B;AAAA,EAC1D,qBAAqB,MAAmB;AACpC,UAAM,aAAa,KAAK,KAAK;AAC7B,UAAM,MAAM,KAAK,IAAI;AACrB,QAAI;AACJ,QAAI,eAAe,QAAQ;AACvB,WAAK;AACJ,SAAwB,MAAM,KAAK;AACpC,UAAI;AAAa,aAAK,IAAY,OAAO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AAO,OAAO,KAAK,GAAG,QAAQA,cAAAA,UAAU,GAAG,CAAC,KAAK,KAAK,WAAW,IAAI,CAAC;AAAA,IAC1E,KAAK;AACD,aAAO,cAAc,KAAK,GAAG,oBAAoB,KAAK,GAAG,oBAAoBA,cAAAA,UAAW,IAAe,WAAW,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC;AAAA,IAClJ;AACI,YAAM,IAAI,MAAM,4BAA4B,WAAW,EAAE;AAAA,EAAA;AAErE;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"never.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"never.cjs","sources":["../../../../../src/nodes/atomic/never.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeNever} from '@deepkit/type';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport {JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport {JitCode} from '../../types.ts';\n\nexport class NeverRunType extends AtomicRunType<TypeNever> {\n emitIsType(): JitCode {\n return {code: 'false', type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(): JitCode {\n throw new Error('Never type cannot be encoded to JSON.');\n }\n emitRestoreFromJson(): JitCode {\n throw new Error('Never type cannot be decoded from JSON.');\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;;;AAYM,MAAO,qBAAqBA,qBAAAA,cAAwB;AAAA,EACtD,aAAU;AACN,WAAO,EAAC,MAAM,SAAS,MAAM,IAAA;AAAA,EACjC;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,GAAG,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACpD;AAAA,EACA,qBAAkB;AACd,UAAM,IAAI,MAAM,uCAAuC;AAAA,EAC3D;AAAA,EACA,sBAAmB;AACf,UAAM,IAAI,MAAM,yCAAyC;AAAA,EAC7D;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"null.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"null.cjs","sources":["../../../../../src/nodes/atomic/null.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeNull} from '@deepkit/type';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport type {JitCode} from '../../types.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\n\nexport class NullRunType extends AtomicRunType<TypeNull> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `${comp.vλl} === null`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (${comp.vλl} !== null) ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(): JitCode {\n return {code: undefined, type: 'S'};\n }\n emitRestoreFromJson(): JitCode {\n return {code: undefined, type: 'S'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,oBAAoBA,qBAAAA,cAAuB;AAAA,EACpD,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,GAAG,KAAK,GAAG,aAAa,MAAM,IAAA;AAAA,EAChD;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,OAAO,KAAK,GAAG,cAAc,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EAC9E;AAAA,EACA,qBAAkB;AACd,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA,EACA,sBAAmB;AACf,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"number.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"number.cjs","sources":["../../../../../src/nodes/atomic/number.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeNumber} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\n\nexport class NumberRunType extends AtomicRunType<TypeNumber> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `Number.isFinite(${comp.vλl})`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if(!(Number.isFinite(${comp.vλl}))) ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(): JitCode {\n return {code: undefined, type: 'S'};\n }\n emitRestoreFromJson(): JitCode {\n return {code: undefined, type: 'S'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,sBAAsBA,qBAAAA,cAAyB;AAAA,EACxD,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,mBAAmB,KAAK,GAAG,KAAK,MAAM,IAAA;AAAA,EACxD;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,wBAAwB,KAAK,GAAG,OAAO,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACxF;AAAA,EACA,qBAAkB;AACd,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA,EACA,sBAAmB;AACf,WAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAAA,EACnC;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"object.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"object.cjs","sources":["../../../../../src/nodes/atomic/object.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeAny, TypeUnknown} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\n\nexport class ObjectRunType extends AtomicRunType<TypeAny | TypeUnknown> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `(typeof ${comp.vλl} === 'object' && ${comp.vλl} !== null)`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (!(typeof ${comp.vλl} === 'object' && ${comp.vλl} !== null)) ${comp.callJitErr(this)}`, type: 'S'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,sBAAsBA,qBAAAA,cAAoC;AAAA,EACnE,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,WAAW,KAAK,GAAG,oBAAoB,KAAK,GAAG,cAAc,MAAM,IAAA;AAAA,EACrF;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,gBAAgB,KAAK,GAAG,oBAAoB,KAAK,GAAG,eAAe,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACpH;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"regexp.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"regexp.cjs","sources":["../../../../../src/nodes/atomic/regexp.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeRegexp} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\n\nexport class RegexpRunType extends AtomicRunType<TypeRegexp> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `(${comp.vλl} instanceof RegExp)`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (!(${comp.vλl} instanceof RegExp)) ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(comp: JitFnCompiler): JitCode {\n return {code: `${comp.vλl}.toString()`, type: 'E'};\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return {\n code: `(function(){const parts = ${comp.vλl}.match(/\\\\/(.*)\\\\/(.*)?/) ;return new RegExp(parts[1], parts[2] || '')})()`,\n type: 'E',\n };\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,sBAAsBA,qBAAAA,cAAyB;AAAA,EACxD,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,IAAI,KAAK,GAAG,uBAAuB,MAAM,IAAA;AAAA,EAC3D;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,SAAS,KAAK,GAAG,wBAAwB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EAC1F;AAAA,EACA,mBAAmB,MAAmB;AAClC,WAAO,EAAC,MAAM,GAAG,KAAK,GAAG,eAAe,MAAM,IAAA;AAAA,EAClD;AAAA,EACA,oBAAoB,MAAmB;AACnC,WAAO;AAAA,MACH,MAAM,6BAA6B,KAAK,GAAG;AAAA,MAC3C,MAAM;AAAA,IAAA;AAAA,EAEd;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"string.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"string.cjs","sources":["../../../../../src/nodes/atomic/string.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeString} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\n\nexport class StringRunType extends AtomicRunType<TypeString> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `typeof ${comp.vλl} === 'string'`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (typeof ${comp.vλl} !== 'string') ${comp.callJitErr(this)}`, type: 'S'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,sBAAsBA,qBAAAA,cAAyB;AAAA,EACxD,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,UAAU,KAAK,GAAG,iBAAiB,MAAM,IAAA;AAAA,EAC3D;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,cAAc,KAAK,GAAG,kBAAkB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACzF;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"symbol.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"symbol.cjs","sources":["../../../../../src/nodes/atomic/symbol.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeSymbol} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport {JitFunctions} from '../../constants.functions.ts';\n\nexport class SymbolRunType extends AtomicRunType<TypeSymbol> {\n skipJit(comp: JitFnCompiler): boolean {\n if (!comp) return true;\n return comp.fnID !== JitFunctions.toJSCode.id;\n }\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `typeof ${comp.vλl} === 'symbol'`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (typeof ${comp.vλl} !== 'symbol') ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(comp: JitFnCompiler): JitCode {\n return {code: `'Symbol:' + (${comp.vλl}.description || '')`, type: 'E'};\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return {code: `Symbol(${comp.vλl}.substring(7))`, type: 'E'};\n }\n}\n"],"names":["AtomicRunType","JitFunctions"],"mappings":";;;;AAaM,MAAO,sBAAsBA,qBAAAA,cAAyB;AAAA,EACxD,QAAQ,MAAmB;AACvB,QAAI,CAAC;AAAM,aAAO;AAClB,WAAO,KAAK,SAASC,wBAAAA,aAAa,SAAS;AAAA,EAC/C;AAAA,EACA,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,UAAU,KAAK,GAAG,iBAAiB,MAAM,IAAA;AAAA,EAC3D;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,cAAc,KAAK,GAAG,kBAAkB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACzF;AAAA,EACA,mBAAmB,MAAmB;AAClC,WAAO,EAAC,MAAM,gBAAgB,KAAK,GAAG,uBAAuB,MAAM,IAAA;AAAA,EACvE;AAAA,EACA,oBAAoB,MAAmB;AACnC,WAAO,EAAC,MAAM,UAAU,KAAK,GAAG,kBAAkB,MAAM,IAAA;AAAA,EAC5D;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"undefined.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"undefined.cjs","sources":["../../../../../src/nodes/atomic/undefined.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeUndefined} from '@deepkit/type';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport type {JitCode} from '../../types.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\n\nexport class UndefinedRunType extends AtomicRunType<TypeUndefined> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `typeof ${comp.vλl} === 'undefined'`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (typeof ${comp.vλl} !== 'undefined') ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitRestoreFromJson(): JitCode {\n return {code: `undefined`, type: 'E'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,yBAAyBA,qBAAAA,cAA4B;AAAA,EAC9D,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,UAAU,KAAK,GAAG,oBAAoB,MAAM,IAAA;AAAA,EAC9D;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,cAAc,KAAK,GAAG,qBAAqB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EAC5F;AAAA,EACA,sBAAmB;AACf,WAAO,EAAC,MAAM,aAAa,MAAM,IAAA;AAAA,EACrC;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"unknown.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"unknown.cjs","sources":["../../../../../src/nodes/atomic/unknown.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport {AnyRunType} from './any.ts';\n\nexport class UnknownRunType extends AnyRunType {}\n"],"names":["AnyRunType"],"mappings":";;;AASM,MAAO,uBAAuBA,qBAAAA,WAAU;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"void.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"void.cjs","sources":["../../../../../src/nodes/atomic/void.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeVoid} from '@deepkit/type';\nimport type {JitCode} from '../../types.ts';\nimport {AtomicRunType} from '../../lib/baseRunTypes.ts';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\n\nexport class VoidRunType extends AtomicRunType<TypeVoid> {\n emitIsType(comp: JitFnCompiler): JitCode {\n return {code: `${comp.vλl} === undefined`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n return {code: `if (${comp.vλl} !== undefined) ${comp.callJitErr(this)}`, type: 'S'};\n }\n emitPrepareForJson(comp: JitFnCompiler): JitCode {\n return {code: `${comp.vλl} = undefined`, type: 'E'};\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n return {code: `${comp.vλl} = undefined`, type: 'E'};\n }\n}\n"],"names":["AtomicRunType"],"mappings":";;;AAYM,MAAO,oBAAoBA,qBAAAA,cAAuB;AAAA,EACpD,WAAW,MAAmB;AAC1B,WAAO,EAAC,MAAM,GAAG,KAAK,GAAG,kBAAkB,MAAM,IAAA;AAAA,EACrD;AAAA,EACA,eAAe,MAAyB;AACpC,WAAO,EAAC,MAAM,OAAO,KAAK,GAAG,mBAAmB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AAAA,EACnF;AAAA,EACA,mBAAmB,MAAmB;AAClC,WAAO,EAAC,MAAM,GAAG,KAAK,GAAG,gBAAgB,MAAM,IAAA;AAAA,EACnD;AAAA,EACA,oBAAoB,MAAmB;AACnC,WAAO,EAAC,MAAM,GAAG,KAAK,GAAG,gBAAgB,MAAM,IAAA;AAAA,EACnD;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"class.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"class.cjs","sources":["../../../../../src/nodes/collection/class.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\nimport {TypeClass} from '@deepkit/type';\nimport {InterfaceMember, InterfaceRunType} from './interface.ts';\nimport {JitFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport {getJitUtils} from '@mionjs/core';\nimport {toLiteral} from '../../lib/utils.ts';\nimport {isConstructor} from '../../lib/guards.ts';\nimport {JitCode} from '../../types.ts';\n\nexport class ClassRunType extends InterfaceRunType<TypeClass> {\n getClassName(): string {\n return this.src.classType.name;\n }\n isClassWithEmptyConstructor(): boolean {\n const children = this.getChildRunTypes() as InterfaceMember[];\n const isEmpty = children.every((prop) => !isConstructor(prop) || prop.getParameters().getChildRunTypes().length === 0);\n return isEmpty;\n }\n emitRestoreFromJson(comp: JitFnCompiler): JitCode {\n const objJit = super.emitRestoreFromJson(comp);\n const desFnVarName = comp.getLocalVarName('desFn', this);\n const classLiteral = toLiteral(this.getClassName());\n const code = `\n ${objJit.code};\n let ${desFnVarName} = utl.${getJitUtils().getDeserializeFn.name}(${classLiteral});\n if (${desFnVarName}) {${comp.vλl} = ${desFnVarName}(${comp.vλl})}\n else if (${desFnVarName} = utl.${getJitUtils().getSerializeClass.name}(${classLiteral})) {${comp.vλl} = new ${desFnVarName}(${comp.vλl})}\n `;\n return {code, type: 'S'};\n }\n}\n"],"names":["InterfaceRunType","isConstructor","toLiteral","getJitUtils"],"mappings":";;;;;;;;;;;;;AAcM,MAAO,qBAAqBA,+BAAAA,iBAA2B;AAAA,EACzD,eAAY;AACR,WAAO,KAAK,IAAI,UAAU;AAAA,EAC9B;AAAA,EACA,8BAA2B;AACvB,UAAM,WAAW,KAAK,iBAAA;AACtB,UAAM,UAAU,SAAS,MAAK,aAAC,CAAC,SAAS,CAACC,6BAAc,IAAI,KAAK,KAAK,gBAAgB,iBAAA,EAAmB,WAAW;AACpH,WAAO;AAAA,EACX;AAAA,EACA,oBAAoB,MAAmB;AACnC,UAAM,SAAS,MAAM,oBAAoB,IAAI;AAC7C,UAAM,eAAe,KAAK,gBAAgB,SAAS,IAAI;AACvD,UAAM,eAAeC,cAAAA,UAAU,KAAK,aAAA,CAAc;AAClD,UAAM,OAAO;AAAA,cACP,OAAO,IAAI;AAAA,kBACP,YAAY,UAAUC,KAAAA,YAAA,EAAc,iBAAiB,IAAI,IAAI,YAAY;AAAA,kBACzE,YAAY,MAAM,KAAK,GAAG,MAAM,YAAY,IAAI,KAAK,GAAG;AAAA,uBACnD,YAAY,UAAUA,KAAAA,YAAA,EAAc,kBAAkB,IAAI,IAAI,YAAY,OAAO,KAAK,GAAG,UAAU,YAAY,IAAI,KAAK,GAAG;AAAA;AAE1I,WAAO,EAAC,MAAM,MAAM,IAAA;AAAA,EACxB;AAAA;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"functionParams.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"functionParams.cjs","sources":["../../../../../src/nodes/collection/functionParams.ts"],"sourcesContent":["/* ########\n * 2024 mion\n * Author: Ma-jerez\n * License: MIT\n * The software is provided \"as is\", without warranty of any kind.\n * ######## */\n\nimport type {TypeFunction} from '@deepkit/type';\nimport type {JitFnCompiler, JitErrorsFnCompiler} from '../../lib/jitFnCompiler.ts';\nimport type {AnyParameterListRunType, JitCode} from '../../types.ts';\nimport {TupleRunType} from './tuple.ts';\nimport {ParameterRunType} from '../member/param.ts';\n\nexport class FunctionParamsRunType<ParamList extends AnyParameterListRunType = TypeFunction> extends TupleRunType<\n ParamList,\n ParameterRunType\n> {\n emitIsType(comp: JitFnCompiler): JitCode {\n const children = this.getParamRunTypes(comp);\n if (children.length === 0) return {code: `${comp.vλl}.length === 0`, type: 'E'};\n const lengthCode = this.hasRestParameter(comp) ? '' : `${comp.vλl}.length <= ${children.length}`;\n // Only include parameters that require validation\n const paramsCode = children.map((p) => comp.compileIsType(p, 'E').code).filter(Boolean);\n if (paramsCode.length === 0) return lengthCode ? {code: `(${lengthCode})`, type: 'E'} : {code: undefined, type: 'E'};\n return lengthCode\n ? {code: `(${lengthCode} && ${paramsCode.join(' && ')})`, type: 'E'}\n : {code: `(${paramsCode.join(' && ')})`, type: 'E'};\n }\n emitTypeErrors(comp: JitErrorsFnCompiler): JitCode {\n const children = this.getParamRunTypes(comp);\n if (children.length === 0) return {code: `if (${comp.vλl}.length !== 0) ${comp.callJitErr(this)}`, type: 'S'};\n const lengthCode = this.hasRestParameter(comp) ? '' : `${comp.vλl}.length > ${children.length}`;\n\n // Only include parameters that require validation\n const paramsCode = children.map((p) => comp.compileTypeErrors(p, 'S').code).filter(Boolean);\n if (paramsCode.length === 0)\n return lengthCode ? {code: `if (${lengthCode}) ${comp.callJitErr(this)}`, type: 'S'} : {code: undefined, type: 'S'};\n return lengthCode\n ? {code: `if (${lengthCode}) ${comp.callJitErr(this)}; else {${paramsCode.join(';')}}`, type: 'S'}\n : {code: paramsCode.join(';'), type: 'S'};\n }\n}\n"],"names":["TupleRunType"],"mappings":";;;;;;;;AAaM,MAAO,8BAAwFA,2BAAAA,aAGpG;AAAA,EACG,WAAW,MAAmB;AAC1B,UAAM,WAAW,KAAK,iBAAiB,IAAI;AAC3C,QAAI,SAAS,WAAW;AAAG,aAAO,EAAC,MAAM,GAAG,KAAK,GAAG,iBAAiB,MAAM,IAAA;AAC3E,UAAM,aAAa,KAAK,iBAAiB,IAAI,IAAI,KAAK,GAAG,KAAK,GAAG,cAAc,SAAS,MAAM;AAE9F,UAAM,aAAa,SAAS,IAAG,aAAC,CAAC,MAAM,KAAK,cAAc,GAAG,GAAG,EAAE,MAAI,CAAA,KAAA,IAAA,SAAA,CAAA,CAAA,EAAE,OAAO,OAAO;AACtF,QAAI,WAAW,WAAW;AAAG,aAAO,aAAa,EAAC,MAAM,IAAI,UAAU,KAAK,MAAM,IAAA,IAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AAChH,WAAO,aACD,EAAC,MAAM,IAAI,UAAU,OAAO,WAAW,KAAK,MAAM,CAAC,KAAK,MAAM,QAC9D,EAAC,MAAM,IAAI,WAAW,KAAK,MAAM,CAAC,KAAK,MAAM,IAAA;AAAA,EACvD;AAAA,EACA,eAAe,MAAyB;AACpC,UAAM,WAAW,KAAK,iBAAiB,IAAI;AAC3C,QAAI,SAAS,WAAW;AAAG,aAAO,EAAC,MAAM,OAAO,KAAK,GAAG,kBAAkB,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA;AACzG,UAAM,aAAa,KAAK,iBAAiB,IAAI,IAAI,KAAK,GAAG,KAAK,GAAG,aAAa,SAAS,MAAM;AAG7F,UAAM,aAAa,SAAS,IAAG,aAAC,CAAC,MAAM,KAAK,kBAAkB,GAAG,GAAG,EAAE,MAAI,CAAA,KAAA,IAAA,SAAA,CAAA,CAAA,EAAE,OAAO,OAAO;AAC1F,QAAI,WAAW,WAAW;AACtB,aAAO,aAAa,EAAC,MAAM,OAAO,UAAU,KAAK,KAAK,WAAW,IAAI,CAAC,IAAI,MAAM,IAAA,IAAO,EAAC,MAAM,QAAW,MAAM,IAAA;AACnH,WAAO,aACD,EAAC,MAAM,OAAO,UAAU,KAAK,KAAK,WAAW,IAAI,CAAC,WAAW,WAAW,KAAK,GAAG,CAAC,KAAK,MAAM,IAAA,IAC5F,EAAC,MAAM,WAAW,KAAK,GAAG,GAAG,MAAM,IAAA;AAAA,EAC7C;AAAA;;;"}
@@ -54,8 +54,14 @@ class InterfaceRunType extends src_lib_baseRunTypes.CollectionRunType {
54
54
  code: [this.getCallSignature().emitIsType(comp).code, childrenCode].filter(Boolean).join(" && "),
55
55
  type: "E"
56
56
  };
57
+ let propsCode = "";
58
+ if (comp.opts.strictTypes && !this.hasIndexSignature(comp)) {
59
+ const unknownCheck = callCheckUnknownProperties(this, comp, children, false, false);
60
+ if (unknownCheck)
61
+ propsCode = `!${unknownCheck}`;
62
+ }
57
63
  const objectCheck = this.isPartOfUnion() ? "" : `typeof ${varName} === 'object' && ${varName} !== null`;
58
- const itemsCode = [objectCheck, this.allOptionalCode(comp), childrenCode].filter(Boolean).join(" && ");
64
+ const itemsCode = [objectCheck, this.allOptionalCode(comp), childrenCode, propsCode].filter(Boolean).join(" && ");
59
65
  return { code: `(${itemsCode})`, type: "E" };
60
66
  }
61
67
  emitTypeErrors(comp) {
@@ -65,6 +71,18 @@ class InterfaceRunType extends src_lib_baseRunTypes.CollectionRunType {
65
71
  if (this.isCallable()) {
66
72
  return { code: `${this.getCallSignature().emitTypeErrors(comp).code} else {${childrenCode}}`, type: "S" };
67
73
  }
74
+ let propsCode = "";
75
+ if (comp.opts.strictTypes && !this.hasIndexSignature(comp)) {
76
+ const unknownVar = comp.getLocalVarName("unk", this);
77
+ const keyVar = comp.getLocalVarName("ky", this);
78
+ const unknownValue = callCheckUnknownProperties(this, comp, children, true, false);
79
+ if (unknownValue) {
80
+ propsCode = `
81
+ const ${unknownVar} = ${unknownValue};
82
+ if (${unknownVar}) {for (const ${keyVar} of ${unknownVar}) {${comp.callJitErrWithPath("never", keyVar)}}}
83
+ `;
84
+ }
85
+ }
68
86
  const objectCheck = this.isPartOfUnion() ? "" : `typeof ${varName} === 'object' && ${varName} !== null`;
69
87
  const isObjectCode = [objectCheck, this.allOptionalCode(comp)].filter(Boolean).join(" && ");
70
88
  return {
@@ -73,6 +91,7 @@ class InterfaceRunType extends src_lib_baseRunTypes.CollectionRunType {
73
91
  ${comp.callJitErr(this)};
74
92
  } else {
75
93
  ${childrenCode}
94
+ ${propsCode}
76
95
  }
77
96
  `,
78
97
  type: "S"
@@ -204,10 +223,11 @@ function callCheckUnknownProperties(rt, comp, jitChildrenRunTypes, returnKeys, c
204
223
  const checkPropName = src_constants_functions.JitFunctions.hasUnknownKeys.runTimeOptions.checkNonJitProps.keyName;
205
224
  const optsVarName = src_lib_utils.getJitFnArgCallVarName(comp, rt, src_constants_functions.JitFunctions.hasUnknownKeys.id, "θpts");
206
225
  const conditional = allChildrenRuntypes?.length && result.hasNonJitChildren ? `${optsVarName}.${checkPropName} ? ${result.allKeysName} : ${result.keysName}` : result.keysName;
207
- const getUnknownKeysFn = comp.addPureFunction(src_runTypesPureFns.cpf_getUnknownKeysFromArray);
208
- const hasUnknownKeysFn = comp.addPureFunction(src_runTypesPureFns.cpf_hasUnknownKeysFromArray);
209
- if (returnKeys)
226
+ if (returnKeys) {
227
+ const getUnknownKeysFn = comp.addPureFunction(src_runTypesPureFns.cpf_getUnknownKeysFromArray);
210
228
  return `${getUnknownKeysFn}(${comp.vλl}, ${conditional})`;
229
+ }
230
+ const hasUnknownKeysFn = comp.addPureFunction(src_runTypesPureFns.cpf_hasUnknownKeysFromArray);
211
231
  objectCheckCode.push(`${hasUnknownKeysFn}(${comp.vλl}, ${conditional})`);
212
232
  const filtered = objectCheckCode.filter(Boolean);
213
233
  if (filtered.length > 1)