@routier/core 0.2.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/{readme.md → README.md} +3 -3
- package/dist/assertions/index.cjs +191 -0
- package/dist/assertions/index.cjs.map +1 -0
- package/dist/assertions/index.js +43 -63
- package/dist/assertions/index.js.map +1 -1
- package/dist/capabilities/index.cjs +820 -0
- package/dist/capabilities/index.cjs.map +1 -0
- package/dist/capabilities/index.js +584 -558
- package/dist/capabilities/index.js.map +1 -1
- package/dist/codegen/handlers/CloneHandlerBuilder.d.ts +10 -1
- package/dist/codegen/handlers/clone/CloneArrayHandler.d.ts +3 -0
- package/dist/codegen/handlers/clone/CloneDateHandler.d.ts +13 -0
- package/dist/codegen/handlers/clone/CloneValueHandler.d.ts +16 -0
- package/dist/codegen/handlers/compare/CompareComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/compare/CompareFunctionHandler.d.ts +10 -0
- package/dist/codegen/handlers/deserialize/DeserializeArrayHandler.d.ts +14 -0
- package/dist/codegen/handlers/enableChangeTracking/EnableChangeTrackingArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/enrichment/EnrichmentArrayHandler.d.ts +11 -0
- package/dist/codegen/handlers/freeze/FreezeArrayHandler.d.ts +6 -0
- package/dist/codegen/handlers/hash/HashArrayHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashFileHandler.d.ts +24 -0
- package/dist/codegen/handlers/hash/HashObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/hash/HashTransformHandler.d.ts +23 -0
- package/dist/codegen/handlers/merge/MergeArrayHandler.d.ts +20 -0
- package/dist/codegen/handlers/merge/MergeObjectHandler.d.ts +10 -0
- package/dist/codegen/handlers/serialize/SerializeArrayHandler.d.ts +19 -0
- package/dist/codegen/handlers/strip/StripComputedHandler.d.ts +10 -0
- package/dist/codegen/handlers/strip/StripFunctionHandler.d.ts +9 -0
- package/dist/codegen/handlers/types.d.ts +55 -1
- package/dist/codegen/index.cjs +618 -0
- package/dist/codegen/index.cjs.map +1 -0
- package/dist/codegen/index.js +99 -127
- package/dist/codegen/index.js.map +1 -1
- package/dist/collections/MemoryDataCollection.d.ts +15 -1
- package/dist/collections/TagCollection.d.ts +0 -1
- package/dist/collections/index.cjs +702 -0
- package/dist/collections/index.cjs.map +1 -0
- package/dist/collections/index.js +282 -276
- package/dist/collections/index.js.map +1 -1
- package/dist/errors/OptimisticConcurrencyError.d.ts +18 -0
- package/dist/errors/PluginDestroyedError.d.ts +10 -0
- package/dist/errors/index.cjs +132 -0
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +61 -19
- package/dist/errors/index.js.map +1 -1
- package/dist/expressions/evaluate.d.ts +53 -0
- package/dist/expressions/index.cjs +2087 -0
- package/dist/expressions/index.cjs.map +1 -0
- package/dist/expressions/index.d.ts +1 -1
- package/dist/expressions/index.js +1727 -1082
- package/dist/expressions/index.js.map +1 -1
- package/dist/expressions/parser.d.ts +19 -0
- package/dist/expressions/types.d.ts +87 -2
- package/dist/index.cjs +14377 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +12374 -7931
- package/dist/index.js.map +1 -1
- package/dist/performance/index.cjs +217 -0
- package/dist/performance/index.cjs.map +1 -0
- package/dist/performance/index.js +120 -55
- package/dist/performance/index.js.map +1 -1
- package/dist/pipeline/index.cjs +576 -0
- package/dist/pipeline/index.cjs.map +1 -0
- package/dist/pipeline/index.js +223 -161
- package/dist/pipeline/index.js.map +1 -1
- package/dist/plugins/BatchingDbPlugin.d.ts +139 -0
- package/dist/plugins/CacheDbPlugin.d.ts +70 -0
- package/dist/plugins/ConcurrencyDbPlugin.d.ts +78 -0
- package/dist/plugins/EphemeralDataPlugin.d.ts +57 -1
- package/dist/plugins/RetryDbPlugin.d.ts +77 -0
- package/dist/plugins/index.cjs +6551 -0
- package/dist/plugins/index.cjs.map +1 -0
- package/dist/plugins/index.d.ts +5 -0
- package/dist/plugins/index.js +6271 -1170
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/query/QueryOptionsCollection.d.ts +34 -0
- package/dist/plugins/query/explain.d.ts +82 -0
- package/dist/plugins/query/formatExplanation.d.ts +9 -0
- package/dist/plugins/query/index.d.ts +4 -0
- package/dist/plugins/query/join.d.ts +210 -0
- package/dist/plugins/query/similarity.d.ts +38 -0
- package/dist/plugins/query/types.d.ts +75 -1
- package/dist/plugins/translators/DataTranslator.d.ts +28 -0
- package/dist/plugins/translators/JsonTranslator.d.ts +27 -0
- package/dist/plugins/translators/SqlTranslator.d.ts +45 -0
- package/dist/plugins/translators/TupleTranslator.d.ts +45 -0
- package/dist/plugins/translators/index.d.ts +1 -0
- package/dist/plugins/types.d.ts +125 -3
- package/dist/plugins/wire/handler.d.ts +122 -0
- package/dist/plugins/wire/index.d.ts +4 -0
- package/dist/plugins/wire/persist.d.ts +43 -0
- package/dist/plugins/wire/query.d.ts +49 -0
- package/dist/plugins/wire/types.d.ts +139 -0
- package/dist/results/index.cjs +174 -0
- package/dist/results/index.cjs.map +1 -0
- package/dist/results/index.js +29 -44
- package/dist/results/index.js.map +1 -1
- package/dist/schema/PropertyInfo.d.ts +31 -2
- package/dist/schema/SchemaDefinition.d.ts +23 -1
- package/dist/schema/builder.d.ts +35 -1
- package/dist/schema/communication/broadcast.d.ts +17 -1
- package/dist/schema/index.cjs +6911 -0
- package/dist/schema/index.cjs.map +1 -0
- package/dist/schema/index.d.ts +2 -0
- package/dist/schema/index.js +5330 -4541
- package/dist/schema/index.js.map +1 -1
- package/dist/schema/property/base/SchemaBase.d.ts +48 -2
- package/dist/schema/property/modifiers/SchemaNullable.d.ts +10 -0
- package/dist/schema/property/modifiers/SchemaOptional.d.ts +19 -0
- package/dist/schema/property/modifiers/SchemaSearchable.d.ts +34 -0
- package/dist/schema/property/modifiers/index.d.ts +1 -0
- package/dist/schema/property/types/SchemaFile.d.ts +60 -0
- package/dist/schema/property/types/SchemaString.d.ts +21 -1
- package/dist/schema/property/types/SchemaVector.d.ts +61 -0
- package/dist/schema/property/types/index.d.ts +2 -0
- package/dist/schema/table/SchemaTransform.d.ts +40 -0
- package/dist/schema/table/index.d.ts +1 -0
- package/dist/schema/types.d.ts +166 -8
- package/dist/schema/utils/propertyKind.d.ts +4 -0
- package/dist/types/index.cjs +23 -0
- package/dist/types/index.cjs.map +1 -0
- package/dist/types/index.js +0 -14
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/index.cjs +1013 -0
- package/dist/utilities/index.cjs.map +1 -0
- package/dist/utilities/index.js +541 -379
- package/dist/utilities/index.js.map +1 -1
- package/dist/utilities/logger.d.ts +48 -0
- package/package.json +156 -98
- package/dist/codegen/SlotPath.test.d.ts +0 -1
- package/dist/codegen/blocks.test.d.ts +0 -1
- package/dist/codegen/utils.test.d.ts +0 -1
- package/dist/collections/Changes.test.d.ts +0 -1
- package/dist/collections/IdSet.test.d.ts +0 -1
- package/dist/collections/MemoryDataCollection.test.d.ts +0 -1
- package/dist/collections/TagCollection.contract.test.d.ts +0 -1
- package/dist/collections/TagCollection.test.d.ts +0 -1
- package/dist/expressions/parser.test.d.ts +0 -1
- package/dist/expressions/sql.d.ts +0 -28
- package/dist/expressions/sql.test.d.ts +0 -1
- package/dist/expressions/utils.test.d.ts +0 -1
- package/dist/pipeline/SyncronousQueue.test.d.ts +0 -1
- package/dist/plugins/EphemeralDataPlugin.test.d.ts +0 -1
- package/dist/plugins/query/Query.test.d.ts +0 -1
- package/dist/plugins/query/QueryOptionsCollection.test.d.ts +0 -1
- package/dist/plugins/translators/JsonTranslator.test.d.ts +0 -1
- package/dist/plugins/translators/SqlTranslator.test.d.ts +0 -1
- package/dist/plugins/translators/TranslatedValues.test.d.ts +0 -1
- package/dist/results/Result.test.d.ts +0 -1
- package/dist/results/utils.test.d.ts +0 -1
- package/dist/schema/PropertyInfo.test.d.ts +0 -1
- package/dist/schema/communication/broadcast.test.d.ts +0 -1
- package/dist/schema/schemaGeneration.test.d.ts +0 -1
- package/dist/schema/utils/standardJsonSchema.test.d.ts +0 -1
- package/dist/utilities/arrays.test.d.ts +0 -1
- package/dist/utilities/dates.test.d.ts +0 -1
- package/dist/utilities/runtime.test.d.ts +0 -1
- package/dist/utilities/strings.test.d.ts +0 -1
- package/dist/utilities/uuid.test.d.ts +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["webpack://@routier/core/./src/assertions/index.ts","webpack://@routier/core/./src/capabilities/Capability.ts","webpack://@routier/core/./src/capabilities/PerformanceCapability.ts","webpack://@routier/core/./src/capabilities/TracingCapability.ts","webpack://@routier/core/./src/capabilities/index.ts","webpack://@routier/core/./src/capabilities/performance/PerformanceTracker.ts","webpack://@routier/core/./src/capabilities/tracing/CallTraceManager.ts","webpack://@routier/core/./src/codegen/SlotPath.ts","webpack://@routier/core/./src/codegen/blocks.ts","webpack://@routier/core/./src/codegen/handlers/CloneHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/CompareHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/CompareIdsHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/DeserializeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/EnrichmentHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/FreezeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/HashHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/HashTypeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/IdSelectorHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/MergeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/PrepareHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/SerializeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/SetHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/StripHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/clone/CloneArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/clone/CloneObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/clone/CloneValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/compareIds/CompareIdsKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeDeserializerHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/enableChangeTracking/EnableChangeTrackingObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentDefaultFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentDefaultValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentNullableObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentObjectIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentPrimitiveHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentPrimitiveIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/freeze/FreezeObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/freeze/FreezePrimitiveValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/hashType/HashTypeValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/idSelector/IdSelectorValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeDefaultFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeDefaultValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergePrimitiveHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeComputedHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeSerializerHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/set/SetComplexHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/types.ts","webpack://@routier/core/./src/codegen/index.ts","webpack://@routier/core/./src/codegen/utils.ts","webpack://@routier/core/./src/collections/Changes.ts","webpack://@routier/core/./src/collections/IdSet.ts","webpack://@routier/core/./src/collections/MemoryDataCollection.ts","webpack://@routier/core/./src/collections/ReadonlySchemaCollection.ts","webpack://@routier/core/./src/collections/SchemaCollection.ts","webpack://@routier/core/./src/collections/TagCollection.ts","webpack://@routier/core/./src/collections/index.ts","webpack://@routier/core/./src/errors/SchemaError.ts","webpack://@routier/core/./src/errors/index.ts","webpack://@routier/core/./src/expressions/constants.ts","webpack://@routier/core/./src/expressions/index.ts","webpack://@routier/core/./src/expressions/parser.ts","webpack://@routier/core/./src/expressions/sql.ts","webpack://@routier/core/./src/expressions/types.ts","webpack://@routier/core/./src/expressions/utils.ts","webpack://@routier/core/./src/performance/index.ts","webpack://@routier/core/./src/pipeline/SyncronousQueue.ts","webpack://@routier/core/./src/pipeline/TrampolinePipeline.ts","webpack://@routier/core/./src/pipeline/index.ts","webpack://@routier/core/./src/plugins/EphemeralDataPlugin.ts","webpack://@routier/core/./src/plugins/index.ts","webpack://@routier/core/./src/plugins/query/Query.ts","webpack://@routier/core/./src/plugins/query/QueryOptionsCollection.ts","webpack://@routier/core/./src/plugins/query/index.ts","webpack://@routier/core/./src/plugins/query/types.ts","webpack://@routier/core/./src/plugins/translators/DataTranslator.ts","webpack://@routier/core/./src/plugins/translators/JsonTranslator.ts","webpack://@routier/core/./src/plugins/translators/SqlTranslator.ts","webpack://@routier/core/./src/plugins/translators/TranslatedArrayValue.ts","webpack://@routier/core/./src/plugins/translators/TranslatedGroupValue.ts","webpack://@routier/core/./src/plugins/translators/TranslatedSingleValue.ts","webpack://@routier/core/./src/plugins/translators/index.ts","webpack://@routier/core/./src/results/Result.ts","webpack://@routier/core/./src/results/index.ts","webpack://@routier/core/./src/results/utils.ts","webpack://@routier/core/./src/schema/PropertyInfo.ts","webpack://@routier/core/./src/schema/SchemaDefinition.ts","webpack://@routier/core/./src/schema/builder.ts","webpack://@routier/core/./src/schema/communication/broadcast.ts","webpack://@routier/core/./src/schema/index.ts","webpack://@routier/core/./src/schema/property/base/SchemaBase.ts","webpack://@routier/core/./src/schema/property/base/index.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaDefault.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaDeserialize.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaDistinct.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaForeignKey.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaFrom.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaIdentity.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaIndex.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaKey.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaNullable.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaOptional.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaReadonly.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaSerialize.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaTag.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaTracked.ts","webpack://@routier/core/./src/schema/property/modifiers/index.ts","webpack://@routier/core/./src/schema/property/types/SchemaArray.ts","webpack://@routier/core/./src/schema/property/types/SchemaBoolean.ts","webpack://@routier/core/./src/schema/property/types/SchemaDate.ts","webpack://@routier/core/./src/schema/property/types/SchemaNumber.ts","webpack://@routier/core/./src/schema/property/types/SchemaObject.ts","webpack://@routier/core/./src/schema/property/types/SchemaString.ts","webpack://@routier/core/./src/schema/property/types/index.ts","webpack://@routier/core/./src/schema/table/SchemaComputed.ts","webpack://@routier/core/./src/schema/table/SchemaFunction.ts","webpack://@routier/core/./src/schema/table/index.ts","webpack://@routier/core/./src/schema/types.ts","webpack://@routier/core/./src/schema/utils/standardJsonSchema.ts","webpack://@routier/core/./src/utilities/arrays.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/./src/utilities/dbPluginEventUtils.ts","webpack://@routier/core/./src/utilities/functions.ts","webpack://@routier/core/./src/utilities/index.ts","webpack://@routier/core/./src/utilities/logger.ts","webpack://@routier/core/./src/utilities/objects.ts","webpack://@routier/core/./src/utilities/queryOptionsCollection.ts","webpack://@routier/core/./src/utilities/replication.ts","webpack://@routier/core/./src/utilities/runtime.ts","webpack://@routier/core/./src/utilities/strings.ts","webpack://@routier/core/./src/utilities/unsafeCast.ts","webpack://@routier/core/./src/utilities/uuid.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/index.ts"],"sourcesContent":["import { EXPRESSION_TYPES } from \"../expressions/constants\";\nimport { ComparatorExpression, EmptyExpression, Expression, ExpressionType, NotParsableExpression, OperatorExpression, PropertyExpression, ValueExpression } from \"../expressions/types\";\nimport { isDate } from \"../utilities\";\n\nexport function assertDate(data: unknown): asserts data is Date {\n if (isDate(data) === false) {\n throw new TypeError('Value is not a Date');\n }\n}\n\nexport function assertIsNotNull<T>(data: T | null | undefined, message?: string | (() => string)): asserts data is NonNullable<T> {\n if (data == null) {\n if (message == null) {\n throw new TypeError('Assertion failed, data is null');\n }\n\n if (typeof message === \"string\") {\n throw new TypeError(message);\n }\n\n throw new TypeError(message());\n }\n}\n\nexport function assertIsArray<T>(data: unknown, message?: string): asserts data is T[] {\n if (!Array.isArray(data)) {\n throw new TypeError(message ?? 'Assertion failed, data is not of type Array');\n }\n}\n\nexport function assertString(data: unknown, message?: string): asserts data is string {\n if (typeof data !== \"string\") {\n throw new TypeError(message ?? 'Assertion failed, data is not of type String');\n }\n}\n\nexport function assertInstanceOf<T extends new (...args: any[]) => any>(value: unknown, Instance: T): asserts value is T {\n if (value instanceof Instance) {\n return;\n }\n\n if (value != null && typeof value === \"object\" && \"constructor\" in value) {\n throw new TypeError(`value is not instance of type. Type: ${value.constructor.name}`);\n }\n\n throw new TypeError(`value is not instance of type`);\n}\n\nexport function assertIsNumber(value: unknown): asserts value is number {\n if (typeof value !== \"number\") {\n throw new TypeError(\"value is not of type `number`\");\n }\n}\n\n\nfunction isObjectWithType(value: unknown): value is Record<\"type\", unknown> {\n return typeof value === \"object\" && value !== null && \"type\" in value;\n}\n\n/**\n * Type guard: narrows `value` to `Expression` when it is an object with a valid `type` property.\n */\nexport function isExpression(value: unknown): value is Expression {\n return isObjectWithType(value) && EXPRESSION_TYPES.includes(value.type as ExpressionType);\n}\n\n/**\n * Type guard: narrows `value` to `OperatorExpression` when it is an object with `type === \"operator\"`.\n */\nexport function isOperatorExpression(value: unknown): value is OperatorExpression {\n return isObjectWithType(value) && value.type === \"operator\";\n}\n\n/**\n * Type guard: narrows `value` to `ComparatorExpression` when it is an object with `type === \"comparator\"`.\n */\nexport function isComparatorExpression(value: unknown): value is ComparatorExpression {\n return isObjectWithType(value) && value.type === \"comparator\";\n}\n\n/**\n * Type guard: narrows `value` to `PropertyExpression` when it is an object with `type === \"property\"`.\n */\nexport function isPropertyExpression(value: unknown): value is PropertyExpression {\n return isObjectWithType(value) && value.type === \"property\";\n}\n\n/**\n * Type guard: narrows `value` to `ValueExpression` when it is an object with `type === \"value\"`.\n */\nexport function isValueExpression(value: unknown): value is ValueExpression {\n return isObjectWithType(value) && value.type === \"value\";\n}\n\n/**\n * Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === \"empty\"`.\n */\nexport function isEmptyExpression(value: unknown): value is EmptyExpression {\n return isObjectWithType(value) && value.type === \"empty\";\n}\n\n/**\n * Type guard: narrows `value` to `NotParsableExpression` when it is an object with `type === \"not-parsable\"`.\n */\nexport function isNotParsableExpression(value: unknown): value is NotParsableExpression {\n return isObjectWithType(value) && value.type === \"not-parsable\";\n}","import { MethodInfo, MethodInfoMetadata } from \"./types\";\n\nexport abstract class Capability {\n\n protected excludedNames = new Set<string>([\n \"Array\",\n \"Set\",\n \"Map\",\n \"AbortController\",\n \"AbortSignal\",\n \"SchemaString\",\n \"SchemaNumber\",\n \"SchemaArray\",\n \"SchemaBoolean\",\n \"SchemaDate\",\n \"SchemaObject\",\n \"SchemaDefault\",\n \"SchemaDeserialize\",\n \"SchemaDistinct\",\n \"SchemaFrom\",\n \"SchemaIdentity\",\n \"SchemaIndex\",\n \"SchemaKey\",\n \"SchemaNullable\",\n \"SchemaOptional\",\n \"SchemaReadonly\",\n \"SchemaSerialize\",\n \"SchemaTracked\",\n \"SchemaComputed\",\n \"SchemaFunction\",\n \"SchemaBase\",\n \"SchemaDefinition\"\n ]);\n\n protected isValidObject(obj: unknown): obj is object {\n return typeof obj === \"object\" && obj !== null;\n }\n\n protected isCallableMethod(descriptor: PropertyDescriptor | undefined, key: string | symbol): boolean {\n return (\n descriptor?.value &&\n typeof descriptor.value === 'function' &&\n key !== 'constructor' &&\n key !== 'undefined'\n );\n }\n\n\n private canExplore(descriptor: PropertyDescriptor) {\n if (typeof descriptor.value !== \"object\") {\n return false;\n }\n\n if (descriptor.value == null) {\n return false\n }\n\n const name = this.getName(descriptor.value);\n\n if (name == null) {\n return true;\n }\n\n return this.excludedNames.has(name) === false\n }\n\n private getName(value: object) {\n if (value.constructor != null) {\n return value.constructor.name;\n }\n\n return null;\n }\n\n private getPath(info: MethodInfoMetadata, propertyName: string | symbol) {\n\n let parent = info.parent;\n const path = [info.propertyName, propertyName];\n\n while (parent != null) {\n\n path.unshift(parent.propertyName);\n parent = parent.parent;\n }\n\n return path.join(\".\");\n }\n\n protected explore(instance: unknown, onDiscover: (info: MethodInfoMetadata, methodInfo: MethodInfo) => void): void {\n if (!this.isValidObject(instance)) {\n return;\n }\n\n const explore: MethodInfoMetadata[] = [{ instance, propertyName: this.getName(instance) }];\n const visited = new Set<object>();\n\n for (let i = 0; i < explore.length; i++) {\n\n const info = explore[i];\n const item = info.instance;\n\n if (visited.has(item)) {\n continue;\n }\n\n const allKeys = [\n ...Object.getOwnPropertyNames(item),\n ...Object.getOwnPropertySymbols(item),\n ];\n\n for (const key of allKeys) {\n\n const descriptor = Object.getOwnPropertyDescriptor(item, key);\n\n const isCallable = this.isCallableMethod(descriptor, key);\n\n onDiscover(info, {\n name: key,\n isCallable\n });\n\n if (this.canExplore(descriptor) === false) {\n continue;\n }\n\n const path = this.getPath(info, key);\n explore.push({ instance: descriptor.value, parent: info, propertyName: key, path });\n }\n\n visited.add(item);\n }\n }\n\n abstract apply(instance: unknown): void;\n}","import { stringifyObject } from \"../utilities\";\nimport { Capability } from \"./Capability\";\nimport { PerformanceTracker } from \"./performance/PerformanceTracker\";\nimport { CallTraceManager } from \"./tracing/CallTraceManager\";\nimport { MethodInfoMetadata, MethodInfo } from \"./types\";\nimport { logger } from '../utilities';\n\nexport type PerformanceCapabilityOptions = {\n filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean\n}\n\nexport class PerformanceCapability extends Capability {\n\n private callTraceManager: CallTraceManager;\n private performanceTracker: PerformanceTracker;\n private filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean;\n private childDurations: Map<string, number[]> = new Map();\n\n constructor(options?: PerformanceCapabilityOptions) {\n super();\n this.filter = options?.filter ?? (() => true)\n this.callTraceManager = new CallTraceManager();\n this.performanceTracker = new PerformanceTracker();\n }\n\n override apply(instance: unknown): void {\n\n this.explore(instance, (meta, info) => {\n\n if (info.isCallable) {\n const originalMethod = meta.instance[info.name].bind(meta.instance);\n\n meta.instance[info.name] = (...args: any[]) => {\n\n const path = `${meta.path!}.${String(info.name)}()`;\n\n if (this.filter(path, info, meta) === false) {\n return originalMethod(...args);\n }\n\n const isNewOperation = this.callTraceManager.isNewOperation();\n let operationId: string;\n let callTrace: string[];\n let depth: number;\n\n if (isNewOperation) {\n operationId = this.callTraceManager.startNewOperation();\n this.childDurations.set(operationId, []);\n callTrace = this.callTraceManager.addMethodToTrace(path);\n depth = callTrace.length - 1;\n const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);\n\n this.performanceTracker.startMethodTiming(operationId, path);\n\n logger.log(`\\n${'═'.repeat(60)}`);\n logger.log(`▶ ORIGIN [${operationId}] ${path}`);\n if (args.length > 0) {\n logger.log(` Args:`, stringifyObject(args, 4, 0));\n }\n logger.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);\n } else {\n operationId = this.callTraceManager.getActiveOperationId();\n callTrace = this.callTraceManager.addMethodToTrace(path);\n depth = callTrace.length - 1;\n const indent = ' '.repeat(Math.min(depth, 4));\n\n // Track children for this child method too\n const childMethodKey = `${operationId}:${path}`;\n this.childDurations.set(childMethodKey, []);\n\n this.performanceTracker.startMethodTiming(operationId, path);\n\n logger.log(`${indent}└─ CHILD [${operationId}] ${path}`);\n if (args.length > 0) {\n logger.log(`${indent} Args:`, stringifyObject(args, 4, 0));\n }\n }\n\n try {\n return originalMethod(...args);\n } finally {\n const metrics = this.performanceTracker.endMethodTiming(operationId, path);\n const duration = metrics.duration ?? 0;\n const formattedDuration = this.performanceTracker.formatDuration(duration);\n\n if (isNewOperation) {\n const childDurations = this.childDurations.get(operationId) ?? [];\n const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);\n const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);\n const overhead = duration - totalChildTime;\n const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));\n\n logger.log(`\\n${'═'.repeat(60)}`);\n logger.log(`◀ COMPLETE [${operationId}] ${path}`);\n logger.log(` Total Duration: ${formattedDuration}`);\n if (childDurations.length > 0) {\n logger.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);\n logger.log(` Overhead: ${formattedOverhead}`);\n }\n logger.log(`${'═'.repeat(60)}\\n`);\n\n this.childDurations.delete(operationId);\n this.performanceTracker.cleanupOperation(operationId);\n this.callTraceManager.endOperation();\n } else {\n const indent = ' '.repeat(Math.min(depth, 4));\n const childMethodKey = `${operationId}:${path}`;\n const childDurations = this.childDurations.get(childMethodKey) ?? [];\n const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);\n const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);\n const overhead = duration - totalChildTime;\n const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));\n\n logger.log(`${indent} ✓ ${formattedDuration}`);\n if (childDurations.length > 0) {\n logger.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);\n }\n\n // Clean up child method tracking\n this.childDurations.delete(childMethodKey);\n\n // Find the parent method and add this duration to its children list\n // The parent is the method one level up in the call trace\n const currentTrace = this.callTraceManager.getCurrentTrace();\n if (currentTrace.length > 1) {\n // Parent is the second-to-last item in the trace (before we remove current)\n const parentPath = currentTrace[currentTrace.length - 2];\n\n // Check if parent is the root operation (trace length 2 means root + this child)\n if (currentTrace.length === 2) {\n // Direct child of root - add to root's children list\n const rootChildDurations = this.childDurations.get(operationId);\n if (rootChildDurations) {\n rootChildDurations.push(duration);\n }\n } else {\n // Nested child - add to parent method's children list\n const parentMethodKey = `${operationId}:${parentPath}`;\n const parentChildDurations = this.childDurations.get(parentMethodKey);\n if (parentChildDurations) {\n parentChildDurations.push(duration);\n }\n }\n }\n }\n\n this.callTraceManager.removeMethodFromTrace();\n }\n }\n }\n });\n }\n}","import { Capability } from \"./Capability\";\nimport { CallTraceManager } from \"./tracing/CallTraceManager\";\nimport { stringifyObject } from \"../utilities/strings\";\nimport { MethodInfo, MethodInfoMetadata } from \"./types\";\n\nexport type TracingCapabilityOptions = {\n filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean\n}\n\nexport class TracingCapability extends Capability {\n\n private callTraceManager: CallTraceManager;\n private filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean;\n\n constructor(options?: TracingCapabilityOptions) {\n super();\n this.filter = options?.filter ?? (() => true);\n this.callTraceManager = new CallTraceManager();\n }\n\n override apply(instance: unknown): void {\n\n this.explore(instance, (meta, info) => {\n\n if (info.isCallable) {\n\n const originalMethod = meta.instance[info.name].bind(meta.instance);\n\n meta.instance[info.name] = (...args: any[]) => {\n\n const path = `${meta.path!}.${String(info.name)}()`;\n\n if (this.filter(path, info, meta) === false) {\n return originalMethod(...args);\n }\n\n const isNewOperation = this.callTraceManager.isNewOperation();\n let operationId: string;\n\n if (isNewOperation) {\n operationId = this.callTraceManager.startNewOperation();\n const callTrace = this.callTraceManager.addMethodToTrace(path);\n const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);\n\n console.log(`\\n${'═'.repeat(60)}`);\n console.log(`▶ ORIGIN [${operationId}] ${path}`);\n if (args.length > 0) {\n console.log(` Args:`, stringifyObject(args, 4, 0));\n }\n console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);\n } else {\n operationId = this.callTraceManager.getActiveOperationId();\n const callTrace = this.callTraceManager.addMethodToTrace(path);\n\n const indent = ' '.repeat(Math.min(callTrace.length - 1, 4));\n console.log(`${indent}└─ CHILD [${operationId}] ${path}`);\n if (args.length > 0) {\n console.log(`${indent} Args:`, stringifyObject(args, 4, 0));\n }\n }\n\n try {\n return originalMethod(...args);\n } finally {\n this.callTraceManager.removeMethodFromTrace();\n\n if (isNewOperation) {\n this.callTraceManager.endOperation();\n }\n }\n }\n }\n\n });\n }\n}","export { Capability } from './Capability';\nexport { PerformanceCapability } from './PerformanceCapability';\nexport { TracingCapability } from './TracingCapability';\nexport * from './types';","import { PerformanceMetrics } from \"../types\";\n\nexport class PerformanceTracker {\n private methodTimings = new Map<string, { startTime: number; nextMethodStartTime?: number }>();\n private operationStartTimes = new Map<string, number>();\n\n startMethodTiming(operationId: string, methodPath: string): number {\n const startTime = performance.now();\n const key = `${operationId}:${methodPath}`;\n\n // Track operation start time for delta calculations\n if (!this.operationStartTimes.has(operationId)) {\n this.operationStartTimes.set(operationId, startTime);\n }\n\n this.methodTimings.set(key, { startTime });\n return startTime;\n }\n\n recordNextMethodStart(operationId: string, methodPath: string): void {\n const key = `${operationId}:${methodPath}`;\n const timing = this.methodTimings.get(key);\n if (timing) {\n timing.nextMethodStartTime = performance.now();\n }\n }\n\n endMethodTiming(operationId: string, methodPath: string): PerformanceMetrics {\n const endTime = performance.now();\n const key = `${operationId}:${methodPath}`;\n const timing = this.methodTimings.get(key);\n\n if (!timing) {\n return { startTime: endTime };\n }\n\n const duration = endTime - timing.startTime;\n const timeToNextCall = timing.nextMethodStartTime ?\n timing.nextMethodStartTime - timing.startTime : undefined;\n\n // Clean up\n this.methodTimings.delete(key);\n\n return {\n startTime: timing.startTime,\n endTime,\n duration,\n nextMethodStartTime: timing.nextMethodStartTime,\n timeToNextCall\n };\n }\n\n formatDuration(milliseconds: number): string {\n if (milliseconds < 1) {\n return `${(milliseconds * 1000).toFixed(1)}μs`;\n } else if (milliseconds < 1000) {\n return `${milliseconds.toFixed(2)}ms`;\n } else {\n return `${(milliseconds / 1000).toFixed(2)}s`;\n }\n }\n\n getDeltaFromOperationStart(operationId: string, currentTime: number): number {\n const operationStartTime = this.operationStartTimes.get(operationId);\n return operationStartTime ? currentTime - operationStartTime : 0;\n }\n\n cleanupOperation(operationId: string): void {\n this.operationStartTimes.delete(operationId);\n }\n}","import { uuid } from \"../../utilities\";\n\nexport class CallTraceManager {\n private activeOperationId: string | null = null;\n private activeCallStack: string[] = [];\n\n startNewOperation(): string {\n const operationId = uuid(8);\n this.activeOperationId = operationId;\n this.activeCallStack = [];\n return operationId;\n }\n\n isNewOperation(): boolean {\n return this.activeOperationId === null;\n }\n\n getActiveOperationId(): string {\n if (!this.activeOperationId) {\n throw new Error('No active operation context');\n }\n return this.activeOperationId;\n }\n\n addMethodToTrace(methodPath: string): string[] {\n if (this.isNewOperation()) {\n this.activeCallStack = [methodPath];\n } else {\n this.activeCallStack.push(methodPath);\n }\n return [...this.activeCallStack];\n }\n\n removeMethodFromTrace(): void {\n if (!this.isNewOperation()) {\n this.activeCallStack.pop();\n }\n }\n\n endOperation(): void {\n this.activeOperationId = null;\n this.activeCallStack = [];\n }\n\n formatMethodPaths(methodPaths: string[]): string[] {\n return methodPaths.map(path => path.replace(/ → /g, '.'));\n }\n\n getCurrentTrace(): string[] {\n return [...this.activeCallStack];\n }\n}","export class SlotPath {\n\n private _path: string[];\n\n get path() {\n return [...this._path]\n }\n\n constructor(...pathLike: string[]) {\n this._path = pathLike;\n }\n\n push(...pathLike: string[]) {\n this._path.push(...pathLike);\n }\n\n get(up: number = 0) {\n return this._path.slice(0, this._path.length - up).join(\".\")\n }\n}","import { uuid } from \"../utilities\";\nimport { CreateBlockOptions } from \"./types\";\n\ntype Line = string | Block;\n\ntype Param = { name: string, value: any };\ntype GenericParam = { name: string, callName: string };\n\n\nexport abstract class Block {\n readonly name: string;\n protected _lines: Line[] = [];\n protected _indent: string = \"\";\n protected _parent?: Block;\n\n constructor(name?: string, parentIndent: string = \"\", parent?: Block) {\n this.name = name != null ? name : uuid();\n this._indent = parentIndent;\n this._parent = parent;\n }\n\n indexOf(name: string) {\n return this._lines.findIndex(w => typeof w !== \"string\" && w.name === name);\n }\n\n getLines() {\n return this._lines;\n }\n\n getParent() {\n return this._parent;\n }\n\n getIndent() {\n return this._indent;\n }\n\n setLines(lines: Line[]) {\n this._lines = lines;\n }\n\n setParent(block: Block) {\n this._parent = block;\n }\n\n setIndent(indent: string) {\n this._indent = indent;\n }\n\n getOrDefault<T extends Block>(name: string): T | undefined {\n\n if (name.includes('.') === false) {\n return this._lines.find(w => typeof w !== \"string\" && w.name === name) as T | undefined;\n }\n\n const split = name.match(/(\\[[^\\]]+\\]|[^.]+)/g);\n // oxlint-disable-next-line no-this-alias\n let result: Block = this;\n\n for (const item of split) {\n const found = result._lines.find(w => typeof w !== \"string\" && w.name === item) as Block;\n\n if (found == null) {\n\n if (\"getValue\" in result && result.getValue instanceof Block && result.getValue.name === item) {\n result = result.getValue;\n continue;\n }\n\n return undefined;\n }\n\n result = found;\n }\n\n return result as T;\n }\n\n get<T extends Block>(name: string): T {\n const found = this.getOrDefault(name);\n\n if (found == null) {\n throw new Error(`Error finding code block for given path. Path: ${name}`)\n }\n\n return found as T;\n }\n\n has(name: string) {\n return this._lines.some(w => typeof w !== \"string\" && w.name === name);\n }\n\n remove(name: string) {\n this._lines = this._lines.filter(x => typeof x === \"object\" && typeof x.name === \"string\" && x.name !== name);\n }\n\n replace(name: string, line: Block) {\n\n const foundIndex = this._lines.findIndex(x => typeof x !== \"string\" && x.name === name);\n\n if (foundIndex === -1) {\n throw new Error(`Cannot find line by name. Name: ${name}`)\n }\n\n const found = this._lines[foundIndex];\n\n if (typeof found === \"string\") {\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n return;\n }\n\n line.setLines(found.getLines());\n line.setIndent(found.getIndent());\n line.setParent(found.getParent());\n\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n\n return;\n }\n\n protected push(line: Line) {\n this._lines.push(line);\n }\n\n protected unshift(line: Line) {\n this._lines.unshift(line);\n }\n\n protected indent(text: string): string {\n return this._indent + text;\n }\n\n\n abstract toString(): string;\n}\n\nexport abstract class ContainerBlock extends Block {\n if(condition: string, options?: CreateBlockOptions): IfBuilder {\n const builder = new IfBuilder(condition, options?.name, this._indent + \" \", this);\n if (options?.unshift === true) {\n this.unshift(builder);\n } else {\n this.push(builder);\n }\n\n return builder;\n }\n\n raw(raw: string, options?: CreateBlockOptions): RawBuilder {\n const builder = new RawBuilder(raw, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n function(name?: string, options?: CreateBlockOptions): FunctionBuilder {\n const builder = new FunctionBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n factory(name?: string, options?: CreateBlockOptions): FunctionFactoryBuilder {\n const builder = new FunctionFactoryBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n variable(declaration: string, options?: CreateBlockOptions): VariableBuilder {\n const builder = new VariableBuilder(declaration, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n assign(variableName: string, options?: CreateBlockOptions): AssignmentBuilder {\n const builder = new AssignmentBuilder(variableName, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const builder = new ObjectBuilder(options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n slot(name: string) {\n const builder = new SlotBlock(name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n array(accessor: string, options?: CreateBlockOptions) {\n const builder = new ArrayBuilder(accessor, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n}\n\nexport type StringType = \"template\" | \"default\";\n\nexport class StringBuilder extends Block {\n\n private _type: StringType;\n\n constructor(type: StringType, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._type = type;\n }\n\n append(value: string) {\n this._lines.push(value);\n return this;\n }\n\n toString() {\n if (this._type === \"template\") {\n return \"`\" + this._lines.join(\"\") + \"`\";\n }\n\n return `\"${this._lines.join(\"\")}\"`;\n }\n}\n\nexport class SlotBlock extends ContainerBlock {\n\n constructor(name: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n }\n\n insert(line: string | Block) {\n this.push(line);\n }\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}\n\nexport class AssignmentBuilder extends ContainerBlock {\n protected _variableName: string;\n protected _value?: string | Block;\n protected _functionName?: string;\n\n get getValue() {\n return this._value;\n }\n\n constructor(variableName: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._variableName = variableName;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n and(and: string, options?: CreateBlockOptions): this {\n this._value = new AndBuilder(and, options?.name, this._indent, this);\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n call(functionName: string, options?: CreateBlockOptions): ObjectBuilder {\n this._functionName = functionName;\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n string(type: StringType, options?: CreateBlockOptions) {\n const stringBuilder = new StringBuilder(type, options?.name, this._indent, this);\n\n this._value = stringBuilder;\n\n return stringBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for AssignmentBuilder Builder\")\n }\n\n if (this._functionName != null) {\n return this.indent(`${this._variableName} = ${this._functionName}(${this._value.toString()});`);\n }\n\n return this.indent(`${this._variableName} = ${this._value.toString()};`);\n }\n}\n\nexport class AndBuilder extends ContainerBlock {\n\n constructor(and: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(and);\n }\n\n and(and: string) {\n this._lines.push(and);\n }\n\n toString() {\n return this._lines.join(\" && \")\n }\n}\n\nexport class VariableBuilder extends Block {\n protected _declaration: string;\n protected _value?: string | Block;\n\n get getValue() {\n return this._value;\n }\n\n constructor(declaration: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._declaration = declaration;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n array(accessor: string, options?: CreateBlockOptions): ArrayBuilder {\n const arrayBuilder = new ArrayBuilder(accessor, options?.name, this._indent, this);\n\n this._value = arrayBuilder;\n\n return arrayBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for Variable Builder\")\n }\n\n return this.indent(`const ${this._declaration} = ${this._value.toString()};`);\n }\n}\n\nexport class RawBuilder extends ContainerBlock {\n private _raw: string;\n\n constructor(raw: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._raw = raw;\n }\n\n toString(): string {\n return `${this._raw}\\n`;\n }\n}\n\nexport class ObjectBuilder extends Block {\n\n property(line: string) {\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n this.push(line);\n return this;\n }\n\n nested(propertyName: string, name?: string) {\n const builder = new ObjectBuilder(name, this._indent + \" \", this);\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n // Add the property name and opening brace\n this.push(`${propertyName}: {`);\n // Add the nested builder\n this.push(builder);\n // Add the closing brace\n this.push(\"}\");\n return builder;\n }\n\n toString(): string {\n // Check if this is a nested object's content\n const isNestedContent = this._parent instanceof ObjectBuilder;\n\n if (isNestedContent) {\n // For nested object contents, just return the lines\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ).join('\\n');\n }\n\n // For root objects, include the braces\n const lines = [\n \"{\",\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionFactoryBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: Param[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n getParameters() {\n return [...this._params];\n }\n\n createParameter(value: any): Param {\n const name = `injection${this._params.length}`;\n return {\n name,\n value\n }\n }\n\n parameters(...params: Param[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n invoke() {\n const body = this.toString();\n const parameterNames = this._getParameterNames();\n const parameterValues = this._getParameterValues();\n\n return Function(...parameterNames, body)(...parameterValues)\n }\n\n private _getParameterNames() {\n return this._params.map(w => w.name).join(\", \")\n }\n\n private _getParameterValues() {\n return this._params.map(w => w.value);\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterNames()})`\n : `${r}function(${this._getParameterNames()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: (string | GenericParam)[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n parameters(...params: (string | GenericParam)[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n private _getParameterKeys() {\n return this._params.map(w => typeof w === \"object\" ? w.name : w).join(\", \")\n }\n\n toCallable() {\n return `${this._functionName}(${this._params.map(w => typeof w === \"object\" ? w.callName : w).join(\", \")})`\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterKeys()})`\n : `${r}function(${this._getParameterKeys()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class ArrayBuilder extends Block {\n constructor(accessor: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(accessor);\n }\n\n append(accessor: string) {\n this._lines.push(accessor);\n return this;\n }\n\n toString() {\n return `[${this._lines.join(\",\")}]`\n }\n}\n\nexport class IfBuilder extends ContainerBlock {\n private _condition: string;\n\n constructor(condition: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._condition = condition;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n unshiftBody(line: string): this {\n this.unshift(line);\n return this;\n }\n\n private stringifyLine(line: Line) {\n if (typeof line === 'string') {\n return this.indent(\" \" + line);\n }\n\n if (Array.isArray(line)) {\n return line.join(\"\\r\\n\")\n }\n\n return line.toString();\n }\n\n toString(): string {\n // need to join with \\r\\n because we are not an object\n const lines = [\n this.indent(`if (${this._condition}) {`),\n this._lines.map(x => this.stringifyLine(x)).join(\"\\r\\n\"),\n this.indent(\"}\")\n ]\n\n return lines.join(\"\\n\\n\");\n }\n}\n\nexport class CodeBuilder extends ContainerBlock {\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}","import { CloneArrayHandler } from \"./clone/CloneArrayHandler\";\nimport { CloneObjectHandler } from \"./clone/CloneObjectHandler\";\nimport { CloneValueHandler } from \"./clone/CloneValueHandler\";\n\n/// Purpose: \nexport class CloneHandlerBuilder {\n\n build() {\n const handler = new CloneObjectHandler();\n handler\n .setNext(new CloneValueHandler())\n .setNext(new CloneArrayHandler());\n\n return handler;\n }\n}","import { CompareArrayHandler } from \"./compare/CompareArrayHandler\";\nimport { CompareDateHandler } from \"./compare/CompareDateHandler\";\nimport { CompareObjectHandler } from \"./compare/CompareObjectHandler\";\nimport { CompareValueHandler } from \"./compare/CompareValueHandler\";\n\nexport class CompareHandlerBuilder {\n\n build() {\n const handler = new CompareObjectHandler();\n handler.setNext(new CompareArrayHandler())\n .setNext(new CompareDateHandler())\n .setNext(new CompareValueHandler());\n\n return handler;\n }\n}","import { CompareIdsKeyHandler } from \"./compareIds/CompareIdsKeyHandler\";\n\nexport class CompareIdsHandlerBuilder {\n\n build() {\n const handler = new CompareIdsKeyHandler();\n\n return handler;\n }\n}","import { DeserializeObjectHandler } from \"./deserialize/DeserializeObjectHandler\";\nimport { DeserializeValueHandler } from \"./deserialize/DeserializeValueHandler\";\nimport { DeserializeDateHandler } from \"./deserialize/DeserializeDateHandler\";\nimport { DeserializeComputedValueHandler } from \"./deserialize/DeserializeComputedValueHandler\";\nimport { DeserializeFunctionHandler } from \"./deserialize/DeserializeFunctionHandler\";\nimport { DeserializeDeserializerHandler } from \"./deserialize/DeserializeDeserializerHandler\";\n\n/// Purpose: \nexport class DeserializeHandlerBuilder {\n\n build() {\n const handler = new DeserializeObjectHandler();\n handler\n .setNext(new DeserializeDeserializerHandler())\n .setNext(new DeserializeComputedValueHandler())\n .setNext(new DeserializeFunctionHandler())\n .setNext(new DeserializeValueHandler())\n .setNext(new DeserializeDateHandler());\n\n return handler;\n }\n}","import { EnableChangeTrackingObjectHandler } from \"./enableChangeTracking/EnableChangeTrackingObjectHandler\";\nimport { EnableChangeTrackingPrimitiveValueHandler } from \"./enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler\";\n\n/// Purpose: \nexport class EnableChangeTrackingHandlerBuilder {\n\n build() {\n const handler = new EnableChangeTrackingObjectHandler();\n handler.setNext(new EnableChangeTrackingPrimitiveValueHandler());\n\n return handler;\n }\n}","import { EnrichmentNullableObjectHandler } from \"./enrichment/EnrichmentNullableObjectHandler\";\nimport { EnrichmentObjectHandler } from \"./enrichment/EnrichmentObjectHandler\";\nimport { EnrichmentObjectIdentityHandler } from \"./enrichment/EnrichmentObjectIdentityHandler\";\nimport { EnrichmentPrimitiveIdentityHandler } from \"./enrichment/EnrichmentPrimitiveIdentityHandler\";\nimport { EnrichmentPrimitiveHandler } from './enrichment/EnrichmentPrimitiveHandler';\nimport { EnrichmentFunctionHandler } from './enrichment/EnrichmentFunctionHandler';\nimport { EnrichmentDefaultValueHandler } from './enrichment/EnrichmentDefaultValueHandler';\nimport { EnrichmentDefaultFunctionHandler } from './enrichment/EnrichmentDefaultFunctionHandler';\nimport { EnrichmentComputedValueHandler } from './enrichment/EnrichmentComputedValueHandler';\n\n/// Purpose: \nexport class EnrichmentHandlerBuilder {\n\n build() {\n const handler = new EnrichmentPrimitiveIdentityHandler();\n\n handler.setNext(new EnrichmentObjectIdentityHandler())\n .setNext(new EnrichmentObjectHandler())\n .setNext(new EnrichmentNullableObjectHandler())\n .setNext(new EnrichmentFunctionHandler())\n .setNext(new EnrichmentDefaultValueHandler())\n .setNext(new EnrichmentDefaultFunctionHandler())\n .setNext(new EnrichmentComputedValueHandler())\n .setNext(new EnrichmentPrimitiveHandler());\n\n return handler;\n }\n}","import { FreezePrimitiveValueHandler } from \"./freeze/FreezePrimitiveValueHandler\";\nimport { FreezeObjectHandler } from \"./freeze/FreezeObjectHandler\";\n\n/// Purpose: \nexport class FreezeHandlerBuilder {\n\n build() {\n const handler = new FreezeObjectHandler();\n handler.setNext(new FreezePrimitiveValueHandler());\n\n return handler;\n }\n}","import { HashKeyHandler } from \"./hash/HashKeyHandler\";\nimport { HashValueHandler } from \"./hash/HashValueHandler\";\nimport { HashDateHandler } from \"./hash/HashDateHandler\";\nimport { HashIdentityHandler } from \"./hash/HashIdentityHandler\";\nimport { HashFunctionHandler } from \"./hash/HashFunctionHandler\";\nimport { HashComputedValueHandler } from \"./hash/HashComputedValueHandler\";\n\n/// Purpose: \n// Should ignore Id's and Identities for type Object because we want \n// to comare a new addition with what was saved in the database\nexport class HashHandlerBuilder {\n\n build() {\n const handler = new HashKeyHandler();\n\n handler\n .setNext(new HashComputedValueHandler())\n .setNext(new HashFunctionHandler())\n .setNext(new HashIdentityHandler())\n .setNext(new HashDateHandler())\n .setNext(new HashValueHandler());\n\n return handler;\n }\n}","import { HashTypeValueHandler } from \"./hashType/HashTypeValueHandler\";\n\n/// Purpose: \nexport class HashTypeHandlerBuilder {\n\n build() {\n const handler = new HashTypeValueHandler();\n\n return handler;\n }\n}","import { IdSelectorValueHandler } from \"./idSelector/IdSelectorValueHandler\";\n/// Purpose: \nexport class IdSelectorHandlerBuilder {\n\n build() {\n const handler = new IdSelectorValueHandler();\n\n return handler;\n }\n}","import { MergeDefaultFunctionHandler } from \"./merge/MergeDefaultFunctionHandler\";\nimport { MergePrimitiveHandler } from \"./merge/MergePrimitiveHandler\";\nimport { MergeComputedValueHandler } from \"./merge/MergeComputedValueHandler\";\nimport { MergeDefaultValueHandler } from \"./merge/MergeDefaultValueHandler\";\nimport { MergeFunctionHandler } from \"./merge/MergeFunctionHandler\";\n\n/// Purpose: Should recompute computed properties\nexport class MergeHandlerBuilder {\n\n build() {\n const handler = new MergeDefaultFunctionHandler();\n handler.setNext(new MergeDefaultValueHandler())\n .setNext(new MergeFunctionHandler())\n .setNext(new MergeComputedValueHandler())\n .setNext(new MergePrimitiveHandler());\n\n return handler;\n }\n}","import { PrepareIdentityHandler } from \"./prepare/PrepareIdentityHandler\";\nimport { PrepareKeyHandler } from \"./prepare/PrepareKeyHandler\";\nimport { PrepareValueHandler } from \"./prepare/PrepareValueHandler\";\nimport { PrepareObjectHandler } from \"./prepare/PrepareObjectHandler\";\nimport { PrepareComputedValueHandler } from \"./prepare/PrepareComputedValueHandler\";\nimport { PrepareFunctionHandler } from \"./prepare/PrepareFunctionHandler\";\n\n/// Purpose: Called before we save entities to the database. Responsible for cleaning up\n/// an entity before it is sent to the plugin\nexport class PrepareHandlerBuilder {\n\n build() {\n const handler = new PrepareIdentityHandler();\n handler\n .setNext(new PrepareFunctionHandler())\n .setNext(new PrepareComputedValueHandler())\n .setNext(new PrepareKeyHandler())\n .setNext(new PrepareObjectHandler())\n .setNext(new PrepareValueHandler());\n\n return handler;\n }\n}","import { SerializeDateHandler } from \"./serialize/SerializeDateHandler\";\nimport { SerializeObjectHandler } from \"./serialize/SerializeObjectHandler\";\nimport { SerializeValueHandler } from \"./serialize/SerializeValueHandler\";\nimport { SerializeSerializerHandler } from \"./serialize/SerializeSerializerHandler\";\nimport { SerializeFunctionHandler } from \"./serialize/SerializeFunctionHandler\";\nimport { SerializeComputedHandler } from \"./serialize/SerializeComputedHandler\";\n\n/// Purpose: \nexport class SerializeHandlerBuilder {\n\n build() {\n const handler = new SerializeSerializerHandler();\n handler\n .setNext(new SerializeComputedHandler())\n .setNext(new SerializeFunctionHandler())\n .setNext(new SerializeDateHandler())\n .setNext(new SerializeValueHandler())\n .setNext(new SerializeObjectHandler());\n\n return handler;\n }\n}","import { SetComplexHandler } from \"./set/SetComplexHandler\";\n\nexport class SetHandlerBuilder {\n\n build() {\n const handler = new SetComplexHandler();\n\n return handler;\n }\n}","import { StripObjectHandler } from \"./strip/StripObjectHandler\";\nimport { StripValueHandler } from \"./strip/StripValueHandler\";\nimport { StripKeyHandler } from \"./strip/StripKeyHandler\";\nimport { StripIdentityHandler } from \"./strip/StripIdentityHandler\";\n\n/// Purpose: \nexport class StripHandlerBuilder {\n\n build() {\n const handler = new StripIdentityHandler();\n\n handler.setNext(new StripKeyHandler())\n .setNext(new StripObjectHandler())\n .setNext(new StripValueHandler());\n\n return handler;\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CloneArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Array) {\n\n if (property.isNullable || property.isOptional) {\n // Child properties will take care of this\n return builder;\n }\n\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (property.parent == null) {\n\n const resultAssignmentPath = property.getAssignmentPath({ parent: \"result\" });\n const slot = builder.get<SlotBlock>(\"if\");\n\n slot.if(`${entitySelectorPath} != null`).appendBody(`${resultAssignmentPath} = [...${entitySelectorPath}]`);\n return builder;\n }\n // slotPath.push(...property.getParentPathArray());\n // const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n // nestedObjectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CloneObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n\n // Child properties will take care of this\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, IfBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CloneValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object && property.type != SchemaTypes.Array) {\n const slot = builder.get<SlotBlock>(\"if\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const resultAssignmentPath = property.getAssignmentPath({ parent: \"result\" });\n\n if (property.parent == null) {\n // we are a first level property\n slot.if(`${entitySelectorPath} != null`).appendBody(`${resultAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n // Second level or more property\n // Need to ensure parent is assigned\n const propertyParentPath = [\"result\", ...property.getParentPathArray()]\n const ifBuilder = new IfBuilder(`${propertyParentPath.join(\"?.\")} == null`).appendBody(`${propertyParentPath.join(\".\")} = {};`);\n\n slot.if(`${entitySelectorPath} != null`).appendBody(ifBuilder.toString()).appendBody(`${resultAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { AndBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CompareArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Array) {\n let compare = builder.getOrDefault<AndBuilder>(\"result.variable.compare\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n if (compare == null) {\n compare = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .and(`JSON.stringify(${leftCompare}) === JSON.stringify(${rightCompare})`, { name: \"compareArray\" });\n return builder;\n }\n\n compare.and(`JSON.stringify(${leftCompare}) === JSON.stringify(${rightCompare})`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { AndBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CompareDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n let compare = builder.getOrDefault<AndBuilder>(\"result.variable.compare\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n if (compare == null) {\n compare = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .and(`${leftCompare}?.toISOString() === ${rightCompare}?.toISOString()`, { name: \"compareDate\" });\n return builder;\n }\n\n compare.and(`${leftCompare}?.toISOString() === ${rightCompare}?.toISOString()`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CompareObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { AndBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CompareValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n let compare = builder.getOrDefault<AndBuilder>(\"result.variable.compare\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n if (compare == null) {\n compare = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .and(`${leftCompare} === ${rightCompare}`, { name: \"compare\" });\n return builder;\n }\n\n compare.and(`${leftCompare} === ${rightCompare}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class CompareIdsKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<unknown>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey) {\n const slot = builder.get<SlotBlock>(\"ifs\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n slot.if(`${leftCompare} != ${rightCompare}`).appendBody(\"return false;\");\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n // Do nothing with the value\n if (property.functionBody != null && property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ContainerBlock, ObjectBuilder } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Handles converting a string value from a database to a Date value\n */\nexport class DeserializeDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n const slotPath = new SlotPath(\"result.variable.object\");\n let objectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n const entitySelectorPath = property.getSelectrorPath({ parent: \"unserialized\" });\n const entityAssignmentPath = property.getAssignmentPath({ parent: \"entity\", useFromPropertyName: property.isRenamed });\n const assignment = `${property.name}: typeof ${entitySelectorPath} === \"string\" ? new Date(${entitySelectorPath}) : ${entitySelectorPath}`;\n\n // if it is nullable or optional, assign in an if block, otherwise we \n // could unintentionally assign null/undefined to a property that does not exist\n if (property.isOptional || property.isNullable) {\n const ifAssignment = `${entityAssignmentPath} = typeof ${entitySelectorPath} === \"string\" ? new Date(${entitySelectorPath}) : ${entitySelectorPath}`;\n const rootPath = new SlotPath(\"if\");\n builder.get<ContainerBlock>(rootPath.get()).if(`${entitySelectorPath} != null`).appendBody(ifAssignment);\n return;\n }\n\n // A date cannot be a nested object, just do the assignment\n if (property.parent == null) {\n objectBuilder.property(assignment);\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.property(assignment)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class DeserializeDeserializerHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.valueDeserializer != null) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n const assignmentBuilder = builder.getOrDefault<SlotBlock>(\"functions\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"unserialized\" });\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const entity\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n const defaultFunctionWithParameters = this.toNamedFunction(property.valueDeserializer.toString(), assignmentBuilder);\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map((_, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: entitySelectorPath })));\n\n if (property.parent == null) {\n objectBuilder.property(`${property.name}: ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${property.name}: ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions are always unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"result.variable.object\");\n let objectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n\n if (property.parent == null) {\n objectBuilder.nested(property.getResolvedName(), property.name)\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.nested(property.getResolvedName(), property.name)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object && property.type != SchemaTypes.Date) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"unserialized\", useFromPropertyName: property.isRenamed });\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const entity\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n if (property.parent == null) {\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnableChangeTrackingObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const assignmentSlot = builder.get<SlotBlock>(\"assignment\");\n const childSelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const childAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n\n assignmentSlot.if(`${childSelectorPath} != null`).appendBody(`${childAssignmentPath} = enableChangeTracking(${childAssignmentPath});`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnableChangeTrackingPrimitiveValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type !== SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed) {\n\n const parameterNames: string[] = [\"enriched\", \"collectionName\"];\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n parameterNames.push(parameter.name);\n }\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.declarations\");\n const defaultFunctionWithParameters = this.toNamedFunction(property.functionBody.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...parameterNames.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n ifsSlot.if(`${enrichedAssignmentPath} == null`).appendBody(`${enrichedAssignmentPath} = ${defaultFunctionWithParameters.builder.toCallable()}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class EnrichmentDefaultFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.defaultValue != null && typeof property.defaultValue === \"function\") {\n\n this.setEnrichedProperty(property, builder);\n\n // we need to add the call for this function too, want to create an if\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.declarations\");\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n\n if (factory == null) {\n throw new Error(\"Error building enricher, could not find slot for factory\")\n }\n\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n const defaultFunctionWithParameters = this.toNamedFunction(property.defaultValue.toString(), declarationsSlot);\n // This is ok, defaults can only inject one parameter anyways\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map(w => ({ name: w, callName: parameter.name })));\n\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n ifsSlot.if(`${enrichedAssignmentPath} == null`).appendBody(`${enrichedAssignmentPath} = ${defaultFunctionWithParameters.builder.toCallable()}`);\n\n return builder;\n }\n\n const defaultFunction = this.toNamedFunction(property.defaultValue.toString(), declarationsSlot);\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n ifsSlot.if(`${enrichedAssignmentPath} == null`).appendBody(`${enrichedAssignmentPath} = ${defaultFunction.builder.toCallable()}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class EnrichmentDefaultValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.defaultValue != null && typeof property.defaultValue !== \"function\") {\n\n this.setEnrichedProperty(property, builder);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n\n const parameterNames: string[] = [\"enriched\", \"collectionName\"];\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n parameterNames.push(parameter.name);\n }\n\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.declarations\");\n // Unwrap the functions to removing currying\n const defaultFunctionWithParameters = this.toNamedFunction(property.functionBody.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...parameterNames.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n const slot = builder.get<SlotBlock>(\"factory.function.assignment\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n slot.assign(enrichedAssignmentPath).value(defaultFunctionWithParameters.builder.toCallable());\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentNullableObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object && (property.isNullable || property.isOptional)) {\n\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n const nestedSlotPath = this.buildSlotPath(property, slotPath);\n\n // Generate null check for current level using parent relationships\n const entityPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const enrichedPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n\n if (ifsSlot == null) {\n throw new Error(\"Error building enricher, could not find slot for factory.function.ifs\")\n }\n\n\n ifsSlot.if(`${entityPath} != null`).appendBody(`${enrichedPath} = enableChangeTracking(${enrichedPath} || {}, \"${property.name}\");`);\n\n let enriched = builder.getOrDefault<ObjectBuilder>(nestedSlotPath.get());\n\n if (enriched == null) {\n const enrichedSlot = builder.get<ObjectBuilder>(slotPath.get());\n\n if (enrichedSlot == null) {\n throw new Error(`Error building enricher, could not find slot for ${slotPath.get()}`)\n }\n\n enriched = enrichedSlot.nested(property.name, `[${enrichedPath}]`);\n }\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object && (property.isNullable || property.isOptional) === false) {\n\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n const nestedSlotPath = this.buildSlotPath(property, slotPath);\n\n // Generate null check for current level using parent relationships\n const enrichedPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n const slot = builder.get<SlotBlock>(\"factory.function.assignment\");\n\n slot.assign(enrichedPath).value(`enableChangeTracking(${enrichedPath} || {}, \"${property.name}\")`)\n\n let enriched = builder.getOrDefault<ObjectBuilder>(nestedSlotPath.get());\n\n if (enriched == null) {\n const enrichedSlot = builder.get<ObjectBuilder>(slotPath.get());\n\n if (enrichedSlot == null) {\n throw new Error(`Error building enricher, could not find slot for ${slotPath.get()}`)\n }\n\n enriched = enrichedSlot.nested(property.name, `[${enrichedPath}]`);\n }\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentObjectIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true && property.type == SchemaTypes.Object) {\n // do nothing right now\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class EnrichmentPrimitiveHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n this.setEnrichedProperty(property, builder);\n\n return builder;\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentPrimitiveIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true && property.type != SchemaTypes.Object) {\n const selectorPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class FreezeObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const assignmentSlot = builder.get<SlotBlock>(\"assignment\");\n const childSelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const childAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n\n assignmentSlot.if(`${childSelectorPath} != null`).unshiftBody(`${childAssignmentPath} = Object.freeze(${childAssignmentPath});`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class FreezePrimitiveValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type !== SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-object-return.variable.string\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-object-return\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(\"${stringifyDate(\" + entitySelectorPath + \")}\")\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions are always unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class HashIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class HashKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey === true) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-id-if.if-body.variable.string\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-id-if.if-body\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(\"${\" + entitySelectorPath + \"}\")\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type !== SchemaTypes.Object) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-object-return.variable.string\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-object-return\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(\"${\" + entitySelectorPath + \"}\")\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class HashTypeValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey && property.isIdentity) {\n const slot = builder.get<SlotBlock>(\"ifs\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n slot.if(`${entitySelectorPath} == null`).appendBody(`return \"Object\"`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { ArrayBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class IdSelectorValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey) {\n let arrayBuilder = builder.getOrDefault<ArrayBuilder>(\"result.variable.array\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n if (arrayBuilder == null) {\n arrayBuilder = builder.get<SlotBlock>(\"result\")\n .variable(\"result\", { name: \"variable\" })\n .array(`${entitySelectorPath}`, { name: \"array\" });\n\n return builder;\n }\n\n\n arrayBuilder.append(`${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class MergeComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed) {\n const parameterNames: string[] = [\"source\", \"collectionName\"];\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n parameterNames.push(parameter.name);\n }\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.header\");\n const defaultFunctionWithParameters = this.toNamedFunction(property.functionBody.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...parameterNames.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n const slot = builder.get<SlotBlock>(\"factory.function.assignments\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n // We want to recompute the value always in case there are changes\n slot.assign(enrichedAssignmentPath).value(defaultFunctionWithParameters.builder.toCallable());\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class MergeDefaultFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n // we only want this to run if the value for the property is null\n // we are changing merge to be more like enrich so we can handle injections\n // we may need to change more. Need to move towards factories\n if (property.defaultValue != null && typeof property.defaultValue === \"function\") {\n const defaultFunctionParameters: string[] = [];\n\n if (property.injected != null) {\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n defaultFunctionParameters.push(parameter.name);\n }\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n // we only want to run if the destination is null\n const selectorPath = property.getSelectrorPath({ parent: \"destination\" });\n const assignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.header\");\n const defaultFunctionWithParameters = this.toNamedFunction(property.defaultValue.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionParameters.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n\n ifsSlot.if(`${selectorPath} == null`).appendBody(`${assignmentPath} = ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class MergeDefaultValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.defaultValue != null && typeof property.defaultValue !== \"function\") {\n const defaultFunctionParameters: string[] = [];\n\n if (property.injected != null) {\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n defaultFunctionParameters.push(parameter.name);\n }\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n // we only want to run if the destination is null\n const selectorPath = property.getSelectrorPath({ parent: \"destination\" });\n const assignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n ifsSlot.if(`${selectorPath} == null`).appendBody(`${assignmentPath} = ${typeof property.defaultValue === \"string\" ? `\"${property.defaultValue}\"` : property.defaultValue}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class MergeFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class MergePrimitiveHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n const selectorPath = property.getSelectrorPath({ parent: \"source\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"factory.function.assignments\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"source\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n// Do nothing with the value\nexport class PrepareComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class PrepareFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions are always unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class PrepareIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true) {\n const selectorPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"assignments\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"result\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class PrepareKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey === true) {\n const selectorPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"assignments\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"result\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class PrepareObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"result\", \"variable\", \"object\");\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n // There is a chance this is the first property we handle,\n // if that is the case, the main result variable will not be\n // constructed yet\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n if (property.parent == null) {\n objectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class PrepareValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n // Remap the property to the name in the database if from is set\n const name = property.from != null ? property.from : property.name;\n\n if (property.parent == null) {\n objectBuilder.property(`${name}: ${entitySelectorPath}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${name}: ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class SerializeComputedHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n // Do not serialize computed properties that are unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ContainerBlock, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Handles converting a Date value from JavaScript to a string value. Should handle remapping here because it is the lowest level in the code here.\n * Remapping higher up could break lower level code\n */\nexport class SerializeDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n let objectBuilder = builder.get<SlotBlock>(\"if\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\", useFromPropertyName: property.isRenamed });\n const entityAssignmentPath = property.getAssignmentPath({\n parent: \"result\"\n });\n const _assignment = `${property.name}: ${entitySelectorPath} instanceof Date ? ${entitySelectorPath}.toISOString() : ${entitySelectorPath}`;\n\n // if it is nullable or optional, assign in an if block, otherwise we \n // could unintentionally assign null/undefined to a property that does not exist\n if (property.isOptional || property.isNullable) {\n const ifAssignment = `${entityAssignmentPath} = ${entitySelectorPath} instanceof Date ? ${entitySelectorPath}.toISOString() : ${entitySelectorPath}`;\n const rootPath = new SlotPath(\"if\");\n builder.get<ContainerBlock>(rootPath.get()).if(`${entitySelectorPath} != null`).appendBody(ifAssignment);\n return;\n }\n\n // A date cannot be a nested object, just do the assignment\n if (property.parent == null) {\n objectBuilder.if(`Object.hasOwn(entity, \"${property.name}\")`).appendBody(`${entityAssignmentPath} = ${entitySelectorPath}`)\n\n return builder;\n }\n\n // TODO: SOLVE THIS, IT IS CLOSE\n //const slotPath = new SlotPath(...property.getParentPathArray());\n // slotPath.push(...property.getParentPathArray());\n // const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n // nestedObjectBuilder.property(assignment)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class SerializeFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions should not be serialized\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\nexport class SerializeObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"assignments\");\n const childPath = property.getAssignmentPath({\n parent: \"result\"\n });\n\n if (property.isNullable || property.isOptional) {\n // Do nothing if it's nullable or optional as property assignments will check\n // and create if it does not exist. This way we can handle null/optional\n return builder;\n }\n\n const slot = builder.get<SlotBlock>(slotPath.get());\n slot.assign(`${childPath}`, { name: `[${childPath}]` }).value(\"{}\");\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class SerializeSerializerHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.valueSerializer != null) {\n const objectBuilder = builder.getOrDefault<SlotBlock>(\"if\");\n const assignmentBuilder = builder.getOrDefault<SlotBlock>(\"functions\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\", useFromPropertyName: property.isRenamed });\n const resultSelectorPath = property.getAssignmentPath({ parent: \"result\" });\n\n const defaultFunctionWithParameters = this.toNamedFunction(property.valueSerializer.toString(), assignmentBuilder);\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map((_, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: entitySelectorPath })));\n\n if (property.parent == null) {\n objectBuilder.if(`Object.hasOwn(entity, \"${property.name}\")`).appendBody(`${resultSelectorPath} = ${defaultFunctionWithParameters.builder.toCallable()}`)\n return builder;\n }\n\n // TODO: SOLVE THIS\n //const slotPath = new SlotPath(...property.getParentPathArray());\n\n // const slotPath = new SlotPath(...property.getParentPathArray());\n // objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n // objectBuilder.property(`${property.name}: ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, IfBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class SerializeValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object && property.type != SchemaTypes.Date) {\n const slot = builder.getOrDefault<SlotBlock>(\"if\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\", useFromPropertyName: property.isRenamed });\n const resultSelectorPath = property.getAssignmentPath({ parent: \"result\" });\n\n if (property.parent == null) {\n // Only assign if the incoming entity has the property, this allows partial serialization\n // Basically only serialize what is there\n slot.if(`Object.hasOwn(entity, \"${property.name}\")`).appendBody(`${resultSelectorPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n const parentSelectPath = [\"entity\", ...property.getParentPathArray()].join(\".\");\n const parentAssignPath = [\"result\", ...property.getParentPathArray()].join(\".\");\n\n // We need to handle serializing delta changes in getChanges, there is the possibility that child objects are null \n // and we need to handle that scenario\n const ifSlot = slot.if(`${parentSelectPath} != null && Object.hasOwn(${parentSelectPath}, \"${property.name}\")`);\n\n if (property.parent.isNullable || property.parent.isOptional) {\n // Do this for nullable/optional parents. Parent will be null if its nullable/optional\n const conditionallyCreateParent = new IfBuilder(`${parentAssignPath} == null`).appendBody(`${parentAssignPath} = {}`);\n ifSlot.appendBody(conditionallyCreateParent.toString());\n }\n\n ifSlot.appendBody(`${resultSelectorPath} = ${entitySelectorPath}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema/PropertyInfo\";\nimport { SchemaTypes } from \"../../../schema/types\";\n\nconst allowedTypes = new Set<SchemaTypes>([\n SchemaTypes.Array,\n SchemaTypes.Boolean,\n SchemaTypes.Date,\n SchemaTypes.Number,\n SchemaTypes.Object,\n SchemaTypes.String\n]);\n\nexport class SetComplexHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (allowedTypes.has(property.type)) {\n const selectorPath = property.getSelectrorPath({ parent: \"source\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"assignments\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"source\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class StripIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class StripKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class StripObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"result.variable.object\");\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n if (property.parent == null) {\n objectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { PropertyInfo, SchemaTypes } from \"../../../schema\";\nimport { PropertyInfoHandler } from \"../types\";\nimport { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\n\nexport class StripValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n // There is a chance this is the first property we handle,\n // if that is the case, the main result variable will not be\n // constructed yet\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n if (property.parent == null) {\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ContainerBlock, ObjectBuilder, SlotBlock } from '..';\nimport { PropertyInfo } from '../../schema/PropertyInfo';\nimport { SlotPath } from '../SlotPath';\nimport { SchemaError } from '../../errors/SchemaError';\nimport { uuid } from '../../utilities/uuid';\nimport { countWordOccurance } from '../utils';\n\nexport interface IHandler {\n setNext(handler: IHandler): IHandler;\n\n handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null;\n}\n\nexport abstract class PropertyInfoHandler implements IHandler {\n\n private _next: IHandler | null;\n\n setNext(handler: IHandler): IHandler {\n this._next = handler;\n\n return handler;\n }\n\n handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n try {\n if (this._next) {\n return this._next.handle(property, builder);\n }\n\n return null;\n } catch (e: any) {\n throw new SchemaError(e, `Error handling property: ${property.name}`);\n }\n }\n\n protected buildSlotPath(property: PropertyInfo<any>, path: SlotPath) {\n\n const result = new SlotPath(...path.path);\n const items: string[] = []\n let p = property;\n\n while (p.parent != null) {\n items.unshift(p.name);\n p = p.parent;\n }\n\n items.unshift(p.name);\n\n result.push(...items);\n\n return result\n }\n\n protected setEnrichedProperty(property: PropertyInfo<any>, root: CodeBuilder) {\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n if (property.parent != null) {\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n const path = property.parent.getAssignmentPath({ parent: \"enriched\" });\n slotPath.push(`[${path}]`)\n const objectBuilder = root.get<ObjectBuilder>(slotPath.get());\n const childEntityPathSelector = property.getSelectrorPath({ parent: \"entity\" });\n objectBuilder.property(`${property.name}: ${childEntityPathSelector}`);\n return;\n }\n\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n let enriched = root.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (enriched == null) {\n const enrichedSlot = root.get<SlotBlock>(\"factory.function.enriched\");\n enriched = enrichedSlot.variable(\"enriched\", { name: \"object\" }).object({ name: \"enriched\" });\n }\n\n enriched.property(`${property.name}: ${entitySelectorPath}`);\n }\n\n protected toNamedFunction(stringifiedFunction: string, parent: ContainerBlock) {\n const name = `_${uuid()}`;\n\n const builder = parent.function(name);\n const occurences = countWordOccurance(stringifiedFunction, \"=>\")\n\n if (occurences > 0) {\n\n const split = stringifiedFunction.split(\"=>\").map(w => w.trim());\n const parameters = split[0].replace(/\\(|\\)/g, \"\").split(\",\");\n let body = split[1];\n\n if (occurences > 1) {\n // we have a function that returns a function\n const index = stringifiedFunction.indexOf(\"=>\");\n body = stringifiedFunction.slice(index + 2, stringifiedFunction.length)\n }\n\n if (body.startsWith(\"{\") === true && body.endsWith(\"}\")) {\n\n // Remove brackets, wrapping function will have them\n builder.appendBody(body.slice(1, body.length - 1));\n\n return {\n builder,\n parameters\n };\n }\n\n builder.appendBody(`return ${body};`);\n return {\n builder,\n parameters\n }\n }\n\n throw new Error(\"Only arrow functions are allowed in the schema definition: function () {} ---> () => {}\");\n }\n}","export * from './blocks';\nexport * from './types';","/**\n * Counts non-overlapping occurrences of a term in text.\n *\n * Behavior:\n * - Case-sensitive matching\n * - If the search term is composed entirely of word characters (A–Z, a–z, 0–9, _),\n * enforce whole-word boundaries so \"red\" does not match inside \"redder\".\n * - If the search term contains any non-word character (e.g. \"=>\", \"()\", \"::\"),\n * match anywhere without boundary checks (useful for symbols).\n * - Non-overlapping matches (after a hit, advances by term length)\n * - Optimized single-character fast path; otherwise uses indexOf loop\n *\n * Examples:\n * - countWordOccurance(\"red redder red\", \"red\") => 2\n * - countWordOccurance(\"()=>{}\", \"=>\") => 1\n * - countWordOccurance(\"aaaa\", \"aa\") => 2 (non-overlapping)\n *\n * @param text The source text to scan\n * @param word The term to match (must be non-empty)\n * @returns The number of occurrences found\n */\nexport const countWordOccurance = (text: string, word: string) => {\n const wl = word.length;\n const tl = text.length;\n\n if (wl === 0 || wl > tl) return 0;\n\n // Fast path for single-character words\n if (wl === 1) {\n let c = 0;\n const code = word.charCodeAt(0);\n for (let i = 0; i < tl; i++) if (text.charCodeAt(i) === code) c++;\n return c;\n }\n\n let count = 0;\n let i = 0;\n\n function isWordCharCode(c: number): boolean {\n return (c >= 48 && c <= 57) // 0-9\n || (c >= 65 && c <= 90) // A-Z\n || (c >= 97 && c <= 122) // a-z\n || c === 95; // _\n }\n\n // Decide whether to enforce word boundaries based on the search term\n let enforceWordBoundaries = true;\n for (let k = 0; k < wl; k++) {\n const cc = word.charCodeAt(k);\n if (!isWordCharCode(cc)) {\n enforceWordBoundaries = false;\n break;\n }\n }\n\n while (true) {\n i = text.indexOf(word, i);\n if (i === -1) break;\n\n if (enforceWordBoundaries) {\n const left = i - 1;\n const right = i + wl;\n const leftOk = left < 0 || !isWordCharCode(text.charCodeAt(left));\n const rightOk = right >= tl || !isWordCharCode(text.charCodeAt(right));\n if (leftOk && rightOk) count++;\n } else {\n // No boundary enforcement for symbol-containing terms\n count++;\n }\n i += wl; // non-overlapping word matches\n }\n\n return count;\n}","import { EntityUpdateInfo } from \"../plugins/types\";\nimport { InferCreateType, InferType, SchemaId } from \"../schema\";\nimport { TagCollection } from \"./TagCollection\";\nexport class BulkPersistResult extends Map<SchemaId, SchemaPersistResult> {\n\n resolve<T extends {} = Record<string, unknown>>(schemaId: SchemaId): SchemaPersistResult<T> {\n if (this.has(schemaId)) {\n return this.get(schemaId);\n }\n\n this.set(schemaId, new SchemaPersistResult<T>());\n\n return this.get(schemaId);\n }\n\n override get<T extends {} = Record<string, unknown>>(schemaId: SchemaId) {\n return super.get(schemaId) as SchemaPersistResult<T>\n }\n\n get aggregate() {\n return {\n size: this.aggregateSize,\n adds: this.aggregateAddsSize,\n updates: this.aggregateUpdatesSize,\n removes: this.aggregateRemovesSize\n }\n }\n\n private get aggregateSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.total;\n }\n\n return count;\n }\n\n private get aggregateAddsSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.adds.length;\n }\n\n return count;\n }\n\n private get aggregateUpdatesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.updates.length;\n }\n\n return count;\n }\n\n private get aggregateRemovesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.removes.length;\n }\n\n return count;\n }\n}\n\nexport class BulkPersistChanges extends Map<SchemaId, SchemaPersistChanges> {\n\n resolve<T extends {} = Record<string, unknown>>(schemaId: SchemaId): SchemaPersistChanges<T> {\n if (this.has(schemaId)) {\n return this.get(schemaId);\n }\n\n this.set(schemaId, new SchemaPersistChanges<T>());\n\n return this.get(schemaId);\n }\n\n override get<T extends {} = Record<string, unknown>>(schemaId: SchemaId) {\n return super.get(schemaId) as SchemaPersistChanges<T>\n }\n\n get aggregate() {\n return {\n size: this.aggregateSize,\n adds: this.aggregateAddsSize,\n updates: this.aggregateUpdatesSize,\n removes: this.aggregateRemovesSize\n }\n }\n\n private get aggregateSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.total;\n }\n\n return count;\n }\n\n private get aggregateAddsSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.adds.length;\n }\n\n return count;\n }\n\n private get aggregateUpdatesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.updates.length;\n }\n\n return count;\n }\n\n private get aggregateRemovesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.removes.length;\n }\n\n return count;\n }\n\n /**\n * Ensures the result has the same result sets as the change sets\n * @returns \n */\n toResult() {\n const result = new BulkPersistResult();\n\n for (const [schemaId] of this) {\n result.set(schemaId, new SchemaPersistResult());\n }\n\n return result;\n }\n}\n\nexport class SchemaPersistChanges<T extends {} = Record<string, unknown>> {\n adds: InferCreateType<T>[] = [];\n updates: EntityUpdateInfo<T>[] = [];\n removes: InferType<T>[] = [];\n tags: TagCollection = new TagCollection();\n\n get hasItems() {\n return this.total > 0;\n }\n\n get total() {\n return this.adds.length + this.updates.length + this.removes.length;\n }\n}\n\nexport class SchemaPersistResult<T extends {} = Record<string, unknown>> {\n adds: InferType<T>[] = [];\n updates: InferType<T>[] = [];\n removes: InferType<T>[] = [];\n\n get hasItems() {\n return this.total > 0;\n }\n\n get total() {\n return this.adds.length + this.updates.length + this.removes.length;\n }\n}","import { IdType } from \"../schema\";\n\nexport class IdSet {\n\n readonly ids: readonly IdType[];\n\n constructor(...ids: IdType[]) {\n this.ids = Object.freeze(ids);\n }\n\n equals(other: IdSet): boolean {\n\n if (this.ids.length === 1) {\n return this.ids[0] === other.ids[0];\n }\n\n return this.toString() === other.toString();\n }\n\n toString(): string {\n\n if (this.ids.length === 1) {\n return String(this.ids[0]);\n }\n\n return this.ids.toString();\n }\n}","import { CompiledSchema, IdType, InferType, PropertyInfo, SchemaTypes } from \"../schema\";\nimport { CallbackResult, Result } from \"../results\";\nimport { uuidv4 } from \"../utilities\";\nimport { IdSet } from \"./IdSet\";\n\nexport class MemoryDataCollection {\n\n protected readonly nextNumericalIds: Map<string, number>;\n protected readonly data: Map<string, Record<string, unknown>>;\n protected readonly schema: CompiledSchema<any>;\n protected readonly idProperties: PropertyInfo<any>[];\n\n get size() {\n return this.data.size;\n }\n\n get records() {\n return [...this.data.values()];\n }\n\n constructor(schema: CompiledSchema<any>) {\n this.data = new Map<string, Record<string, unknown>>();\n this.nextNumericalIds = new Map<string, number>();\n this.schema = schema;\n this.idProperties = schema.idProperties;\n }\n\n private _getNextId(property: PropertyInfo<any>) {\n\n let nextId = 1;\n\n if (this.nextNumericalIds.has(property.id) === true) {\n nextId = this.nextNumericalIds.get(property.id) + 1;\n }\n\n this.nextNumericalIds.set(property.id, nextId);\n\n return nextId;\n }\n\n private resolveId(property: PropertyInfo<any>, value: unknown) {\n if (typeof value !== \"number\") {\n return;\n }\n\n const currentIdForProperty = this.nextNumericalIds.get(property.id);\n\n if (value <= currentIdForProperty) {\n return;\n }\n\n this.nextNumericalIds.set(property.id, value);\n }\n\n private getAndSetId(item: Record<string, unknown>, property: PropertyInfo<any>): IdType {\n if (item[property.name] != null) {\n return item[property.name] as IdType;\n }\n\n if (property.type === SchemaTypes.String) {\n const uuid = uuidv4()\n item[property.name] = uuid;\n return uuid;\n }\n\n if (property.type === SchemaTypes.Number) {\n const id = this._getNextId(property);\n item[property.name] = id;\n return id;\n }\n\n throw new Error(`Id Property '${property.name}' must be string or number, found '${property.type}'`)\n }\n\n seed(items: Record<string, unknown>[]) {\n for (let i = 0, length = items.length; i < length; i++) {\n const id = this.resolveIdSet(items[i] as InferType<unknown>);\n this.data.set(id.toString(), items[i]);\n }\n }\n\n private resolveCurrentIdSet(item: Record<string, unknown>): IdSet {\n const idProperties = this.schema.idProperties;\n const ids: IdType[] = [];\n // ensure keys\n for (let j = 0, l = idProperties.length; j < l; j++) {\n const property = idProperties[j];\n const value = property.getValue(item);\n\n if (value == null) {\n throw new Error(`Key cannot be null. Key: ${property.name}`);\n }\n\n ids.push(value);\n }\n\n return new IdSet(...ids);\n }\n\n private resolveIdSet(item: Record<string, unknown>): IdSet {\n\n if (this.schema.hasIdentityKeys) {\n const idProperties = this.schema.idProperties;\n const ids: IdType[] = Array.from({ length: idProperties.length });\n\n // Need to make sure we allow for seeding the collection when we call add vs seed\n // There will be an existing id, but the id type could still be identity\n if (idProperties.length === 1) {\n const value = this.getAndSetId(item, idProperties[0]);\n this.resolveId(idProperties[0], value);\n ids[0] = value;\n } else {\n for (let j = 0, l = idProperties.length; j < l; j++) {\n const value = this.getAndSetId(item, idProperties[j]);\n this.resolveId(idProperties[j], value);\n ids[j] = value;\n }\n }\n\n return new IdSet(...ids);\n }\n\n return this.resolveCurrentIdSet(item);\n }\n\n add(item: Record<string, unknown>) {\n const id = this.resolveIdSet(item);\n this.data.set(id.toString(), item);\n }\n\n remove(item: Record<string, unknown>) {\n const id = this.resolveCurrentIdSet(item);\n this.data.delete(id.toString());\n }\n\n update(item: Record<string, unknown>) {\n const id = this.resolveCurrentIdSet(item);\n this.data.set(id.toString(), item);\n }\n\n destroy(done: CallbackResult<never>) {\n this.nextNumericalIds.clear();\n this.data.clear();\n done(Result.success());\n }\n\n load(done: CallbackResult<never>) {\n done(Result.success())\n }\n\n save(done: CallbackResult<never>) {\n done(Result.success())\n }\n}","import { CompiledSchema, SchemaId } from \"../schema\";\n\n/**\n * Collection of schemas with generic typing for type-safe schema retrieval\n */\nexport class ReadonlySchemaCollection {\n\n protected data: Map<SchemaId, CompiledSchema<Record<string, unknown>>>;\n\n constructor(data?: [SchemaId, CompiledSchema<Record<string, unknown>>][]) {\n this.data = new Map<SchemaId, CompiledSchema<Record<string, unknown>>>(data);\n }\n\n get<T>(schemaId: SchemaId): CompiledSchema<T> | undefined {\n return this.data.get(schemaId) as CompiledSchema<T> | undefined;\n }\n\n has(schemaId: SchemaId): boolean {\n return this.data.has(schemaId);\n }\n\n get size(): number {\n return this.data.size;\n }\n\n keys(): IterableIterator<SchemaId> {\n return this.data.keys();\n }\n\n values(): IterableIterator<CompiledSchema<Record<string, unknown>>> {\n return this.data.values();\n }\n\n entries(): IterableIterator<[SchemaId, CompiledSchema<Record<string, unknown>>]> {\n return this.data.entries();\n }\n\n forEach(callbackfn: (value: CompiledSchema<Record<string, unknown>>, key: SchemaId, map: Map<SchemaId, CompiledSchema<Record<string, unknown>>>) => void, thisArg?: any): void {\n this.data.forEach(callbackfn, thisArg);\n }\n\n [Symbol.iterator](): IterableIterator<[SchemaId, CompiledSchema<Record<string, unknown>>]> {\n return this.data[Symbol.iterator]();\n }\n\n getByName<T>(collectionName: string): CompiledSchema<T> | undefined {\n const found = [...this.data].find(x => x[1].collectionName === collectionName);\n\n if (found != null) {\n return found[1] as CompiledSchema<T>;\n }\n\n return undefined;\n }\n}","import { CompiledSchema, SchemaId } from \"../schema\";\nimport { ReadonlySchemaCollection } from \"./ReadonlySchemaCollection\";\n\n/**\n * Collection of schemas with generic typing for type-safe schema retrieval\n */\nexport class SchemaCollection extends ReadonlySchemaCollection {\n\n set<T>(schemaId: SchemaId, schema: CompiledSchema<T>): this {\n this.data.set(schemaId, schema as CompiledSchema<Record<string, unknown>>);\n return this;\n }\n\n delete(schemaId: SchemaId): boolean {\n return this.data.delete(schemaId);\n }\n\n clear(): void {\n this.data.clear();\n }\n}","export class TagCollection implements Disposable {\n\n private data: Map<object, unknown> = new Map<object, unknown>();\n private _size: number = 0;\n\n get size() {\n return this._size;\n }\n\n get(key: object) {\n return this.data.get(key);\n }\n\n has(key: object) {\n return this.data.has(key);\n }\n\n set(key: object, tag: unknown) {\n this._size++;\n return this.data.set(key, tag);\n }\n\n delete(key: object) {\n const result = this.data.delete(key);\n\n if (result) {\n this._size--;\n }\n\n return result;\n }\n\n setMany(keys: object[], tag: unknown) {\n this._size += keys.length;\n for (let i = 0, length = keys.length; i < length; i++) {\n const key = keys[i];\n this.set(key, tag);\n }\n }\n\n combine(tags: TagCollection) {\n for (const [key, value] of tags) {\n this.data.set(key, value);\n }\n }\n\n values() {\n return this.data.values();\n }\n\n keys() {\n return this.data.keys();\n }\n\n [Symbol.dispose]() {\n this.data.clear();\n }\n\n [Symbol.iterator]() {\n return this.data[Symbol.iterator]();\n }\n}","export * from './Changes';\nexport * from './TagCollection';\nexport * from './IdSet';\nexport * from './MemoryDataCollection';\nexport * from './SchemaCollection';\nexport * from './ReadonlySchemaCollection';","export class SchemaError extends Error {\n\n constructor(error: any, innerErrorMessage: string) {\n super(`Error: ${error.message}; Inner Error: ${innerErrorMessage}`);\n }\n}","export { SchemaError } from './SchemaError';","import { ExpressionType } from \"./types\";\n\nexport const EXPRESSION_TYPES: ExpressionType[] = [\n \"operator\",\n \"comparator\",\n \"property\",\n \"value\",\n \"empty\",\n \"not-parsable\",\n];\n","export * from './parser';\nexport * from './sql';\nexport * from './types';\nexport * from './utils';\nexport * from './constants';","import { logger } from \"../utilities\";\nimport { assertString } from \"../assertions\";\nimport { CompiledSchema, SchemaTypes } from \"../schema\";\nimport { Expression, OperatorExpression, ComparatorExpression, ValueExpression, PropertyExpression, Filter, ParamsFilter, Operator } from \"./types\";\n\n// Pre-compiled regex patterns for better performance\nconst METHOD_REGEX = /([a-zA-Z0-9_.]+)\\.(startsWith|endsWith|includes)\\(([^)]+)\\)(\\s*(===|==|!==|!=)\\s*(true|false))?/;\nconst TRANSFORM_METHOD_REGEX = /([a-zA-Z0-9_.]+)\\.(toLowerCase|toUpperCase|toLocaleLowerCase|toLocaleUpperCase)\\(\\)\\.(startsWith|endsWith|includes)\\(((?:[^()]|\\([^)]*\\))*)\\)(\\s*(===|==|!==|!=)\\s*(true|false))?/;\nconst EQUALITY_REGEX = /([^=!<>]+?)\\s*(===|==|!==|!=)\\s*(.+)/;\nconst COMPARISON_REGEX = /([^=!<>]+?)\\s*(>=|<=|>|<)\\s*(.+)/;\nconst PARAM_PATH_REGEX = /^([a-zA-Z0-9_.]+)/;\n\n// Pre-compiled regex patterns for comment removal\nconst SINGLE_LINE_COMMENT_REGEX = /\\/\\/.*$/gm;\nconst MULTI_LINE_COMMENT_REGEX = /\\/\\*[\\s\\S]*?\\*\\//g;\nconst WHITESPACE_REGEX = /\\s+/g;\n\n// need to have negated + strict\nconst comparators: Record<string, ComparatorExpression> = {\n startsWith: new ComparatorExpression({\n comparator: \"starts-with\",\n negated: false,\n strict: false\n }),\n endsWith: new ComparatorExpression({\n comparator: \"ends-with\",\n negated: false,\n strict: false\n }),\n includes: new ComparatorExpression({\n comparator: \"includes\",\n negated: false,\n strict: false\n }),\n \"==\": new ComparatorExpression({\n comparator: \"equals\",\n negated: false,\n strict: false\n }),\n \"===\": new ComparatorExpression({\n comparator: \"equals\",\n negated: false,\n strict: true\n }),\n \"!=\": new ComparatorExpression({\n comparator: \"equals\",\n negated: true,\n strict: false\n }),\n \"!==\": new ComparatorExpression({\n comparator: \"equals\",\n negated: true,\n strict: true\n }),\n \">=\": new ComparatorExpression({\n comparator: \"greater-than-equals\",\n negated: false,\n strict: false\n }),\n \">==\": new ComparatorExpression({\n comparator: \"greater-than-equals\",\n negated: false,\n strict: true\n }),\n \"<=\": new ComparatorExpression({\n comparator: \"less-than-equals\",\n negated: false,\n strict: false\n }),\n \"<==\": new ComparatorExpression({\n comparator: \"less-than-equals\",\n negated: false,\n strict: true\n }),\n \">\": new ComparatorExpression({\n comparator: \"greater-than\",\n negated: false,\n strict: false\n }),\n \"<\": new ComparatorExpression({\n comparator: \"less-than\",\n negated: false,\n strict: false\n })\n} as const;\n\n// Optimized comparator lookup using Map\nconst COMPARATOR_MAP = new Map(Object.entries(comparators));\n\n// Error message constants\nconst ERROR_MESSAGES = {\n COMPARATOR_NOT_FOUND: (value: string) => `Cannot find comparator: ${value}`,\n PROPERTY_NOT_FOUND: (path: string) => `Error parsing query, could not find PropertyInfo for path: ${path}`,\n PARAM_PATH_NOT_FOUND: (value: string, params: any) => `Cannot find path in params for .where(). Make sure parameters are not used inline.\\r\\nPath: ${value}, Params: ${JSON.stringify(params)}`\n};\n\nconst STRINGIFIED_COMPARE_OPERATORS = [\"true\", \"false\"];\n\nconst parseUnknown = (value: unknown) => {\n assertString(value);\n return JSON.parse(value);\n}\n\nexport const combineExpressions = (...expressions: Expression[]): Expression => {\n\n if (expressions.length === 0) {\n throw new Error(\"combineExpressions requires at least 1 expression\");\n }\n\n\n if (expressions.length === 1) {\n return expressions[0];\n }\n\n // Start with the first expression\n let result = expressions[0];\n\n // Loop through remaining expressions and combine them\n for (let i = 1; i < expressions.length; i++) {\n result = new OperatorExpression({\n operator: \"&&\",\n left: result,\n right: expressions[i]\n });\n }\n\n return result;\n};\n\nexport const toExpression = <T extends any, P extends any>(schema: CompiledSchema<any>, fn: Filter<T> | ParamsFilter<T, P>, params?: P) => {\n const stringifiedFunction = fn.toString();\n\n try {\n\n // Optimized string parsing\n const arrowIndex = stringifiedFunction.indexOf('=>');\n if (arrowIndex === -1) {\n throw new Error(\"Invalid Function\");\n }\n\n const parameterNames = stringifiedFunction.substring(0, arrowIndex).trim();\n let expression = stringifiedFunction.substring(arrowIndex + 2).trim();\n\n // Remove JavaScript comments from the expression\n expression = expression\n .replace(SINGLE_LINE_COMMENT_REGEX, '') // Remove single-line comments\n .replace(MULTI_LINE_COMMENT_REGEX, '') // Remove multi-line comments\n .replace(WHITESPACE_REGEX, ' ') // Normalize whitespace\n .trim();\n\n let parameterData: { name: string, data: P } | undefined = undefined;\n\n if (params != null) {\n let name: string;\n if (parameterNames.includes(\"[\") && parameterNames.includes(\"]\")) {\n // Optimized parameter name extraction\n const commaIndex = parameterNames.indexOf(\",\");\n if (commaIndex !== -1) {\n const bracketIndex = parameterNames.indexOf(\"]\", commaIndex);\n if (bracketIndex !== -1) {\n name = parameterNames.substring(commaIndex + 1, bracketIndex).trim();\n }\n }\n }\n\n parameterData = {\n name,\n data: params\n };\n }\n\n return parseExpressionToTree(schema, expression, parameterData);\n } catch (error) {\n logger.warn(\"Error parsing expression\", {\n error,\n collectionName: schema.collectionName,\n params,\n selector: stringifiedFunction\n });\n return Expression.NOT_PARSABLE;\n }\n}\n\nconst parseExpressionToTree = <P extends any>(schema: CompiledSchema<any>, expression: string, params?: { name: string, data: P }) => {\n\n const parse = (exp: string): Expression => {\n // Remove any wrapping parentheses\n exp = exp.trim();\n if (exp.startsWith('(') && exp.endsWith(')')) {\n let depth = 0;\n let isWrapper = true;\n for (let i = 0; i < exp.length; i++) {\n const char = exp[i];\n if (char === '(') {\n depth++;\n } else if (char === ')') {\n depth--;\n if (depth < 0) break; // Early exit for invalid parentheses\n }\n // Early exit if we find a closing parenthesis that's not the last character\n if (depth === 0 && i !== exp.length - 1) {\n isWrapper = false;\n break; // Early exit\n }\n // Early exit if we go negative (invalid parentheses)\n if (depth < 0) {\n isWrapper = false;\n break;\n }\n }\n if (isWrapper) {\n exp = exp.slice(1, -1).trim();\n }\n }\n\n // Parse based on the operator precedence\n let operator: Operator | null = null, splitIndex = -1, depth = 0;\n\n for (let i = 0; i < exp.length - 1; i++) {\n const char = exp[i];\n if (char === '(') depth++;\n else if (char === ')') depth--;\n else if (depth === 0) {\n // Optimized operator detection using character comparison\n if (char === '&' && exp[i + 1] === '&') {\n operator = '&&';\n splitIndex = i;\n break; // AND takes precedence over OR\n } else if (operator === null && char === '|' && exp[i + 1] === '|') {\n operator = '||';\n splitIndex = i;\n }\n }\n }\n\n if (operator) {\n const left = exp.slice(0, splitIndex).trim();\n const right = exp.slice(splitIndex + 2).trim();\n\n return new OperatorExpression({\n operator,\n left: parse(left),\n right: parse(right)\n });\n }\n\n // If no operator, try to parse as a condition\n return parseCondition(schema, exp, params);\n }\n\n return parse(expression);\n}\n\nconst convertAndAssignValue = (valueExpression: unknown, propertyPathExpression: unknown) => {\n\n assertIsPropertyPathExpression(propertyPathExpression);\n\n assertIsValueExpression(valueExpression)\n\n const propertyType = propertyPathExpression.property.type;\n\n valueExpression.value = converters[propertyType](valueExpression.value);\n}\n\nconst converters: Record<SchemaTypes, (value: unknown) => unknown> = {\n Array: v => v,\n Boolean: v => v == null ? v : Boolean(v),\n Computed: v => v,\n Date: v => v,\n Definition: v => v,\n Function: v => v,\n Number: v => v == null ? v : Number(v),\n Object: v => v,\n String: v => v == null ? v : String(v)\n};\n\nconst isExpression = (value: unknown): value is Expression => {\n return typeof value === \"object\" && value !== null && \"type\" in value;\n}\n\nfunction assertIsExpression(value: unknown): asserts value is Expression {\n if (isExpression(value) === false) {\n throw new Error(\"Assertion Failed: Value is not a Expression\")\n }\n}\n\nfunction assertIsPropertyPathExpression(value: unknown): asserts value is PropertyExpression {\n\n assertIsExpression(value);\n\n if (!(\"property\" in value)) {\n throw new Error(\"Assertion Failed: Value is not a PropertyPathExpression\")\n }\n}\n\nfunction assertIsValueExpression(value: unknown): asserts value is ValueExpression {\n\n assertIsExpression(value);\n\n if (!(\"value\" in value)) {\n throw new Error(\"Assertion Failed: Value is not a ValueExpression\")\n }\n}\n\n// Helper function to detect if a string is a property path\nconst isPropertyPath = (value: string, params?: { name: string, data: any }): boolean => {\n // Check for dot notation (e.g., entity.name)\n if (value.includes('.') && value.match(/^[a-zA-Z0-9_.]+$/) !== null) {\n return true;\n }\n // Check for bracket notation with literal strings (e.g., entity[\"name\"], entity['name'], or entity[\\\"name\\\"] with escaped quotes)\n const literalBracketPattern = /^[a-zA-Z_$][a-zA-Z0-9_$]*(\\[\\\\?[\"'][^\"']+\\\\?[\"']\\])+$/;\n if (literalBracketPattern.test(value)) {\n return true;\n }\n // Check for bracket notation with parameter paths (e.g., entity[p.name], entity[params.property])\n if (params && value.includes('[') && value.includes(']')) {\n const bracketMatch = value.match(/\\[([^\\]]+)\\]/);\n if (bracketMatch) {\n const bracketContent = bracketMatch[1].trim();\n // Check if it's a parameter path - should start with params.name followed by dot, or be just params.name\n const isParamPath = bracketContent.startsWith(params.name + '.') || bracketContent === params.name;\n if (isParamPath || (bracketContent.includes('.') && bracketContent.match(PARAM_PATH_REGEX))) {\n return true;\n }\n }\n }\n return false;\n};\n\n// Helper function to determine if we need to swap the operator for reversed comparisons\nconst getSwappedOperator = (operator: string): string => {\n const swapMap: Record<string, string> = {\n '>': '<',\n '<': '>',\n '>=': '<=',\n '<=': '>='\n };\n return swapMap[operator] || operator;\n};\n\nconst parseCondition = <P extends any>(schema: CompiledSchema<any>, expression: string, params?: { name: string, data: P }): Expression => {\n\n // Optimized string operations - single trim operation\n const trimmed = expression.trim();\n const isNegation = trimmed.startsWith('!');\n const finalExpression = isNegation ? trimmed.slice(1).trim() : trimmed;\n\n // Enhanced pattern matching for complex expressions\n const methodMatch = finalExpression.match(METHOD_REGEX);\n const transformMethodMatch = finalExpression.match(TRANSFORM_METHOD_REGEX);\n const equalityMatch = finalExpression.match(EQUALITY_REGEX);\n const comparisonMatch = finalExpression.match(COMPARISON_REGEX);\n\n if (methodMatch) {\n // Handle .startsWith or .endsWith\n const comparator = getComparator(methodMatch[2]);\n\n if (isNegation) {\n comparator.negated = isNegation;\n }\n\n // Check if the left side is a parameter path\n const leftSide = methodMatch[1];\n const rightSide = methodMatch[3];\n\n if (params && leftSide.startsWith(params.name)) {\n // This is a parameter path on the left side (e.g., params.distinctPlayers.includes(entity.playerId))\n // For includes method, we need to swap left and right sides\n if (methodMatch[2] === 'includes') {\n\n const property = getProperty(schema, rightSide, params);\n const value = getValue(leftSide, params); // retrieve the original value\n const serializer = property.property.valueSerializer;\n comparator.left = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;\n comparator.right = property;\n } else {\n // For other methods, return NOT_PARSABLE for now\n return Expression.NOT_PARSABLE;\n }\n } else {\n // Normal case: property on left, value on right\n const property = getProperty(schema, leftSide, params);\n const serializer = property.property.valueSerializer;\n const value = getValue(rightSide, params); // retrieve the original value\n\n comparator.left = property;\n comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;\n }\n\n // If the comparison is explicitly to false, mark it as negated\n if (methodMatch[6] === \"false\") {\n comparator.negated = true;\n }\n\n return comparator;\n }\n\n // Check for transformations on the value side (right side of comparison) - check this FIRST\n const valueTransformMatch = finalExpression.match(/([^=!<>]+?)\\s*(===|==|!==|!=)\\s*([^)]+)\\.(toLowerCase|toUpperCase|toLocaleLowerCase|toLocaleUpperCase)\\(\\)/);\n if (valueTransformMatch) {\n const comparator = getComparator(valueTransformMatch[2]);\n\n if (isNegation) {\n comparator.negated = isNegation;\n }\n\n const property = getProperty(schema, valueTransformMatch[1].trim(), params);\n const serializer = property.property.valueSerializer;\n const value = getValue(valueTransformMatch[3], params); // retrieve the original value\n\n // Create the property expression for the left side (no transformer)\n const propertyExpression = property;\n\n // Create a ValueExpression for the right side with transformer\n const valueExpression = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;\n\n // Set transformer and locale based on the method\n const method = valueTransformMatch[4];\n if (method === 'toLowerCase' || method === 'toLocaleLowerCase') {\n valueExpression.transformer = 'to-lower-case';\n if (method === 'toLocaleLowerCase') {\n valueExpression.locale = 'en-US';\n }\n } else {\n valueExpression.transformer = 'to-upper-case';\n if (method === 'toLocaleUpperCase') {\n valueExpression.locale = 'en-US';\n }\n }\n\n comparator.left = propertyExpression;\n comparator.right = valueExpression;\n\n return comparator;\n }\n\n if (transformMethodMatch) {\n // Handle .toLowerCase or .toUpperCase on the property side\n const comparator = getComparator(transformMethodMatch[3]); // e.g., startsWith, endsWith, includes\n\n if (isNegation) {\n comparator.negated = isNegation;\n }\n\n // Create the property expression for the left side with transformer\n const property = getProperty(schema, transformMethodMatch[1], params);\n\n // Set transformer and locale based on the method\n const method = transformMethodMatch[2];\n if (method === 'toLowerCase' || method === 'toLocaleLowerCase') {\n property.transformer = 'to-lower-case';\n if (method === 'toLocaleLowerCase') {\n property.locale = 'en-US'; // Default locale, could be extracted from method call\n }\n } else {\n property.transformer = 'to-upper-case';\n if (method === 'toLocaleUpperCase') {\n property.locale = 'en-US'; // Default locale, could be extracted from method call\n }\n }\n\n // Create a ValueExpression for the right side\n let value = getValue(transformMethodMatch[4], params);\n\n // Check if the value also has a transformation (but only if it's not already handled by value-side check)\n const valueTransformMatch = transformMethodMatch[4].match(/^([^)]+)\\.(toLowerCase|toUpperCase|toLocaleLowerCase|toLocaleUpperCase)\\(\\)$/);\n\n if (valueTransformMatch) {\n // Create a new ValueExpression with the base value and transformer\n value = new ValueExpression({\n value: valueTransformMatch[1].replace(/^[\"']|[\"']$/g, '') // Remove quotes\n });\n\n // Set transformer and locale based on the method\n const valueMethod = valueTransformMatch[2];\n if (valueMethod === 'toLowerCase' || valueMethod === 'toLocaleLowerCase') {\n value.transformer = 'to-lower-case';\n if (valueMethod === 'toLocaleLowerCase') {\n value.locale = 'en-US'; // Default locale\n }\n } else {\n value.transformer = 'to-upper-case';\n if (valueMethod === 'toLocaleUpperCase') {\n value.locale = 'en-US'; // Default locale\n }\n }\n }\n\n const serializer = property.property.valueSerializer;\n\n comparator.left = property;\n comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;\n\n // If the comparison is explicitly to false, mark it as negated\n if (transformMethodMatch[7] === \"false\") {\n comparator.negated = true;\n }\n\n return comparator;\n }\n\n if (equalityMatch) {\n const left = equalityMatch[1].trim();\n const operator = equalityMatch[2];\n const right = equalityMatch[3].trim();\n\n const leftIsProperty = isPropertyPath(left, params);\n const rightIsProperty = isPropertyPath(right, params);\n\n // Determine which side is the property and which is the value\n let propertySide: string, valueSide: string, finalOperator: string;\n\n if (leftIsProperty && !rightIsProperty) {\n // Normal case: property === value\n propertySide = left;\n valueSide = right;\n finalOperator = operator;\n } else if (!leftIsProperty && rightIsProperty) {\n // Reversed case: value === property\n propertySide = right;\n valueSide = left;\n finalOperator = operator;\n } else {\n // Both sides look like properties or neither does - assume left is property\n propertySide = left;\n valueSide = right;\n finalOperator = operator;\n }\n\n const comparator = getComparator(finalOperator);\n\n if (isNegation) {\n comparator.negated = isNegation;\n }\n\n const property = getProperty(schema, propertySide, params);\n const value = getValue(valueSide, params);\n const serializer = property.property.valueSerializer;\n\n comparator.left = property;\n comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;\n\n convertAndAssignValue(comparator.right, comparator.left);\n\n return comparator;\n }\n\n if (comparisonMatch) {\n const left = comparisonMatch[1].trim();\n const operator = comparisonMatch[2];\n const right = comparisonMatch[3].trim();\n\n const leftIsProperty = isPropertyPath(left, params);\n const rightIsProperty = isPropertyPath(right, params);\n\n // Determine which side is the property and which is the value\n let propertySide: string, valueSide: string, finalOperator: string;\n\n if (leftIsProperty && !rightIsProperty) {\n // Normal case: property > value\n propertySide = left;\n valueSide = right;\n finalOperator = operator;\n } else if (!leftIsProperty && rightIsProperty) {\n // Reversed case: value > property -> property < value\n propertySide = right;\n valueSide = left;\n finalOperator = getSwappedOperator(operator);\n } else {\n // Both sides look like properties or neither does - assume left is property\n propertySide = left;\n valueSide = right;\n finalOperator = operator;\n }\n\n const comparator = getComparator(finalOperator);\n\n if (isNegation) {\n comparator.negated = isNegation;\n }\n\n const property = getProperty(schema, propertySide, params);\n const value = getValue(valueSide, params);\n const serializer = property.property.valueSerializer;\n\n comparator.left = property;\n comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;\n\n convertAndAssignValue(comparator.right, comparator.left);\n\n return comparator;\n }\n\n // Check for standalone property reference (truthy comparison)\n // Pattern: property name only (e.g., \"w.inStock\" -> w.inStock === true)\n const standalonePropertyMatch = finalExpression.match(/^[a-zA-Z_$][a-zA-Z0-9_$]*(\\.[a-zA-Z_$][a-zA-Z0-9_$]*)*$/);\n if (standalonePropertyMatch && isPropertyPath(finalExpression, params)) {\n const comparator = getComparator('===');\n\n if (isNegation) {\n comparator.negated = isNegation;\n }\n\n const property = getProperty(schema, finalExpression, params);\n const value = getValue('true', params);\n const serializer = property.property.valueSerializer;\n\n comparator.left = property;\n // need to parse the value so it matches what the serializer expects\n comparator.right = serializer ? getValue(String(property.property.valueSerializer(parseUnknown(value.value)))) : value;\n\n return comparator;\n }\n\n // If we get here, the expression is too complex for the current parser\n // This is expected for complex real-world expressions\n throw new Error(`Unsupported expression format: ${finalExpression}`);\n}\n\nconst getComparator = (value: string): ComparatorExpression => {\n\n const comparator = COMPARATOR_MAP.get(value);\n\n if (comparator == null) {\n throw new Error(ERROR_MESSAGES.COMPARATOR_NOT_FOUND(value))\n }\n\n // Return a new instance to avoid modifying the cached one\n return new ComparatorExpression({\n comparator: comparator.comparator,\n negated: comparator.negated,\n strict: comparator.strict\n });\n}\n\nconst getValue = <P extends any>(value: string, params?: { name: string, data: P }): ValueExpression => {\n\n // Early return for string literals\n if (value.startsWith(\"'\") || value.startsWith(\"\\\"\")) {\n return new ValueExpression({\n value: value.replace(/\"|'/g, \"\")\n });\n }\n\n // Early return for null/undefined\n if (value === \"null\") {\n return new ValueExpression({ value: null });\n }\n\n if (value === \"undefined\" || value === \"void 0\") {\n return new ValueExpression({ value: undefined });\n }\n\n // Optimized number parsing with early return\n const numValue = +value;\n if (!isNaN(numValue) && isFinite(numValue)) {\n return new ValueExpression({ value: numValue });\n }\n\n // Handle parameter paths if params are provided\n if (params != null) {\n // Check if this is a parameter path (starts with params.name)\n if (value.startsWith(params.name)) {\n return new ValueExpression({\n value: getValueFromParams(value, params)\n });\n }\n\n // Check if this is a parameter path without the params prefix\n if (value.includes('.')) {\n // Try to extract the parameter path\n const paramMatch = value.match(PARAM_PATH_REGEX);\n if (paramMatch) {\n const potentialParamPath = paramMatch[1];\n try {\n const paramValue = getValueFromParams(`${params.name}.${potentialParamPath}`, params);\n return new ValueExpression({ value: paramValue });\n } catch {\n // Not a parameter path, continue with normal parsing\n }\n }\n }\n }\n\n if (STRINGIFIED_COMPARE_OPERATORS.includes(value)) {\n return new ValueExpression({ value });\n }\n\n if (isNaN(numValue)) {\n // value is a variable passed in by the dev, we cannot evaluate it's value\n // need to fallback to select all by throwing an error\n throw new Error(`Cannot derive value from variable, please pass parameters into the expression.\n\nExample: .where(([x, params]) => x.id === params.id, { id: someVar.id })\nIssue At: ${value}`);\n }\n\n // Default case: return as-is\n return new ValueExpression({ value });\n}\n\nconst getValueFromParams = <P extends any>(value: string, params: { name: string, data: P }) => {\n\n const split = value.split('.');\n\n // Early exit for invalid paths\n if (split.length === 1) {\n throw new Error(ERROR_MESSAGES.PARAM_PATH_NOT_FOUND(value, params.data))\n }\n\n let result = params.data as any;\n\n // For nested params - start from index 1 to skip the params prefix\n for (let i = 1; i < split.length; i++) {\n const name = split[i];\n\n if (name in result) {\n result = result[name];\n continue;\n }\n\n throw new Error(ERROR_MESSAGES.PARAM_PATH_NOT_FOUND(value, params.data))\n }\n\n return result;\n}\n\nconst getProperty = <P extends any>(schema: CompiledSchema<any>, value: string, params?: { name: string, data: P }): PropertyExpression => {\n let pathString: string;\n\n // Handle bracket notation (e.g., entity[\"name\"], entity['name'], entity[p.name], or entity[\\\"name\\\"] with escaped quotes)\n if (value.includes('[') && value.includes(']')) {\n // First try to match literal string brackets: [\"name\"], ['name'], [\\\"name\\\"], [\\'name\\']\n const literalBracketMatches = value.matchAll(/\\[\\\\?[\"']([^\"']+)\\\\?[\"']\\]/g);\n const pathParts: string[] = [];\n let foundLiteral = false;\n\n for (const match of literalBracketMatches) {\n // match[1] is the property name inside the brackets\n const propName = match[1];\n if (propName) {\n pathParts.push(propName);\n foundLiteral = true;\n }\n }\n\n // If no literal matches found, try parameter path in brackets (e.g., [p.name])\n if (!foundLiteral && params) {\n // Match brackets containing parameter paths: [p.name], [params.property], etc.\n const bracketParamMatch = value.match(/\\[([^\\]]+)\\]/);\n if (bracketParamMatch) {\n const bracketContent = bracketParamMatch[1].trim();\n\n // Check if this is a parameter path\n // It should start with params.name (e.g., \"p\") followed by a dot, or be just params.name\n const isParamPath = bracketContent.startsWith(params.name + '.') || bracketContent === params.name;\n\n if (isParamPath || (bracketContent.includes('.') && bracketContent.match(PARAM_PATH_REGEX))) {\n try {\n // Try to resolve as a parameter path\n let paramPath: string;\n if (bracketContent.startsWith(params.name + '.') || bracketContent === params.name) {\n // Already has params.name prefix\n paramPath = bracketContent;\n } else {\n // Add params.name prefix\n const paramMatch = bracketContent.match(PARAM_PATH_REGEX);\n paramPath = paramMatch\n ? `${params.name}.${paramMatch[1]}`\n : `${params.name}.${bracketContent}`;\n }\n\n const resolvedValue = getValueFromParams(paramPath, params);\n // The resolved value should be the property name\n if (typeof resolvedValue === 'string') {\n pathParts.push(resolvedValue);\n } else {\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n } catch {\n // Not a valid parameter path, continue to error\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n } else {\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n } else {\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n }\n\n if (pathParts.length === 0) {\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n\n pathString = pathParts.join(\".\");\n } else if (value.includes('.')) {\n // Handle dot notation (e.g., entity.name)\n const pathSplit = value.split(/[?!.]/g).slice(1);\n pathString = pathSplit.join(\".\");\n } else {\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n\n // Early exit if no path found\n if (!pathString) {\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n\n const found = schema.properties.find(w => w.getAssignmentPath() == pathString);\n\n if (found == null) {\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(value));\n }\n\n return new PropertyExpression({ property: found });\n}\n\n\n","/**\n * Dialect-aware SQL WHERE generation from expression trees.\n *\n * Uses a **Strategy** for SQL dialects (quoting, placeholders, LIKE vs GLOB).\n * Uses a **Visitor** over the expression AST. Equals comparison uses a Strategy\n * per (column-side, null vs value) case.\n */\nimport type { ComparatorExpression, Expression, PropertyExpression } from \"./types\";\nimport {\n isComparatorExpression,\n isOperatorExpression,\n isPropertyExpression,\n isValueExpression,\n} from \"../assertions\";\n\n/** Supported SQL dialect names. */\nexport type SqlDialectName = \"sqlite\" | \"postgresql\" | \"mysql\" | \"mssql\";\n\n/**\n * Dialect interface for generating portable SQL WHERE fragments.\n */\nexport interface SqlDialect {\n quoteIdentifier(name: string): string;\n getPlaceholder(paramIndex: number): string;\n stringMatchKind: \"LIKE\" | \"GLOB\";\n likeEscapeClause(): string;\n}\n\nconst DIALECTS: Record<SqlDialectName, SqlDialect> = {\n sqlite: {\n quoteIdentifier(name) {\n return `\"${name.replace(/\"/g, '\"\"')}\"`;\n },\n getPlaceholder(_i) {\n return \"?\";\n },\n stringMatchKind: \"GLOB\",\n likeEscapeClause() {\n return \"\";\n },\n },\n postgresql: {\n quoteIdentifier(name) {\n return `\"${name.replace(/\"/g, '\"\"')}\"`;\n },\n getPlaceholder(i) {\n return `$${i + 1}`;\n },\n stringMatchKind: \"LIKE\",\n likeEscapeClause() {\n return \" ESCAPE E'\\\\\\\\'\";\n },\n },\n mysql: {\n quoteIdentifier(name) {\n return \"`\" + name.replace(/`/g, \"``\") + \"`\";\n },\n getPlaceholder(_i) {\n return \"?\";\n },\n stringMatchKind: \"LIKE\",\n likeEscapeClause() {\n return \" ESCAPE '\\\\\\\\'\";\n },\n },\n mssql: {\n quoteIdentifier(name) {\n return \"[\" + name.replace(/]/g, \"]]\") + \"]\";\n },\n getPlaceholder(i) {\n return `@p${i + 1}`;\n },\n stringMatchKind: \"LIKE\",\n likeEscapeClause() {\n return \" ESCAPE '\\\\\\\\'\";\n },\n },\n};\n\nexport function getDialect(name: SqlDialectName): SqlDialect {\n const d = DIALECTS[name];\n if (!d) throw new Error(`Unknown SQL dialect: ${name}`);\n return d;\n}\n\nfunction escapeLikeLiteral(value: string): string {\n return value.replace(/\\\\/g, \"\\\\\\\\\").replace(/%/g, \"\\\\%\").replace(/_/g, \"\\\\_\");\n}\n\nfunction escapeGlobLiteral(value: string): string {\n return value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\\*/g, \"\\\\*\").replace(/\\?/g, \"\\\\?\");\n}\n\nfunction escapeForPattern(value: string, kind: \"LIKE\" | \"GLOB\"): string {\n return kind === \"LIKE\" ? escapeLikeLiteral(value) : escapeGlobLiteral(value);\n}\n\nfunction buildPattern(\n escapedValue: string,\n match: \"contains\" | \"starts-with\" | \"ends-with\",\n kind: \"LIKE\" | \"GLOB\"\n): string {\n if (kind === \"LIKE\") {\n switch (match) {\n case \"contains\":\n return `%${escapedValue}%`;\n case \"starts-with\":\n return `${escapedValue}%`;\n case \"ends-with\":\n return `%${escapedValue}`;\n }\n }\n switch (match) {\n case \"contains\":\n return `*${escapedValue}*`;\n case \"starts-with\":\n return `${escapedValue}*`;\n case \"ends-with\":\n return `*${escapedValue}`;\n }\n}\n\n/** Result of splitting a comparator into left/right property and value sides. */\ninterface PropertyValueSides {\n propLeft: PropertyExpression | null;\n propRight: PropertyExpression | null;\n valLeft: unknown;\n valRight: unknown;\n}\n\nfunction getPropertyValueSides(cmp: ComparatorExpression): PropertyValueSides {\n const propLeft = cmp.left && isPropertyExpression(cmp.left) ? cmp.left : null;\n const propRight = cmp.right && isPropertyExpression(cmp.right) ? cmp.right : null;\n const valLeft = cmp.left && isValueExpression(cmp.left) ? cmp.left.value : null;\n const valRight = cmp.right && isValueExpression(cmp.right) ? cmp.right.value : null;\n return { propLeft, propRight, valLeft, valRight };\n}\n\n// --- Equals: Strategy per (column-side, null vs value) case ---\n\ntype EqualsCase = \"null-column-left\" | \"null-column-right\" | \"value-column-left\" | \"value-column-right\";\n\ninterface EqualsRenderContext {\n col: string;\n value: unknown;\n negated: boolean;\n params: unknown[];\n placeholder: () => string;\n}\n\nfunction getEqualsCase(\n value: unknown,\n columnOnLeft: boolean,\n columnOnRight: boolean\n): EqualsCase | null {\n if (value === null && columnOnLeft) return \"null-column-left\";\n if (value === null && columnOnRight) return \"null-column-right\";\n if (value !== null && columnOnLeft) return \"value-column-left\";\n if (value !== null && columnOnRight) return \"value-column-right\";\n return null;\n}\n\nfunction equalsNullColumnLeft(ctx: EqualsRenderContext): string {\n return ctx.negated ? `${ctx.col} IS NOT NULL` : `${ctx.col} IS NULL`;\n}\n\nfunction equalsNullColumnRight(ctx: EqualsRenderContext): string {\n ctx.params.push(null);\n const ph = ctx.placeholder();\n return ctx.negated ? `${ph} IS NOT NULL` : `${ph} IS NULL`;\n}\n\nfunction equalsValueColumnLeft(ctx: EqualsRenderContext): string {\n ctx.params.push(ctx.value);\n const ph = ctx.placeholder();\n return ctx.negated ? `${ctx.col} != ${ph}` : `${ctx.col} = ${ph}`;\n}\n\nfunction equalsValueColumnRight(ctx: EqualsRenderContext): string {\n ctx.params.push(ctx.value);\n const ph = ctx.placeholder();\n return ctx.negated ? `${ph} != ${ctx.col}` : `${ph} = ${ctx.col}`;\n}\n\nconst EQUALS_STRATEGIES: Record<EqualsCase, (ctx: EqualsRenderContext) => string> = {\n \"null-column-left\": equalsNullColumnLeft,\n \"null-column-right\": equalsNullColumnRight,\n \"value-column-left\": equalsValueColumnLeft,\n \"value-column-right\": equalsValueColumnRight,\n};\n\n// --- String-pattern comparison (includes / starts-with / ends-with) ---\n\nfunction renderStringPatternComparison(\n cmp: ComparatorExpression,\n d: SqlDialect,\n params: unknown[],\n placeholder: () => string\n): string {\n const { propLeft, propRight, valLeft, valRight } = getPropertyValueSides(cmp);\n const kind = d.stringMatchKind;\n\n if (cmp.comparator === \"includes\") {\n const col =\n propLeft && valRight !== null\n ? d.quoteIdentifier(propLeft.property.name)\n : propRight && valLeft !== null\n ? d.quoteIdentifier(propRight.property.name)\n : null;\n const value = valRight !== null ? valRight : valLeft;\n\n if (col === null) {\n throw new Error(\"Complex expressions not supported for includes operations\");\n }\n\n if (Array.isArray(value)) {\n const placeholders = value.map(() => placeholder()).join(\", \");\n params.push(...value);\n return cmp.negated ? `${col} NOT IN (${placeholders})` : `${col} IN (${placeholders})`;\n }\n\n const escaped = escapeForPattern(String(value), kind);\n const pattern = buildPattern(escaped, \"contains\", kind);\n params.push(pattern);\n const ph = placeholder();\n const op = kind === \"GLOB\" ? \"GLOB\" : \"LIKE\";\n const escape = kind === \"LIKE\" ? d.likeEscapeClause() : \"\";\n if (propLeft && valRight !== null) {\n return cmp.negated ? `${col} NOT ${op} ${ph}${escape}` : `${col} ${op} ${ph}${escape}`;\n }\n return cmp.negated ? `${ph} NOT ${op} ${col}${escape}` : `${ph} ${op} ${col}${escape}`;\n }\n\n const col =\n propLeft && valRight !== null\n ? d.quoteIdentifier(propLeft.property.name)\n : propRight && valLeft !== null\n ? d.quoteIdentifier(propRight.property.name)\n : null;\n const value = valRight !== null ? String(valRight) : valLeft !== null ? String(valLeft) : null;\n\n if (col === null || value === null) {\n throw new Error(`Complex expressions not supported for ${cmp.comparator} operations`);\n }\n\n const escaped = escapeForPattern(value, kind);\n const pattern = buildPattern(\n escaped,\n cmp.comparator === \"starts-with\" ? \"starts-with\" : \"ends-with\",\n kind\n );\n params.push(pattern);\n const ph = placeholder();\n const op = kind === \"GLOB\" ? \"GLOB\" : \"LIKE\";\n const escape = kind === \"LIKE\" ? d.likeEscapeClause() : \"\";\n\n if (propLeft && valRight !== null) {\n return cmp.negated ? `${col} NOT ${op} ${ph}${escape}` : `${col} ${op} ${ph}${escape}`;\n }\n return cmp.negated ? `${ph} NOT ${op} ${col}${escape}` : `${ph} ${op} ${col}${escape}`;\n}\n\n// --- Generic comparison ---\n\nfunction renderGenericComparison(\n cmp: ComparatorExpression,\n walk: (e: Expression) => string\n): string {\n const leftExpr = walk(cmp.left!);\n const rightExpr = walk(cmp.right!);\n switch (cmp.comparator) {\n case \"equals\":\n return cmp.negated ? `${leftExpr} != ${rightExpr}` : `${leftExpr} = ${rightExpr}`;\n case \"greater-than\":\n return cmp.negated ? `${leftExpr} <= ${rightExpr}` : `${leftExpr} > ${rightExpr}`;\n case \"greater-than-equals\":\n return cmp.negated ? `${leftExpr} < ${rightExpr}` : `${leftExpr} >= ${rightExpr}`;\n case \"less-than\":\n return cmp.negated ? `${leftExpr} >= ${rightExpr}` : `${leftExpr} < ${rightExpr}`;\n case \"less-than-equals\":\n return cmp.negated ? `${leftExpr} > ${rightExpr}` : `${leftExpr} <= ${rightExpr}`;\n default:\n throw new Error(`Unsupported comparator: ${cmp.comparator}`);\n }\n}\n\nexport interface ToSqlResult {\n where: string;\n params: unknown[];\n}\n\n/**\n * Converts an Expression to a SQL WHERE clause and bound parameters for the given dialect.\n */\nexport function toSql(\n expr: Expression,\n dialect: SqlDialectName | SqlDialect\n): ToSqlResult {\n const d = typeof dialect === \"string\" ? getDialect(dialect) : dialect;\n const params: unknown[] = [];\n let paramIndex = 0;\n\n function placeholder(): string {\n const p = d.getPlaceholder(paramIndex);\n paramIndex += 1;\n return p;\n }\n\n /** Visitor: map each expression node type to a SQL fragment. */\n function walk(e: Expression): string {\n if (isOperatorExpression(e)) {\n const left = e.left ? walk(e.left) : \"\";\n const right = e.right ? walk(e.right) : \"\";\n const sqlOp = e.operator === \"&&\" ? \"AND\" : e.operator === \"||\" ? \"OR\" : e.operator;\n return `(${left} ${sqlOp} ${right})`;\n }\n\n if (isComparatorExpression(e)) {\n const cmp = e;\n const isStringPattern =\n cmp.comparator === \"starts-with\" ||\n cmp.comparator === \"ends-with\" ||\n cmp.comparator === \"includes\";\n\n if (isStringPattern) {\n /* String pattern: includes / starts-with / ends-with → one renderer. */\n return renderStringPatternComparison(cmp, d, params, placeholder);\n }\n\n if (cmp.comparator === \"equals\") {\n /* Equals: Strategy per (column-side, null vs value) case. */\n const { propLeft, propRight, valLeft, valRight } = getPropertyValueSides(cmp);\n const col =\n propLeft && (valRight !== undefined || propRight)\n ? d.quoteIdentifier(propLeft.property.name)\n : propRight && (valLeft !== undefined || propLeft)\n ? d.quoteIdentifier(propRight.property.name)\n : null;\n const value = valRight !== undefined ? valRight : valLeft;\n const columnOnLeft = Boolean(propLeft && cmp.right && isValueExpression(cmp.right));\n const columnOnRight = Boolean(propRight && cmp.left && isValueExpression(cmp.left));\n\n if (col !== null && value !== undefined) {\n const caseKey = getEqualsCase(value, columnOnLeft, columnOnRight);\n if (caseKey !== null) {\n const strategy = EQUALS_STRATEGIES[caseKey];\n return strategy({\n col,\n value,\n negated: cmp.negated,\n params,\n placeholder,\n });\n }\n }\n }\n\n /* Generic: walk both sides and emit comparison operator. */\n return renderGenericComparison(cmp, walk);\n }\n\n if (isPropertyExpression(e)) {\n return d.quoteIdentifier(e.property.name);\n }\n\n if (isValueExpression(e)) {\n params.push(e.value);\n return placeholder();\n }\n\n throw new Error(`Unknown expression type: ${(e as Expression).type}`);\n }\n\n const where = walk(expr);\n return { where, params };\n}\n","import { QueryOptionExecutionTarget } from \"../plugins\";\nimport { PropertyInfo } from \"../schema\";\n\nexport type ParsedExpression = {\n expression: Expression;\n // Will be memory when trying to query on an untracked computed property or on a function\n executionTarget: QueryOptionExecutionTarget;\n}\n\n/**\n * The base class for all expression types.\n */\nexport abstract class Expression {\n /** The type of the expression. */\n abstract readonly type: ExpressionType;\n /** The left-hand side of the expression (if applicable). */\n left?: Expression;\n /** The right-hand side of the expression (if applicable). */\n right?: Expression;\n\n constructor(left?: Expression, right?: Expression) {\n this.left = left;\n this.right = right;\n }\n\n static get EMPTY() {\n return new EmptyExpression();\n }\n\n static get NOT_PARSABLE() {\n return new NotParsableExpression();\n }\n\n static isEmpty(expression: Expression) {\n return expression.type === \"empty\" || expression instanceof EmptyExpression;\n }\n\n static isNotParsable(expression: Expression) {\n return expression.type === \"not-parsable\" || expression instanceof NotParsableExpression;\n }\n}\n\nexport class EmptyExpression extends Expression {\n readonly type = \"empty\" as const;\n}\n\nexport class NotParsableExpression extends Expression {\n readonly type = \"not-parsable\" as const;\n}\n\n/**\n * A class representing a comparison operation (e.g., equals, greater-than).\n */\nexport class ComparatorExpression extends Expression {\n /** The type of the expression (always 'comparator'). */\n readonly type = \"comparator\" as const;\n /** The comparator operation (e.g., equals, greater-than). */\n comparator: Comparator;\n /** Whether the comparison is negated (e.g., not equals). */\n negated: boolean;\n /** Whether the comparison is strict (type-sensitive). */\n strict: boolean;\n\n constructor(\n options: {\n comparator: Comparator,\n negated: boolean,\n strict: boolean,\n left?: Expression,\n right?: Expression\n }\n ) {\n super(options.left, options.right);\n this.comparator = options.comparator;\n this.negated = options.negated;\n this.strict = options.strict;\n }\n}\n\n/**\n * A class representing a logical operator (e.g., &&, ||).\n */\nexport class OperatorExpression extends Expression {\n /** The type of the expression (always 'operator'). */\n readonly type = \"operator\" as const;\n /** The logical operator. */\n operator: Operator;\n\n constructor(options: { operator: Operator, left?: Expression, right?: Expression }) {\n super(options.left, options.right);\n this.operator = options.operator;\n }\n}\n\n/**\n * A class representing a property path.\n */\nexport class PropertyExpression extends Expression {\n /** The type of the expression (always 'property'). */\n readonly type = \"property\" as const;\n /** The property info for the path. */\n property: PropertyInfo<any>;\n transformer: Transformer | null = null;\n locale: string | null = null;\n\n constructor(options: { property: PropertyInfo<any> }) {\n super();\n this.property = options.property;\n }\n}\n\n/**\n * A class representing a literal value.\n */\nexport class ValueExpression extends Expression {\n /** The type of the expression (always 'value'). */\n readonly type = \"value\" as const;\n /** The literal value. */\n value: unknown;\n\n transformer: Transformer | null = null;\n locale: string | null = null;\n\n constructor(options: {\n value: unknown\n }) {\n super();\n this.value = options.value;\n }\n}\n\n\n/**\n * The set of possible expression types.\n */\nexport type ExpressionType = \"operator\" | \"comparator\" | \"property\" | \"value\" | \"empty\" | \"not-parsable\";\n\n/**\n * Supported value transformations that can be applied to values.\n */\nexport type Transformer = \"to-lower-case\" | \"to-upper-case\";\n\n/**\n * Supported comparator operations for expressions.\n */\nexport type Comparator =\n | \"equals\"\n | \"starts-with\"\n | \"includes\"\n | \"ends-with\"\n | \"greater-than\"\n | \"greater-than-equals\"\n | \"less-than\"\n | \"less-than-equals\";\n\n/**\n * Supported logical operators for expressions.\n */\nexport type Operator = \"&&\" | \"||\";\n\n/**\n * A function that filters a value of type T and returns a boolean.\n */\nexport type Filter<T extends any> = (value: T) => boolean;\n\n/**\n * A function that filters a value of type T with additional parameters P.\n */\nexport type ParamsFilter<T extends any, P> = (payload: [T, P]) => boolean;\n\n/**\n * A filter that can be either a simple filter or a parameterized filter.\n */\nexport type CompositeFilter<T extends any, P = never> = Filter<T> | ParamsFilter<T, P>;\n\n/**\n * An object that can be filtered using a composite filter and optional parameters.\n */\nexport type Filterable<T extends any, P = any> = {\n /** The filter function. */\n filter: CompositeFilter<T, P>;\n /** Optional parameters for the filter. */\n params?: P;\n};","import { PropertyInfo } from \"../schema\";\nimport { Expression, PropertyExpression } from \"./types\";\n\n/**\n * Extracts all properties referenced in an expression\n * @param expression The expression to analyze\n * @returns Array of PropertyInfo objects referenced in the expression\n */\nexport function getProperties(expression: Expression): PropertyInfo<any>[] {\n const properties: PropertyInfo<any>[] = [];\n\n function traverse(expr: Expression) {\n // If this is a property expression, add it to our collection\n if (expr.type === \"property\") {\n properties.push((expr as PropertyExpression).property);\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n traverse(expr.left);\n }\n if (expr.right) {\n traverse(expr.right);\n }\n }\n\n traverse(expression);\n return properties;\n}\n\nexport function forEach(expression: Expression, callback: (expression: Expression) => boolean) {\n function traverse(expr: Expression): boolean {\n // Call the callback for this expression\n // If callback returns false, stop traversing\n if (!callback(expr)) {\n return false;\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n if (!traverse(expr.left)) {\n return false;\n }\n }\n if (expr.right) {\n if (!traverse(expr.right)) {\n return false;\n }\n }\n\n return true;\n }\n\n traverse(expression);\n}","import { logger } from \"../utilities\";\n\nconst measurements: Record<string, number> = {}\n\nexport const now = (): number => {\n if (typeof performance !== 'undefined' && performance.now) {\n // Browser or modern Node.js\n return performance.now();\n }\n\n // Fallback for older environments\n return Date.now();\n}\n\nexport const measure = {\n start: (name: string): void => {\n measurements[name] = now();\n },\n end: (name: string): void => {\n const start = measurements[name];\n\n delete measurements[name];\n\n const delta = now() - start;\n\n logger.log(`[ROUTIER] - Performance: ${name} took ${delta}`);\n }\n}","export type SyncronousUnitOfWork = (done: () => void) => void\n\nexport class SyncronousQueue {\n\n private readonly _queue: SyncronousUnitOfWork[] = [];\n private _current: SyncronousUnitOfWork | null = null;\n\n enqueue(unitOfWork: SyncronousUnitOfWork) {\n this._queue.push(unitOfWork);\n this._next();\n }\n\n private _next() {\n if (this._current != null || this._queue.length === 0) {\n return;\n }\n\n // Take first item\n this._current = this._queue.shift() ?? null;\n\n if (this._current == null) {\n return;\n }\n\n this._current(() => {\n this._current = null;\n this._next();\n })\n }\n}","import { logger } from \"../utilities\";\nimport { CallbackResult, Result, ResultType } from \"../results\";\n\n/**\n * Type definition for an asynchronous function that takes data and a callback.\n * TIn: The input data type.\n * TOut: The output data type (passed to the callback).\n */\nexport type Processor<TIn, TOut> = (data: TIn, callback: (result: TOut, error?: any) => void) => void;\n\n// Return type for a step execution: Either the next step function or null if waiting/done.\ntype StepResult<TData> = TrampolineStep<TData> | null;\ntype TrampolineStep<TData> = () => StepResult<TData>;\n\nexport class TrampolinePipeline<TInitial, TCurrent = TInitial> {\n private _list: Processor<any, any>[] = [];\n private _hasErrored: boolean = false; // Flag to prevent calling done on error\n\n filter<TFinal>(initialData: TInitial, done: (data: TFinal, error?: any) => void) {\n\n this._hasErrored = false; // Reset error flag on new execution\n\n if (this._list.length === 0) {\n done(initialData as unknown as TFinal);\n return;\n }\n\n let index = 0;\n let currentData: any = initialData;\n let isRunning = false; // Guard against overlapping trampoline calls\n\n try {\n // --- Revised Completion Logic --- (Moved up for clarity)\n const finalStepSentinel = (): StepResult<any> => { // A special step function for the very end\n // Only call done if no error has occurred\n if (!this._hasErrored) {\n done(currentData as TFinal);\n }\n return null; // Stop the trampoline\n };\n\n const createStepRevised = (idx: number): TrampolineStep<any> => {\n return () => {\n if (this._hasErrored) return null; // Stop if an error occurred elsewhere\n\n if (idx >= this._list.length) {\n return finalStepSentinel(); // Execute the dedicated final step\n }\n\n const processor = this._list[idx];\n // Initialize syncCallbackResult to null to satisfy StepResult type\n let syncCallbackResult: StepResult<any> = null;\n let calledSync = false;\n\n try {\n processor(currentData, (result, error) => {\n // --- Error Handling ---\n if (error) {\n logger.error(`Error reported by processor at index ${idx}:`, error);\n this._hasErrored = true; // Set flag\n // Throw the error to be caught by outer try...catch blocks\n throw error;\n }\n // --- /Error Handling ---\n\n // If no error, proceed as before\n currentData = result;\n index = idx + 1; // Update index for the next step\n const nextStep = createStepRevised(index); // Use updated index\n\n if (isRunning) {\n // Callback was synchronous\n syncCallbackResult = nextStep; // Store next step function\n calledSync = true;\n } else {\n // Callback was asynchronous, restart trampoline\n trampoline(nextStep);\n }\n });\n } catch (error) {\n if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback\n logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);\n this._hasErrored = true;\n }\n // Rethrow to be caught by the trampoline's catch block\n throw error;\n }\n\n if (calledSync) {\n // Return the next step function for the sync loop\n return syncCallbackResult;\n } else {\n // Pause trampoline for async, loop will stop as step returns null\n return null;\n }\n };\n };\n\n // The trampoline loop\n const trampoline = (step: TrampolineStep<any> | null) => {\n\n if (isRunning) {\n return;\n }\n\n isRunning = true;\n let currentStep = step;\n\n while (currentStep !== null) {\n try {\n // Stop immediately if an error was flagged elsewhere\n if (this._hasErrored) {\n currentStep = null;\n break;\n }\n currentStep = currentStep(); // Execute step, get next step or null\n } catch (trampolineError) {\n // Catch errors propagated from step execution (processor or callback errors)\n if (!this._hasErrored) { // Avoid double logging\n logger.error(\"Error during trampoline step execution:\", trampolineError);\n this._hasErrored = true;\n }\n currentStep = null; // Stop the loop\n // We don't call `done` here because an error occurred.\n // The application should handle the uncaught exception if desired.\n break; // Explicitly break loop on error\n }\n }\n // Loop ends when currentStep is null or loop is broken by error\n isRunning = false;\n\n // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.\n };\n\n // --- Start the process ---\n index = 0; // Reset index\n currentData = initialData; // Reset data\n trampoline(createStepRevised(0)); // Start with the revised step creator\n } catch (error: any) {\n done(currentData, error);\n }\n }\n\n pipe<TNext>(processor: Processor<TCurrent, TNext>) {\n this._list.push(processor);\n return this as unknown as TrampolinePipeline<TInitial, TNext>;\n }\n\n pipeEach(items: TCurrent[], fn: (payload: ResultType<TCurrent>, done: CallbackResult<TCurrent>) => void, map: (previous: ResultType<TCurrent>, current: ResultType<TCurrent>) => ResultType<TCurrent>) {\n for (let i = 0, length = items.length; i < length; i++) {\n\n this.pipe<ResultType<TCurrent>>((previous, done) => {\n\n fn(map(previous as ResultType<TCurrent>, Result.success(items[i])), done);\n });\n }\n }\n}\n\nexport type UnitOfWork = (done: CallbackResult<never>) => void;\n\n/**\n * Processes functions with callbacks asynchronously.\n * \n * This pipeline handles work items that contain callback functions,\n * executing them in an asynchronous manner while maintaining proper\n * flow control and error handling.\n */\nexport class WorkPipeline {\n private unitsOfWork: UnitOfWork[] = [];\n private _hasErrored: boolean = false; // Flag to prevent calling done on error\n\n filter(done: CallbackResult<never>) {\n\n this._hasErrored = false; // Reset error flag on new execution\n\n if (this.unitsOfWork.length === 0) {\n done(Result.success());\n return;\n }\n\n let index = 0;\n let isRunning = false; // Guard against overlapping trampoline calls\n\n try {\n // --- Revised Completion Logic --- (Moved up for clarity)\n const finalStepSentinel = (): StepResult<never> => { // A special step function for the very end\n // Only call done if no error has occurred\n if (!this._hasErrored) {\n done(Result.success());\n }\n return null; // Stop the trampoline\n };\n\n const createStepRevised = (idx: number): TrampolineStep<any> => {\n return () => {\n if (this._hasErrored) return null; // Stop if an error occurred elsewhere\n\n if (idx >= this.unitsOfWork.length) {\n return finalStepSentinel(); // Execute the dedicated final step\n }\n\n const processor = this.unitsOfWork[idx];\n // Initialize syncCallbackResult to null to satisfy StepResult type\n let syncCallbackResult: StepResult<any> = null;\n let calledSync = false;\n\n try {\n processor((result) => {\n // --- Error Handling ---\n if (result.ok === Result.ERROR) {\n logger.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);\n this._hasErrored = true; // Set flag\n // Throw the error to be caught by outer try...catch blocks\n throw result.error;\n }\n // --- /Error Handling ---\n\n // If no error, proceed as before\n index = idx + 1; // Update index for the next step\n const nextStep = createStepRevised(index); // Use updated index\n\n if (isRunning) {\n // Callback was synchronous\n syncCallbackResult = nextStep; // Store next step function\n calledSync = true;\n } else {\n // Callback was asynchronous, restart trampoline\n trampoline(nextStep);\n }\n });\n } catch (error) {\n if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback\n logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);\n this._hasErrored = true;\n }\n // Rethrow to be caught by the trampoline's catch block\n throw error;\n }\n\n if (calledSync) {\n // Return the next step function for the sync loop\n return syncCallbackResult;\n } else {\n // Pause trampoline for async, loop will stop as step returns null\n return null;\n }\n };\n };\n\n // The trampoline loop\n const trampoline = (step: TrampolineStep<any> | null) => {\n\n if (isRunning) {\n return;\n }\n\n isRunning = true;\n let currentStep = step;\n\n while (currentStep !== null) {\n try {\n // Stop immediately if an error was flagged elsewhere\n if (this._hasErrored) {\n currentStep = null;\n break;\n }\n currentStep = currentStep(); // Execute step, get next step or null\n } catch (trampolineError) {\n // Catch errors propagated from step execution (processor or callback errors)\n if (!this._hasErrored) { // Avoid double logging\n logger.error(\"Error during trampoline step execution:\", trampolineError);\n this._hasErrored = true;\n }\n currentStep = null; // Stop the loop\n // We don't call `done` here because an error occurred.\n // The application should handle the uncaught exception if desired.\n break; // Explicitly break loop on error\n }\n }\n // Loop ends when currentStep is null or loop is broken by error\n isRunning = false;\n\n // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.\n };\n\n // --- Start the process ---\n index = 0; // Reset index\n trampoline(createStepRevised(0)); // Start with the revised step creator\n } catch (error: any) {\n done(Result.error(error));\n }\n }\n\n pipe(work: UnitOfWork) {\n this.unitsOfWork.push(work);\n }\n}","export * from './SyncronousQueue';\nexport * from './TrampolinePipeline';","import { assertIsNotNull } from '../assertions';\nimport { BulkPersistResult } from '../collections';\nimport { WorkPipeline } from '../pipeline';\nimport { DbPluginBulkPersistEvent, DbPluginEvent, DbPluginQueryEvent, IDbPlugin, ITranslatedValue, JsonTranslator } from '.';\nimport { PluginEventCallbackPartialResult, PluginEventCallbackResult, PluginEventResult, Result } from '../results';\nimport { CompiledSchema, InferCreateType, InferType } from '../schema';\nimport { DeepPartial } from '../types';\nimport { MemoryDataCollection } from '../collections/MemoryDataCollection';\nimport { UnknownRecord } from '../utilities';\n\nexport abstract class EphemeralDataPlugin implements IDbPlugin {\n\n protected databaseName: string;\n\n constructor(databaseName: string) {\n this.databaseName = databaseName;\n }\n\n protected abstract resolveCollection<TEntity extends {}>(schema: CompiledSchema<TEntity>): MemoryDataCollection;\n\n bulkPersist(event: DbPluginBulkPersistEvent, done: PluginEventCallbackPartialResult<BulkPersistResult>) {\n try {\n const bulkPersistResult = event.operation.toResult();\n const schemas = event.schemas;\n const pipeline = new WorkPipeline();\n let hasWork = false;\n\n for (const [schemaId, changes] of event.operation) {\n const { adds, hasItems, removes, updates } = changes;\n\n if (!hasItems) {\n continue;\n }\n\n hasWork = true;\n const result = bulkPersistResult.get(schemaId);\n const schema = schemas.get(schemaId);\n assertIsNotNull(schema);\n\n pipeline.pipe((d) => {\n try {\n const collection = this.resolveCollection(schema);\n const addsLength = adds.length;\n const updatesLength = updates.length;\n const removesLength = removes.length;\n\n // Only need to load if we have updates or removes (need existing data)\n // For adds-only operations, we can skip load for better performance\n const needsLoad = updatesLength > 0 || removesLength > 0;\n\n const processChanges = () => {\n result.adds = Array.from({ length: addsLength });\n result.updates = Array.from({ length: updatesLength });\n result.removes = Array.from({ length: removesLength });\n\n for (let j = 0; j < addsLength; j++) {\n const item = adds[j];\n collection.add(item);\n result.adds[j] = item as DeepPartial<InferCreateType<UnknownRecord>>;\n }\n\n for (let j = 0; j < updatesLength; j++) {\n const item = updates[j].entity;\n collection.update(item);\n result.updates[j] = item;\n }\n\n for (let j = 0; j < removesLength; j++) {\n collection.remove(removes[j]);\n result.removes[j] = removes[j];\n }\n\n collection.save(saveResult => {\n if (saveResult.ok === Result.ERROR) {\n d(saveResult);\n return;\n }\n d(Result.success());\n });\n };\n\n if (needsLoad) {\n collection.load(readResult => {\n if (readResult.ok === Result.ERROR) {\n d(readResult);\n return;\n }\n processChanges();\n });\n } else {\n // Skip load for adds-only operations\n processChanges();\n }\n } catch (e) {\n d(Result.error(e));\n }\n });\n }\n\n // If there is no work, just return the result\n if (!hasWork) {\n done(PluginEventResult.success(event.id, bulkPersistResult));\n return;\n }\n\n pipeline.filter((result) => {\n if (result.ok === Result.ERROR) {\n done(PluginEventResult.error(event.id, result.error));\n return;\n }\n done(PluginEventResult.success(event.id, bulkPersistResult));\n });\n } catch (e: any) {\n done(PluginEventResult.error(event.id, e));\n }\n }\n\n query<TEntity extends {}, TShape extends any = TEntity>(event: DbPluginQueryEvent<TEntity, TShape>, done: PluginEventCallbackResult<ITranslatedValue<TShape>>): void {\n try {\n const operation = event.operation;\n const schema = operation.schema;\n const translator = new JsonTranslator<TEntity, TShape>(operation);\n const collection = this.resolveCollection(schema);\n\n collection.load(r => {\n if (r.ok === Result.ERROR) {\n done(PluginEventResult.error(event.id, r.error));\n return;\n }\n\n const records = collection.records;\n const length = records.length;\n const cloned: Record<string, unknown>[] = Array.from({ length });\n\n for (let i = 0; i < length; i++) {\n cloned[i] = schema.clone(records[i] as InferType<TEntity>);\n }\n\n done(PluginEventResult.success(event.id, translator.translate(cloned)));\n });\n } catch (e) {\n done(PluginEventResult.error(event.id, e));\n }\n }\n\n abstract destroy(event: DbPluginEvent, done: PluginEventCallbackResult<never>): void;\n}","export * from './types';\nexport * from './translators';\nexport * from './query';\nexport * from './EphemeralDataPlugin';","\nimport { CompiledSchema } from '../../schema';\nimport { IQuery } from '../types';\nimport { QueryOptionsCollection } from './QueryOptionsCollection';\n\nexport class Query<TRoot extends {}, TShape> implements IQuery<TRoot, TShape> {\n\n readonly options: QueryOptionsCollection<TShape>;\n readonly schema: CompiledSchema<TRoot>;\n private enableChangeTrackingOverride?: boolean\n\n constructor(\n options: QueryOptionsCollection<TShape>,\n schema: CompiledSchema<TRoot>,\n enableChangeTrackingOverride?: boolean,\n ) {\n this.schema = schema;\n this.options = options;\n this.enableChangeTrackingOverride = enableChangeTrackingOverride;\n }\n\n // boolean value whether or not change tracking can be enabled on the query result\n get changeTracking(): boolean {\n\n if (this.enableChangeTrackingOverride != null) {\n return this.enableChangeTrackingOverride;\n }\n\n const map = this.options.getValues(\"map\");\n const count = this.options.has(\"count\");\n const max = this.options.has(\"max\");\n const min = this.options.has(\"min\");\n const sum = this.options.has(\"sum\");\n\n if (map.some(x => x.fields.length > 0)) {\n return false\n }\n\n if (count === true ||\n max === true ||\n min === true ||\n sum === true) {\n return false\n }\n\n return true;\n }\n\n static EMPTY<T extends {}, S>(schema: CompiledSchema<T>) {\n return new Query<T, S>(QueryOptionsCollection.EMPTY<S>(), schema);\n }\n\n static isEmpty<T extends {}, S>(query: IQuery<T, S>) {\n return QueryOptionsCollection.isEmpty(query.options);\n }\n\n static toString<TRoot extends {}, TShape>(query: IQuery<TRoot, TShape>) {\n return JSON.stringify({\n options: query.options.items,\n schema: {\n id: query.schema.id,\n collectionName: query.schema.collectionName\n },\n changeTracking: query.changeTracking\n })\n }\n}","import { isPropertyExpression } from \"../../assertions\";\nimport { forEach } from \"../../expressions/utils\";\nimport { QueryOption, QueryOptionName, QueryOptionExecutionTarget, QueryOptionValueMap } from \"./types\";\n\nexport type QueryCollectionItem<T, K extends QueryOptionName> = { index: number, option: QueryOption<T, K> };\n\nexport class QueryOptionsCollection<T> {\n\n private options: Map<QueryOptionName, QueryCollectionItem<any, any>[]> = new Map<QueryOptionName, QueryCollectionItem<any, any>[]>();\n private nextExecutionTarget: QueryOptionExecutionTarget = \"database\";\n private nextIndex: number = 0;\n private enumeratedItems: QueryCollectionItem<any, any>[] = [];\n\n get items() {\n return this.options;\n }\n\n get isEmpty() {\n return this.items.size === 0;\n }\n\n static EMPTY<R>() {\n return new QueryOptionsCollection<R>();\n }\n\n static isEmpty<T>(options: QueryOptionsCollection<T>) {\n return options.isEmpty;\n }\n\n add<K extends QueryOptionName>(name: K, value: QueryOption<T, K>[\"value\"]) {\n\n if (name === \"map\") {\n const mapValue = value as QueryOptionValueMap<T>[\"map\"];\n\n // Evaluate the map value to see if we are renaming properties, \n // if we are we need to perform everything after in memory\n if (mapValue.fields.some(x => x.isRename === true) || mapValue.fields.some(x => x.property?.isUnmapped === true)) {\n // Cut over to memory execution since we are renaming a property with .map\n // We do not want to figure out how the new name flows through the entire query\n this.nextExecutionTarget = \"memory\";\n }\n }\n\n if (name === \"filter\") {\n // Need to check for unmapped properties\n const filterValue = value as QueryOptionValueMap<T>[\"filter\"];\n\n if (filterValue.expression.type === \"not-parsable\") {\n this.nextExecutionTarget = \"memory\";\n } else {\n forEach(filterValue.expression, (expression) => {\n\n if (isPropertyExpression(expression) && expression.property.isUnmapped) {\n // Cut over to memory execution, unmapped properties are not in the database and\n // cannot be queried\n this.nextExecutionTarget = \"memory\";\n return false;\n }\n\n return true;\n });\n }\n }\n\n const item: QueryCollectionItem<T, K> = {\n index: this.nextIndex,\n option: {\n name,\n target: this.nextExecutionTarget,\n value\n }\n }\n\n this.nextIndex++;\n\n const found = this.options.get(name);\n\n this.options.set(name, [...found ?? [], item]);\n }\n\n split(): { memory: QueryOptionsCollection<T>, database: QueryOptionsCollection<T> } {\n this.resolveEnumeration();\n\n const sortedItems = this.enumeratedItems.toSorted((a, b) => a.index - b.index);\n const memoryQueryOptionsCollection = new QueryOptionsCollection<T>();\n const databaseQueryOptionsCollection = new QueryOptionsCollection<T>();\n\n for (let i = 0, length = sortedItems.length; i < length; i++) {\n const sortedItem = sortedItems[i];\n\n if (sortedItem.option.target === \"database\") {\n databaseQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n continue;\n }\n\n memoryQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n }\n\n return {\n memory: memoryQueryOptionsCollection,\n database: databaseQueryOptionsCollection\n }\n }\n\n hasTransformations(): boolean {\n const transformationOptions: QueryOptionName[] = [\"map\", \"group\", \"min\", \"max\", \"count\", \"sum\"];\n return transformationOptions.some((name) => this.options.has(name));\n }\n\n has<K extends QueryOptionName>(name: K): boolean {\n return this.options.has(name);\n }\n\n get<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[] {\n return this.options.get(name) ?? [] as QueryCollectionItem<T, K>[];\n }\n\n getLast<K extends QueryOptionName>(name: K): QueryOption<T, K> | null {\n this.resolveEnumeration();\n\n for (let i = this.enumeratedItems.length - 1; i >= 0; i--) {\n const item = this.enumeratedItems[i];\n\n if (item.option.name === name) {\n return item.option;\n }\n }\n\n return null\n }\n\n getValues<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[\"option\"][\"value\"][] | undefined {\n\n const found = this.options.get(name);\n\n if (found == null) {\n return [];\n }\n\n return found.map(w => w.option.value) as QueryCollectionItem<T, K>[\"option\"][\"value\"][];\n }\n\n private getEnumeration() {\n return [...this.options.values()].flat().toSorted((a, b) => a.index - b.index);\n }\n\n private resolveEnumeration() {\n if (this.enumeratedItems.length != this.nextIndex) {\n this.enumeratedItems = this.getEnumeration();\n }\n }\n\n forEach(iterator: (item: QueryCollectionItem<T, any>[\"option\"]) => void) {\n this.resolveEnumeration();\n\n for (let i = 0, length = this.enumeratedItems.length; i < length; i++) {\n iterator(this.enumeratedItems[i].option);\n }\n }\n}","export * from './Query';\nexport * from './QueryOptionsCollection';\nexport * from './types';","import { Expression, Filter, ParamsFilter } from \"../../expressions\";\nimport { PropertyInfo } from \"../../schema\";\nimport { GenericFunction } from \"../../types\";\n\nexport enum QueryOrdering {\n Descending = \"desc\",\n Ascending = \"asc\"\n}\n\n/**\n * Field mapping for a query result, including source and destination names and a getter function.\n */\nexport type QueryField = {\n sourceName: string,\n destinationName: string,\n isRename: boolean;\n property?: PropertyInfo<unknown>;\n getter: <T>(data: Record<string, unknown>) => T;\n};\n\nexport type QueryOptionExecutionTarget = \"database\" | \"memory\";\nexport type QueryOptionName = keyof QueryOptionValueMap<unknown>;\n\nexport type QueryOption<T, K extends QueryOptionName> = {\n name: QueryOptionName;\n value: QueryOptionValueMap<T>[K],\n target: QueryOptionExecutionTarget;\n}\n\nexport type QueryOptionValueMap<T extends {}> = {\n skip: number;\n take: number;\n sort: { selector: GenericFunction<T, T[keyof T]>, direction: QueryOrdering, propertyName: string };\n map: { selector: GenericFunction<T, any>, fields: QueryField[] };\n group: { selector: GenericFunction<T, any>, key: QueryField, fields: QueryField[] };\n filter: { params?: {}, filter: ParamsFilter<T, {}> | Filter<T>, expression: Expression };\n min: true; // True or not set\n max: true; // True or not set\n count: true; // True or not set\n sum: true; // True or not set\n distinct: true; // True or not set\n};\n\n/**\n * Sort specification for a query.\n */\nexport type QuerySort = { key: string, selector: (item: unknown) => unknown, direction: \"asc\" | \"desc\" };","import { QueryOption, QueryOptionName } from \"../query/types\";\nimport { IQuery } from \"../types\";\nimport { TranslatedArrayValue } from \"./TranslatedArrayValue\";\nimport { TranslatedGroupValue } from \"./TranslatedGroupValue\";\nimport { TranslatedSingleValue } from \"./TranslatedSingleValue\";\nimport { ITranslatedValue } from \"./types\";\n\nexport abstract class DataTranslator<TRoot extends {}, TShape> {\n\n protected query: IQuery<TRoot, TShape>;\n private functionMap: Record<QueryOptionName, (data: unknown, option: QueryOption<any, any>) => TShape> = {\n count: (data: unknown, option: QueryOption<TShape, \"count\">) => this.count<any>(data, option),\n distinct: (data: unknown, option: QueryOption<TShape, \"distinct\">) => this.distinct(data, option),\n filter: (data: unknown, option: QueryOption<TShape, \"filter\">) => this.filter(data, option),\n map: (data: unknown, option: QueryOption<TShape, \"map\">) => this.map(data, option),\n max: (data: unknown, option: QueryOption<TShape, \"max\">) => this.max<any>(data, option),\n min: (data: unknown, option: QueryOption<TShape, \"min\">) => this.min<any>(data, option),\n skip: (data: unknown, option: QueryOption<TShape, \"skip\">) => this.skip(data, option),\n sort: (data: unknown, option: QueryOption<TShape, \"sort\">) => this.sort(data, option),\n sum: (data: unknown, option: QueryOption<TShape, \"sum\">) => this.sum<any>(data, option),\n take: (data: unknown, option: QueryOption<TShape, \"take\">) => this.take(data, option),\n group: (data: unknown, option: QueryOption<TShape, \"group\">) => this.group(data, option)\n };\n\n constructor(query: IQuery<TRoot, TShape>) {\n this.query = query;\n }\n\n // Terminators\n abstract count<TResult extends number>(data: unknown, option: QueryOption<TShape, \"count\">): TResult;\n abstract min<TResult extends string | number | Date>(data: unknown, option: QueryOption<TShape, \"min\">): TResult;\n abstract max<TResult extends string | number | Date>(data: unknown, option: QueryOption<TShape, \"max\">): TResult;\n abstract sum<TResult extends number>(data: unknown, option: QueryOption<TShape, \"sum\">): TResult;\n abstract distinct<TResult>(data: unknown, option: QueryOption<TShape, \"distinct\">): TResult;\n\n // Shapers\n abstract filter<TResult>(data: unknown, option: QueryOption<TShape, \"filter\">): TResult;\n abstract skip(data: unknown, option: QueryOption<TShape, \"skip\">): TShape;\n abstract take(data: unknown, option: QueryOption<TShape, \"take\">): TShape;\n abstract sort(data: unknown, option: QueryOption<TShape, \"sort\">): TShape;\n abstract map(data: unknown, option: QueryOption<TShape, \"map\">): TShape;\n abstract group(data: unknown, option: QueryOption<TShape, \"group\">): TShape;\n\n translate(data: unknown): ITranslatedValue<TShape> {\n\n const isTransformed = this.query.options.hasTransformations();\n\n this.query.options.forEach(item => {\n data = this.functionMap[item.name](data, item);\n });\n\n if (Array.isArray(data)) {\n return new TranslatedArrayValue<TShape>(data, isTransformed);\n }\n\n if (this.query.options.has(\"group\")) {\n return new TranslatedGroupValue<TShape>(data, isTransformed);\n }\n\n return new TranslatedSingleValue<TShape>(data, isTransformed);\n }\n}","import { DataTranslator } from \"./DataTranslator\";\nimport { QueryOption } from \"../query/types\";\nimport { assertIsArray } from \"../../assertions\";\nimport { ParamsFilter } from \"../../expressions\";\nimport { isDate, UnknownRecord } from \"../../utilities\";\nimport { IdType } from \"../../schema\";\n\nexport class JsonTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {\n\n override filter<TResult>(data: unknown, option: QueryOption<TShape, \"filter\">): TResult {\n\n assertIsArray(data);\n\n if (option.value.filter) {\n\n if (option.value.params == null) {\n // standard filtering\n return data.filter(option.value.filter) as TResult;\n }\n\n // params filtering\n const selector = option.value.filter as ParamsFilter<unknown, {}>\n return data.filter(w => selector([w, option.value.params])) as TResult;\n }\n\n return data as TResult;\n }\n\n override map<T>(data: unknown, option: QueryOption<T, \"map\">): T {\n\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only map an array of data\");\n }\n\n const response = Array.from({ length: data.length });\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value\n const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;\n field.property.setValue(data[i], resolvedValue);\n }\n }\n }\n\n response[i] = option.value.selector(data[i]);\n }\n\n return response as T;\n }\n\n override group<T>(data: unknown, option: QueryOption<T, \"group\">): T {\n\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only group an array of data\");\n }\n\n const group: Record<IdType, unknown[]> = {};\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n const keyValue = option.value.selector(data[i]) as IdType;\n\n if (!group[keyValue]) {\n group[keyValue] = [];\n }\n\n const item: UnknownRecord = {};\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value\n const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;\n field.property.setValue(item, resolvedValue);\n continue;\n }\n\n // The property exists, lets set it to the value (null/undefined)\n if (Object.hasOwn(data[i], field.destinationName)) {\n field.property.setValue(item, value);\n }\n }\n }\n\n group[keyValue].push(item);\n }\n\n return group as T;\n }\n\n override count<TResult extends number>(data: unknown, _: QueryOption<TShape, \"count\">): TResult {\n\n if (Array.isArray(data)) {\n return data.length as TResult;\n }\n\n throw new Error(\"Cannot count resulting data, it must be an array. Please return array of data for function: count()\");\n }\n\n override min<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"min\">): TResult {\n return this._minMax(data, \"min\", (a: any, b: any) => a - b);\n }\n\n override max<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"max\">): TResult {\n return this._minMax(data, \"max\", (a: any, b: any) => b - a);\n }\n\n override sort<TResult>(data: unknown, option: QueryOption<TShape, \"sort\">): TResult {\n\n if (Array.isArray(data)) {\n\n data.sort((a, b) => {\n if (option.value.direction === \"asc\") {\n return (option.value.selector(a) as any) - (option.value.selector(b) as any);\n }\n\n return (option.value.selector(b) as any) - (option.value.selector(a) as any);\n });\n }\n\n return data as TResult;\n }\n\n override sum<TResult extends number>(data: unknown, _: QueryOption<TShape, \"sum\">): TResult {\n\n assertIsArray(data, this._formatDataNotArrayError(\"sum\"));\n\n if (data.length === 0) {\n throw new Error(\"Cannot perform operation on empty array, result query contains no data\")\n }\n\n const map = this.query.options.getLast(\"map\");\n\n let sum = 0;\n const field = this._getSelectionField(\"sum\", map);\n\n for (let i = 0, length = data.length; i < length; i++) {\n const value = data[i];\n\n if (typeof value !== \"number\") {\n throw new Error(`Cannot sum, property is not a number. Property: ${field.sourceName}`);\n }\n\n sum += value;\n }\n\n return sum as TResult;\n }\n\n override distinct<TResult>(data: unknown, _: QueryOption<TShape, \"distinct\">): TResult {\n\n assertIsArray(data, this._formatDataNotArrayError(\"distinct\"));\n\n const result = new Set<string | number | Date>();\n\n // would be nice to have property info here for type detection\n let needsDateConversion = false;\n\n for (let i = 0, length = data.length; i < length; i++) {\n const value = data[i];\n\n if (typeof value === \"number\" || typeof value === \"string\") {\n result.add(value);\n continue;\n }\n\n if (isDate(value)) {\n needsDateConversion = true;\n result.add(value.toISOString());\n continue;\n }\n\n }\n\n if (needsDateConversion) {\n return [...result].map(w => new Date(w)) as TResult;\n }\n\n return [...result] as TResult\n }\n\n override skip<TResult>(data: unknown, option: QueryOption<TShape, \"skip\">): TResult {\n\n if (Array.isArray(data)) {\n\n if (option.value > 0) {\n\n if (data.length < option.value) {\n // We don't have enough data to skip, return an empty array\n return [] as TResult;\n }\n\n return data.slice(option.value) as TResult;\n }\n\n return data as TResult;\n }\n\n return data as TResult;\n }\n\n override take<TResult>(data: unknown, option: QueryOption<TShape, \"take\">): TResult {\n if (Array.isArray(data)) {\n\n if (option.value > 0) {\n\n if (data.length < option.value) {\n return data as TResult;\n }\n\n return data.slice(0, option.value) as TResult;\n }\n\n return data as TResult;\n }\n\n return data as TResult;\n }\n\n private _getSelectionField(name: string, mapOption: QueryOption<TShape, \"map\"> | null) {\n\n if (mapOption == null ||\n mapOption.value.fields.length === 0 ||\n mapOption.value.fields.length > 1) {\n throw new Error(`${name}() operation can only be performed when one field is mapped for a result. Ex. myset.map(x => x.someNumberOrDateOrString).${name}()`)\n }\n\n return mapOption.value.fields[0];\n }\n\n private _minMax<T extends string | number | Date>(data: unknown, name: string, sort: (a: any, b: any) => any): T {\n\n assertIsArray(data, this._formatDataNotArrayError(name));\n\n data.sort(sort);\n\n if (data.length === 0) {\n throw new Error(\"Cannot perform operation on empty array, result query contains no data\")\n }\n\n return data[0] as T;\n }\n\n private _formatDataNotArrayError(functionName: string) {\n return `Cannot sum resulting data, it must be an array. Please return array of data for function: ${functionName}()`\n }\n}","import { IdType } from \"../../schema/types\";\nimport { UnknownRecord } from \"../../utilities/types\";\nimport { QueryOption } from \"../query/types\";\nimport { DataTranslator } from \"./DataTranslator\";\n\nexport class SqlTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {\n\n count<TResult extends number>(data: unknown, _: QueryOption<TShape, \"count\">): TResult {\n if (Array.isArray(data) && data.length > 0) {\n // Count should be returned as the property alias on the query\n return data[0].count;\n }\n\n return data as TResult;\n }\n\n min<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"min\">): TResult {\n return this.shapeResult(data);\n }\n\n max<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"max\">): TResult {\n return this.shapeResult(data);\n }\n\n sum<TResult extends number>(data: unknown, _: QueryOption<TShape, \"sum\">): TResult {\n return this.shapeResult(data);\n }\n\n private shapeResult<TResult>(data: unknown) {\n if (Array.isArray(data) && data.length > 0) {\n // Shape the result\n return data[0];\n }\n\n return data as TResult;\n }\n\n distinct<TResult>(data: unknown, _: QueryOption<TShape, \"distinct\">): TResult {\n return data as TResult;\n }\n\n filter<TResult>(data: unknown, _: QueryOption<TShape, \"filter\">): TResult {\n return data as TResult;\n }\n\n skip(data: unknown, _: QueryOption<TShape, \"skip\">): TShape {\n return data as TShape;\n }\n\n take(data: unknown, _: QueryOption<TShape, \"take\">): TShape {\n return data as TShape;\n }\n\n sort(data: unknown, _: QueryOption<TShape, \"sort\">): TShape {\n return data as TShape;\n }\n\n group<T>(data: unknown, option: QueryOption<T, \"group\">): T {\n\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only group an array of data\");\n }\n\n const group: Record<IdType, unknown[]> = {};\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n const keyValue = option.value.selector(data[i]) as IdType;\n\n if (!group[keyValue]) {\n group[keyValue] = [];\n }\n\n const item: UnknownRecord = {};\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n field.property.setValue(item, field.property.deserialize(value));\n }\n }\n }\n\n group[keyValue].push(item);\n }\n\n return group as T;\n }\n\n map(data: unknown, option: QueryOption<TShape, \"map\">): TShape {\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only map an array of data\");\n }\n\n if (this.query.options.has(\"count\") && data.length === 1) {\n // data here is the shape of { count: number }[] and will map to nothing. \n // Return the original data and let count take care of this\n return data as TShape;\n }\n\n const response = [];\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n field.property.setValue(data[i], field.property.deserialize(value));\n }\n }\n }\n\n response.push(option.value.selector(data[i]));\n }\n\n return response as TShape;\n }\n}","import { ITranslatedValue } from './types';\n\nexport class TranslatedArrayValue<T> implements ITranslatedValue<T> {\n\n readonly value: T;\n readonly isTransformed: boolean;\n readonly isEmpty: boolean;\n\n constructor(value: unknown, isTransformed: boolean) {\n this.value = value as T;\n this.isEmpty = value == null || (Array.isArray(value) && value.length === 0);\n this.isTransformed = isTransformed;\n }\n\n forEach(callback: (item: unknown) => unknown): void {\n const data = this.value as unknown[];\n for (let i = 0, length = data.length; i < length; i++) {\n const result = callback(data[i]);\n\n if (result) {\n // reassign if the callback returns a result\n data[i] = result;\n }\n }\n }\n}","import { ITranslatedValue } from './types';\n\nexport class TranslatedGroupValue<T> implements ITranslatedValue<T> {\n\n readonly value: T;\n readonly isTransformed: boolean;\n readonly isEmpty: boolean;\n\n constructor(value: unknown, isTransformed: boolean) {\n this.value = value as T;\n this.isEmpty = value == null;\n this.isTransformed = isTransformed;\n }\n\n forEach(callback: (item: unknown) => unknown): void {\n const group = this.value as Record<string, unknown[]>;\n const keys = Object.keys(group);\n for (let i = 0, length = keys.length; i < length; i++) {\n const key = keys[i];\n const data = group[key];\n\n for (let j = 0, len = data.length; j < len; j++) {\n\n const result = callback(data[j]);\n\n if (result) {\n // reassign if the callback returns a result\n data[j] = result;\n }\n }\n }\n }\n}","import { ITranslatedValue } from './types';\n\nexport class TranslatedSingleValue<T> implements ITranslatedValue<T> {\n\n value: T;\n readonly isTransformed: boolean;\n readonly isEmpty: boolean;\n\n constructor(value: unknown, isTransformed: boolean) {\n this.value = value as T;\n this.isEmpty = value == null;\n this.isTransformed = isTransformed;\n }\n\n forEach(callback: (item: unknown) => unknown): void {\n const result = callback(this.value) as T;\n\n if (result) {\n this.value = result;\n }\n }\n}","export * from './DataTranslator';\nexport * from './JsonTranslator';\nexport * from './SqlTranslator';\nexport * from './types';\nexport * from './TranslatedArrayValue';\nexport * from './TranslatedGroupValue';\nexport * from './TranslatedSingleValue';","import { PartialResultType, PluginEventPartialResultType, PluginEventResultType, ResultType } from \"./types\";\n\nabstract class BaseResult {\n static ERROR = \"error\" as const;\n static SUCCESS = \"success\" as const;\n static PARTIAL = \"partial\" as const;\n\n static resolve<T>(result: ResultType<T> | PartialResultType<T>, resolve: (data: T) => void, reject: (error?: any) => void) {\n if (result.ok === BaseResult.SUCCESS) {\n resolve(result.data);\n return;\n }\n\n if (result.ok === BaseResult.PARTIAL) {\n reject({\n partial: result.data,\n error: result.error\n });\n return;\n }\n\n reject(result.error);\n }\n\n static assertSuccess<T>(result: any): asserts result is { ok: \"success\"; data: T } {\n if (result.ok !== BaseResult.SUCCESS) {\n throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);\n }\n }\n}\n\nexport class Result extends BaseResult {\n static success<T>(data: T): ResultType<T>;\n static success(): ResultType<never>;\n static success<T>(data?: T): ResultType<T> {\n return {\n ok: Result.SUCCESS,\n data\n }\n }\n\n static error<T>(error: any): ResultType<T> {\n return {\n ok: Result.ERROR,\n error\n }\n }\n\n static partial<T>(data: T, error: any): PartialResultType<T> {\n return {\n ok: Result.PARTIAL,\n data,\n error\n }\n }\n}\n\nexport class PluginEventResult extends BaseResult {\n static success<T>(id: string, data: T): PluginEventResultType<T>;\n static success(id: string): PluginEventResultType<never>;\n static success<T>(id: string, data?: T): PluginEventResultType<T> {\n return {\n id,\n ok: Result.SUCCESS,\n data\n }\n }\n\n static error<T>(id: string, error: any): PluginEventResultType<T> {\n return {\n id,\n ok: Result.ERROR,\n error\n }\n }\n\n static partial<T>(id: string, data: T, error: any): PluginEventPartialResultType<T> {\n return {\n id,\n ok: Result.PARTIAL,\n data,\n error\n }\n }\n\n static assertSuccess<T>(result: PluginEventResultType<T>): asserts result is { ok: \"success\"; data: T; id: string } {\n if (result.ok !== Result.SUCCESS) {\n throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);\n }\n }\n}\n","export * from './Result';\nexport * from './types';\nexport * from './utils';","import { Result } from \"./Result\";\nimport { CallbackResult } from \"./types\";\n\nexport function toPromise<T>(fn: (callback: CallbackResult<T>) => void) {\n return new Promise<T>((resolve, reject) => {\n fn((r) => {\n if (r.ok === Result.ERROR) {\n reject(r.error);\n return;\n }\n\n resolve(r.data);\n });\n });\n}\n","import { UnknownRecord } from '../utilities';\nimport { SchemaBase } from './property/base/SchemaBase';\nimport { SchemaArray } from './property/types/SchemaArray';\nimport { DefaultValue, ForeignKey, FunctionBody, PropertyDeserializer, PropertySerializer, SchemaTypes } from './types';\n\nconst SUPPORTED_DESERIALIZATION_TYPES = new Set<SchemaTypes>([\n SchemaTypes.Boolean,\n SchemaTypes.Date,\n SchemaTypes.Number,\n SchemaTypes.String,\n]);\n\n/**\n * Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.\n */\nexport class PropertyInfo<T extends {}> {\n\n get id() {\n if (this._idCache) {\n return this._idCache;\n }\n this._idCache = this.getPathArray().join(\".\");\n return this._idCache;\n }\n\n /** The name of the property. */\n readonly name: string;\n /** The name of the property we need to map from. */\n readonly from: string | null = null;\n /** The schema type of the property. */\n readonly type: SchemaTypes;\n\n /** Whether the property can be null. */\n readonly isNullable: boolean;\n /** Whether the property is optional. */\n readonly isOptional: boolean;\n /** Whether the property is a key. */\n readonly isKey: boolean;\n /** Foreign key schema and property */\n readonly foreignKeyDefinition: ForeignKey<unknown> | null;\n /** Whether the property is an identity property. */\n readonly isIdentity: boolean;\n /** Whether the property is readonly. */\n readonly isReadonly: boolean;\n /** Whether the property is unmapped. */\n readonly isUnmapped: boolean;\n /** Whether the property is distinct. */\n readonly isDistinct: boolean;\n /** Indexes associated with the property. */\n readonly indexes: string[];\n\n /** Any injected value for the property. */\n readonly injected: any | null = null;\n /** The default value for the property, if any. */\n readonly defaultValue: DefaultValue<any> | null = null;\n /** Serializer for the property value, if any. */\n readonly valueSerializer: PropertySerializer<T> | null = null;\n /** Deserializer for the property value, if any. */\n readonly valueDeserializer: PropertyDeserializer<T> | null = null;\n /** Function body for computed properties, if any. */\n readonly functionBody: FunctionBody<any, T> | null;\n /** Child properties of this property. */\n readonly children: PropertyInfo<T>[] = [];\n /** The schema this property belongs to. */\n readonly schema: SchemaBase<T, any>;\n /** The inner schema if this property is an array. */\n readonly innerSchema?: SchemaBase<unknown, any>;\n /** Literal values allowed for this property. */\n readonly literals: T[];\n /** Tags passed from the schema */\n readonly tags: string[];\n\n /** The parent property, if any. */\n readonly parent?: PropertyInfo<T>;\n\n // Cached computed values for performance\n private _propertyChainCache?: PropertyInfo<T>[];\n private _pathArrayCache?: string[];\n private _parentPathArrayCache?: string[];\n private _idCache?: string;\n private _levelCache?: number;\n private _hasNullableParentsCache?: boolean;\n\n constructor(schema: SchemaBase<T, any>, name: string, parent?: PropertyInfo<T> | null) {\n this.schema = schema;\n this.name = name;\n this.type = schema.type;\n this.literals = schema.literals;\n\n if (schema instanceof SchemaArray) {\n this.innerSchema = schema.innerSchema;\n }\n\n this.isNullable = schema.isNullable;\n this.isOptional = schema.isOptional;\n this.isKey = schema.isKey;\n this.isIdentity = schema.isIdentity;\n this.isReadonly = schema.isReadonly;\n this.isUnmapped = schema.isUnmapped;\n this.injected = schema.injected;\n this.isDistinct = schema.isDistict;\n this.indexes = schema.indexes;\n this.from = schema.fromPropertyName;\n this.tags = schema.tags;\n this.foreignKeyDefinition = schema.foreignKeyDefinition;\n\n this.defaultValue = schema.defaultValue;\n this.valueSerializer = schema.valueSerializer;\n this.valueDeserializer = schema.valueDeserializer;\n this.functionBody = schema.functionBody;\n\n this.parent = parent;\n }\n\n /**\n * Returns the depth (level) of this property in the property tree.\n *\n * The root property has a level of 0. Each child property increases the level by 1.\n * Traverses up the parent chain, incrementing the level for each parent until the root is reached.\n * \n * @returns {number} The number of parent properties above this property (0 for root).\n */\n get level() {\n if (this._levelCache !== undefined) {\n return this._levelCache;\n }\n\n let level = 0;\n // oxlint-disable-next-line no-this-alias\n let current: PropertyInfo<T> | undefined = this;\n\n while (current) {\n if (current.parent == null) {\n this._levelCache = level;\n return level;\n }\n\n current = current.parent;\n level++;\n }\n\n this._levelCache = level;\n return level;\n }\n\n get isRenamed() {\n return !!this.from;\n }\n\n get supportsDeserialization() {\n return this.valueDeserializer != null || SUPPORTED_DESERIALIZATION_TYPES.has(this.type);\n }\n\n private _getPropertyChain(): PropertyInfo<T>[] {\n if (this._propertyChainCache) {\n return this._propertyChainCache;\n }\n\n const chain: PropertyInfo<T>[] = [];\n // oxlint-disable-next-line no-this-alias\n let current: PropertyInfo<T> | undefined = this;\n\n while (current) {\n chain.unshift(current);\n current = current.parent;\n }\n\n this._propertyChainCache = chain;\n return chain;\n }\n\n private _needsOptionalChaining(prop: PropertyInfo<T>, assignmentType?: AssignmentType): boolean {\n if (assignmentType === \"ASSIGNMENT\") {\n return false;\n }\n\n return assignmentType === \"FORCE_NULLABLE_OR_OPTIONAL\" || prop.isNullable || prop.isOptional;\n }\n\n private _resolvePathArray(options?: {\n root?: string,\n assignmentType?: AssignmentType\n useFromPropertyName?: boolean,\n }) {\n const propertyChain = this._getPropertyChain();\n const hasRoot = options?.root != null;\n const path: string[] = hasRoot ? [options!.root!] : [];\n\n for (const prop of propertyChain) {\n const accessor = this._needsOptionalChaining(prop, options?.assignmentType) ? '?.' : '.';\n path.push(accessor, options?.useFromPropertyName ? prop.from : prop.name);\n }\n\n return path;\n }\n\n getResolvedName() {\n return this.from ?? this.name;\n }\n\n /**\n * Returns an array of property names representing the path from the root to this property.\n *\n * @returns {string[]} The property path as an array of names.\n */\n getPathArray() {\n if (this._pathArrayCache) {\n return this._pathArrayCache;\n }\n\n const path: string[] = [];\n const propertyChain = this._getPropertyChain();\n\n for (const prop of propertyChain) {\n path.push(prop.name);\n }\n\n this._pathArrayCache = path;\n return path;\n }\n\n /**\n * Returns an array of property names representing the path from the root to the parent of this property.\n *\n * @returns {string[]} The property path as an array of names, excluding this property.\n */\n getParentPathArray() {\n if (this._parentPathArrayCache) {\n return this._parentPathArrayCache;\n }\n\n const path: string[] = [];\n const propertyChain = this._getPropertyChain();\n\n for (let i = 0; i < propertyChain.length - 1; i++) {\n const prop = propertyChain[i];\n path.push(prop.name);\n }\n\n this._parentPathArrayCache = path;\n return path;\n }\n\n /**\n * Returns true if any parent property is nullable or optional.\n *\n * @returns {boolean} True if any parent is nullable or optional, false otherwise.\n */\n get hasNullableParents() {\n if (this._hasNullableParentsCache !== undefined) {\n return this._hasNullableParentsCache;\n }\n\n let parent = this.parent;\n while (parent != null) {\n if (parent.isNullable || parent.isOptional) {\n this._hasNullableParentsCache = true;\n return true;\n }\n parent = parent.parent;\n }\n\n this._hasNullableParentsCache = false;\n return false;\n }\n\n /**\n * Returns true if any child property (recursively) is an identity property.\n *\n * @returns {boolean} True if any child is an identity property, false otherwise.\n */\n get hasIdentityChildren() {\n const children = [...this.children];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child.isIdentity === true) {\n return true;\n }\n if (child.children.length > 0) {\n children.push(...child.children)\n }\n }\n return false;\n }\n\n /**\n * Gets the value of this property from the given instance, following the property path.\n *\n * @param instance The object instance to retrieve the value from.\n * @returns The value of the property, or null if not found.\n */\n getValue(instance: UnknownRecord) {\n if (instance == null) {\n return null;\n }\n const pathArray = this.getPathArray();\n const length = pathArray.length;\n // Fast path for single level properties\n if (length === 1) {\n return instance[pathArray[0]];\n }\n let current: any = instance;\n for (let i = 0; i < length; i++) {\n if (current == null) {\n return null;\n }\n current = current[pathArray[i]];\n }\n return current;\n }\n\n /**\n * Sets the value of this property on the given instance, creating intermediate objects as needed.\n *\n * @param instance The object instance to set the value on.\n * @param value The value to set.\n */\n setValue(instance: UnknownRecord, value: unknown) {\n if (instance == null) {\n throw new Error('Cannot set value on null or undefined instance');\n }\n const pathArray = this.getPathArray();\n const length = pathArray.length;\n // Fast path for single level properties\n if (length === 1) {\n instance[pathArray[0]] = value;\n return;\n }\n let current: any = instance;\n let i = 0;\n // Navigate to the parent of the target property\n while (i < length - 1) {\n const prop = pathArray[i];\n const next = current[prop];\n // Only create new object if next level doesn't exist\n if (next == null) {\n current[prop] = {};\n }\n current = current[prop];\n i++;\n }\n // Set the value on the final property\n current[pathArray[length - 1]] = value;\n }\n\n /**\n * Returns a selector path string for this property, starting from the given parent variable name.\n *\n * @param options.parent The root variable name.\n * @param options.assignmentType Optional assignment type for path resolution.\n * @returns {string} The selector path string (e.g., 'parent.prop1.prop2').\n */\n getSelectrorPath(options: { parent: string, assignmentType?: AssignmentType, useFromPropertyName?: boolean, useRemappedName?: boolean }) {\n const parts = this._resolvePathArray({\n root: options.parent,\n assignmentType: options?.assignmentType,\n useFromPropertyName: options?.useFromPropertyName\n });\n return parts.join(\"\");\n }\n\n /**\n * Returns an assignment path string for this property, optionally starting from a parent variable name.\n *\n * @param options.parent Optional root variable name.\n * @returns {string} The assignment path string (e.g., 'prop1.prop2').\n */\n getAssignmentPath(options?: { parent?: string, useFromPropertyName?: boolean }) {\n const parts = this._resolvePathArray({\n root: options?.parent,\n assignmentType: \"ASSIGNMENT\",\n useFromPropertyName: options?.useFromPropertyName\n });\n\n if (options?.parent == null) {\n return parts.slice(1).join(\"\");\n }\n\n return parts.join(\"\");\n }\n\n deserialize(value: string | number) {\n\n if (this.valueDeserializer != null) {\n return this.valueDeserializer(value);\n }\n\n if (this.type === SchemaTypes.Date) {\n return new Date(value);\n }\n\n if (this.type === SchemaTypes.String) {\n return String(value);\n }\n\n if (this.type === SchemaTypes.Number) {\n return Number(value);\n }\n\n if (this.type === SchemaTypes.Boolean) {\n return Boolean(value);\n }\n\n throw new Error(`Unsupported deserialization for type. Type: ${this.type}`);\n }\n}\n\ntype AssignmentType = \"FORCE_NULLABLE_OR_OPTIONAL\" | \"ASSIGNMENT\";","import { SchemaFunction } from './table/SchemaFunction';\nimport { SchemaComputed } from './table/SchemaComputed';\nimport { SchemaBase } from \"./property/base/SchemaBase\";\nimport { PropertyInfo } from './PropertyInfo';\nimport { CodeBuilder, FunctionBuilder, SlotBlock } from '../codegen';\nimport { EnrichmentHandlerBuilder } from '../codegen/handlers/EnrichmentHandlerBuilder';\nimport { MergeHandlerBuilder } from '../codegen/handlers/MergeHandlerBuilder';\nimport { PrepareHandlerBuilder } from '../codegen/handlers/PrepareHandlerBuilder';\nimport { StripHandlerBuilder } from '../codegen/handlers/StripHandlerBuilder';\nimport { CloneHandlerBuilder } from '../codegen/handlers/CloneHandlerBuilder';\nimport { CompareHandlerBuilder } from '../codegen/handlers/CompareHandlerBuilder';\nimport { DeserializeHandlerBuilder } from '../codegen/handlers/DeserializeHandlerBuilder';\nimport { HashTypeHandlerBuilder } from '../codegen/handlers/HashTypeHandlerBuilder';\nimport { IdSelectorHandlerBuilder } from '../codegen/handlers/IdSelectorHandlerBuilder';\nimport { HashHandlerBuilder } from '../codegen/handlers/HashHandlerBuilder';\nimport { EnableChangeTrackingHandlerBuilder } from '../codegen/handlers/EnableChangeTrackingHandlerBuilder';\nimport { FreezeHandlerBuilder } from '../codegen/handlers/FreezeHandlerBuilder';\nimport { SchemaError } from '../errors/SchemaError';\nimport { SerializeHandlerBuilder } from \"../codegen/handlers/SerializeHandlerBuilder\";\nimport { hash, logger } from \"../utilities\";\nimport { CollectionName, CompiledSchema, CompiledSchemaCore, CompiledSchemaWithMetadata, GetHashTypeFunction, HashFunction, HashType, IdType, Index, InferCreateType, InferType, Prepare, Preprocess, SchemaId, SchemaTypes, SetProperties } from './types';\nimport { DeepPartial } from '../types';\nimport { SchemaSubscription } from './communication/broadcast';\nimport { CompareIdsHandlerBuilder } from '../codegen/handlers/CompareIdsHandlerBuilder';\nimport { StandardJSONSchemaV1, createStandardJsonSchemaProps, rehydrateSchemaFromJsonString } from './utils/standardJsonSchema';\nimport { SetHandlerBuilder } from '../codegen/handlers';\n\nfunction createChangeTracker() {\n const DIRTY_ENTITY_MARKER: string = \"isDirty\";\n const CHANGES_ENTITY_KEY: string = \"changes\";\n const ORIGINAL_ENTITY_KEY: string = \"original\";\n const PAUSED_ENTITY_KEY: string = \"isPaused\";\n const TRACKING_KEY: string = \"__tracking__\";\n const PROXY_MARKER: string = \"__isProxy__\";\n\n return <TEntity extends {}>(entity: TEntity, path?: string, parent?: TEntity) => {\n\n const proxyHandler: ProxyHandler<TEntity> = {\n set(entity, property, value) {\n const indexableEntity: { [key: string]: any } = entity;\n const key = String(property);\n const originalValue = indexableEntity[key];\n\n // if values are the same, do nothing\n if (originalValue === value) {\n return true;\n }\n\n const resolvedParent: { [key: string]: any } = parent ?? entity;\n\n if (resolvedParent[TRACKING_KEY] == null) {\n resolvedParent[TRACKING_KEY] = {\n [CHANGES_ENTITY_KEY]: {},\n [DIRTY_ENTITY_MARKER]: false,\n [ORIGINAL_ENTITY_KEY]: {},\n [PAUSED_ENTITY_KEY]: false\n }\n }\n\n if (key == TRACKING_KEY) {\n return true;\n }\n\n if (resolvedParent[TRACKING_KEY] != null && resolvedParent[TRACKING_KEY][PAUSED_ENTITY_KEY] === true) {\n Reflect.set(indexableEntity, property, value);\n return true;\n }\n\n const resolvedPath = path == null ? key : `${path}.${key}`;\n const changes = resolvedParent[TRACKING_KEY];\n\n if (changes[CHANGES_ENTITY_KEY][resolvedPath] != null) {\n\n if (changes[ORIGINAL_ENTITY_KEY][resolvedPath] === value) {\n // we are changing the value back to the original value, remove the change\n delete changes[ORIGINAL_ENTITY_KEY][resolvedPath];\n delete changes[CHANGES_ENTITY_KEY][resolvedPath];\n } else {\n // track the change\n changes[CHANGES_ENTITY_KEY][resolvedPath] = value;\n }\n\n } else if (changes[CHANGES_ENTITY_KEY][resolvedPath] == null) {\n // don't keep updating, keep the original value\n changes[CHANGES_ENTITY_KEY][resolvedPath] = value;\n changes[ORIGINAL_ENTITY_KEY][resolvedPath] = originalValue;\n }\n\n const isDirty = Object.keys(changes[ORIGINAL_ENTITY_KEY]).length > 0;\n changes[DIRTY_ENTITY_MARKER] = isDirty;\n\n Reflect.set(indexableEntity, property, value);\n\n return true;\n },\n get(target, property, receiver) {\n\n if (property === PROXY_MARKER) {\n return true;\n }\n\n return Reflect.get(target, property, receiver);\n }\n }\n\n return new Proxy(entity, proxyHandler) as TEntity;\n }\n}\n\n\nexport class SchemaDefinition<T extends {}> extends SchemaBase<T, any> {\n\n instance: T;\n type = SchemaTypes.Definition;\n collectionName: CollectionName;\n\n constructor(collectionName: CollectionName, schema: T) {\n super();\n this.collectionName = collectionName;\n this.instance = schema;\n this.isNullable = false;\n this.isOptional = false;\n }\n\n /**\n * Creates a SchemaDefinition from a JSON string containing a JSON Schema.\n * Parses the JSON string, rehydrates the schema structure, and compiles it.\n * \n * @param jsonString - The JSON string containing the JSON Schema (typically from `schema['~standard'].jsonSchema.input()` or `output()`)\n * @param collectionName - Optional collection name override (if not present in JSON Schema metadata)\n * @returns A compiled schema ready to use\n * @throws Error if the JSON string is invalid or doesn't contain a valid JSON Schema\n * \n * @example\n * ```typescript\n * // Serialize a schema to JSON\n * const jsonSchema = mySchema['~standard'].jsonSchema.input({ target: 'draft-2020-12' });\n * const jsonString = JSON.stringify(jsonSchema);\n * \n * // Rehydrate from JSON string\n * const rehydratedSchema = SchemaDefinition.fromJson(jsonString);\n * // Schema is already compiled and ready to use\n * ```\n */\n static fromJson(jsonString: string, collectionName?: string): CompiledSchema<any> {\n const schemaDefinition = rehydrateSchemaFromJsonString(jsonString, collectionName);\n return schemaDefinition.compile();\n }\n\n /**\n * Standard JSON Schema V1 implementation.\n * Provides JSON Schema conversion for Routier schemas.\n */\n get '~standard'(): StandardJSONSchemaV1.Props<InferCreateType<T>, InferType<T>> {\n const schema = this.compile();\n\n return createStandardJsonSchemaProps(schema);\n }\n\n private createReturnFunction<TResult>(builder: CodeBuilder): TResult {\n const body = builder.toString();\n try {\n return Function(`return ${body}`) as TResult;\n } catch (e) {\n logger.error(`Error compiling schema function. Function Body: ${body}`)\n throw e;\n }\n }\n\n private createFunction<TResult>(builder: CodeBuilder, ...fnArgs: string[]): TResult {\n const body = builder.toString();\n\n try {\n return Function(...fnArgs, body) as TResult;\n } catch (e) {\n logger.error(`Error compiling schema function. Function Body: ${body}`)\n throw e;\n }\n }\n\n modify<R>(builder: (d: {\n function: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected: I) => UU, injected?: I) => SchemaFunction<UU, I, \"unmapped\">;\n computed: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected: I) => UU, injected?: I) => SchemaComputed<UU, I, \"computed\" | \"unmapped\">;\n }) => R) {\n\n const b = {\n function: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected?: I) => UU, injected?: I) => new SchemaFunction<UU, I, \"unmapped\">(fn as any, injected),\n computed: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected?: I) => UU, injected?: I) => new SchemaComputed<UU, I, \"computed\" | \"unmapped\">(fn as any, injected)\n }\n\n const r = builder(b)\n\n return new SchemaDefinition<R & T>(this.collectionName, { ...this.instance, ...r });\n }\n\n private _iterate(\n instance: SchemaBase<any, any>,\n callback: (property: PropertyInfo<any>) => void\n ) {\n const explore: {\n path: string | null;\n instance:\n | SchemaBase<any, any>\n | { [key: string]: SchemaBase<any, any> };\n parents: {\n schema: { [key: string]: SchemaBase<any, any> };\n propertyInfo: PropertyInfo<any>;\n }[];\n propertyInfo: PropertyInfo<any> | null;\n }[] = [\n { path: null, instance, parents: [], propertyInfo: null }\n ];\n const properties: PropertyInfo<any>[] = [];\n\n for (let i = 0; i < explore.length; i++) {\n const item = explore[i];\n\n if (item.instance.type === SchemaTypes.Definition) {\n explore.push({\n path: null,\n instance: item.instance.instance,\n parents: [],\n propertyInfo: null\n });\n continue;\n }\n\n const instanceObj = item.instance as {\n [key: string]: SchemaBase<any, any>;\n };\n for (const key in instanceObj) {\n const propertyInstance = instanceObj[key] as SchemaBase<any, any>;\n const previousParent =\n item.parents.length === 0\n ? null\n : item.parents[item.parents.length - 1].propertyInfo;\n\n if (propertyInstance.type === SchemaTypes.Object) {\n const propertyInfo = new PropertyInfo<any>(\n propertyInstance,\n key,\n previousParent\n );\n explore.push({\n path: [item.path, key].filter((w) => w != null).join(\".\"),\n instance: propertyInstance.instance,\n parents: [\n ...item.parents,\n { schema: instanceObj, propertyInfo: propertyInfo }\n ],\n propertyInfo\n });\n\n if (previousParent === null) {\n properties.push(propertyInfo);\n continue;\n }\n\n previousParent.children.push(propertyInfo);\n continue;\n }\n\n const childPrimitivePropertyInfo = new PropertyInfo<any>(\n (item.instance as any)[key],\n key,\n previousParent\n );\n if (previousParent === null) {\n properties.push(childPrimitivePropertyInfo);\n continue;\n }\n\n previousParent.children.push(childPrimitivePropertyInfo);\n }\n }\n\n // Recursively trigger callbacks on properties and their children\n function recursiveCallback(prop: PropertyInfo<any>) {\n callback(prop);\n for (const child of prop.children) {\n recursiveCallback(child);\n }\n }\n\n for (const prop of properties) {\n recursiveCallback(prop);\n }\n }\n\n compile<TMetadata>(metadata: TMetadata): CompiledSchemaWithMetadata<T, TMetadata>\n compile(): CompiledSchema<T>;\n compile<TMetadata>(metadata?: TMetadata): CompiledSchema<T> | CompiledSchemaWithMetadata<T, TMetadata> {\n\n try {\n const properties: PropertyInfo<T>[] = [];\n const propertyMap: Map<string, PropertyInfo<T>> = new Map<string, PropertyInfo<T>>();\n\n const enrichmentHandlerBuilder = new EnrichmentHandlerBuilder();\n const mergeHandlerFactory = new MergeHandlerBuilder();\n const prepareHandlerBuilder = new PrepareHandlerBuilder();\n const stripHandlerBuilder = new StripHandlerBuilder();\n const cloneHandlerBuilder = new CloneHandlerBuilder();\n const compareHandlerBuilder = new CompareHandlerBuilder();\n const deserializeHandlerBuilder = new DeserializeHandlerBuilder();\n const hashTypeHandlerBuilder = new HashTypeHandlerBuilder();\n const idSelectorHandlerBuilder = new IdSelectorHandlerBuilder();\n const hashHandlerBuilder = new HashHandlerBuilder();\n const enableChangeTrackingHandlerBuilder = new EnableChangeTrackingHandlerBuilder();\n const freezeHandlerBuilder = new FreezeHandlerBuilder();\n const serializeHandlerBuilder = new SerializeHandlerBuilder();\n const compareIdsHandlerBuilder = new CompareIdsHandlerBuilder();\n const setHandlerBuilder = new SetHandlerBuilder();\n\n const enricher = enrichmentHandlerBuilder.build();\n const merge = mergeHandlerFactory.build();\n const prepare = prepareHandlerBuilder.build();\n const strip = stripHandlerBuilder.build();\n const clone = cloneHandlerBuilder.build();\n const compare = compareHandlerBuilder.build();\n const deserialize = deserializeHandlerBuilder.build();\n const hashTypeHandler = hashTypeHandlerBuilder.build();\n const idSelectorHandler = idSelectorHandlerBuilder.build();\n const hashHandler = hashHandlerBuilder.build();\n const enableChangeTrackingHandler = enableChangeTrackingHandlerBuilder.build();\n const freezeHandler = freezeHandlerBuilder.build();\n const serializeHandler = serializeHandlerBuilder.build();\n const compareIdsHandler = compareIdsHandlerBuilder.build();\n const setHandlerHanlder = setHandlerBuilder.build();\n\n const changeTrackingCodeBuilder = new CodeBuilder();\n changeTrackingCodeBuilder.raw(`${createChangeTracker.toString()}`);\n changeTrackingCodeBuilder.slot(\"declarations\").variable(\"enableChangeTracking\").value('createChangeTracker()');\n changeTrackingCodeBuilder.slot(\"assignment\");\n changeTrackingCodeBuilder.slot(\"return\").raw('\\treturn enableChangeTracking(entity);');\n\n const freezeCodeBuilder = new CodeBuilder();\n freezeCodeBuilder.slot(\"assignment\");\n freezeCodeBuilder.slot(\"return\").raw('\\treturn Object.freeze(entity);');\n\n const enricherCodeBuilder = new CodeBuilder();\n\n const enricherFunctionRoot = enricherCodeBuilder.factory(\"factory\", { name: \"factory\" }).parameters({ name: \"collectionName\", value: this.collectionName });\n enricherFunctionRoot.slot(\"changeTracker\").raw(`${createChangeTracker.toString()}`);\n enricherFunctionRoot.slot(\"changeTrackerFunction\").raw(`\\tconst changeTracker = createChangeTracker();`);\n const enricherFunctionBody = enricherFunctionRoot.function(undefined, { name: \"function\" }).parameters(\"entity\", \"changeTrackingType\").return();\n\n enricherFunctionBody.slot(\"enableChangeTracking\")\n .variable(\"enableChangeTracking\")\n .value('changeTrackingType === \"proxy\" ? changeTracker : e => e');\n\n enricherFunctionBody.slot(\"append\");\n enricherFunctionBody.slot(\"enriched\");\n enricherFunctionBody.slot(\"declarations\");\n enricherFunctionBody.slot(\"assignment\");\n enricherFunctionBody.slot(\"ifs\");\n enricherFunctionBody.slot(\"tracking\").if('changeTrackingType === \"immutable\"', { name: \"freeze\" });\n enricherFunctionBody.slot(\"return\").raw('\\treturn enableChangeTracking(enriched);');\n\n const preprocessCodeBuilder = new CodeBuilder();\n preprocessCodeBuilder.slot(\"main\");\n preprocessCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const postprocessCodeBuilder = new CodeBuilder();\n postprocessCodeBuilder.slot(\"main\");\n postprocessCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const setCodeBuilder = new CodeBuilder();\n setCodeBuilder.slot(\"assignments\");\n setCodeBuilder.slot(\"ifs\");\n\n const mergeCodeBuilder = new CodeBuilder();\n\n const mergeFunctionRoot = mergeCodeBuilder.factory(\"factory\", { name: \"factory\" }).parameters({ name: \"collectionName\", value: this.collectionName });\n const mergeFunctionBody = mergeFunctionRoot.function(undefined, { name: \"function\" }).parameters(\"destination\", \"source\").return();\n\n const pauseFunctionBody = mergeFunctionBody.function(\"pause\")\n .appendBody(\"// initiate change tracking if needed\");\n\n pauseFunctionBody.if(\"destination.__tracking__ == null\")\n .appendBody(\"destination.__tracking__ = {};\");\n\n pauseFunctionBody.appendBody(\"destination.__tracking__.isPaused = true;\");\n\n mergeFunctionBody.function(\"unpause\")\n .appendBody(\"// unpause change tracking if needed\")\n .if(\"destination.__tracking__ != null\")\n .appendBody(\"destination.__tracking__.isPaused = false;\");\n\n mergeFunctionBody.slot(\"header\").raw(`pause()`);\n mergeFunctionBody.slot(\"assignments\");\n mergeFunctionBody.slot(\"ifs\");\n mergeFunctionBody.slot(\"return\").raw(`\n unpause();\n\n return destination;`);\n\n const prepareCodeBuilder = new CodeBuilder();\n prepareCodeBuilder.slot(\"result\");\n prepareCodeBuilder.slot(\"assignments\");\n prepareCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const stripCodeBuilder = new CodeBuilder();\n stripCodeBuilder.slot(\"result\");\n stripCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const cloneCodeBuilder = new CodeBuilder();\n cloneCodeBuilder.slot(\"result\").raw(\"const result = {};\");;\n cloneCodeBuilder.slot(\"assignments\");\n cloneCodeBuilder.slot(\"if\");\n cloneCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const compareCodeBuilder = new CodeBuilder();\n compareCodeBuilder.slot(\"result\");\n compareCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const compareIdsCodeBuilder = new CodeBuilder();\n compareIdsCodeBuilder.slot(\"ifs\");\n compareIdsCodeBuilder.slot(\"return\").raw(` return true;`);\n\n const deserializeCodeBuilder = new CodeBuilder();\n deserializeCodeBuilder.slot(\"functions\");\n deserializeCodeBuilder.slot(\"result\");\n deserializeCodeBuilder.slot(\"if\");\n deserializeCodeBuilder.slot(\"return\").raw(` return entity;`);\n\n const serializeCodeBuilder = new CodeBuilder();\n serializeCodeBuilder.slot(\"result\").raw(\"const result = {};\");\n serializeCodeBuilder.slot(\"assignments\");\n serializeCodeBuilder.slot(\"functions\");\n serializeCodeBuilder.slot(\"if\");\n serializeCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const idSelectorCodeBuilder = new CodeBuilder();\n idSelectorCodeBuilder.slot(\"result\");\n idSelectorCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const hashTypeCodeBuilder = new CodeBuilder();\n hashTypeCodeBuilder.slot(\"ifs\");\n hashTypeCodeBuilder.slot(\"return\").raw(` return \"Ids\";`);\n\n const hashCodeBuilder = new CodeBuilder();\n hashCodeBuilder.slot(\"functions\").raw(`\n function stringifyDate(d) {\n\n if (d == null) {\n return \"\";\n }\n\n if (typeof d === \"string\") {\n return d;\n }\n\n if (d.toISOString != null) {\n return d.toISOString();\n }\n\n return d.toString();\n } \n`);\n const hashCodeBuilderIfBlock = hashCodeBuilder.if(`type === \"Ids\"`, { name: \"hash-id-if\" });\n hashCodeBuilderIfBlock.slot(\"if-body\");\n hashCodeBuilderIfBlock.appendBody(\"return result\");\n hashCodeBuilder.slot(\"hash-object-return\");\n hashCodeBuilder.raw(` return result;`)\n\n const idProperties: PropertyInfo<any>[] = [];\n const allPropertyNamesAndPaths: string[] = [];\n let hashType: HashType = HashType.Ids;\n let hasIdentities = false;\n let hasIdentityKeys = false;\n\n this._iterate(this, (property) => {\n\n properties.push(property);\n propertyMap.set(property.id, property);\n allPropertyNamesAndPaths.push(property.getSelectrorPath({ parent: \"entity\" }));\n\n if (property.isIdentity === true) {\n hasIdentities = true;\n }\n\n if (property.isKey === true) {\n idProperties.push(property);\n }\n\n if (property.isKey === true && property.isIdentity === true) {\n hasIdentityKeys = true;\n }\n\n enricher.handle(property, enricherCodeBuilder);\n merge.handle(property, mergeCodeBuilder);\n prepare.handle(property, prepareCodeBuilder);\n strip.handle(property, stripCodeBuilder);\n clone.handle(property, cloneCodeBuilder);\n compare.handle(property, compareCodeBuilder);\n deserialize.handle(property, deserializeCodeBuilder);\n serializeHandler.handle(property, serializeCodeBuilder)\n hashTypeHandler.handle(property, hashTypeCodeBuilder);\n idSelectorHandler.handle(property, idSelectorCodeBuilder);\n hashHandler.handle(property, hashCodeBuilder);\n enableChangeTrackingHandler.handle(property, changeTrackingCodeBuilder);\n freezeHandler.handle(property, freezeCodeBuilder);\n compareIdsHandler.handle(property, compareIdsCodeBuilder);\n setHandlerHanlder.handle(property, setCodeBuilder);\n });\n\n if (idProperties.length === 0) {\n throw new Error(`Schema must have a key. Use .key() to mark a property as a key. Collection Name: ${this.collectionName}`)\n }\n\n const enrichParams = enricherFunctionRoot.getParameters();\n const mergeParams = mergeFunctionRoot.getParameters();\n\n const enrichGenerator = this.createReturnFunction<Function>(enricherCodeBuilder);\n const mergeGenerator = this.createReturnFunction<Function>(mergeCodeBuilder);\n\n // After enricher is used, we modify it to be deserialize and enrich\n enricherFunctionBody.get<SlotBlock>(\"append\").insert(deserializeCodeBuilder.get<SlotBlock>(\"functions\"));\n enricherFunctionBody.get<SlotBlock>(\"append\").insert(deserializeCodeBuilder.get<SlotBlock>(\"result\"));\n enricherFunctionBody.get<SlotBlock>(\"append\").insert(deserializeCodeBuilder.get<SlotBlock>(\"if\"));\n enricherFunctionRoot.replace(\"function\", new FunctionBuilder(undefined).parameters(\"unserialized\", \"changeTrackingType\").return());\n\n const postProcessGenerator = this.createReturnFunction<Function>(enricherCodeBuilder);\n const postProcessParams = enricherFunctionRoot.getParameters();\n\n // Combine prepare and serialize\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(prepareCodeBuilder.get<SlotBlock>(\"result\"));\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(prepareCodeBuilder.get<SlotBlock>(\"assignments\"));\n\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(serializeCodeBuilder.get<SlotBlock>(\"assignments\"));\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(serializeCodeBuilder.get<SlotBlock>(\"functions\"));\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(serializeCodeBuilder.get<SlotBlock>(\"if\"));\n\n const getIdsFunction = this.createFunction<(entity: InferType<T>) => [IdType]>(idSelectorCodeBuilder, \"entity\");\n const getHashTypeFunction = this.createFunction<GetHashTypeFunction<T>>(hashTypeCodeBuilder, \"entity\");\n const prepareFunction = this.createFunction<Prepare<T>>(prepareCodeBuilder, \"entity\");\n const cloneFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(cloneCodeBuilder, \"entity\");\n const deserializeFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(deserializeCodeBuilder, \"unserialized\");\n const serializeFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(serializeCodeBuilder, \"entity\");\n const compareFunction = this.createFunction<(a: InferType<T>, b: InferType<T>) => boolean>(compareCodeBuilder, \"a\", \"b\");\n const stripFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(stripCodeBuilder, \"entity\");\n const hashFunction = this.createFunction<HashFunction<T>>(hashCodeBuilder, \"entity\", \"type\");\n const enableChangeTrackingFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(changeTrackingCodeBuilder, \"entity\");\n const freezeFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(freezeCodeBuilder, \"entity\");\n const compareIdsFunction = this.createFunction<(a: InferType<T>, b: InferType<T>) => boolean>(compareIdsCodeBuilder, \"a\", \"b\");\n const preprocessFunction = this.createFunction<Preprocess<T>>(preprocessCodeBuilder, \"entity\");\n const setFunction = this.createFunction<SetProperties<T>>(setCodeBuilder, \"destination\", \"source\");\n\n const enricherFactoryFunction = enrichGenerator();\n const postProcessFactoryFunction = postProcessGenerator();\n const mergeFactoryFunction = mergeGenerator();\n const postProcessFunction = postProcessFactoryFunction(...postProcessParams.map(w => w.value))\n const enricherFunction = enricherFactoryFunction(...enrichParams.map(w => w.value));\n const mergeFunction = mergeFactoryFunction(...mergeParams.map(w => w.value));\n\n const idPropertyNames = idProperties.map(w => w.name);\n const getId = (entity: InferType<T>) => {\n if (idPropertyNames.length > 1) {\n return hashFunction(entity, HashType.Ids) as IdType;\n }\n\n return getIdsFunction(entity as any)[0] as IdType;\n }\n\n const getProperty = (id: string) => propertyMap.get(id);\n const id = hash([...allPropertyNamesAndPaths, this.collectionName].join(\",\")) as SchemaId;\n\n // memoize this by the validProperties\n // TODO: See if we can generate a function to do this and eliminate loops\n const deserializePartial = (item: Record<string, unknown>, properties: PropertyInfo<T>[]) => {\n\n for (let i = 0, length = properties.length; i < length; i++) {\n const property = properties[i];\n const value = property.getValue(item);\n\n if (value == null) {\n continue;\n }\n\n const deserialized = property.deserialize(value);\n property.setValue(item, deserialized);\n }\n\n return item as DeepPartial<InferType<T>>;\n }\n\n const result: CompiledSchemaCore<T> = {\n preprocess: preprocessFunction,\n postprocess: postProcessFunction,\n set: setFunction,\n getId,\n getProperty,\n properties,\n idProperties,\n hasIdentities,\n hashType,\n getHashType: getHashTypeFunction,\n merge: mergeFunction,\n prepare: prepareFunction,\n clone: cloneFunction,\n deserializePartial,\n deserialize: deserializeFunction,\n serialize: serializeFunction,\n compare: compareFunction,\n compareIds: compareIdsFunction,\n strip: stripFunction,\n hash: hashFunction,\n id,\n getIds: getIdsFunction,\n enrich: enricherFunction,\n collectionName: this.collectionName,\n hasIdentityKeys,\n freeze: freezeFunction,\n enableChangeTracking: enableChangeTrackingFunction,\n definition: this,\n getIndexes: () => {\n\n const indexes: Index[] = [];\n\n for (let i = 0, length = properties.length; i < length; i++) {\n const property = properties[i];\n\n if (property.indexes.length === 0) {\n continue; // No Index\n }\n\n for (let j = 0, l = property.indexes.length; j < l; j++) {\n const indexName = property.indexes[j];\n\n // Test for compound indexes\n const connections = properties.filter(w =>\n w !== property && // Don't match with self\n w.indexes.some(index => index === indexName)\n );\n\n const indexedProperties = [property, ...connections];\n\n if (indexedProperties.length === 1) {\n // Not a compound property\n if (indexedProperties[0].isKey) {\n indexes.push({\n properties: indexedProperties,\n type: \"primary-key\",\n name: indexName\n });\n continue;\n }\n\n if (indexedProperties[0].isDistinct) {\n indexes.push({\n properties: indexedProperties,\n type: \"unique\",\n name: indexName\n });\n continue;\n }\n\n indexes.push({\n properties: indexedProperties,\n type: \"single\",\n name: indexName\n });\n continue;\n }\n\n if (indexes.some(w => w.name === indexName)) {\n continue; // Already in a compound index\n }\n\n indexes.push({\n properties: indexedProperties,\n type: \"compound\",\n name: indexName\n });\n }\n }\n\n return indexes;\n }\n };\n\n if (metadata != null) {\n\n const compiledSchemaWithMetadata: CompiledSchemaWithMetadata<T, TMetadata> = {\n ...result,\n createSubscription: (signal?: AbortSignal) => new SchemaSubscription(result, signal),\n metadata\n };\n\n return compiledSchemaWithMetadata;\n }\n\n const compiledSchema = {\n createSubscription: (signal?: AbortSignal) => new SchemaSubscription(result, signal),\n ...result\n };\n\n return compiledSchema;\n } catch (e) {\n throw new SchemaError(e, `Error compiling schema for collection: ${this.collectionName}`);\n }\n }\n}\n","import { SchemaArray } from \"./property/types/SchemaArray\";\nimport { SchemaBase } from \"./property/base/SchemaBase\";\nimport { SchemaBoolean } from \"./property/types/SchemaBoolean\";\nimport { SchemaDate } from \"./property/types/SchemaDate\";\nimport { SchemaDefinition } from \"./SchemaDefinition\";\nimport { SchemaNumber } from \"./property/types/SchemaNumber\";\nimport { SchemaObject } from \"./property/types/SchemaObject\";\nimport { SchemaString } from \"./property/types/SchemaString\";\nimport { CollectionName } from \"./types\";\n\nexport const s = {\n number: <T extends number[] = number[]>(...literals: T) => new SchemaNumber<T[number] extends never ? number : T[number], never>(null, literals),\n string: <T extends string[] = string[]>(...literals: T) => new SchemaString<T[number] extends never ? string : T[number], never>(null, literals),\n boolean: <T extends boolean = boolean>() => new SchemaBoolean<T, never>(),\n date: <T extends Date = Date>() => new SchemaDate<T, never>(),\n array: <T extends any>(schema: SchemaBase<T, never>) => new SchemaArray<SchemaBase<T, never>, never>(schema as any),\n object: <T extends {} = {}>(schema: T) => new SchemaObject<T, never>(schema),\n define: <T extends {}>(collectionName: string, schema: T) => new SchemaDefinition<T>(collectionName as CollectionName, schema),\n}","import { now } from \"../../performance\";\nimport { Branded, uuid } from \"../../utilities\";\nimport { CompiledSchemaCore, ISchemaSubscription, SchemaId, SubscriptionChanges } from \"../types\";\n\ntype BroadcastChannelReceiverId = Branded<string, \"BroadcastChannelReceiverId\">;\ntype SubscriptionListenerCallback<T> = (changes: StampedChanges<T>) => void;\ntype BroadcastChannelType = InstanceType<typeof BroadcastChannel>;\ninterface ISubscriptionAction<T> {\n action(changes: StampedChanges<T>): void\n}\ntype StampedChanges<T> = { data: SubscriptionChanges<T>, timestamp: number };\n\nconst registry: Record<SchemaId, SchemaChannel<unknown>> = {};\n\nconst getChannelRegistry = <T>(schemaId: SchemaId): SchemaChannel<T> => {\n\n if (registry[schemaId]) {\n return registry[schemaId] as SchemaChannel<T>;\n }\n\n const channel = new SchemaChannel<T>(schemaId);\n\n registry[schemaId] = channel;\n\n return channel;\n}\n\n// Must have a sender and receiver. Sender cannot listen for it's own message\nclass SchemaChannel<T> {\n\n readonly sender: SchemaChannelSender<T>;\n readonly receiver: SchemaChannelReceiver<T>;\n\n constructor(schemaId: SchemaId) {\n this.sender = new SchemaChannelSender<T>(schemaId);\n this.receiver = new SchemaChannelReceiver<T>(schemaId);\n }\n}\n\nclass SchemaChannelSender<T> {\n\n private readonly broadcastChannel: BroadcastChannelType;\n\n constructor(schemaId: SchemaId) {\n this.broadcastChannel = new BroadcastChannel(`__routier-schema-subscription-channel:${schemaId}`);\n }\n\n send(changes: StampedChanges<T>) {\n this.broadcastChannel.postMessage(changes)\n }\n}\n\nclass SchemaChannelReceiver<T> {\n\n private readonly broadcastChannel: BroadcastChannelType;\n private subscriptions: SubscriptionListener<T>[] = [];\n\n constructor(schemaId: SchemaId) {\n this.broadcastChannel = new BroadcastChannel(`__routier-schema-subscription-channel:${schemaId}`);\n\n this.broadcastChannel.onmessage = (e) => {\n\n // We can't send to the same instance it is not possbile\n const stampedChanges = e.data as StampedChanges<T>;\n\n for (let i = 0, length = this.subscriptions.length; i < length; i++) {\n const subscription = this.subscriptions[i];\n\n subscription.action(stampedChanges);\n }\n };\n }\n\n addListener(id: BroadcastChannelReceiverId, listener: SubscriptionListenerCallback<T>) {\n this.subscriptions.push(new SubscriptionListener<T>(id, listener));\n }\n\n removeListeners(id: BroadcastChannelReceiverId) {\n this.subscriptions = this.subscriptions.filter(w => w.id !== id);\n }\n}\n\nclass SubscriptionListener<T> implements ISubscriptionAction<T> {\n\n readonly id: BroadcastChannelReceiverId;\n private readonly listener: SubscriptionListenerCallback<T>;\n\n constructor(id: BroadcastChannelReceiverId, listener: SubscriptionListenerCallback<T>) {\n this.id = id;\n this.listener = listener;\n }\n\n action(changes: StampedChanges<T>) {\n this.listener(changes);\n }\n}\n\nexport class SchemaSubscription<T extends {}> implements ISchemaSubscription<T> {\n\n private readonly id: BroadcastChannelReceiverId;\n private readonly schema: CompiledSchemaCore<T>;\n private readonly createdAt: number;\n\n constructor(schema: CompiledSchemaCore<T>, signal?: AbortSignal) {\n this.createdAt = now();\n this.id = uuid(8) as BroadcastChannelReceiverId;\n this.schema = schema;\n\n signal?.addEventListener(\"abort\", () => {\n this.dispose();\n }, { once: true });\n }\n\n send(changes: SubscriptionChanges<T>) {\n const regisry = getChannelRegistry<T>(this.schema.id);\n\n // cannot send raw data, needs to be preprocessed\n const preprocessedChanges: SubscriptionChanges<T> = {\n adds: Array.from({ length: changes.adds.length }),\n removals: Array.from({ length: changes.removals.length }),\n unknown: Array.from({ length: changes.unknown.length }),\n updates: Array.from({ length: changes.updates.length }),\n };\n\n for (let i = 0, length = changes.adds.length; i < length; i++) {\n preprocessedChanges.adds[i] = this.schema.preprocess(changes.adds[i]);\n }\n\n for (let i = 0, length = changes.removals.length; i < length; i++) {\n preprocessedChanges.removals[i] = this.schema.preprocess(changes.removals[i]);\n }\n\n for (let i = 0, length = changes.unknown.length; i < length; i++) {\n preprocessedChanges.unknown[i] = this.schema.preprocess(changes.unknown[i]);\n }\n\n for (let i = 0, length = changes.updates.length; i < length; i++) {\n preprocessedChanges.updates[i] = this.schema.preprocess(changes.updates[i]);\n }\n\n // Send message to all listeners.\n // Since we create a new listener when we do onMessage,\n // we don't need to worry about sending to ourselves, it \n // can't happen\n regisry.sender.send({\n data: preprocessedChanges,\n timestamp: now()\n });\n }\n\n onMessage(callback: (changes: SubscriptionChanges<T>) => void) {\n\n const regisry = getChannelRegistry<T>(this.schema.id);\n\n // Link the callback to an instance\n regisry.receiver.addListener(this.id, ({ data, timestamp }) => {\n\n if (timestamp < this.createdAt) {\n // Sent before the receiver was even created\n return;\n }\n\n // Changes were preprocessed before they were sent, need to postprocess them\n const postProcessedChanges: SubscriptionChanges<T> = {\n adds: Array.from({ length: data.adds.length }),\n removals: Array.from({ length: data.removals.length }),\n unknown: Array.from({ length: data.unknown.length }),\n updates: Array.from({ length: data.updates.length }),\n };\n\n for (let i = 0, length = data.adds.length; i < length; i++) {\n postProcessedChanges.adds[i] = this.schema.preprocess(data.adds[i]);\n }\n\n for (let i = 0, length = data.removals.length; i < length; i++) {\n postProcessedChanges.removals[i] = this.schema.preprocess(data.removals[i]);\n }\n\n for (let i = 0, length = data.unknown.length; i < length; i++) {\n postProcessedChanges.unknown[i] = this.schema.preprocess(data.unknown[i]);\n }\n\n for (let i = 0, length = data.updates.length; i < length; i++) {\n postProcessedChanges.updates[i] = this.schema.preprocess(data.updates[i]);\n }\n\n callback(postProcessedChanges);\n });\n }\n\n dispose() {\n this[Symbol.dispose]();\n }\n\n [Symbol.dispose](): void {\n const regisry = getChannelRegistry<T>(this.schema.id);\n\n // Remove listeners for this instance only\n regisry.receiver.removeListeners(this.id);\n }\n}","export * from './builder';\nexport * from './table';\nexport * from './property/base';\nexport * from './property/modifiers';\nexport * from './property/types';\nexport * from './PropertyInfo';\nexport * from './types';\nexport * from './utils/standardJsonSchema';\nexport * from './SchemaDefinition';","import { DefaultValue, ForeignKey, FunctionBody, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\n\nexport abstract class SchemaBase<T extends any, TModifiers extends SchemaModifiers> {\n\n abstract instance: T;\n modifiers: TModifiers;\n\n isNullable: boolean = false;\n isUnmapped: boolean = false;\n isOptional: boolean = false;\n isKey: boolean = false;\n isIdentity: boolean = false;\n isReadonly: boolean = false;\n isDistict: boolean = false;\n indexes: string[] = [];\n fromPropertyName: string | null = null;\n\n foreignKeyDefinition: ForeignKey<unknown> | null = null;\n tags: string[] = [];\n injected: any = null;\n defaultValue: DefaultValue<T> | null = null;\n valueSerializer: PropertySerializer<T> | null = null;\n valueDeserializer: PropertyDeserializer<T> | null = null;\n type: SchemaTypes;\n functionBody: FunctionBody<any, T> | null;\n private _schemaBase = true;\n readonly literals: T[] = [];\n\n constructor(entity?: SchemaBase<T, TModifiers>, literals?: T[]) {\n\n if (entity != null) {\n this.valueSerializer = entity.valueSerializer;\n this.valueDeserializer = entity.valueDeserializer;\n this.functionBody = entity.functionBody;\n this.isNullable = entity.isNullable;\n this.isOptional = entity.isOptional;\n this.isKey = entity.isKey;\n this.isIdentity = entity.isIdentity;\n this.isReadonly = entity.isReadonly;\n this.defaultValue = entity.defaultValue;\n this.type = entity.type;\n this.injected = entity.injected;\n this.indexes = entity.indexes;\n this.fromPropertyName = entity.fromPropertyName;\n this.tags = entity.tags;\n }\n\n if (literals) {\n this.literals = literals;\n }\n }\n}","export * from './SchemaBase';","import { logger } from \"../../../utilities\";\nimport { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaDefault<T extends any, I, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaDefault = true;\n\n constructor(defaultValue: DefaultValue<T, I>, injected: I, current: SchemaBase<T, TModifiers>) {\n super(current);\n\n if (defaultValue == null) {\n logger.warn(\"Do not use `.default(null)` in your schema, please use `.default(() => null)`\")\n }\n\n this.instance = current.instance;\n this.injected = injected;\n this.defaultValue = defaultValue;\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaDeserialize<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaDeserialize = true;\n\n constructor(deserializer: PropertyDeserializer<T>, current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.valueDeserializer = deserializer;\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n default<I = never>(value: DefaultValue<T | null, I>, injected?: I) {\n return new SchemaDefault<T | null, I, TModifiers | \"default\">(value, injected, this);\n }\n\n}","import { SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\n\nexport class SchemaDistinct<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaDistinct = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isDistict = true;\n }\n}","import { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaIdentity } from \"./SchemaIdentity\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { CompiledSchema, DefaultValue, InferType, SchemaModifiers } from \"../../types\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaTag } from \"./SchemaTag\";\n\nexport class SchemaForeignKey<T extends any, TModifiers extends SchemaModifiers, K extends {}> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaForeignKey = true;\n\n constructor(current: SchemaBase<T, TModifiers>, relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n super(current);\n this.instance = current.instance;\n this.foreignKeyDefinition = {\n schema: relatingSchema,\n property: relatingSchema.getProperty(String(property))\n };\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaDistinct } from \"./SchemaDistinct\";\nimport { SchemaIdentity } from \"./SchemaIdentity\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaReadonly } from \"./SchemaReadonly\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaFrom<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaFrom = true;\n\n constructor(propertyName: string, current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.fromPropertyName = propertyName;\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n}","import { SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\n\nexport class SchemaIdentity<T, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaIdentity = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isIdentity = true;\n }\n}","import { uuidv4 } from \"../../../utilities\";\nimport { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaDistinct } from \"./SchemaDistinct\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaReadonly } from \"./SchemaReadonly\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaIndex<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaIndex = true;\n\n constructor(current: SchemaBase<T, TModifiers>, ...indexes: string[]) {\n super(current);\n this.instance = current.instance;\n\n if (indexes.length === 0) {\n indexes.push(uuidv4()); // Create our own unique index identifier\n }\n\n this.indexes = indexes;\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n}","import { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaIdentity } from \"./SchemaIdentity\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { DefaultValue, IdType, SchemaModifiers } from \"../../types\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaTag } from \"./SchemaTag\";\n\nexport class SchemaKey<T extends IdType, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaKey = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isKey = true;\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { DefaultValue, PropertyDeserializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaOptional } from \"./SchemaOptional\";\n\nexport class SchemaNullable<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaNullable = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isNullable = true;\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n default<I = never>(value: DefaultValue<T | null, I>, injected?: I) {\n return new SchemaDefault<T | null, I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T | null>) {\n return new SchemaDeserialize<T | null, TModifiers | \"deserialize\">(deserializer, this);\n }\n}","import { PropertyDeserializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaNullable } from \"./SchemaNullable\";\n\nexport class SchemaOptional<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaOptional = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isOptional = true;\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T | undefined>) {\n return new SchemaDeserialize<T | undefined, TModifiers | \"deserialize\">(deserializer, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaReadonly<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaReadonly = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isReadonly = true;\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserializer(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serializer(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"deserialize\">(serializer, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n}","import { PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\n\nexport class SchemaSerialize<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaSerialize = true;\n\n constructor(serializer: PropertySerializer<T>, current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.valueSerializer = serializer;\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaArray } from \"../types\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaDistinct } from \"./SchemaDistinct\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaIndex } from \"./SchemaIndex\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaReadonly } from \"./SchemaReadonly\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaTag<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaTag = true;\n\n constructor(tags: string[], current: SchemaBase<T, TModifiers>) {\n super(current);\n this.tags = tags;\n this.instance = current.instance;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n}","import { CompiledSchema, IdType, InferType, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaForeignKey } from \"./SchemaForeignKey\";\nimport { SchemaKey } from \"./SchemaKey\";\nimport { SchemaTag } from \"./SchemaTag\";\n\nexport class SchemaTracked<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaTracked = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isUnmapped = false;\n }\n\n key(): T extends IdType ? SchemaKey<T, TModifiers | \"key\"> : never {\n return new SchemaKey(this as SchemaBase<T & IdType, TModifiers>) as T extends IdType ? SchemaKey<T, TModifiers | \"key\"> : never;\n }\n\n foreignKey<K extends {}>(relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n return new SchemaForeignKey<T, TModifiers, K>(this, relatingSchema, property);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","export * from './SchemaDefault';\nexport * from './SchemaDeserialize';\nexport * from './SchemaDistinct';\nexport * from './SchemaIdentity';\nexport * from './SchemaIndex';\nexport * from './SchemaKey';\nexport * from './SchemaNullable';\nexport * from './SchemaOptional';\nexport * from './SchemaReadonly';\nexport * from './SchemaSerialize';\nexport * from './SchemaTracked';\nexport * from './SchemaFrom';\nexport * from './SchemaTag';\nexport * from './SchemaForeignKey';","import { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaDeserialize } from '../modifiers/SchemaDeserialize';\nimport { SchemaSerialize } from '../modifiers/SchemaSerialize';\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\n\nexport class SchemaArray<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T[], TModifiers> {\n\n instance: T[];\n type = SchemaTypes.Array;\n private _schemaArray = true;\n readonly innerSchema?: SchemaBase<any, any>; // we need to know the type of the array, that is what this is for\n\n constructor(entity?: SchemaBase<T[], TModifiers>, literals?: T[][]) {\n super(entity, literals);\n this.innerSchema = entity;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T[], TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T[], TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T[], TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T[], I>, injected?: I) {\n return new SchemaDefault<T[], I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T[]>) {\n return new SchemaDeserialize<T[], TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T[]>) {\n return new SchemaSerialize<T[], TModifiers | \"serialize\">(serializer, this);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T[], TModifiers>(this, ...indexes);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T[], TModifiers>(tags, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaBoolean<T extends boolean, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Boolean;\n private _schemaBoolean = true;\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaDate<T extends Date, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Date;\n private _schemaDate = true;\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { CompiledSchema, DefaultValue, InferType, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaForeignKey } from \"../modifiers/SchemaForeignKey\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIdentity } from \"../modifiers/SchemaIdentity\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaKey } from \"../modifiers/SchemaKey\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaNumber<T extends number, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Number;\n private _schemaNumber = true;\n\n constrain<K extends T>() {\n return new SchemaNumber<K, TModifiers>(this as unknown as SchemaBase<K, TModifiers>);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n key() {\n return new SchemaKey<T, TModifiers | \"key\">(this);\n }\n\n foreignKey<K extends {}>(relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n return new SchemaForeignKey<T, TModifiers, K>(this, relatingSchema, property);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { DefaultValue, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIdentity } from \"../modifiers/SchemaIdentity\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaObject<T extends {}, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Object;\n private _schemaObject = true;\n\n constructor(schema: T) {\n super();\n this.instance = schema;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { CompiledSchema, DefaultValue, InferType, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaForeignKey } from \"../modifiers/SchemaForeignKey\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIdentity } from \"../modifiers/SchemaIdentity\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaKey } from \"../modifiers/SchemaKey\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaString<T extends string, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.String;\n private _schemaString = true;\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n constrain<K extends T>() {\n return new SchemaString<K, TModifiers>(this as unknown as SchemaBase<K, TModifiers>);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n key() {\n return new SchemaKey<T, TModifiers | \"key\">(this);\n }\n\n foreignKey<K extends {}>(relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n return new SchemaForeignKey<T, TModifiers, K>(this, relatingSchema, property);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","export * from './SchemaArray';\nexport * from './SchemaBoolean';\nexport * from './SchemaDate';\nexport * from './SchemaNumber';\nexport * from './SchemaObject';\nexport * from './SchemaString';","import { SchemaBase } from \"../property/base/SchemaBase\";\nimport { SchemaTracked } from '../property/modifiers/SchemaTracked';\nimport { SchemaModifiers, SchemaTypes } from \"../types\";\n\nexport class SchemaComputed<T extends any, I, TModifiers extends SchemaModifiers = \"computed\"> extends SchemaBase<T, TModifiers> {\n instance: T;\n type = SchemaTypes.Computed;\n private _schemaComputed = true;\n\n constructor(fn: T, injected: I, current?: SchemaBase<T, TModifiers>) {\n super(current);\n this.injected = injected;\n this.isUnmapped = true;\n this.functionBody = fn as any;\n }\n\n tracked() {\n return new SchemaTracked<T, Exclude<TModifiers, \"unmapped\">>(this as unknown as SchemaBase<T, Exclude<TModifiers, \"unmapped\">>);\n }\n}","import { SchemaBase } from \"../property/base/SchemaBase\";\nimport { SchemaModifiers, SchemaTypes } from \"../types\";\n\nexport class SchemaFunction<T extends any, I, TModifiers extends SchemaModifiers = \"unmapped\"> extends SchemaBase<() => T, TModifiers> {\n instance: () => T;\n type = SchemaTypes.Function;\n private _schemaFunction = true;\n\n constructor(fn: (injected: I) => T, injected: I, current?: SchemaBase<() => T, TModifiers>) {\n super(current);\n this.injected = injected;\n this.isUnmapped = true;\n this.functionBody = fn as any;\n }\n}","export * from './SchemaComputed';\nexport * from './SchemaFunction';","import type { SchemaDefinition } from \"./SchemaDefinition\";\nimport type { SchemaBase } from \"./property/base/SchemaBase\";\nimport type { SchemaArray } from \"./property/types/SchemaArray\";\nimport type { SchemaObject } from \"./property/types/SchemaObject\";\nimport type { PropertyInfo } from \"./PropertyInfo\";\nimport type { DeepPartial } from \"../types\";\nimport type { SchemaFunction } from \"./table\";\nimport type { SchemaOptional } from \"./property/modifiers\";\nimport type { Branded } from \"../utilities/types\";\n\nexport type DefaultValue<T, I = never> = T | ((injected: I) => T);\nexport type FunctionBody<TEntity, TResult> = (entity: TEntity, collectionName: CollectionName) => TResult;\nexport type IdType = string | number;\nexport type ForeignKey<T extends {}> = { \n schema: CompiledSchema<T>, \n property: PropertyInfo<T> \n};\n\nexport enum SchemaTypes {\n Array = \"Array\",\n Boolean = \"Boolean\",\n Date = \"Date\",\n Number = \"Number\",\n Object = \"Object\",\n String = \"String\",\n Definition = \"Definition\",\n Function = \"Function\",\n Computed = \"Computed\"\n}\n\nexport type ArrayShape = string | number | Date | {};\n\nexport type ExpandedProperty = ExpandedChildProperty & {\n assignmentPath: string;\n selectorPath: string;\n properties: Map<string, ExpandedChildProperty>;\n childDegree: number;\n};\n\nexport type ExpandedChildProperty = {\n propertyName: string;\n type: SchemaTypes;\n isNullableOrOptional: boolean;\n isReadonly: boolean;\n isIdentity: boolean;\n isUnmapped: boolean;\n}\n\nexport enum HashType {\n Ids = \"Ids\",\n Object = \"Object\"\n}\n\nexport type HashFunction<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>, type: HashType.Object): string;\n (entity: InferType<TEntity>, type: HashType.Ids): string;\n}\n\nexport type GetHashTypeFunction<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>): HashType.Object;\n (entity: InferType<TEntity>): HashType.Ids;\n}\n\nexport type ChangeTrackingType = \"proxy\" | \"diff\" | \"immutable\";\n\nexport type IndexType = \"single\" | \"compound\" | \"unique\" | \"primary-key\"\nexport type Index = {\n properties: PropertyInfo<any>[],\n type: IndexType;\n name: string;\n}\n\n/**\n * Represents changes to subscriptions, categorizing them by modifications to\n * entities (additions, updates, removals) or query-driven removals.\n * @template T - The type of the entities in the subscription.\n */\nexport type SubscriptionChanges<T extends {}> = {\n /**\n * Entities that have been added to the subscription.\n */\n adds: InferType<T>[];\n /**\n * Entities that have been updated within the subscription.\n */\n updates: InferType<T>[];\n /**\n * Entities that have been removed from the subscription.\n */\n removals: InferType<T>[];\n /**\n * Entities that have been added/updated/removed from the subscription and it is unknown \n * if the entities have been added/updated/removed.\n */\n unknown: InferType<T>[];\n}\n\nexport interface ISchemaSubscription<T extends {}> extends Disposable {\n send(changes: SubscriptionChanges<T>): void;\n onMessage(callback: (changes: SubscriptionChanges<T>) => void): void;\n}\n\nexport type Enrich<TEntity extends {}> = {\n (entity: InferType<TEntity>, changeTrackingType: ChangeTrackingType): InferType<TEntity>;\n (entity: InferCreateType<TEntity>, changeTrackingType: ChangeTrackingType): InferCreateType<TEntity>;\n}\nexport type Prepare<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>): InferCreateType<TEntity>;\n (entity: InferType<TEntity>): InferType<TEntity>;\n}\nexport type Preprocess<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>): InferType<TEntity>;\n (entity: InferType<TEntity>): InferType<TEntity>;\n}\n\nexport type SetProperties<TEntity extends {}> = (destination: InferType<TEntity> | InferCreateType<TEntity>, source: InferType<TEntity> | InferCreateType<TEntity>) => void;\n\nexport type CompiledSchemaCore<TEntity extends {}> = Omit<CompiledSchema<TEntity>, \"createSubscription\">;\n\nexport type CompiledSchemaWithMetadata<TEntity extends {}, TMetadata> = {\n readonly metadata: TMetadata;\n} & CompiledSchema<TEntity>;\n\n/**\n * Represents a fully compiled schema with all utilities and metadata for an entity type.\n */\nexport type CompiledSchema<TEntity extends {}> = {\n\n deserializePartial: (item: Record<string, unknown>, properties: PropertyInfo<TEntity>[]) => DeepPartial<InferType<TEntity>>;\n\n createSubscription: (abortSignal?: AbortSignal) => ISchemaSubscription<TEntity>;\n /** Returns the property info for a given id (full path) */\n getProperty: (id: string) => PropertyInfo<TEntity>;\n /** Returns the ID of the given entity. */\n getId: (entity: InferType<TEntity>) => IdType;\n /** Returns a deep clone of the given entity. */\n clone: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Removes unmapped or extraneous properties from the entity. */\n strip: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Prepares a new entity for creation, applying defaults and transformations. */\n prepare: Prepare<TEntity>;\n /** Merges the source entity into the destination entity. */\n merge: (destination: InferType<TEntity> | InferCreateType<TEntity>, source: InferType<TEntity>) => InferType<TEntity>;\n /** Indicates if the schema has identity properties. */\n hasIdentities: boolean;\n /** List of properties that are identity keys. */\n idProperties: PropertyInfo<TEntity>[];\n /** All property metadata for the schema. */\n properties: PropertyInfo<TEntity>[],\n /** The hash type used for this schema. */\n hashType: HashType;\n /** Computes a hash for the given entity. */\n hash: HashFunction<TEntity>;\n /** Returns the hash type for the given entity. */\n getHashType: GetHashTypeFunction<TEntity>;\n /** Compares two entities for equality. */\n compare: (a: InferType<TEntity>, fromDb: InferType<TEntity>) => boolean;\n /** Deserializes an entity from storage format. */\n deserialize: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Sets 1 or many properties from the source object onto the destination object with change tracking. */\n set: SetProperties<TEntity>;\n /** Combines serializing and preparing an entity for saving. */\n preprocess: Preprocess<TEntity>;\n /** Combines deserializing and enriching an entity for selection. */\n postprocess: Enrich<TEntity>;\n\n /** Serializes an entity to storage format. */\n serialize: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Unique id for the schema. */\n id: SchemaId,\n /** The name of the collection for this schema. */\n collectionName: CollectionName;\n /** Returns all IDs for the given entity (usually a single-element tuple). */\n getIds: (entity: InferType<TEntity>) => [IdType];\n /** Enriches the entity with change tracking or other metadata. */\n enrich: Enrich<TEntity>;\n /** Indicates if the schema has identity keys. */\n hasIdentityKeys: boolean;\n /** Returns a deeply frozen (immutable) version of the entity. */\n freeze: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Enables change tracking on the entity. */\n enableChangeTracking: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** The schema definition object. */\n definition: SchemaDefinition<TEntity>;\n /** Returns all indexes defined for this schema. */\n getIndexes: () => Index[];\n /** Compares two entities for Id equality. */\n compareIds: (a: InferType<TEntity>, b: InferType<TEntity>) => boolean;\n}\n\nexport type PropertySerializer<T extends any> = (value: T) => string | number;\nexport type PropertyDeserializer<T extends any> = (value: string | number) => T;\n\nexport type SchemaId = Branded<number, \"SchemaId\">;\nexport type CollectionName = Branded<string, \"CollectionName\">;\n\nexport type SchemaModifiers = \"default\" | \"deserialize\" |\n \"identity\" | \"key\" |\n \"nullable\" | \"optional\" |\n \"readonly\" | \"serialize\" |\n \"unmapped\" | \"computed\" |\n \"distinct\";\n\ntype InferPrimitive<T> =\n T extends SchemaOptional<infer C, infer __> ? C extends (string | number | Date) ? C : { [K in keyof C]: InferPrimitive<C[K]> } :\n T extends SchemaArray<infer Y, infer __> ? InferPrimitive<Y>[]\n : T extends SchemaObject<infer Obj, infer _> ?\n { [K in keyof Obj]: InferPrimitive<Obj[K]> } : // Process nested objects\n T extends SchemaFunction<infer F, infer __> ? F : T extends SchemaBase<infer X, infer _> ?\n X extends Array<infer A> ? InferPrimitive<A>[] : X : // Extract the primitive type\n never;\n\nexport type InferType<T> = T extends CompiledSchema<infer R> ? InferCompiledSchema<R> : T extends {} ? InferCompiledSchema<T> : T;\nexport type InferCreateType<T> = T extends CompiledSchema<infer R> ? InferCompiledCreateSchema<R> : T extends {} ? InferCompiledCreateSchema<T> : unknown;\nexport type InferMappedType<T> = T extends SchemaBase<infer K, infer __> ? InferType<K> : InferCompiledSchema<T>;\nexport type InferRoot<T> = T extends CompiledSchema<infer R> ? R : never;\n\ntype HasModifier<T, K extends keyof T, M extends SchemaModifiers> =\n T[K] extends SchemaBase<any, infer Mods> ?\n M extends Mods ? true : false :\n false;\n\ntype IsPlainProperty<T, K extends keyof T> =\n [\n HasModifier<T, K, \"readonly\">,\n HasModifier<T, K, \"optional\">,\n HasModifier<T, K, \"nullable\">\n ] extends [\n false,\n false,\n false\n ] ? true : false;\n\ntype IsCreateExcluded<T, K extends keyof T> =\n [\n HasModifier<T, K, \"identity\">,\n HasModifier<T, K, \"computed\">,\n HasModifier<T, K, \"unmapped\">\n ] extends [\n false,\n false,\n false\n ] ? false : true;\n\ntype IsCreateOptional<T, K extends keyof T> =\n [\n HasModifier<T, K, \"optional\">,\n HasModifier<T, K, \"default\">\n ] extends [\n false,\n false\n ] ? false : true;\n\ntype IsCreateNullable<T, K extends keyof T> =\n HasModifier<T, K, \"nullable\"> extends true ? true : false;\n\ntype InferCreateProperty<T, K extends keyof T> =\n IsCreateNullable<T, K> extends true ? null | InferPrimitive<T[K]> : InferPrimitive<T[K]>;\n\ntype InferCompiledSchema<T> = CoalesceEmpty<{\n [K in keyof T as IsPlainProperty<T, K> extends true ? K : never]: InferPrimitive<T[K]>\n}, {\n readonly [K in keyof T as HasModifier<T, K, \"readonly\"> extends true ? K : never]: InferPrimitive<T[K]>\n }, {\n [K in keyof T as HasModifier<T, K, \"optional\"> extends true ? K : never]?: InferPrimitive<T[K]>\n }, {\n [K in keyof T as HasModifier<T, K, \"nullable\"> extends true ? K : never]: null | InferPrimitive<T[K]>\n}>;\n\ntype InferCompiledCreateSchema<T> = {\n [K in keyof T as IsCreateExcluded<T, K> extends true ? never\n : IsCreateOptional<T, K> extends true ? K : never]?: InferCreateProperty<T, K>\n} & {\n [K in keyof T as IsCreateExcluded<T, K> extends true ? never\n : IsCreateOptional<T, K> extends true ? never : K]: InferCreateProperty<T, K>\n};\n\ntype IsEmptyObject<T> = keyof T extends never ? true : false;\ntype CoalesceEmpty<T1 extends {}, T2 extends {}, T3 extends {}, T4 extends {}> = (IsEmptyObject<T1> extends true ? {} : T1) & (IsEmptyObject<T2> extends true ? {} : T2) & (IsEmptyObject<T3> extends true ? {} : T3) & (IsEmptyObject<T4> extends true ? {} : T4);\n","import { PropertyInfo } from '../PropertyInfo';\nimport { CompiledSchema, InferCreateType, InferType, SchemaTypes } from '../types';\nimport { SchemaBase } from '../property/base/SchemaBase';\nimport { SchemaArray } from '../property/types/SchemaArray';\nimport { SchemaDefinition } from '../SchemaDefinition';\nimport { s } from '../builder';\n\n/**\n * Standard JSON Schema V1 interface types\n * Based on https://standardschema.dev/json-schema\n */\nexport interface StandardTypedV1<Input = unknown, Output = Input> {\n readonly '~standard': StandardTypedV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardTypedV1 {\n export interface Props<Input = unknown, Output = Input> {\n readonly version: 1;\n readonly vendor: string;\n readonly types?: Types<Input, Output> | undefined;\n }\n\n export interface Types<Input = unknown, Output = Input> {\n readonly input: Input;\n readonly output: Output;\n }\n}\n\nexport interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n readonly '~standard': StandardJSONSchemaV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardJSONSchemaV1 {\n export interface Props<Input = unknown, Output = Input>\n extends StandardTypedV1.Props<Input, Output> {\n readonly jsonSchema: StandardJSONSchemaV1.Converter;\n }\n\n export interface Converter {\n readonly input: (\n options: StandardJSONSchemaV1.Options\n ) => Record<string, unknown>;\n readonly output: (\n options: StandardJSONSchemaV1.Options\n ) => Record<string, unknown>;\n }\n\n export type Target =\n | 'draft-2020-12'\n | 'draft-07'\n | 'openapi-3.0'\n | ({} & string);\n\n export interface Options {\n readonly target: Target;\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n}\n\n/**\n * Context for property conversion\n */\ninterface ConversionContext {\n target: StandardJSONSchemaV1.Target;\n visited: Set<string>;\n useOutputType: boolean;\n convertProperty: (property: PropertyInfo<any>) => Record<string, unknown>;\n}\n\n/**\n * Strategy interface for converting property types to JSON Schema\n */\ntype PropertyConverter = (\n property: PropertyInfo<any>,\n context: ConversionContext\n) => Record<string, unknown>;\n\n/**\n * Converts a primitive property with optional enum/literals\n */\nfunction createPrimitiveConverter(\n jsonType: 'string' | 'number' | 'boolean'\n): PropertyConverter {\n return (property, _context) => {\n const jsonSchema: Record<string, unknown> = { type: jsonType };\n if (property.literals && property.literals.length > 0) {\n jsonSchema.enum = property.literals;\n }\n return jsonSchema;\n };\n}\n\n/**\n * Converts a Date property to JSON Schema\n */\nconst dateConverter: PropertyConverter = (_property, _context) => {\n return {\n type: 'string',\n format: 'date-time'\n };\n};\n\n/**\n * Converts an Object property to JSON Schema\n */\nconst objectConverter: PropertyConverter = (property, context) => {\n const jsonSchema: Record<string, unknown> = { type: 'object' };\n\n if (property.children && property.children.length > 0) {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const child of property.children) {\n // Skip computed and function properties for input schemas\n // Include them in output schemas as they represent derived values\n if (!context.useOutputType && (child.type === SchemaTypes.Computed || child.type === SchemaTypes.Function)) {\n continue;\n }\n\n const childSchema = context.convertProperty(child);\n\n // Skip empty schemas (e.g., computed properties that return empty for input)\n if (Object.keys(childSchema).length === 0) {\n continue;\n }\n\n const propertyName = child.from || child.name;\n properties[propertyName] = childSchema;\n\n // Add to required if not optional and not nullable\n // Computed/function properties are never required in JSON Schema\n if (!child.isOptional && !child.isNullable &&\n child.type !== SchemaTypes.Computed && child.type !== SchemaTypes.Function) {\n required.push(propertyName);\n }\n }\n\n if (Object.keys(properties).length > 0) {\n jsonSchema.properties = properties;\n }\n if (required.length > 0) {\n jsonSchema.required = required;\n }\n } else {\n // Empty object or unknown structure\n jsonSchema.properties = {};\n }\n\n return jsonSchema;\n};\n\n/**\n * Converts array inner schema to JSON Schema items\n * Attempts to fully recurse into object schemas when possible\n */\nfunction convertArrayItems(\n innerSchema: SchemaBase<any, any>,\n context: ConversionContext\n): Record<string, unknown> {\n const innerType = innerSchema.type;\n\n switch (innerType) {\n case SchemaTypes.String:\n return { type: 'string' };\n case SchemaTypes.Number:\n return { type: 'number' };\n case SchemaTypes.Boolean:\n return { type: 'boolean' };\n case SchemaTypes.Date:\n return { type: 'string', format: 'date-time' };\n case SchemaTypes.Object:\n // Try to extract object structure from innerSchema.instance\n // For SchemaObject, instance contains the property definitions\n if (innerSchema.instance && typeof innerSchema.instance === 'object') {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n // Iterate through the instance properties\n for (const [key, value] of Object.entries(innerSchema.instance)) {\n if (value && typeof value === 'object' && 'type' in value) {\n // This is a SchemaBase - try to convert it\n const schemaBase = value as SchemaBase<any, any>;\n const tempProperty = new PropertyInfo(schemaBase, key);\n\n // Skip computed/function for input schemas\n if (!context.useOutputType &&\n (tempProperty.type === SchemaTypes.Computed || tempProperty.type === SchemaTypes.Function)) {\n continue;\n }\n\n const itemSchema = context.convertProperty(tempProperty);\n if (Object.keys(itemSchema).length > 0) {\n properties[key] = itemSchema;\n if (!tempProperty.isOptional && !tempProperty.isNullable &&\n tempProperty.type !== SchemaTypes.Computed && tempProperty.type !== SchemaTypes.Function) {\n required.push(key);\n }\n }\n }\n }\n\n if (Object.keys(properties).length > 0) {\n return {\n type: 'object',\n properties,\n ...(required.length > 0 ? { required } : {})\n };\n }\n }\n // Fallback for unknown object structure\n return {\n type: 'object',\n properties: {},\n description: 'Array item object schema'\n };\n case SchemaTypes.Array:\n // Nested arrays - recursively handle\n if (innerSchema instanceof SchemaArray && innerSchema.innerSchema) {\n return {\n type: 'array',\n items: convertArrayItems(innerSchema.innerSchema, context)\n };\n }\n return {\n type: 'array',\n items: { type: 'object' } // Simplified fallback\n };\n default:\n return { type: 'object' };\n }\n}\n\n/**\n * Converts an Array property to JSON Schema\n */\nconst arrayConverter: PropertyConverter = (property, context) => {\n const jsonSchema: Record<string, unknown> = { type: 'array' };\n\n if (property.innerSchema) {\n jsonSchema.items = convertArrayItems(property.innerSchema, context);\n } else {\n jsonSchema.items = { type: 'object' };\n }\n\n return jsonSchema;\n};\n\n/**\n * Converts computed/function properties to JSON Schema\n * For input schemas, these return empty (should be skipped)\n * For output schemas, we include them with a generic object type\n */\nconst computedConverter: PropertyConverter = (property, context) => {\n // For input schemas, computed/function properties are not part of the data shape\n if (!context.useOutputType) {\n return {};\n }\n\n // For output schemas, include computed properties\n // We can't know the exact return type without executing the function,\n // so we use a generic object type with a note\n const routierMeta: Record<string, unknown> = {\n isComputed: property.type === SchemaTypes.Computed,\n isFunction: property.type === SchemaTypes.Function\n };\n\n // Store function source code for rehydration\n if (property.functionBody) {\n try {\n routierMeta.functionSource = property.functionBody.toString();\n } catch {\n // If function can't be serialized, store a placeholder\n routierMeta.functionSource = null;\n }\n }\n\n // Store injected value if it's serializable\n if (property.injected !== null && property.injected !== undefined) {\n try {\n // Try to serialize the injected value\n JSON.stringify(property.injected);\n routierMeta.injected = property.injected;\n } catch {\n // If injected value can't be serialized, store null\n routierMeta.injected = null;\n }\n } else {\n routierMeta.injected = null;\n }\n\n return {\n type: 'object',\n description: property.type === SchemaTypes.Computed\n ? 'Computed property (derived value)'\n : 'Function property (derived value)',\n 'x-routier': routierMeta\n };\n};\n\n/**\n * Default converter for unknown types\n */\nconst defaultConverter: PropertyConverter = () => {\n return { type: 'object' };\n};\n\n/**\n * Factory registry mapping SchemaTypes to converters\n */\nconst converterRegistry = new Map<SchemaTypes, PropertyConverter>([\n [SchemaTypes.String, createPrimitiveConverter('string')],\n [SchemaTypes.Number, createPrimitiveConverter('number')],\n [SchemaTypes.Boolean, createPrimitiveConverter('boolean')],\n [SchemaTypes.Date, dateConverter],\n [SchemaTypes.Object, objectConverter],\n [SchemaTypes.Array, arrayConverter],\n [SchemaTypes.Computed, computedConverter],\n [SchemaTypes.Function, computedConverter],\n]);\n\n/**\n * Applies nullable handling to a JSON Schema based on the target draft version\n */\nfunction applyNullable(\n jsonSchema: Record<string, unknown>,\n property: PropertyInfo<any>,\n target: StandardJSONSchemaV1.Target\n): void {\n if (!property.isNullable) {\n return;\n }\n\n if (target === 'draft-2020-12') {\n if (Array.isArray(jsonSchema.type)) {\n (jsonSchema.type as string[]).push('null');\n } else {\n jsonSchema.type = [jsonSchema.type as string, 'null'];\n }\n } else {\n jsonSchema.nullable = true;\n }\n}\n\n/**\n * Applies Routier-specific metadata to a JSON Schema\n */\nfunction applyRoutierMetadata(\n jsonSchema: Record<string, unknown>,\n property: PropertyInfo<any>\n): void {\n // Don't overwrite existing x-routier metadata (e.g., from computed properties)\n if (!jsonSchema['x-routier']) {\n jsonSchema['x-routier'] = {};\n }\n const routierMeta = jsonSchema['x-routier'] as Record<string, unknown>;\n\n // Only add metadata if it doesn't already exist (to preserve computed property metadata)\n if (property.isKey && !routierMeta.isKey) {\n routierMeta.isKey = true;\n }\n if (property.isIdentity && !routierMeta.isIdentity) {\n routierMeta.isIdentity = true;\n }\n if (property.isReadonly && !routierMeta.isReadonly) {\n routierMeta.isReadonly = true;\n }\n if (property.isDistinct && !routierMeta.isDistinct) {\n routierMeta.isDistinct = true;\n }\n if (property.indexes && property.indexes.length > 0 && !routierMeta.indexes) {\n routierMeta.indexes = property.indexes;\n }\n if ((property.valueSerializer || property.valueDeserializer) && !routierMeta.hasCustomSerialization) {\n routierMeta.hasCustomSerialization = true;\n }\n if (property.defaultValue != null && !routierMeta.hasDefault) {\n routierMeta.hasDefault = true;\n // Note: We can't serialize function defaults, only note their presence\n if (typeof property.defaultValue === 'function') {\n routierMeta.defaultIsFunction = true;\n } else {\n // For static defaults, we can include the actual value\n // Note: This includes falsy values like 0, false, empty string, etc.\n routierMeta.defaultValue = property.defaultValue;\n }\n }\n // Store the Routier property name in metadata (may differ from JSON Schema key if from() is used)\n if (!routierMeta.propertyName) {\n routierMeta.propertyName = property.name;\n }\n if (property.from != null && !routierMeta.from) {\n routierMeta.from = property.from;\n }\n}\n\n/**\n * Converts a Routier PropertyInfo to a JSON Schema property definition.\n */\nexport function propertyInfoToJsonSchema(\n property: PropertyInfo<any>,\n target: StandardJSONSchemaV1.Target,\n visited: Set<string> = new Set(),\n useOutputType: boolean = false\n): Record<string, unknown> {\n // Create conversion context with recursive converter\n const context: ConversionContext = {\n target,\n visited,\n useOutputType,\n convertProperty: (prop) => propertyInfoToJsonSchema(prop, target, visited, useOutputType)\n };\n\n // Get converter from factory registry\n const converter = converterRegistry.get(property.type) ?? defaultConverter;\n\n // Convert the property\n const jsonSchema = converter(property, context);\n\n // Apply nullable handling\n applyNullable(jsonSchema, property, target);\n\n // Apply Routier-specific metadata\n applyRoutierMetadata(jsonSchema, property);\n\n return jsonSchema;\n}\n\n/**\n * Converts a CompiledSchema to a JSON Schema object schema.\n */\nexport function compiledSchemaToJsonSchema<T extends {}>(\n compiledSchema: CompiledSchema<T>,\n target: StandardJSONSchemaV1.Target,\n useOutputType: boolean = false\n): Record<string, unknown> {\n const jsonSchema: Record<string, unknown> = {\n $schema: target === 'draft-2020-12'\n ? 'https://json-schema.org/draft/2020-12/schema'\n : target === 'draft-07'\n ? 'http://json-schema.org/draft-07/schema#'\n : 'http://json-schema.org/draft-04/schema#',\n type: 'object',\n properties: {} as Record<string, unknown>,\n required: [] as string[]\n };\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n // Iterate through all properties\n for (const property of compiledSchema.properties) {\n // Skip computed and function properties for input schema\n // For output schema, we include computed properties\n if (!useOutputType && (property.type === SchemaTypes.Computed || property.type === SchemaTypes.Function)) {\n continue;\n }\n\n // Skip unmapped properties (except computed/function properties in output schema)\n if (property.isUnmapped && !(useOutputType && (property.type === SchemaTypes.Computed || property.type === SchemaTypes.Function))) {\n continue;\n }\n\n const propertySchema = propertyInfoToJsonSchema(property, target, new Set(), useOutputType);\n\n // Skip empty schemas (e.g., computed properties that return empty)\n if (Object.keys(propertySchema).length === 0) {\n continue;\n }\n\n const propertyName = property.from || property.name;\n properties[propertyName] = propertySchema;\n\n // Add to required if not optional and not nullable\n if (!property.isOptional && !property.isNullable) {\n required.push(propertyName);\n }\n }\n\n jsonSchema.properties = properties;\n if (required.length > 0) {\n jsonSchema.required = required;\n }\n\n // Add Routier-specific metadata\n jsonSchema['x-routier'] = {\n collectionName: compiledSchema.collectionName,\n idProperties: compiledSchema.idProperties.map(p => p.name),\n hasIdentities: compiledSchema.hasIdentities,\n hasIdentityKeys: compiledSchema.hasIdentityKeys\n };\n\n return jsonSchema;\n}\n\n/**\n * Creates Standard JSON Schema V1 props for a compiled schema.\n */\nexport function createStandardJsonSchemaProps<T extends {}>(\n compiledSchema: CompiledSchema<T>\n): StandardJSONSchemaV1.Props<InferCreateType<T>, InferType<T>> {\n return {\n version: 1,\n vendor: 'routier',\n types: {\n input: undefined as any as InferCreateType<T>,\n output: undefined as any as InferType<T>\n },\n jsonSchema: {\n input: (options: StandardJSONSchemaV1.Options): Record<string, unknown> => {\n return compiledSchemaToJsonSchema(compiledSchema, options.target, false);\n },\n output: (options: StandardJSONSchemaV1.Options): Record<string, unknown> => {\n return compiledSchemaToJsonSchema(compiledSchema, options.target, true);\n }\n }\n };\n}\n\n/**\n * Parses a JSON string containing a JSON Schema and rehydrates it into a Routier SchemaDefinition.\n * This is a convenience wrapper around `rehydrateSchemaFromJsonSchema` that handles JSON parsing.\n * \n * @param jsonString - The JSON string containing the JSON Schema\n * @param collectionName - The collection name for the schema (if not in x-routier metadata)\n * @returns A SchemaDefinition that can be compiled\n * @throws Error if the JSON string is invalid or doesn't contain a valid JSON Schema\n */\nexport function rehydrateSchemaFromJsonString(\n jsonString: string,\n collectionName?: string\n): SchemaDefinition<any> {\n try {\n const jsonSchema = JSON.parse(jsonString) as Record<string, unknown>;\n return rehydrateSchemaFromJsonSchema(jsonSchema, collectionName);\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new Error(`Invalid JSON string: ${error.message}`);\n }\n throw error;\n }\n}\n\n/**\n * Rehydrates a JSON Schema back into a Routier SchemaDefinition.\n * This parses the JSON Schema structure and reconstructs the schema using Routier's builder API.\n * \n * @param jsonSchema - The JSON Schema object to rehydrate\n * @param collectionName - The collection name for the schema (if not in x-routier metadata)\n * @returns A SchemaDefinition that can be compiled\n */\nexport function rehydrateSchemaFromJsonSchema(\n jsonSchema: Record<string, unknown>,\n collectionName?: string\n): SchemaDefinition<any> {\n // Extract collection name - provided collectionName takes precedence over metadata\n const routierMeta = jsonSchema['x-routier'] as Record<string, unknown> | undefined;\n const finalCollectionName = collectionName || (routierMeta?.collectionName as string) || 'unknown';\n\n if (!jsonSchema.properties || typeof jsonSchema.properties !== 'object') {\n throw new Error('JSON Schema must have a properties object');\n }\n\n const properties = jsonSchema.properties as Record<string, unknown>;\n const required = (jsonSchema.required as string[] | undefined) || [];\n const schemaDefinition: Record<string, any> = {};\n const computedProperties: Array<{ name: string; isComputed: boolean; functionSource: string | null; injected: any }> = [];\n\n // Get idProperties from schema-level metadata as fallback\n const idProperties = (routierMeta?.idProperties as string[] | undefined) || [];\n\n for (const [propName, propSchema] of Object.entries(properties)) {\n const prop = propSchema as Record<string, unknown>;\n const isRequired = required.includes(propName);\n const routierPropMeta = prop['x-routier'] as Record<string, unknown> | undefined;\n\n // Use Routier property name from metadata if available, otherwise use JSON Schema property name\n const routierPropName = (routierPropMeta?.propertyName as string | undefined) || propName;\n\n // Check if this is a computed or function property\n if (routierPropMeta?.isComputed || routierPropMeta?.isFunction) {\n computedProperties.push({\n name: routierPropName,\n isComputed: routierPropMeta.isComputed === true,\n functionSource: (routierPropMeta.functionSource as string | null) || null,\n injected: routierPropMeta.injected !== undefined ? routierPropMeta.injected : null\n });\n continue;\n }\n\n // Convert JSON Schema property to Routier schema\n let schemaBuilder: any = convertJsonSchemaPropertyToRoutier(prop);\n\n // Apply Routier-specific modifiers (using type assertion for method chaining)\n // Note: Apply key() first as it's required for schema compilation\n // Check both property-level metadata and schema-level idProperties list\n const isKey = routierPropMeta?.isKey === true || idProperties.includes(routierPropName);\n if (isKey && typeof schemaBuilder.key === 'function') {\n schemaBuilder = schemaBuilder.key();\n }\n // Apply from() mapping early, as it's a fundamental property mapping\n if (routierPropMeta?.from && typeof schemaBuilder.from === 'function') {\n schemaBuilder = schemaBuilder.from(routierPropMeta.from as string);\n }\n if (routierPropMeta?.isIdentity && typeof schemaBuilder.identity === 'function') {\n schemaBuilder = schemaBuilder.identity();\n }\n if (routierPropMeta?.isReadonly && typeof schemaBuilder.readonly === 'function') {\n schemaBuilder = schemaBuilder.readonly();\n }\n if (routierPropMeta?.isDistinct && typeof schemaBuilder.distinct === 'function') {\n schemaBuilder = schemaBuilder.distinct();\n }\n // Apply optional if property is not required (nullable and optional are independent)\n if (!isRequired && typeof schemaBuilder.optional === 'function') {\n schemaBuilder = schemaBuilder.optional();\n }\n // Apply nullable if property allows null (nullable and optional are independent)\n if (prop.nullable === true || (Array.isArray(prop.type) && prop.type.includes('null'))) {\n if (typeof schemaBuilder.nullable === 'function') {\n schemaBuilder = schemaBuilder.nullable();\n }\n }\n if (routierPropMeta?.indexes && Array.isArray(routierPropMeta.indexes)) {\n if (typeof schemaBuilder.index === 'function') {\n schemaBuilder = schemaBuilder.index(...(routierPropMeta.indexes as string[]));\n }\n }\n\n // Apply default value if present (only static defaults, not function defaults)\n // hasDefault=true and defaultIsFunction=false means we have a static default value stored\n if (routierPropMeta?.hasDefault && !routierPropMeta.defaultIsFunction && routierPropMeta.hasOwnProperty('defaultValue')) {\n if (typeof schemaBuilder.default === 'function') {\n schemaBuilder = schemaBuilder.default(routierPropMeta.defaultValue);\n }\n }\n\n schemaDefinition[routierPropName] = schemaBuilder;\n }\n\n // Build base schema\n let schema = s.define(finalCollectionName, schemaDefinition);\n\n // Add computed properties via modify()\n if (computedProperties.length > 0) {\n schema = schema.modify(x => {\n const computedDefs: Record<string, any> = {};\n\n for (const computedProp of computedProperties) {\n if (computedProp.functionSource) {\n // Recreate the function from source code\n // The function signature is: (entity, collectionName, injected) => result\n // We use new Function() to create the function, but wrap it so toString() returns the arrow function\n let recreatedFn: any;\n try {\n const functionSource = computedProp.functionSource;\n\n // Parse the arrow function to extract parameters and body\n const arrowMatch = functionSource.match(/^\\(([^)]*)\\)\\s*=>\\s*(.+)$/s);\n\n if (!arrowMatch) {\n throw new Error('Function source is not an arrow function');\n }\n\n // Parse parameters\n const paramsStr = arrowMatch[1].trim();\n const params = paramsStr ? paramsStr.split(',').map(p => p.trim()).filter(p => p) : [];\n const body = arrowMatch[2].trim();\n\n // Create function body - if it's a block (starts with {), use as-is, otherwise wrap in return\n const functionBody = body.startsWith('{')\n ? body.slice(1, -1) // Remove outer braces\n : `return ${body}`;\n\n // Create the function using new Function()\n // If no parameters, call with just the body; otherwise spread the params\n const fn = params.length > 0\n ? new Function(...params, functionBody)\n : new Function(functionBody);\n\n // Wrap it so toString() returns the original arrow function string\n // This is needed because the schema system validates that functions are arrow functions\n recreatedFn = Object.assign(fn, {\n toString: () => functionSource\n });\n } catch (e) {\n // If we can't recreate the function, create a placeholder arrow function that throws\n recreatedFn = () => {\n throw new Error(`Cannot recreate computed property ${computedProp.name}: ${e instanceof Error ? e.message : 'unknown error'}`);\n };\n // Ensure toString returns an arrow function for validation\n Object.assign(recreatedFn, {\n toString: () => `() => { throw new Error(\"Cannot recreate computed property ${computedProp.name}\"); }`\n });\n }\n\n // Add computed property with optional injected value\n if (computedProp.isComputed) {\n computedDefs[computedProp.name] = x.computed(recreatedFn, computedProp.injected);\n } else {\n computedDefs[computedProp.name] = x.function(recreatedFn, computedProp.injected);\n }\n } else {\n // No function source available - create a placeholder\n computedDefs[computedProp.name] = computedProp.isComputed\n ? x.computed(() => {\n throw new Error(`Computed property ${computedProp.name} could not be rehydrated: function source not available`);\n })\n : x.function(() => {\n throw new Error(`Function property ${computedProp.name} could not be rehydrated: function source not available`);\n });\n }\n }\n\n return computedDefs;\n });\n }\n\n return schema;\n}\n\n/**\n * Converts a JSON Schema property definition to a Routier schema builder.\n */\nfunction convertJsonSchemaPropertyToRoutier(\n prop: Record<string, unknown>\n): SchemaBase<any, any> {\n const type = Array.isArray(prop.type)\n ? (prop.type as string[]).find(t => t !== 'null') || prop.type[0]\n : prop.type as string;\n\n // Check for date type - dates are serialized as string with format 'date-time'\n if (type === 'string' && prop.format === 'date-time') {\n return s.date();\n }\n\n switch (type) {\n case 'string':\n if (prop.enum && Array.isArray(prop.enum)) {\n return s.string(...(prop.enum as string[]));\n }\n return s.string();\n\n case 'number':\n case 'integer':\n if (prop.enum && Array.isArray(prop.enum)) {\n return s.number(...(prop.enum as number[]));\n }\n return s.number();\n\n case 'boolean':\n return s.boolean();\n\n case 'object':\n // Recurse into object properties\n if (prop.properties && typeof prop.properties === 'object') {\n const objectProps = prop.properties as Record<string, unknown>;\n const objectSchema: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(objectProps)) {\n objectSchema[key] = convertJsonSchemaPropertyToRoutier(value as Record<string, unknown>);\n }\n\n return s.object(objectSchema);\n }\n return s.object({});\n\n case 'array':\n // Handle array items\n if (prop.items && typeof prop.items === 'object') {\n const itemsSchema = convertJsonSchemaPropertyToRoutier(prop.items as Record<string, unknown>);\n return s.array(itemsSchema as any);\n }\n return s.array(s.object({}) as any);\n\n default:\n // Fallback to object for unknown types\n return s.object({});\n }\n}\n\n/**\n * Attempts to extract type information from a compiled schema for better type inference.\n * \n * Note: TypeScript types are compile-time only, so we can't extract actual type information at runtime.\n * The Standard JSON Schema spec allows libraries to advertise their inferred types via the `types` property,\n * but this requires compile-time type information that isn't available at runtime.\n * \n * For proper type inference, consumers should use TypeScript's type system:\n * ```typescript\n * const schema = s.define(\"users\", { ... }).compile();\n * type User = InferType<typeof schema>;\n * type CreateUser = InferCreateType<typeof schema>;\n * ```\n * \n * @param compiledSchema - The compiled schema to extract type info from\n * @returns A description of the type names (for documentation purposes only)\n */\nexport function extractTypeInfo<T extends {}>(\n compiledSchema: CompiledSchema<T>\n): { inputType: string; outputType: string } {\n return {\n inputType: `InferCreateType<${compiledSchema.collectionName}>`,\n outputType: `InferType<${compiledSchema.collectionName}>`\n };\n}\n","export const toMap = <T extends {}>(data: T[], keySelector: (item: T) => T[keyof T] | string) => {\n\n const result = new Map<T[keyof T] | string, T>();\n\n for (let i = 0; i < data.length; i++) {\n const item = data[i];\n const key = keySelector(item);\n result.set(key, item);\n }\n\n return result;\n}\n","export const isDate = (data: unknown): data is Date => {\n if (data == null) {\n return false;\n }\n\n if (typeof data !== \"object\") {\n return false;\n }\n\n return data instanceof Date;\n}","import { InferCreateType, InferType, SchemaId } from \"../schema\";\nimport { DbPluginBulkPersistEvent, EntityUpdateInfo } from \"../plugins\";\n\ntype DbEvent = {\n type: \"add\",\n data: InferCreateType<unknown>;\n} | {\n type: \"update\",\n data: EntityUpdateInfo<unknown>;\n} | {\n type: \"remove\",\n data: InferType<unknown>;\n}\n\nexport const toEventArray = (event: DbPluginBulkPersistEvent): [SchemaId, DbEvent][] => {\n\n const result: [SchemaId, DbEvent][] = [];\n for (const [schemaId, changes] of event.operation) {\n\n if (changes.hasItems === false) {\n continue;\n }\n\n if (changes.adds.length > 0) {\n result.push(...changes.adds.map(add => {\n return [schemaId as SchemaId, { data: { ...add }, type: \"add\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.updates.length > 0) {\n result.push(...changes.updates.map(update => {\n return [schemaId as SchemaId, { data: { ...update }, type: \"update\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.removes.length > 0) {\n result.push(...changes.removes.map(remove => {\n return [schemaId as SchemaId, { data: { ...remove }, type: \"remove\" }] as [SchemaId, DbEvent];\n }));\n }\n }\n\n return result\n}","export const noop = (..._args: any[]) => { };","export * from './arrays';\nexport * from './strings';\nexport * from './dates';\nexport * from './objects';\nexport * from './runtime';\nexport * from './uuid';\nexport * from './replication';\nexport * from './types';\nexport * from './queryOptionsCollection';\nexport * from './dbPluginEventUtils';\nexport * from './functions';\nexport * from './unsafeCast';\nexport * from './logger';","/**\n * Enable logging by setting `globalThis.__ROUTIER_DEBUG__ = true` before any routier code runs.\n */\nconst shouldLog = (): boolean => {\n if (typeof globalThis !== 'undefined') {\n const g = globalThis as { __ROUTIER_DEBUG__?: boolean };\n if (g.__ROUTIER_DEBUG__ === true) return true;\n }\n\n if (typeof process !== 'undefined' && process.env != null) {\n const debug = process.env.DEBUG;\n if (debug === 'routier' || debug === '*') return true;\n const env = process.env.NODE_ENV?.toLowerCase();\n if (env === 'dev' || env === 'development' || env === 'test') return true;\n }\n\n return false;\n};\n\ntype LogMethods = \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\" | \"table\";\nconst tryLog = (type: LogMethods, ...args: unknown[]) => {\n if (shouldLog()) {\n (console[type] as (...args: unknown[]) => void)(...args);\n }\n};\n\nexport const logger = {\n log: (...args: unknown[]): void => {\n tryLog(\"log\", ...args);\n },\n info: (...args: unknown[]): void => {\n tryLog(\"info\", ...args);\n },\n warn: (...args: unknown[]): void => {\n tryLog(\"warn\", ...args);\n },\n error: (...args: unknown[]): void => {\n tryLog(\"error\", ...args);\n },\n debug: (...args: unknown[]): void => {\n tryLog(\"debug\", ...args);\n },\n table: (...args: unknown[]): void => {\n tryLog(\"table\", ...args);\n },\n};\n\n","export const cast = <TIn, TOut>(item: TIn) => {\n return item as unknown as TOut;\n}\n\nexport function clone<T extends {}>(data: T): T {\n return JSON.parse(JSON.stringify(data)) as T;\n}","import { QueryOptionsCollection } from \"../plugins/query\";\n\nexport const combineQueryOptionsCollections = <T>(...collections: QueryOptionsCollection<T>[]) => {\n const result = new QueryOptionsCollection<T>();\n\n for (let i = 0, length = collections.length; i < length; i++) {\n const collection = collections[i];\n\n // Add scoped items first\n collection.forEach(item => {\n result.add(item.name, item.value);\n });\n }\n\n return result;\n}","import { BulkPersistResult, BulkPersistChanges } from \"../collections\";\nimport { DbPluginBulkPersistEvent } from \"../plugins\";\n\nexport const resolveBulkPersistChanges = (event: DbPluginBulkPersistEvent, result: BulkPersistResult, bulkPersistChanges: BulkPersistChanges) => {\n // make sure we swap the adds here, that way we can make sure other persist events\n // don't take their additions and try to change subsequent calls\n for (const [schemaId, changes] of event.operation) {\n\n const schemmaBulkPersistResult = result.get(schemaId);\n const schemaBulkPersistChanges = bulkPersistChanges.resolve(schemaId);\n\n // Set the original removes\n schemaBulkPersistChanges.removes = changes.removes;\n\n // Set the original updates\n schemaBulkPersistChanges.updates = changes.updates;\n\n // Take the adds from the result and set them to be persisted\n // in the replicated plugins because the id's are set in the \n // memory data store\n schemaBulkPersistChanges.adds = schemmaBulkPersistResult.adds;\n }\n}","export const isNodeRuntime = () => typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null;","export const hash = (value: string, seed: number = 0) => {\n // From Stack Overflow\n // https://stackoverflow.com/a/52171480/3329760\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\n for (let i = 0, ch: number; i < value.length; i++) {\n ch = value.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\n/**\n * Fast string hash optimized for comparisons.\n * Uses djb2 algorithm - very fast and good distribution for short to medium strings.\n * Same input always produces same output (deterministic).\n * \n * @param value - The string to hash\n * @param seed - Optional seed value (default: 5381)\n * @returns A positive 32-bit integer hash value\n * \n * @example\n * ```ts\n * fastHash(\"test\") === fastHash(\"test\") // true\n * fastHash(\"test\") !== fastHash(\"test2\") // true\n * ```\n */\nexport const fastHash = (value: string, seed: number = 5381): number => {\n let hash = seed;\n for (let i = 0; i < value.length; i++) {\n hash = ((hash << 5) + hash) + value.charCodeAt(i);\n }\n return hash >>> 0; // Convert to unsigned 32-bit integer\n}\n\n/**\n * Converts any value to a readable string representation.\n * Handles primitives, objects, arrays, classes, dates, errors, and functions.\n * Supports depth limiting to prevent infinite recursion on circular references.\n * \n * @param obj - The value to stringify\n * @param maxDepth - Maximum depth for nested objects (default: 3)\n * @param currentDepth - Current recursion depth (default: 0)\n * @returns String representation of the value\n * \n * @example\n * ```ts\n * stringifyObject({ name: \"test\", count: 5 }) // '{ name: \"test\", count: 5 }'\n * stringifyObject([1, 2, 3]) // '[1, 2, 3]'\n * stringifyObject(new Date()) // 'Date(2024-01-01T00:00:00.000Z)'\n * ```\n */\nexport function stringifyObject(obj: unknown, maxDepth: number = 3, currentDepth: number = 0): string {\n if (obj === null) return 'null';\n if (obj === undefined) return 'undefined';\n\n const type = typeof obj;\n\n switch (type) {\n case 'string':\n return `\"${obj}\"`;\n case 'number':\n case 'boolean':\n return String(obj);\n case 'function':\n return `[Function: ${getFunctionName(obj as Function)}]`;\n case 'object':\n if (currentDepth >= maxDepth) {\n return '[Max Depth Reached]';\n }\n return stringifyObjectValue(obj, maxDepth, currentDepth);\n default:\n return `[${type}]`;\n }\n}\n\nfunction getFunctionName(fn: Function): string {\n const name = fn.name;\n return name || 'anonymous';\n}\n\nfunction getObjectProperties(obj: any): Record<string, any> {\n const properties: Record<string, any> = {};\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n properties[key] = obj[key];\n }\n }\n\n return properties;\n}\n\nfunction stringifyObjectValue(obj: any, maxDepth: number, currentDepth: number): string {\n if (obj === null) return 'null';\n\n if (obj instanceof Date) {\n return `Date(${obj.toISOString()})`;\n }\n\n if (obj instanceof Error) {\n return `Error(${obj.message})`;\n }\n\n if (obj instanceof RegExp) {\n return obj.toString();\n }\n\n if (Array.isArray(obj)) {\n return stringifyArray(obj, maxDepth, currentDepth);\n }\n\n if (obj.constructor && obj.constructor.name !== 'Object') {\n return stringifyClassInstance(obj, maxDepth, currentDepth);\n }\n\n return stringifyPlainObject(obj, maxDepth, currentDepth);\n}\n\nfunction stringifyArray(arr: any[], maxDepth: number, currentDepth: number): string {\n if (arr.length === 0) return '[]';\n\n const items = arr.slice(0, 5).map(item =>\n stringifyObject(item, maxDepth, currentDepth + 1)\n );\n\n const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';\n return `[${items.join(', ')}${suffix}]`;\n}\n\nfunction stringifyClassInstance(obj: any, maxDepth: number, currentDepth: number): string {\n const className = obj.constructor.name;\n const properties = getObjectProperties(obj);\n\n if (Object.keys(properties).length === 0) {\n return `${className} {}`;\n }\n\n const props = Object.entries(properties)\n .slice(0, 5)\n .map(([key, value]) => {\n const isPrimitive = value === null || value === undefined ||\n (typeof value !== 'object' && typeof value !== 'function');\n const depth = isPrimitive ? currentDepth : currentDepth + 1;\n return `${key}: ${stringifyObject(value, maxDepth, depth)}`;\n });\n\n const suffix = Object.keys(properties).length > 5 ?\n `... (+${Object.keys(properties).length - 5} more)` : '';\n\n return `${className} { ${props.join(', ')}${suffix} }`;\n}\n\nfunction stringifyPlainObject(obj: any, maxDepth: number, currentDepth: number): string {\n const properties = getObjectProperties(obj);\n\n if (Object.keys(properties).length === 0) {\n return '{}';\n }\n\n const props = Object.entries(properties)\n .slice(0, 5)\n .map(([key, value]) => {\n const isPrimitive = value === null || value === undefined ||\n (typeof value !== 'object' && typeof value !== 'function');\n const depth = isPrimitive ? currentDepth : currentDepth + 1;\n return `${key}: ${stringifyObject(value, maxDepth, depth)}`;\n });\n\n const suffix = Object.keys(properties).length > 5 ?\n `... (+${Object.keys(properties).length - 5} more)` : '';\n\n return `{ ${props.join(', ')}${suffix} }`;\n}","export const unsafeCast = <T>(value: unknown): T => {\n return value as T\n}","export const uuid = (length: number = 16): string => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charLength = chars.length;\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.random() * charLength | 0];\n }\n return result;\n}\n\nconst HEX_CHARS = '0123456789abcdef';\nconst UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\nconst hasCrypto =\n typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n\nexport const uuidv4 = (): string => {\n let randomBytes: Uint8Array | null = null;\n if (hasCrypto) {\n randomBytes = crypto.getRandomValues(new Uint8Array(16));\n }\n\n let byteIndex = 0;\n let uuid = '';\n\n for (let i = 0; i < UUID_TEMPLATE.length; i++) {\n const c = UUID_TEMPLATE[i];\n if (c === '-') {\n uuid += '-';\n continue;\n }\n\n let r: number;\n if (hasCrypto && randomBytes) {\n // Each byte gives two hex digits (nibbles)\n r =\n (i % 2 === 0\n ? randomBytes[byteIndex] >> 4\n : randomBytes[byteIndex++] & 0x0f);\n } else {\n r = Math.floor(Math.random() * 16);\n }\n\n if (c === 'x') {\n uuid += HEX_CHARS[r];\n } else if (c === 'y') {\n // Variant bits: 8, 9, A, or B\n uuid += HEX_CHARS[(r & 0x3) | 0x8];\n } else if (c === '4') {\n uuid += '4';\n }\n }\n\n return uuid;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './assertions';\nexport * from './codegen';\nexport * from './collections';\nexport * from './errors';\nexport * from './expressions';\nexport * from './performance';\nexport * from './pipeline';\nexport * from './plugins';\nexport * from './results';\nexport * from './schema';\nexport * from './types';\nexport * from './utilities';\nexport * from './capabilities';"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAA4D;AAEtB;AAE/B,SAAS,UAAU,CAAC,IAAa;IACpC,IAAI,sCAAM,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;IAC/C,CAAC;AACL,CAAC;AAEM,SAAS,eAAe,CAAI,IAA0B,EAAE,OAAiC;IAC5F,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACf,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YAClB,MAAM,IAAI,SAAS,CAAC,gCAAgC,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IACnC,CAAC;AACL,CAAC;AAEM,SAAS,aAAa,CAAI,IAAa,EAAE,OAAgB;IAC5D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,SAAS,CA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oBACR,CAAC,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC;oBAC7B,CAAC,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/C,CAAC;aAAM,CAAC;YACJ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACZ,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACnB,8BAA8B;YAC9B,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACnB,IAAI,IAAI,GAAG,CAAC;QAChB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvDF;AACA;AACA;AACA,kDAAkD,wCAAwC;AAC1F;AACA;AACA,E;;;;ACNA,wF;;;;ACAA;AACA;AACA;AACA,uDAAuD,iBAAiB;AACxE;AACA,gDAAgD,aAAa;AAC7D,E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACN6B;AACH;AACI;AACL;AACK;AACA;AACH;AACD;AACA;AACD;AACD;AACI;AACG"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["webpack://@routier/core/./src/assertions/index.ts","webpack://@routier/core/./src/capabilities/Capability.ts","webpack://@routier/core/./src/capabilities/performance/PerformanceTracker.ts","webpack://@routier/core/./src/capabilities/tracing/CallTraceManager.ts","webpack://@routier/core/./src/capabilities/PerformanceCapability.ts","webpack://@routier/core/./src/capabilities/TracingCapability.ts","webpack://@routier/core/./src/capabilities/index.ts","webpack://@routier/core/./src/codegen/blocks.ts","webpack://@routier/core/./src/codegen/index.ts","webpack://@routier/core/./src/collections/Changes.ts","webpack://@routier/core/./src/collections/ReadonlySchemaCollection.ts","webpack://@routier/core/./src/collections/SchemaCollection.ts","webpack://@routier/core/./src/collections/TagCollection.ts","webpack://@routier/core/./src/collections/IdSet.ts","webpack://@routier/core/./src/collections/MemoryDataCollection.ts","webpack://@routier/core/./src/collections/index.ts","webpack://@routier/core/./src/errors/OptimisticConcurrencyError.ts","webpack://@routier/core/./src/errors/PluginDestroyedError.ts","webpack://@routier/core/./src/errors/SchemaError.ts","webpack://@routier/core/./src/errors/index.ts","webpack://@routier/core/./src/expressions/constants.ts","webpack://@routier/core/./src/expressions/evaluate.ts","webpack://@routier/core/./src/expressions/index.ts","webpack://@routier/core/./src/expressions/parser.ts","webpack://@routier/core/./src/expressions/types.ts","webpack://@routier/core/./src/expressions/utils.ts","webpack://@routier/core/./src/performance/index.ts","webpack://@routier/core/./src/pipeline/TrampolinePipeline.ts","webpack://@routier/core/./src/pipeline/SyncronousQueue.ts","webpack://@routier/core/./src/pipeline/index.ts","webpack://@routier/core/./src/plugins/translators/TranslatedArrayValue.ts","webpack://@routier/core/./src/plugins/translators/TranslatedGroupValue.ts","webpack://@routier/core/./src/plugins/translators/TranslatedSingleValue.ts","webpack://@routier/core/./src/plugins/translators/DataTranslator.ts","webpack://@routier/core/./src/plugins/query/similarity.ts","webpack://@routier/core/./src/plugins/query/Query.ts","webpack://@routier/core/./src/plugins/query/join.ts","webpack://@routier/core/./src/plugins/translators/JsonTranslator.ts","webpack://@routier/core/./src/plugins/translators/SqlTranslator.ts","webpack://@routier/core/./src/plugins/translators/TupleTranslator.ts","webpack://@routier/core/./src/plugins/translators/index.ts","webpack://@routier/core/./src/plugins/query/explain.ts","webpack://@routier/core/./src/plugins/query/formatExplanation.ts","webpack://@routier/core/./src/plugins/query/types.ts","webpack://@routier/core/./src/plugins/query/index.ts","webpack://@routier/core/./src/plugins/wire/query.ts","webpack://@routier/core/./src/plugins/wire/persist.ts","webpack://@routier/core/./src/plugins/wire/handler.ts","webpack://@routier/core/./src/plugins/wire/index.ts","webpack://@routier/core/./src/plugins/ConcurrencyDbPlugin.ts","webpack://@routier/core/./src/plugins/EphemeralDataPlugin.ts","webpack://@routier/core/./src/plugins/RetryDbPlugin.ts","webpack://@routier/core/./src/plugins/CacheDbPlugin.ts","webpack://@routier/core/./src/plugins/BatchingDbPlugin.ts","webpack://@routier/core/./src/plugins/index.ts","webpack://@routier/core/./src/plugins/query/QueryOptionsCollection.ts","webpack://@routier/core/./src/results/Result.ts","webpack://@routier/core/./src/results/utils.ts","webpack://@routier/core/./src/results/index.ts","webpack://@routier/core/./src/schema/property/base/SchemaBase.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaDistinct.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaIdentity.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaSearchable.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaOptional.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaNullable.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaSerialize.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaReadonly.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaFrom.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaDeserialize.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaDefault.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaIndex.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaTag.ts","webpack://@routier/core/./src/schema/property/types/SchemaArray.ts","webpack://@routier/core/./src/schema/property/types/SchemaBoolean.ts","webpack://@routier/core/./src/schema/property/types/SchemaDate.ts","webpack://@routier/core/./src/schema/table/SchemaFunction.ts","webpack://@routier/core/./src/schema/table/SchemaTransform.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaForeignKey.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaKey.ts","webpack://@routier/core/./src/schema/property/modifiers/SchemaTracked.ts","webpack://@routier/core/./src/schema/table/SchemaComputed.ts","webpack://@routier/core/./src/schema/PropertyInfo.ts","webpack://@routier/core/./src/codegen/SlotPath.ts","webpack://@routier/core/./src/codegen/utils.ts","webpack://@routier/core/./src/codegen/handlers/types.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentNullableObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentObjectIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentPrimitiveIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentPrimitiveHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentDefaultValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentDefaultFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentComputedValueHandler.ts","webpack://@routier/core/./src/schema/utils/propertyKind.ts","webpack://@routier/core/./src/codegen/handlers/enrichment/EnrichmentArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/EnrichmentHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeDefaultFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergePrimitiveHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeDefaultValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/merge/MergeArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/MergeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/prepare/PrepareFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/PrepareHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/strip/StripComputedHandler.ts","webpack://@routier/core/./src/codegen/handlers/StripHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/clone/CloneArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/clone/CloneDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/clone/CloneObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/clone/CloneValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/CloneHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareComputedHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/compare/CompareValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/CompareHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeDeserializerHandler.ts","webpack://@routier/core/./src/codegen/handlers/deserialize/DeserializeArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/DeserializeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/hashType/HashTypeValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/HashTypeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/idSelector/IdSelectorValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/IdSelectorHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashIdentityHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashComputedValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashFileHandler.ts","webpack://@routier/core/./src/codegen/handlers/hash/HashTransformHandler.ts","webpack://@routier/core/./src/codegen/handlers/HashHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/enableChangeTracking/EnableChangeTrackingObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/enableChangeTracking/EnableChangeTrackingArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/EnableChangeTrackingHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/freeze/FreezePrimitiveValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/freeze/FreezeObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/freeze/FreezeArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/FreezeHandlerBuilder.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeDateHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeObjectHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeValueHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeSerializerHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeFunctionHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeComputedHandler.ts","webpack://@routier/core/./src/codegen/handlers/serialize/SerializeArrayHandler.ts","webpack://@routier/core/./src/codegen/handlers/SerializeHandlerBuilder.ts","webpack://@routier/core/./src/schema/communication/broadcast.ts","webpack://@routier/core/./src/codegen/handlers/compareIds/CompareIdsKeyHandler.ts","webpack://@routier/core/./src/codegen/handlers/CompareIdsHandlerBuilder.ts","webpack://@routier/core/./src/schema/utils/standardJsonSchema.ts","webpack://@routier/core/./src/codegen/handlers/set/SetComplexHandler.ts","webpack://@routier/core/./src/codegen/handlers/SetHandlerBuilder.ts","webpack://@routier/core/./src/schema/SchemaDefinition.ts","webpack://@routier/core/./src/schema/property/types/SchemaNumber.ts","webpack://@routier/core/./src/schema/property/types/SchemaObject.ts","webpack://@routier/core/./src/schema/property/types/SchemaFile.ts","webpack://@routier/core/./src/schema/property/types/SchemaString.ts","webpack://@routier/core/./src/schema/property/types/SchemaVector.ts","webpack://@routier/core/./src/schema/builder.ts","webpack://@routier/core/./src/schema/table/index.ts","webpack://@routier/core/./src/schema/property/base/index.ts","webpack://@routier/core/./src/schema/property/modifiers/index.ts","webpack://@routier/core/./src/schema/property/types/index.ts","webpack://@routier/core/./src/schema/index.ts","webpack://@routier/core/./src/schema/types.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/./src/utilities/arrays.ts","webpack://@routier/core/./src/utilities/objects.ts","webpack://@routier/core/./src/utilities/runtime.ts","webpack://@routier/core/./src/utilities/replication.ts","webpack://@routier/core/./src/utilities/queryOptionsCollection.ts","webpack://@routier/core/./src/utilities/dbPluginEventUtils.ts","webpack://@routier/core/./src/utilities/functions.ts","webpack://@routier/core/./src/utilities/unsafeCast.ts","webpack://@routier/core/./src/utilities/index.ts","webpack://@routier/core/./src/utilities/logger.ts","webpack://@routier/core/./src/utilities/strings.ts","webpack://@routier/core/./src/utilities/uuid.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/./src/index.ts"],"sourcesContent":["import { EXPRESSION_TYPES } from \"../expressions/constants\";\nimport { ComparatorExpression, EmptyExpression, Expression, ExpressionType, NotParsableExpression, OperatorExpression, PropertyExpression, ValueExpression } from \"../expressions/types\";\nimport { isDate } from \"../utilities\";\n\nexport function assertDate(data: unknown): asserts data is Date {\n if (isDate(data) === false) {\n throw new TypeError('Value is not a Date');\n }\n}\n\nexport function assertIsNotNull<T>(data: T | null | undefined, message?: string | (() => string)): asserts data is NonNullable<T> {\n if (data == null) {\n if (message == null) {\n throw new TypeError('Assertion failed, data is null');\n }\n\n if (typeof message === \"string\") {\n throw new TypeError(message);\n }\n\n throw new TypeError(message());\n }\n}\n\nexport function assertIsArray<T>(data: unknown, message?: string): asserts data is T[] {\n if (!Array.isArray(data)) {\n throw new TypeError(message ?? 'Assertion failed, data is not of type Array');\n }\n}\n\nexport function assertString(data: unknown, message?: string): asserts data is string {\n if (typeof data !== \"string\") {\n throw new TypeError(message ?? 'Assertion failed, data is not of type String');\n }\n}\n\nexport function assertInstanceOf<T extends new (...args: any[]) => any>(value: unknown, Instance: T): asserts value is T {\n if (value instanceof Instance) {\n return;\n }\n\n if (value != null && typeof value === \"object\" && \"constructor\" in value) {\n throw new TypeError(`value is not instance of type. Type: ${value.constructor.name}`);\n }\n\n throw new TypeError(`value is not instance of type`);\n}\n\nexport function assertIsNumber(value: unknown): asserts value is number {\n if (typeof value !== \"number\") {\n throw new TypeError(\"value is not of type `number`\");\n }\n}\n\n\nfunction isObjectWithType(value: unknown): value is Record<\"type\", unknown> {\n return typeof value === \"object\" && value !== null && \"type\" in value;\n}\n\n/**\n * Type guard: narrows `value` to `Expression` when it is an object with a valid `type` property.\n */\nexport function isExpression(value: unknown): value is Expression {\n return isObjectWithType(value) && EXPRESSION_TYPES.includes(value.type as ExpressionType);\n}\n\n/**\n * Type guard: narrows `value` to `OperatorExpression` when it is an object with `type === \"operator\"`.\n */\nexport function isOperatorExpression(value: unknown): value is OperatorExpression {\n return isObjectWithType(value) && value.type === \"operator\";\n}\n\n/**\n * Type guard: narrows `value` to `ComparatorExpression` when it is an object with `type === \"comparator\"`.\n */\nexport function isComparatorExpression(value: unknown): value is ComparatorExpression {\n return isObjectWithType(value) && value.type === \"comparator\";\n}\n\n/**\n * Type guard: narrows `value` to `PropertyExpression` when it is an object with `type === \"property\"`.\n */\nexport function isPropertyExpression(value: unknown): value is PropertyExpression {\n return isObjectWithType(value) && value.type === \"property\";\n}\n\n/**\n * Type guard: narrows `value` to `ValueExpression` when it is an object with `type === \"value\"`.\n */\nexport function isValueExpression(value: unknown): value is ValueExpression {\n return isObjectWithType(value) && value.type === \"value\";\n}\n\n/**\n * Type guard: narrows `value` to `EmptyExpression` when it is an object with `type === \"empty\"`.\n */\nexport function isEmptyExpression(value: unknown): value is EmptyExpression {\n return isObjectWithType(value) && value.type === \"empty\";\n}\n\n/**\n * Type guard: narrows `value` to `NotParsableExpression` when it is an object with `type === \"not-parsable\"`.\n */\nexport function isNotParsableExpression(value: unknown): value is NotParsableExpression {\n return isObjectWithType(value) && value.type === \"not-parsable\";\n}","import { MethodInfo, MethodInfoMetadata } from \"./types\";\n\nexport abstract class Capability {\n\n protected excludedNames = new Set<string>([\n \"Array\",\n \"Set\",\n \"Map\",\n \"AbortController\",\n \"AbortSignal\",\n \"SchemaString\",\n \"SchemaNumber\",\n \"SchemaArray\",\n \"SchemaBoolean\",\n \"SchemaDate\",\n \"SchemaObject\",\n \"SchemaDefault\",\n \"SchemaDeserialize\",\n \"SchemaDistinct\",\n \"SchemaSearchable\",\n \"SchemaFrom\",\n \"SchemaIdentity\",\n \"SchemaIndex\",\n \"SchemaKey\",\n \"SchemaNullable\",\n \"SchemaOptional\",\n \"SchemaReadonly\",\n \"SchemaSerialize\",\n \"SchemaTracked\",\n \"SchemaComputed\",\n \"SchemaFunction\",\n \"SchemaBase\",\n \"SchemaDefinition\"\n ]);\n\n protected isValidObject(obj: unknown): obj is object {\n return typeof obj === \"object\" && obj !== null;\n }\n\n protected isCallableMethod(descriptor: PropertyDescriptor | undefined, key: string | symbol): boolean {\n return (\n descriptor?.value &&\n typeof descriptor.value === 'function' &&\n key !== 'constructor' &&\n key !== 'undefined'\n );\n }\n\n\n private canExplore(descriptor: PropertyDescriptor) {\n if (typeof descriptor.value !== \"object\") {\n return false;\n }\n\n if (descriptor.value == null) {\n return false\n }\n\n const name = this.getName(descriptor.value);\n\n if (name == null) {\n return true;\n }\n\n return this.excludedNames.has(name) === false\n }\n\n private getName(value: object) {\n if (value.constructor != null) {\n return value.constructor.name;\n }\n\n return null;\n }\n\n private getPath(info: MethodInfoMetadata, propertyName: string | symbol) {\n\n let parent = info.parent;\n const path = [info.propertyName, propertyName];\n\n while (parent != null) {\n\n path.unshift(parent.propertyName);\n parent = parent.parent;\n }\n\n return path.join(\".\");\n }\n\n protected explore(instance: unknown, onDiscover: (info: MethodInfoMetadata, methodInfo: MethodInfo) => void): void {\n if (!this.isValidObject(instance)) {\n return;\n }\n\n const explore: MethodInfoMetadata[] = [{ instance, propertyName: this.getName(instance) }];\n const visited = new Set<object>();\n\n for (let i = 0; i < explore.length; i++) {\n\n const info = explore[i];\n const item = info.instance;\n\n if (visited.has(item)) {\n continue;\n }\n\n const allKeys = [\n ...Object.getOwnPropertyNames(item),\n ...Object.getOwnPropertySymbols(item),\n ];\n\n for (const key of allKeys) {\n\n const descriptor = Object.getOwnPropertyDescriptor(item, key);\n\n const isCallable = this.isCallableMethod(descriptor, key);\n\n onDiscover(info, {\n name: key,\n isCallable\n });\n\n if (this.canExplore(descriptor) === false) {\n continue;\n }\n\n const path = this.getPath(info, key);\n explore.push({ instance: descriptor.value, parent: info, propertyName: key, path });\n }\n\n visited.add(item);\n }\n }\n\n abstract apply(instance: unknown): void;\n}","import { PerformanceMetrics } from \"../types\";\n\nexport class PerformanceTracker {\n private methodTimings = new Map<string, { startTime: number; nextMethodStartTime?: number }>();\n private operationStartTimes = new Map<string, number>();\n\n startMethodTiming(operationId: string, methodPath: string): number {\n const startTime = performance.now();\n const key = `${operationId}:${methodPath}`;\n\n // Track operation start time for delta calculations\n if (!this.operationStartTimes.has(operationId)) {\n this.operationStartTimes.set(operationId, startTime);\n }\n\n this.methodTimings.set(key, { startTime });\n return startTime;\n }\n\n recordNextMethodStart(operationId: string, methodPath: string): void {\n const key = `${operationId}:${methodPath}`;\n const timing = this.methodTimings.get(key);\n if (timing) {\n timing.nextMethodStartTime = performance.now();\n }\n }\n\n endMethodTiming(operationId: string, methodPath: string): PerformanceMetrics {\n const endTime = performance.now();\n const key = `${operationId}:${methodPath}`;\n const timing = this.methodTimings.get(key);\n\n if (!timing) {\n return { startTime: endTime };\n }\n\n const duration = endTime - timing.startTime;\n const timeToNextCall = timing.nextMethodStartTime ?\n timing.nextMethodStartTime - timing.startTime : undefined;\n\n // Clean up\n this.methodTimings.delete(key);\n\n return {\n startTime: timing.startTime,\n endTime,\n duration,\n nextMethodStartTime: timing.nextMethodStartTime,\n timeToNextCall\n };\n }\n\n formatDuration(milliseconds: number): string {\n if (milliseconds < 1) {\n return `${(milliseconds * 1000).toFixed(1)}μs`;\n } else if (milliseconds < 1000) {\n return `${milliseconds.toFixed(2)}ms`;\n } else {\n return `${(milliseconds / 1000).toFixed(2)}s`;\n }\n }\n\n getDeltaFromOperationStart(operationId: string, currentTime: number): number {\n const operationStartTime = this.operationStartTimes.get(operationId);\n return operationStartTime ? currentTime - operationStartTime : 0;\n }\n\n cleanupOperation(operationId: string): void {\n this.operationStartTimes.delete(operationId);\n }\n}","import { uuid } from \"../../utilities\";\n\nexport class CallTraceManager {\n private activeOperationId: string | null = null;\n private activeCallStack: string[] = [];\n\n startNewOperation(): string {\n const operationId = uuid(8);\n this.activeOperationId = operationId;\n this.activeCallStack = [];\n return operationId;\n }\n\n isNewOperation(): boolean {\n return this.activeOperationId === null;\n }\n\n getActiveOperationId(): string {\n if (!this.activeOperationId) {\n throw new Error('No active operation context');\n }\n return this.activeOperationId;\n }\n\n addMethodToTrace(methodPath: string): string[] {\n if (this.isNewOperation()) {\n this.activeCallStack = [methodPath];\n } else {\n this.activeCallStack.push(methodPath);\n }\n return [...this.activeCallStack];\n }\n\n removeMethodFromTrace(): void {\n if (!this.isNewOperation()) {\n this.activeCallStack.pop();\n }\n }\n\n endOperation(): void {\n this.activeOperationId = null;\n this.activeCallStack = [];\n }\n\n formatMethodPaths(methodPaths: string[]): string[] {\n return methodPaths.map(path => path.replace(/ → /g, '.'));\n }\n\n getCurrentTrace(): string[] {\n return [...this.activeCallStack];\n }\n}","import { stringifyObject } from \"../utilities\";\nimport { Capability } from \"./Capability\";\nimport { PerformanceTracker } from \"./performance/PerformanceTracker\";\nimport { CallTraceManager } from \"./tracing/CallTraceManager\";\nimport { MethodInfoMetadata, MethodInfo } from \"./types\";\nimport { logger } from '../utilities';\n\nexport type PerformanceCapabilityOptions = {\n filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean\n}\n\nexport class PerformanceCapability extends Capability {\n\n private callTraceManager: CallTraceManager;\n private performanceTracker: PerformanceTracker;\n private filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean;\n private childDurations: Map<string, number[]> = new Map();\n\n constructor(options?: PerformanceCapabilityOptions) {\n super();\n this.filter = options?.filter ?? (() => true)\n this.callTraceManager = new CallTraceManager();\n this.performanceTracker = new PerformanceTracker();\n }\n\n override apply(instance: unknown): void {\n\n this.explore(instance, (meta, info) => {\n\n if (info.isCallable) {\n const originalMethod = meta.instance[info.name].bind(meta.instance);\n\n meta.instance[info.name] = (...args: any[]) => {\n\n const path = `${meta.path!}.${String(info.name)}()`;\n\n if (this.filter(path, info, meta) === false) {\n return originalMethod(...args);\n }\n\n const isNewOperation = this.callTraceManager.isNewOperation();\n let operationId: string;\n let callTrace: string[];\n let depth: number;\n\n if (isNewOperation) {\n operationId = this.callTraceManager.startNewOperation();\n this.childDurations.set(operationId, []);\n callTrace = this.callTraceManager.addMethodToTrace(path);\n depth = callTrace.length - 1;\n const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);\n\n this.performanceTracker.startMethodTiming(operationId, path);\n\n logger.log(`\\n${'═'.repeat(60)}`);\n logger.log(`▶ ORIGIN [${operationId}] ${path}`);\n if (args.length > 0) {\n logger.log(` Args:`, stringifyObject(args, 4, 0));\n }\n logger.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);\n } else {\n operationId = this.callTraceManager.getActiveOperationId();\n callTrace = this.callTraceManager.addMethodToTrace(path);\n depth = callTrace.length - 1;\n const indent = ' '.repeat(Math.min(depth, 4));\n\n // Track children for this child method too\n const childMethodKey = `${operationId}:${path}`;\n this.childDurations.set(childMethodKey, []);\n\n this.performanceTracker.startMethodTiming(operationId, path);\n\n logger.log(`${indent}└─ CHILD [${operationId}] ${path}`);\n if (args.length > 0) {\n logger.log(`${indent} Args:`, stringifyObject(args, 4, 0));\n }\n }\n\n try {\n return originalMethod(...args);\n } finally {\n const metrics = this.performanceTracker.endMethodTiming(operationId, path);\n const duration = metrics.duration ?? 0;\n const formattedDuration = this.performanceTracker.formatDuration(duration);\n\n if (isNewOperation) {\n const childDurations = this.childDurations.get(operationId) ?? [];\n const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);\n const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);\n const overhead = duration - totalChildTime;\n const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));\n\n logger.log(`\\n${'═'.repeat(60)}`);\n logger.log(`◀ COMPLETE [${operationId}] ${path}`);\n logger.log(` Total Duration: ${formattedDuration}`);\n if (childDurations.length > 0) {\n logger.log(` Children Duration: ${formattedTotalChildTime} (${childDurations.length} calls)`);\n logger.log(` Overhead: ${formattedOverhead}`);\n }\n logger.log(`${'═'.repeat(60)}\\n`);\n\n this.childDurations.delete(operationId);\n this.performanceTracker.cleanupOperation(operationId);\n this.callTraceManager.endOperation();\n } else {\n const indent = ' '.repeat(Math.min(depth, 4));\n const childMethodKey = `${operationId}:${path}`;\n const childDurations = this.childDurations.get(childMethodKey) ?? [];\n const totalChildTime = childDurations.reduce((sum, d) => sum + d, 0);\n const formattedTotalChildTime = this.performanceTracker.formatDuration(totalChildTime);\n const overhead = duration - totalChildTime;\n const formattedOverhead = this.performanceTracker.formatDuration(Math.max(0, overhead));\n\n logger.log(`${indent} ✓ ${formattedDuration}`);\n if (childDurations.length > 0) {\n logger.log(`${indent} Children: ${formattedTotalChildTime} (${childDurations.length} calls), Overhead: ${formattedOverhead}`);\n }\n\n // Clean up child method tracking\n this.childDurations.delete(childMethodKey);\n\n // Find the parent method and add this duration to its children list\n // The parent is the method one level up in the call trace\n const currentTrace = this.callTraceManager.getCurrentTrace();\n if (currentTrace.length > 1) {\n // Parent is the second-to-last item in the trace (before we remove current)\n const parentPath = currentTrace[currentTrace.length - 2];\n\n // Check if parent is the root operation (trace length 2 means root + this child)\n if (currentTrace.length === 2) {\n // Direct child of root - add to root's children list\n const rootChildDurations = this.childDurations.get(operationId);\n if (rootChildDurations) {\n rootChildDurations.push(duration);\n }\n } else {\n // Nested child - add to parent method's children list\n const parentMethodKey = `${operationId}:${parentPath}`;\n const parentChildDurations = this.childDurations.get(parentMethodKey);\n if (parentChildDurations) {\n parentChildDurations.push(duration);\n }\n }\n }\n }\n\n this.callTraceManager.removeMethodFromTrace();\n }\n }\n }\n });\n }\n}","import { Capability } from \"./Capability\";\nimport { CallTraceManager } from \"./tracing/CallTraceManager\";\nimport { stringifyObject } from \"../utilities/strings\";\nimport { MethodInfo, MethodInfoMetadata } from \"./types\";\n\nexport type TracingCapabilityOptions = {\n filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean\n}\n\nexport class TracingCapability extends Capability {\n\n private callTraceManager: CallTraceManager;\n private filter: (methodName: string | symbol, methodInfo: MethodInfo, metadata: MethodInfoMetadata) => boolean;\n\n constructor(options?: TracingCapabilityOptions) {\n super();\n this.filter = options?.filter ?? (() => true);\n this.callTraceManager = new CallTraceManager();\n }\n\n override apply(instance: unknown): void {\n\n this.explore(instance, (meta, info) => {\n\n if (info.isCallable) {\n\n const originalMethod = meta.instance[info.name].bind(meta.instance);\n\n meta.instance[info.name] = (...args: any[]) => {\n\n const path = `${meta.path!}.${String(info.name)}()`;\n\n if (this.filter(path, info, meta) === false) {\n return originalMethod(...args);\n }\n\n const isNewOperation = this.callTraceManager.isNewOperation();\n let operationId: string;\n\n if (isNewOperation) {\n operationId = this.callTraceManager.startNewOperation();\n const callTrace = this.callTraceManager.addMethodToTrace(path);\n const formattedCallTrace = this.callTraceManager.formatMethodPaths(callTrace);\n\n console.log(`\\n${'═'.repeat(60)}`);\n console.log(`▶ ORIGIN [${operationId}] ${path}`);\n if (args.length > 0) {\n console.log(` Args:`, stringifyObject(args, 4, 0));\n }\n console.log(` Call Stack: ${formattedCallTrace.join(' → ')}`);\n } else {\n operationId = this.callTraceManager.getActiveOperationId();\n const callTrace = this.callTraceManager.addMethodToTrace(path);\n\n const indent = ' '.repeat(Math.min(callTrace.length - 1, 4));\n console.log(`${indent}└─ CHILD [${operationId}] ${path}`);\n if (args.length > 0) {\n console.log(`${indent} Args:`, stringifyObject(args, 4, 0));\n }\n }\n\n try {\n return originalMethod(...args);\n } finally {\n this.callTraceManager.removeMethodFromTrace();\n\n if (isNewOperation) {\n this.callTraceManager.endOperation();\n }\n }\n }\n }\n\n });\n }\n}","export { Capability } from './Capability';\nexport { PerformanceCapability } from './PerformanceCapability';\nexport { TracingCapability } from './TracingCapability';\nexport * from './types';","import { uuid } from \"../utilities\";\nimport { CreateBlockOptions } from \"./types\";\n\ntype Line = string | Block;\n\ntype Param = { name: string, value: any };\ntype GenericParam = { name: string, callName: string };\n\n\nexport abstract class Block {\n readonly name: string;\n protected _lines: Line[] = [];\n protected _indent: string = \"\";\n protected _parent?: Block;\n\n constructor(name?: string, parentIndent: string = \"\", parent?: Block) {\n this.name = name != null ? name : uuid();\n this._indent = parentIndent;\n this._parent = parent;\n }\n\n indexOf(name: string) {\n return this._lines.findIndex(w => typeof w !== \"string\" && w.name === name);\n }\n\n getLines() {\n return this._lines;\n }\n\n getParent() {\n return this._parent;\n }\n\n getIndent() {\n return this._indent;\n }\n\n setLines(lines: Line[]) {\n this._lines = lines;\n }\n\n setParent(block: Block) {\n this._parent = block;\n }\n\n setIndent(indent: string) {\n this._indent = indent;\n }\n\n getOrDefault<T extends Block>(name: string): T | undefined {\n\n if (name.includes('.') === false) {\n return this._lines.find(w => typeof w !== \"string\" && w.name === name) as T | undefined;\n }\n\n const split = name.match(/(\\[[^\\]]+\\]|[^.]+)/g);\n // oxlint-disable-next-line no-this-alias\n let result: Block = this;\n\n for (const item of split) {\n const found = result._lines.find(w => typeof w !== \"string\" && w.name === item) as Block;\n\n if (found == null) {\n\n if (\"getValue\" in result && result.getValue instanceof Block && result.getValue.name === item) {\n result = result.getValue;\n continue;\n }\n\n return undefined;\n }\n\n result = found;\n }\n\n return result as T;\n }\n\n get<T extends Block>(name: string): T {\n const found = this.getOrDefault(name);\n\n if (found == null) {\n throw new Error(`Error finding code block for given path. Path: ${name}`)\n }\n\n return found as T;\n }\n\n has(name: string) {\n return this._lines.some(w => typeof w !== \"string\" && w.name === name);\n }\n\n remove(name: string) {\n this._lines = this._lines.filter(x => typeof x === \"object\" && typeof x.name === \"string\" && x.name !== name);\n }\n\n replace(name: string, line: Block) {\n\n const foundIndex = this._lines.findIndex(x => typeof x !== \"string\" && x.name === name);\n\n if (foundIndex === -1) {\n throw new Error(`Cannot find line by name. Name: ${name}`)\n }\n\n const found = this._lines[foundIndex];\n\n if (typeof found === \"string\") {\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n return;\n }\n\n line.setLines(found.getLines());\n line.setIndent(found.getIndent());\n line.setParent(found.getParent());\n\n // Replace the line\n this._lines.splice(foundIndex, 1, line);\n\n return;\n }\n\n protected push(line: Line) {\n this._lines.push(line);\n }\n\n protected unshift(line: Line) {\n this._lines.unshift(line);\n }\n\n protected indent(text: string): string {\n return this._indent + text;\n }\n\n\n abstract toString(): string;\n}\n\nexport abstract class ContainerBlock extends Block {\n if(condition: string, options?: CreateBlockOptions): IfBuilder {\n const builder = new IfBuilder(condition, options?.name, this._indent + \" \", this);\n if (options?.unshift === true) {\n this.unshift(builder);\n } else {\n this.push(builder);\n }\n\n return builder;\n }\n\n raw(raw: string, options?: CreateBlockOptions): RawBuilder {\n const builder = new RawBuilder(raw, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n function(name?: string, options?: CreateBlockOptions): FunctionBuilder {\n const builder = new FunctionBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n factory(name?: string, options?: CreateBlockOptions): FunctionFactoryBuilder {\n const builder = new FunctionFactoryBuilder(name, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n variable(declaration: string, options?: CreateBlockOptions): VariableBuilder {\n const builder = new VariableBuilder(declaration, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n assign(variableName: string, options?: CreateBlockOptions): AssignmentBuilder {\n const builder = new AssignmentBuilder(variableName, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const builder = new ObjectBuilder(options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n slot(name: string) {\n const builder = new SlotBlock(name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n\n array(accessor: string, options?: CreateBlockOptions) {\n const builder = new ArrayBuilder(accessor, options?.name, this._indent + \" \", this);\n this.push(builder);\n return builder;\n }\n}\n\nexport type StringType = \"template\" | \"default\";\n\nexport class StringBuilder extends Block {\n\n private _type: StringType;\n\n constructor(type: StringType, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._type = type;\n }\n\n append(value: string) {\n this._lines.push(value);\n return this;\n }\n\n toString() {\n if (this._type === \"template\") {\n return \"`\" + this._lines.join(\"\") + \"`\";\n }\n\n return `\"${this._lines.join(\"\")}\"`;\n }\n}\n\nexport class SlotBlock extends ContainerBlock {\n\n constructor(name: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n }\n\n insert(line: string | Block) {\n this.push(line);\n }\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}\n\nexport class AssignmentBuilder extends ContainerBlock {\n protected _variableName: string;\n protected _value?: string | Block;\n protected _functionName?: string;\n\n get getValue() {\n return this._value;\n }\n\n constructor(variableName: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._variableName = variableName;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n and(and: string, options?: CreateBlockOptions): this {\n this._value = new AndBuilder(and, options?.name, this._indent, this);\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n call(functionName: string, options?: CreateBlockOptions): ObjectBuilder {\n this._functionName = functionName;\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n string(type: StringType, options?: CreateBlockOptions) {\n const stringBuilder = new StringBuilder(type, options?.name, this._indent, this);\n\n this._value = stringBuilder;\n\n return stringBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for AssignmentBuilder Builder\")\n }\n\n if (this._functionName != null) {\n return this.indent(`${this._variableName} = ${this._functionName}(${this._value.toString()});`);\n }\n\n return this.indent(`${this._variableName} = ${this._value.toString()};`);\n }\n}\n\nexport class AndBuilder extends ContainerBlock {\n\n constructor(and: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(and);\n }\n\n and(and: string) {\n this._lines.push(and);\n }\n\n toString() {\n return this._lines.join(\" && \")\n }\n}\n\nexport class VariableBuilder extends Block {\n protected _declaration: string;\n protected _value?: string | Block;\n\n get getValue() {\n return this._value;\n }\n\n constructor(declaration: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._declaration = declaration;\n }\n\n value(value: string): this {\n this._value = value;\n return this;\n }\n\n object(options?: CreateBlockOptions): ObjectBuilder {\n const objectBuilder = new ObjectBuilder(options?.name, this._indent, this);\n\n this._value = objectBuilder;\n\n return objectBuilder;\n }\n\n array(accessor: string, options?: CreateBlockOptions): ArrayBuilder {\n const arrayBuilder = new ArrayBuilder(accessor, options?.name, this._indent, this);\n\n this._value = arrayBuilder;\n\n return arrayBuilder;\n }\n\n toString(): string {\n\n if (this._value == null) {\n throw new Error(\"Value cannot be null for Variable Builder\")\n }\n\n return this.indent(`const ${this._declaration} = ${this._value.toString()};`);\n }\n}\n\nexport class RawBuilder extends ContainerBlock {\n private _raw: string;\n\n constructor(raw: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._raw = raw;\n }\n\n toString(): string {\n return `${this._raw}\\n`;\n }\n}\n\nexport class ObjectBuilder extends Block {\n\n property(line: string) {\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n this.push(line);\n return this;\n }\n\n nested(propertyName: string, name?: string) {\n const builder = new ObjectBuilder(name, this._indent + \" \", this);\n // Add comma to previous line if it exists and isn't a brace\n if (this._lines.length > 0) {\n const lastLine = this._lines[this._lines.length - 1];\n if (typeof lastLine === 'string' && !lastLine.endsWith(\"{\")) {\n this._lines[this._lines.length - 1] = lastLine + \",\";\n }\n }\n // Add the property name and opening brace\n this.push(`${propertyName}: {`);\n // Add the nested builder\n this.push(builder);\n // Add the closing brace\n this.push(\"}\");\n return builder;\n }\n\n toString(): string {\n // Check if this is a nested object's content\n const isNestedContent = this._parent instanceof ObjectBuilder;\n\n if (isNestedContent) {\n // For nested object contents, just return the lines\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ).join('\\n');\n }\n\n // For root objects, include the braces\n const lines = [\n \"{\",\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionFactoryBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: Param[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n getParameters() {\n return [...this._params];\n }\n\n createParameter(value: any): Param {\n const name = `injection${this._params.length}`;\n return {\n name,\n value\n }\n }\n\n parameters(...params: Param[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n invoke() {\n const body = this.toString();\n const parameterNames = this._getParameterNames();\n const parameterValues = this._getParameterValues();\n\n return Function(...parameterNames, body)(...parameterValues)\n }\n\n private _getParameterNames() {\n return this._params.map(w => w.name).join(\", \")\n }\n\n private _getParameterValues() {\n return this._params.map(w => w.value);\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterNames()})`\n : `${r}function(${this._getParameterNames()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class FunctionBuilder extends ContainerBlock {\n private _functionName?: string;\n private _params: (string | GenericParam)[] = [];\n private _return: boolean = false;\n\n constructor(functionName?: string, sectionName?: string, parentIndent: string = \"\", parent?: Block) {\n super(sectionName, parentIndent, parent);\n this._functionName = functionName;\n }\n\n parameters(...params: (string | GenericParam)[]): this {\n this._params.push(...params);\n return this;\n }\n\n return() {\n this._return = true;\n return this;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n private _getParameterKeys() {\n return this._params.map(w => typeof w === \"object\" ? w.name : w).join(\", \")\n }\n\n toCallable() {\n return `${this._functionName}(${this._params.map(w => typeof w === \"object\" ? w.callName : w).join(\", \")})`\n }\n\n toString(): string {\n const r = this._return === true ? \"return \" : \"\";\n const signature = this._functionName\n ? `${r}function ${this._functionName}(${this._getParameterKeys()})`\n : `${r}function(${this._getParameterKeys()})`;\n\n const lines = [\n this.indent(signature + \" {\"),\n ...this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(\" \" + line)\n : line.toString()\n ),\n this.indent(\"}\")\n ];\n\n return lines.join('\\n');\n }\n}\n\nexport class ArrayBuilder extends Block {\n constructor(accessor: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._lines.push(accessor);\n }\n\n append(accessor: string) {\n this._lines.push(accessor);\n return this;\n }\n\n toString() {\n return `[${this._lines.join(\",\")}]`\n }\n}\n\nexport class IfBuilder extends ContainerBlock {\n private _condition: string;\n\n constructor(condition: string, name?: string, parentIndent: string = \"\", parent?: Block) {\n super(name, parentIndent, parent);\n this._condition = condition;\n }\n\n appendBody(line: string): this {\n this.push(line);\n return this;\n }\n\n unshiftBody(line: string): this {\n this.unshift(line);\n return this;\n }\n\n private stringifyLine(line: Line) {\n if (typeof line === 'string') {\n return this.indent(\" \" + line);\n }\n\n if (Array.isArray(line)) {\n return line.join(\"\\r\\n\")\n }\n\n return line.toString();\n }\n\n toString(): string {\n // need to join with \\r\\n because we are not an object\n const lines = [\n this.indent(`if (${this._condition}) {`),\n this._lines.map(x => this.stringifyLine(x)).join(\"\\r\\n\"),\n this.indent(\"}\")\n ]\n\n return lines.join(\"\\n\\n\");\n }\n}\n\nexport class CodeBuilder extends ContainerBlock {\n\n toString(): string {\n return this._lines.map(line =>\n typeof line === 'string'\n ? this.indent(line)\n : line.toString()\n ).join('\\n\\n');\n }\n}","export * from './blocks';\nexport * from './types';","import { EntityUpdateInfo } from \"../plugins/types\";\nimport { InferCreateType, InferType, SchemaId } from \"../schema\";\nimport { TagCollection } from \"./TagCollection\";\nexport class BulkPersistResult extends Map<SchemaId, SchemaPersistResult> {\n\n resolve<T extends {} = Record<string, unknown>>(schemaId: SchemaId): SchemaPersistResult<T> {\n if (this.has(schemaId)) {\n return this.get(schemaId);\n }\n\n this.set(schemaId, new SchemaPersistResult<T>());\n\n return this.get(schemaId);\n }\n\n override get<T extends {} = Record<string, unknown>>(schemaId: SchemaId) {\n return super.get(schemaId) as SchemaPersistResult<T>\n }\n\n get aggregate() {\n return {\n size: this.aggregateSize,\n adds: this.aggregateAddsSize,\n updates: this.aggregateUpdatesSize,\n removes: this.aggregateRemovesSize\n }\n }\n\n private get aggregateSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.total;\n }\n\n return count;\n }\n\n private get aggregateAddsSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.adds.length;\n }\n\n return count;\n }\n\n private get aggregateUpdatesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.updates.length;\n }\n\n return count;\n }\n\n private get aggregateRemovesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.removes.length;\n }\n\n return count;\n }\n}\n\nexport class BulkPersistChanges extends Map<SchemaId, SchemaPersistChanges> {\n\n resolve<T extends {} = Record<string, unknown>>(schemaId: SchemaId): SchemaPersistChanges<T> {\n if (this.has(schemaId)) {\n return this.get(schemaId);\n }\n\n this.set(schemaId, new SchemaPersistChanges<T>());\n\n return this.get(schemaId);\n }\n\n override get<T extends {} = Record<string, unknown>>(schemaId: SchemaId) {\n return super.get(schemaId) as SchemaPersistChanges<T>\n }\n\n get aggregate() {\n return {\n size: this.aggregateSize,\n adds: this.aggregateAddsSize,\n updates: this.aggregateUpdatesSize,\n removes: this.aggregateRemovesSize\n }\n }\n\n private get aggregateSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.total;\n }\n\n return count;\n }\n\n private get aggregateAddsSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.adds.length;\n }\n\n return count;\n }\n\n private get aggregateUpdatesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.updates.length;\n }\n\n return count;\n }\n\n private get aggregateRemovesSize() {\n let count = 0;\n\n for (const [, result] of this) {\n count += result.removes.length;\n }\n\n return count;\n }\n\n /**\n * Ensures the result has the same result sets as the change sets\n * @returns \n */\n toResult() {\n const result = new BulkPersistResult();\n\n for (const [schemaId] of this) {\n result.set(schemaId, new SchemaPersistResult());\n }\n\n return result;\n }\n}\n\nexport class SchemaPersistChanges<T extends {} = Record<string, unknown>> {\n adds: InferCreateType<T>[] = [];\n updates: EntityUpdateInfo<T>[] = [];\n removes: InferType<T>[] = [];\n tags: TagCollection = new TagCollection();\n\n get hasItems() {\n return this.total > 0;\n }\n\n get total() {\n return this.adds.length + this.updates.length + this.removes.length;\n }\n}\n\nexport class SchemaPersistResult<T extends {} = Record<string, unknown>> {\n adds: InferType<T>[] = [];\n updates: InferType<T>[] = [];\n removes: InferType<T>[] = [];\n\n get hasItems() {\n return this.total > 0;\n }\n\n get total() {\n return this.adds.length + this.updates.length + this.removes.length;\n }\n}","import { CompiledSchema, SchemaId } from \"../schema\";\n\n/**\n * Collection of schemas with generic typing for type-safe schema retrieval\n */\nexport class ReadonlySchemaCollection {\n\n protected data: Map<SchemaId, CompiledSchema<Record<string, unknown>>>;\n\n constructor(data?: [SchemaId, CompiledSchema<Record<string, unknown>>][]) {\n this.data = new Map<SchemaId, CompiledSchema<Record<string, unknown>>>(data);\n }\n\n get<T>(schemaId: SchemaId): CompiledSchema<T> | undefined {\n return this.data.get(schemaId) as CompiledSchema<T> | undefined;\n }\n\n has(schemaId: SchemaId): boolean {\n return this.data.has(schemaId);\n }\n\n get size(): number {\n return this.data.size;\n }\n\n keys(): IterableIterator<SchemaId> {\n return this.data.keys();\n }\n\n values(): IterableIterator<CompiledSchema<Record<string, unknown>>> {\n return this.data.values();\n }\n\n entries(): IterableIterator<[SchemaId, CompiledSchema<Record<string, unknown>>]> {\n return this.data.entries();\n }\n\n forEach(callbackfn: (value: CompiledSchema<Record<string, unknown>>, key: SchemaId, map: Map<SchemaId, CompiledSchema<Record<string, unknown>>>) => void, thisArg?: any): void {\n this.data.forEach(callbackfn, thisArg);\n }\n\n [Symbol.iterator](): IterableIterator<[SchemaId, CompiledSchema<Record<string, unknown>>]> {\n return this.data[Symbol.iterator]();\n }\n\n getByName<T>(collectionName: string): CompiledSchema<T> | undefined {\n const found = [...this.data].find(x => x[1].collectionName === collectionName);\n\n if (found != null) {\n return found[1] as CompiledSchema<T>;\n }\n\n return undefined;\n }\n}","import { CompiledSchema, SchemaId } from \"../schema\";\nimport { ReadonlySchemaCollection } from \"./ReadonlySchemaCollection\";\n\n/**\n * Collection of schemas with generic typing for type-safe schema retrieval\n */\nexport class SchemaCollection extends ReadonlySchemaCollection {\n\n set<T>(schemaId: SchemaId, schema: CompiledSchema<T>): this {\n this.data.set(schemaId, schema as CompiledSchema<Record<string, unknown>>);\n return this;\n }\n\n delete(schemaId: SchemaId): boolean {\n return this.data.delete(schemaId);\n }\n\n clear(): void {\n this.data.clear();\n }\n}","export class TagCollection implements Disposable {\n\n private data: Map<object, unknown> = new Map<object, unknown>();\n\n // Delegated to the map rather than tracked in a counter field: every mutation path\n // (set, setMany, combine, delete, dispose) would otherwise have to maintain it, and\n // a missed path silently reports a size that disagrees with the contents.\n get size() {\n return this.data.size;\n }\n\n get(key: object) {\n return this.data.get(key);\n }\n\n has(key: object) {\n return this.data.has(key);\n }\n\n set(key: object, tag: unknown) {\n return this.data.set(key, tag);\n }\n\n delete(key: object) {\n return this.data.delete(key);\n }\n\n setMany(keys: object[], tag: unknown) {\n for (let i = 0, length = keys.length; i < length; i++) {\n const key = keys[i];\n this.set(key, tag);\n }\n }\n\n combine(tags: TagCollection) {\n for (const [key, value] of tags) {\n this.set(key, value);\n }\n }\n\n values() {\n return this.data.values();\n }\n\n keys() {\n return this.data.keys();\n }\n\n [Symbol.dispose]() {\n this.data.clear();\n }\n\n [Symbol.iterator]() {\n return this.data[Symbol.iterator]();\n }\n}","import { IdType } from \"../schema\";\n\nexport class IdSet {\n\n readonly ids: readonly IdType[];\n\n constructor(...ids: IdType[]) {\n this.ids = Object.freeze(ids);\n }\n\n equals(other: IdSet): boolean {\n\n if (this.ids.length === 1) {\n return this.ids[0] === other.ids[0];\n }\n\n return this.toString() === other.toString();\n }\n\n toString(): string {\n\n if (this.ids.length === 1) {\n return String(this.ids[0]);\n }\n\n return this.ids.toString();\n }\n}","import { CompiledSchema, IdType, InferType, PropertyInfo, SchemaTypes } from \"../schema\";\nimport { CallbackResult, Result } from \"../results\";\nimport { uuidv4 } from \"../utilities\";\nimport { IdSet } from \"./IdSet\";\n\nexport class MemoryDataCollection {\n\n protected readonly nextNumericalIds: Map<string, number>;\n protected readonly data: Map<string, Record<string, unknown>>;\n protected readonly schema: CompiledSchema<any>;\n protected readonly idProperties: PropertyInfo<any>[];\n\n get size() {\n return this.data.size;\n }\n\n get records() {\n return [...this.data.values()];\n }\n\n /** Iterates stored records without materializing them into an array. */\n values(): IterableIterator<Record<string, unknown>> {\n return this.data.values();\n }\n\n constructor(schema: CompiledSchema<any>) {\n this.data = new Map<string, Record<string, unknown>>();\n this.nextNumericalIds = new Map<string, number>();\n this.schema = schema;\n this.idProperties = schema.idProperties;\n }\n\n private _getNextId(property: PropertyInfo<any>) {\n\n let nextId = 1;\n\n if (this.nextNumericalIds.has(property.id) === true) {\n nextId = this.nextNumericalIds.get(property.id) + 1;\n }\n\n this.nextNumericalIds.set(property.id, nextId);\n\n return nextId;\n }\n\n private resolveId(property: PropertyInfo<any>, value: unknown) {\n if (typeof value !== \"number\") {\n return;\n }\n\n const currentIdForProperty = this.nextNumericalIds.get(property.id);\n\n if (value <= currentIdForProperty) {\n return;\n }\n\n this.nextNumericalIds.set(property.id, value);\n }\n\n private getAndSetId(item: Record<string, unknown>, property: PropertyInfo<any>): IdType {\n if (item[property.name] != null) {\n return item[property.name] as IdType;\n }\n\n if (property.type === SchemaTypes.String) {\n const uuid = uuidv4()\n item[property.name] = uuid;\n return uuid;\n }\n\n if (property.type === SchemaTypes.Number) {\n const id = this._getNextId(property);\n item[property.name] = id;\n return id;\n }\n\n throw new Error(`Id Property '${property.name}' must be string or number, found '${property.type}'`)\n }\n\n seed(items: Record<string, unknown>[]) {\n for (let i = 0, length = items.length; i < length; i++) {\n const id = this.resolveIdSet(items[i] as InferType<unknown>);\n this.data.set(id.toString(), items[i]);\n }\n }\n\n private resolveCurrentIdSet(item: Record<string, unknown>): IdSet {\n const idProperties = this.schema.idProperties;\n const ids: IdType[] = [];\n // ensure keys\n for (let j = 0, l = idProperties.length; j < l; j++) {\n const property = idProperties[j];\n const value = property.getValue(item);\n\n if (value == null) {\n throw new Error(`Key cannot be null. Key: ${property.name}`);\n }\n\n ids.push(value);\n }\n\n return new IdSet(...ids);\n }\n\n private resolveIdSet(item: Record<string, unknown>): IdSet {\n\n if (this.schema.hasIdentityKeys) {\n const idProperties = this.schema.idProperties;\n const ids: IdType[] = Array.from({ length: idProperties.length });\n\n // Need to make sure we allow for seeding the collection when we call add vs seed\n // There will be an existing id, but the id type could still be identity\n if (idProperties.length === 1) {\n const value = this.getAndSetId(item, idProperties[0]);\n this.resolveId(idProperties[0], value);\n ids[0] = value;\n } else {\n for (let j = 0, l = idProperties.length; j < l; j++) {\n const value = this.getAndSetId(item, idProperties[j]);\n this.resolveId(idProperties[j], value);\n ids[j] = value;\n }\n }\n\n return new IdSet(...ids);\n }\n\n return this.resolveCurrentIdSet(item);\n }\n\n add(item: Record<string, unknown>) {\n const id = this.resolveIdSet(item);\n this.data.set(id.toString(), item);\n }\n\n /**\n * Adds a record only when no record with the same key is present. Durable\n * collections use this to hydrate stored records around in-memory mutations\n * without clobbering them.\n */\n addIfAbsent(item: Record<string, unknown>) {\n const id = this.resolveIdSet(item);\n const key = id.toString();\n\n if (this.data.has(key) === false) {\n this.data.set(key, item);\n }\n }\n\n /**\n * Looks up a single record by its key values without scanning the collection.\n * @param ids Key values in schema id property order\n * @returns The matching record or undefined when no record has the given key\n */\n getByIds(ids: IdType[]): Record<string, unknown> | undefined {\n return this.data.get(new IdSet(...ids).toString());\n }\n\n remove(item: Record<string, unknown>) {\n const id = this.resolveCurrentIdSet(item);\n this.data.delete(id.toString());\n }\n\n update(item: Record<string, unknown>) {\n const id = this.resolveCurrentIdSet(item);\n this.data.set(id.toString(), item);\n }\n\n destroy(done: CallbackResult<never>) {\n this.nextNumericalIds.clear();\n this.data.clear();\n done(Result.success());\n }\n\n load(done: CallbackResult<never>) {\n done(Result.success())\n }\n\n save(done: CallbackResult<never>) {\n done(Result.success())\n }\n}","export * from './Changes';\nexport * from './TagCollection';\nexport * from './IdSet';\nexport * from './MemoryDataCollection';\nexport * from './SchemaCollection';\nexport * from './ReadonlySchemaCollection';","import { IdType } from \"../schema\";\n\n/**\n * A save was rejected because another writer changed one of its rows first.\n *\n * Raised when a schema declares a `.concurrency()` token and an update's expected token\n * no longer matches the stored row. The whole save is rolled back — nothing was applied.\n * The caller's recovery is always the same: re-read the conflicted rows (the re-read\n * merges fresh values into the canonical instances), reapply the intent, and save again.\n */\nexport class OptimisticConcurrencyError extends Error {\n\n /** The collection whose rows conflicted. */\n readonly collectionName: string;\n /** Ids of the rows whose stored token no longer matched the writer's read. */\n readonly conflicts: IdType[];\n\n constructor(collectionName: string, conflicts: IdType[]) {\n super(\n `Optimistic concurrency conflict on '${collectionName}': ${conflicts.length} row(s) were changed by another writer after they were read. ` +\n `Nothing was saved. Re-read the rows, reapply the changes, and save again. Conflicted ids: ${conflicts.map(String).join(\", \")}`\n );\n this.name = \"OptimisticConcurrencyError\";\n this.collectionName = collectionName;\n this.conflicts = conflicts;\n }\n\n /** Type guard that survives errors crossing realm/serialization boundaries. */\n static is(error: unknown): error is OptimisticConcurrencyError {\n return error instanceof OptimisticConcurrencyError\n || (error != null && typeof error === \"object\" && (error as Error).name === \"OptimisticConcurrencyError\");\n }\n}\n","/**\n * A write that was accepted but never reached the database, because the plugin holding it was\n * destroyed first — or one submitted after the destroy.\n *\n * Distinct from a backend failure on purpose: nothing was attempted, so a caller that retries\n * on transient errors must not retry this one. There is no database left to retry against.\n */\nexport class PluginDestroyedError extends Error {\n\n constructor(reason: string) {\n super(`The plugin was destroyed: ${reason}`);\n this.name = \"PluginDestroyedError\";\n }\n}\n","export class SchemaError extends Error {\n\n constructor(error: any, innerErrorMessage: string) {\n super(`Error: ${error.message}; Inner Error: ${innerErrorMessage}`);\n }\n}","export { SchemaError } from './SchemaError';\nexport { OptimisticConcurrencyError } from './OptimisticConcurrencyError';\nexport { PluginDestroyedError } from './PluginDestroyedError';\n","import { ExpressionType } from \"./types\";\n\nexport const EXPRESSION_TYPES: ExpressionType[] = [\n \"operator\",\n \"comparator\",\n \"property\",\n \"value\",\n \"empty\",\n \"not-parsable\",\n];\n","import { isComparatorExpression, isOperatorExpression, isPropertyExpression, isValueExpression } from \"../assertions\";\nimport { UnknownRecord } from \"../utilities\";\nimport { Comparator, Expression, Transformer } from \"./types\";\n\n/**\n * Runs a parsed expression against a row.\n *\n * The counterpart to `toSql` and `toMql`: those turn a tree into a backend's language, and this\n * turns it into an answer. Needed wherever a tree exists but the closure that produced it does\n * not — a filter split out of a larger predicate, an option rebuilt from a serialized query.\n *\n * ## It fails OPEN, and that is the whole safety argument\n *\n * `undefined` means \"this tree cannot be evaluated here\" — an unknown node, a transformer with no\n * implementation, a comparison between shapes that do not compare. Callers must read that as KEEP\n * THE ROW, never as exclude it.\n *\n * The reason is asymmetric cost. Every caller today uses this to NARROW something that a\n * subsequent, authoritative predicate will check again: a semi-join prefilter, a split conjunct.\n * Keeping a row this cannot judge costs one wasted comparison downstream. Dropping one loses data\n * from a query result and nothing anywhere reports it. So every uncertain path returns `undefined`,\n * and no path guesses `false`.\n *\n * ## Why not just reuse the caller's closure\n *\n * Because there often isn't one. A conjunct pulled out of `([p, m]) => p.a === 1 && m.b === 2` is\n * source TEXT; turning it back into a callable needs `new Function`, which a\n * Content-Security-Policy blocks — the same constraint that makes `softDeleteScope` build its tree\n * by hand. The tree is the only representation that survives.\n */\nexport type EvaluationResult = boolean | undefined;\n\n/** Reads a property or literal operand, or `UNRESOLVED` when the node is not one. */\nconst UNRESOLVED = Symbol(\"unresolved\");\n\nconst applyTransformer = (value: unknown, transformer: Transformer | null): unknown | typeof UNRESOLVED => {\n if (transformer == null) {\n return value;\n }\n\n // A transformer applied to an absent value has no answer, and inventing one (\"\" for a missing\n // string) is how a filter starts matching rows it should not.\n if (value == null) {\n return UNRESOLVED;\n }\n\n if (transformer === \"to-lower-case\") {\n return typeof value === \"string\" ? value.toLowerCase() : UNRESOLVED;\n }\n\n if (transformer === \"to-upper-case\") {\n return typeof value === \"string\" ? value.toUpperCase() : UNRESOLVED;\n }\n\n if (transformer === \"length\") {\n return typeof value === \"string\" || Array.isArray(value) ? value.length : UNRESOLVED;\n }\n\n return UNRESOLVED;\n};\n\nconst operand = (expression: Expression | undefined, row: UnknownRecord): unknown | typeof UNRESOLVED => {\n if (expression == null) {\n return UNRESOLVED;\n }\n\n if (isValueExpression(expression)) {\n return applyTransformer(expression.value, expression.transformer);\n }\n\n if (isPropertyExpression(expression)) {\n // Through the PropertyInfo, so a nested path and a `from`-renamed segment resolve the same\n // way every other consumer of the tree resolves them.\n return applyTransformer(expression.property.getValue(row), expression.transformer);\n }\n\n return UNRESOLVED;\n};\n\n/**\n * `a === b` for the comparators, with Dates compared by VALUE.\n *\n * A Date compares by reference under `===`, so two Dates holding the same instant would be\n * unequal — which is not what a filter on a date means, and not what any backend does.\n */\nconst equals = (left: unknown, right: unknown, strict: boolean): boolean => {\n if (left instanceof Date && right instanceof Date) {\n return left.getTime() === right.getTime();\n }\n\n // oxlint-disable-next-line eqeqeq\n return strict ? left === right : left == right;\n};\n\n/** Ordered comparison, only for shapes that have an order. */\nconst compare = (left: unknown, right: unknown, comparator: Comparator): EvaluationResult => {\n const asComparable = (value: unknown) => value instanceof Date ? value.getTime() : value;\n\n const a = asComparable(left);\n const b = asComparable(right);\n\n const comparable = (typeof a === \"number\" && typeof b === \"number\")\n || (typeof a === \"string\" && typeof b === \"string\");\n\n if (comparable === false) {\n return undefined;\n }\n\n if (comparator === \"greater-than\") {\n return a > b;\n }\n\n if (comparator === \"greater-than-equals\") {\n return a >= b;\n }\n\n if (comparator === \"less-than\") {\n return a < b;\n }\n\n return a <= b;\n};\n\nconst evaluateComparator = (comparator: Comparator, left: unknown, right: unknown, strict: boolean): EvaluationResult => {\n\n if (comparator === \"equals\") {\n return equals(left, right, strict);\n }\n\n if (comparator === \"includes\") {\n // Two shapes, and the tree does not distinguish them: `array.includes(value)` and\n // `string.includes(substring)`. Whichever side is the container decides.\n if (Array.isArray(left)) {\n return left.some(item => equals(item, right, strict));\n }\n\n if (Array.isArray(right)) {\n return right.some(item => equals(item, left, strict));\n }\n\n return typeof left === \"string\" && typeof right === \"string\" ? left.includes(right) : undefined;\n }\n\n if (comparator === \"starts-with\") {\n return typeof left === \"string\" && typeof right === \"string\" ? left.startsWith(right) : undefined;\n }\n\n if (comparator === \"ends-with\") {\n return typeof left === \"string\" && typeof right === \"string\" ? left.endsWith(right) : undefined;\n }\n\n return compare(left, right, comparator);\n};\n\n/**\n * Evaluates `expression` against `row`, or returns `undefined` when it cannot.\n *\n * See the note at the top of this file: `undefined` means KEEP the row.\n */\nexport const evaluate = (expression: Expression, row: UnknownRecord): EvaluationResult => {\n\n if (isOperatorExpression(expression)) {\n const left = expression.left == null ? undefined : evaluate(expression.left, row);\n const right = expression.right == null ? undefined : evaluate(expression.right, row);\n\n /**\n * One unevaluable side does not have to sink the whole tree.\n *\n * `a && b` where `a` is definitely false is false whatever `b` is, and `a || b` where `a`\n * is definitely true is true. That short-circuiting is what lets a mostly-understood\n * predicate still narrow anything at all — without it, one unfamiliar sub-expression makes\n * the entire filter a no-op.\n */\n if (expression.operator === \"&&\") {\n if (left === false || right === false) {\n return false;\n }\n\n return left === true && right === true ? true : undefined;\n }\n\n if (left === true || right === true) {\n return true;\n }\n\n return left === false && right === false ? false : undefined;\n }\n\n if (isComparatorExpression(expression)) {\n const left = operand(expression.left, row);\n const right = operand(expression.right, row);\n\n if (left === UNRESOLVED || right === UNRESOLVED) {\n return undefined;\n }\n\n const result = evaluateComparator(expression.comparator, left, right, expression.strict);\n\n if (result === undefined) {\n return undefined;\n }\n\n return expression.negated ? result === false : result;\n }\n\n // A tautology excludes nothing, which is exactly `true`. Anything else — a bare property, a\n // literal, `not-parsable` — is not a predicate this can judge.\n return expression.type === \"empty\" ? true : undefined;\n};\n\n/**\n * `evaluate`, as a predicate that keeps whatever it cannot judge.\n *\n * The form every narrowing caller wants, with the fail-open rule applied once here rather than\n * remembered at each call site.\n */\nexport const toPredicate = (expression: Expression) => (row: UnknownRecord): boolean =>\n evaluate(expression, row) !== false;\n\n/**\n * `evaluate`, as a predicate that THROWS on anything it cannot judge.\n *\n * The opposite default to `toPredicate`, and the right one when the predicate is the only thing\n * standing between a caller and rows they asked to exclude — a filter that arrived over a wire and\n * is being applied by the receiver. Failing open there does not cost a wasted comparison; it returns\n * data the requester filtered out, and reports nothing.\n *\n * Use `toPredicate` when something authoritative re-checks the result, and this when nothing does.\n */\nexport const toStrictPredicate = (expression: Expression) => (row: UnknownRecord): boolean => {\n const result = evaluate(expression, row);\n\n if (result === undefined) {\n throw new Error(\n \"Cannot apply this filter: its expression cannot be evaluated in memory, and applying it partially would \" +\n \"return rows the filter excludes. This happens when a filter arrives without a runnable predicate — over a \" +\n \"wire, or rebuilt from a serialized query — and names something the evaluator does not understand.\"\n );\n }\n\n return result;\n};\n","export * from './evaluate';\nexport * from './parser';\nexport * from './types';\nexport * from './utils';\nexport * from './constants';","import { logger } from \"../utilities\";\nimport { assertString } from \"../assertions\";\nimport { CompiledSchema, PropertyInfo, SchemaTypes } from \"../schema\";\nimport { Expression, OperatorExpression, ComparatorExpression, ValueExpression, PropertyExpression, Filter, ParamsFilter, Comparator, Transformer } from \"./types\";\n\n// Error message constants\nconst ERROR_MESSAGES = {\n PROPERTY_NOT_FOUND: (path: string) => `Error parsing query, could not find PropertyInfo for path: ${path}`,\n PARAM_PATH_NOT_FOUND: (value: string, params: unknown) => `Cannot find path in params for .where(). Make sure parameters are not used inline.\\r\\nPath: ${value}, Params: ${JSON.stringify(params)}`,\n VARIABLE_VALUE: (value: string) => `Cannot derive value from variable, please pass parameters into the expression.\n\nExample: .where(([x, params]) => x.id === params.id, { id: someVar.id })\nIssue At: ${value}`,\n UNSUPPORTED: (value: string) => `Unsupported expression format: ${value}`\n};\n\nconst parseUnknown = (value: unknown) => {\n assertString(value);\n return JSON.parse(value);\n}\n\n/**\n * A parse failure caused by the params VALUES rather than the filter source.\n * These must never poison the template cache — the same source can succeed\n * with different params.\n */\nclass ParamDependentParseError extends Error { }\n\nconst converters: Record<SchemaTypes, (value: unknown) => unknown> = {\n Array: v => v,\n Boolean: v => v == null ? v : Boolean(v),\n // Stryker disable next-line ArrowFunction: filters on computed properties route to\n // in-memory execution, so this entry cannot be reached through a parsable filter.\n Computed: v => v,\n Date: v => v,\n // A file is a reference, and a filter can legitimately compare its fields — content type\n // and size are ordinary columns. The value passes through unconverted like an object.\n File: v => v,\n // Stryker disable next-line ArrowFunction: SchemaTypes.Definition is handled as a\n // generic primitive everywhere (specs/known-defects.md) and never pairs in a filter.\n Definition: v => v,\n // Stryker disable next-line ArrowFunction: filters on function properties route to\n // in-memory execution, so this entry cannot be reached through a parsable filter.\n Function: v => v,\n Number: v => v == null ? v : Number(v),\n Object: v => v,\n String: v => v == null ? v : String(v),\n // A vector is a list of numbers and passes through like any other array. Nothing\n // converts it because nothing compares it: similarity is `.nearest()`, not a filter.\n Vector: v => v\n};\n\n// #region Tokenizer\n\ntype TokenKind = \"identifier\" | \"string\" | \"number\" | \"punctuation\";\n\ntype Token = {\n kind: TokenKind;\n value: string;\n}\n\n// Longest first so multi-character punctuation wins over its prefixes\nconst MULTI_CHARACTER_PUNCTUATION = [\"===\", \"!==\", \"?.\", \"&&\", \"||\", \"==\", \"!=\", \">=\", \"<=\", \"=>\"] as const;\n// Stryker disable next-line all: documented equivalent cluster (see\n// docs/mutation-backlog.md) — dropping an entry only affects source the parser rejects\n// either way, and the rejection message names the character from the source rather than\n// from this set, so no observable boundary distinguishes the mutant. Established\n// experimentally: 30 message-asserting tests killed 1 of 12.\nconst SINGLE_CHARACTER_PUNCTUATION = new Set([\"(\", \")\", \"[\", \"]\", \"{\", \"}\", \".\", \",\", \";\", \"!\", \">\", \"<\", \"-\", \"+\", \"*\", \"/\", \"%\", \"=\", \"?\", \":\", \"&\", \"|\"]);\n\nconst STRING_ESCAPES: Record<string, string> = {\n \"n\": \"\\n\",\n \"r\": \"\\r\",\n \"t\": \"\\t\",\n \"b\": \"\\b\",\n \"f\": \"\\f\",\n \"v\": \"\\v\",\n \"0\": \"\\0\"\n};\n\nconst isIdentifierStart = (char: string) => /[a-zA-Z_$]/.test(char);\nconst isIdentifierPart = (char: string) => /[a-zA-Z0-9_$]/.test(char);\nconst isDigit = (char: string) => char >= \"0\" && char <= \"9\";\nconst isHexDigit = (char: string) => isDigit(char) || (char >= \"a\" && char <= \"f\") || (char >= \"A\" && char <= \"F\");\n\n/**\n * Decodes a `\\uXXXX`, `\\u{...}` or `\\xXX` escape starting at the backslash.\n * Returns the decoded character and the index just past the escape. These\n * escapes carry a computed character, so mapping them through STRING_ESCAPES\n * (which would yield the literal \"u\"/\"x\") silently corrupts the value.\n */\nconst decodeCodeEscape = (source: string, backslashIndex: number): { value: string, nextIndex: number } => {\n const kind = source[backslashIndex + 1];\n let start = backslashIndex + 2;\n\n if (kind === \"u\" && source[start] === \"{\") {\n const end = source.indexOf(\"}\", start + 1);\n\n if (end === -1) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"unterminated unicode escape\"));\n }\n\n return { value: String.fromCodePoint(parseInt(source.slice(start + 1, end), 16)), nextIndex: end + 1 };\n }\n\n const length = kind === \"u\" ? 4 : 2;\n const digits = source.slice(start, start + length);\n\n if (digits.length < length || [...digits].some(d => !isHexDigit(d))) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'\\\\${kind}' escape`));\n }\n\n return { value: String.fromCharCode(parseInt(digits, 16)), nextIndex: start + length };\n}\n\n/**\n * Converts filter source text into a flat token stream. Strings and comments are\n * consumed here so operator characters inside literals can never be mistaken for\n * real operators.\n */\nconst tokenize = (source: string): Token[] => {\n\n const tokens: Token[] = [];\n let i = 0;\n\n while (i < source.length) {\n const char = source[i];\n\n // Whitespace\n if (char === \" \" || char === \"\\t\" || char === \"\\r\" || char === \"\\n\") {\n i++;\n continue;\n }\n\n // Comments\n if (char === \"/\" && source[i + 1] === \"/\") {\n while (i < source.length && source[i] !== \"\\n\") {\n i++;\n }\n continue;\n }\n\n if (char === \"/\" && source[i + 1] === \"*\") {\n i += 2;\n while (i < source.length && !(source[i] === \"*\" && source[i + 1] === \"/\")) {\n i++;\n }\n i += 2;\n continue;\n }\n\n // String literals\n if (char === \"'\" || char === \"\\\"\" || char === \"`\") {\n const quote = char;\n let value = \"\";\n i++;\n\n while (i < source.length && source[i] !== quote) {\n if (source[i] === \"\\\\\") {\n const escaped = source[i + 1];\n\n if (escaped === \"u\" || escaped === \"x\") {\n const decoded = decodeCodeEscape(source, i);\n value += decoded.value;\n i = decoded.nextIndex;\n continue;\n }\n\n value += STRING_ESCAPES[escaped] ?? escaped;\n i += 2;\n continue;\n }\n\n if (quote === \"`\" && source[i] === \"$\" && source[i + 1] === \"{\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"template literal interpolation\"));\n }\n\n value += source[i];\n i++;\n }\n\n if (i >= source.length) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"unterminated string literal\"));\n }\n\n i++; // consume closing quote\n tokens.push({ kind: \"string\", value });\n continue;\n }\n\n // Numbers — covers decimals, exponents (1e6), hex/octal/binary (0xFF),\n // and numeric separators (1_000_000). Values are normalized here (the\n // separator stripped) so the parser can hand them straight to Number()\n if (isDigit(char)) {\n let value = \"\";\n\n const nextChar = source[i + 1];\n const radixPrefix = char === \"0\" && nextChar != null && \"xXoObB\".includes(nextChar);\n\n if (radixPrefix) {\n value = source[i] + source[i + 1];\n i += 2;\n\n while (i < source.length && (isHexDigit(source[i]) || source[i] === \"_\")) {\n value += source[i];\n i++;\n }\n } else {\n while (i < source.length && (isDigit(source[i]) || source[i] === \".\" || source[i] === \"_\")) {\n value += source[i];\n i++;\n }\n\n // Exponent part: e/E, optional sign, then digits. Only consumed when\n // digits follow, so a stray identifier after a number still errors\n if ((source[i] === \"e\" || source[i] === \"E\")) {\n const signLength = source[i + 1] === \"+\" || source[i + 1] === \"-\" ? 1 : 0;\n\n if (isDigit(source[i + 1 + signLength])) {\n value += source[i];\n i++;\n\n if (signLength === 1) {\n value += source[i];\n i++;\n }\n\n while (i < source.length && isDigit(source[i])) {\n value += source[i];\n i++;\n }\n }\n }\n }\n\n tokens.push({ kind: \"number\", value: value.replace(/_/g, \"\") });\n continue;\n }\n\n // Identifiers / keywords\n if (isIdentifierStart(char)) {\n let value = \"\";\n\n while (i < source.length && isIdentifierPart(source[i])) {\n value += source[i];\n i++;\n }\n\n tokens.push({ kind: \"identifier\", value });\n continue;\n }\n\n // Multi-character punctuation (longest match first)\n const multi = MULTI_CHARACTER_PUNCTUATION.find(w => source.startsWith(w, i));\n\n if (multi != null) {\n tokens.push({ kind: \"punctuation\", value: multi });\n i += multi.length;\n continue;\n }\n\n if (SINGLE_CHARACTER_PUNCTUATION.has(char)) {\n tokens.push({ kind: \"punctuation\", value: char });\n i++;\n continue;\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`unexpected character '${char}'`));\n }\n\n return tokens;\n}\n\n/**\n * Cursor over the token stream with the small set of lookahead operations the\n * parser needs.\n */\nclass TokenStream {\n\n private readonly tokens: Token[];\n private index: number = 0;\n\n constructor(tokens: Token[]) {\n this.tokens = tokens;\n }\n\n get isAtEnd() {\n return this.index >= this.tokens.length;\n }\n\n peek(offset: number = 0): Token | null {\n return this.tokens[this.index + offset] ?? null;\n }\n\n next(): Token {\n const token = this.tokens[this.index];\n\n if (token == null) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"unexpected end of expression\"));\n }\n\n this.index++;\n return token;\n }\n\n isPunctuation(value: string, offset: number = 0): boolean {\n const token = this.peek(offset);\n return token != null && token.kind === \"punctuation\" && token.value === value;\n }\n\n matchPunctuation(value: string): boolean {\n if (this.isPunctuation(value)) {\n this.index++;\n return true;\n }\n\n return false;\n }\n\n expectPunctuation(value: string) {\n if (!this.matchPunctuation(value)) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`expected '${value}'`));\n }\n }\n}\n\n// #endregion\n\n// #region Operands\n\n// Discriminated union so a condition builder can only ever see the operand\n// shapes the grammar allows\ntype PropertyOperand = {\n kind: \"property\";\n property: PropertyInfo<any>;\n transformer: Transformer | null;\n locale: string | null;\n}\n\ntype ValueOperand = {\n kind: \"value\";\n value: unknown;\n transformer: Transformer | null;\n locale: string | null;\n}\n\ntype ParamOperand = {\n kind: \"param\";\n path: string[];\n transformer: Transformer | null;\n locale: string | null;\n}\n\ntype MethodCallOperand = {\n kind: \"method-call\";\n target: PropertyOperand | ParamOperand | ValueOperand;\n method: \"startsWith\" | \"endsWith\" | \"includes\";\n argument: PropertyOperand | ValueOperand | ParamOperand;\n}\n\ntype Operand = PropertyOperand | ValueOperand | ParamOperand | MethodCallOperand;\n\nconst COMPARATOR_METHODS: Record<string, Comparator> = {\n startsWith: \"starts-with\",\n endsWith: \"ends-with\",\n includes: \"includes\"\n};\n\nconst TRANSFORM_METHODS: Record<string, { transformer: Transformer, locale: string | null }> = {\n toLowerCase: { transformer: \"to-lower-case\", locale: null },\n toUpperCase: { transformer: \"to-upper-case\", locale: null },\n toLocaleLowerCase: { transformer: \"to-lower-case\", locale: \"en-US\" },\n toLocaleUpperCase: { transformer: \"to-upper-case\", locale: \"en-US\" }\n};\n\nconst COMPARISON_OPERATORS: Record<string, { comparator: Comparator, negated: boolean, strict: boolean }> = {\n \"==\": { comparator: \"equals\", negated: false, strict: false },\n \"===\": { comparator: \"equals\", negated: false, strict: true },\n \"!=\": { comparator: \"equals\", negated: true, strict: false },\n \"!==\": { comparator: \"equals\", negated: true, strict: true },\n \">\": { comparator: \"greater-than\", negated: false, strict: false },\n \">=\": { comparator: \"greater-than-equals\", negated: false, strict: false },\n \"<\": { comparator: \"less-than\", negated: false, strict: false },\n \"<=\": { comparator: \"less-than-equals\", negated: false, strict: false }\n};\n\nconst SWAPPED_COMPARATORS: Record<Comparator, Comparator> = {\n \"equals\": \"equals\",\n \"greater-than\": \"less-than\",\n \"greater-than-equals\": \"less-than-equals\",\n \"less-than\": \"greater-than\",\n \"less-than-equals\": \"greater-than-equals\",\n \"starts-with\": \"starts-with\",\n \"ends-with\": \"ends-with\",\n \"includes\": \"includes\"\n};\n\n// #endregion\n\n// #region Param references\n\n/**\n * Placeholder for a parameter value inside a cached expression template. Never\n * escapes this module — binding replaces it with a plain ValueExpression that\n * holds the resolved value.\n */\nclass ParamReferenceExpression extends ValueExpression {\n\n /** Path into the params object, excluding the params root name. */\n readonly paramPath: string[];\n /** The property this value is compared against; drives serialization/conversion at bind time. */\n readonly pairedProperty: PropertyInfo<any> | null;\n /** Whether the paired property's type converter applies (equality/relational comparisons only). */\n readonly applyConverter: boolean;\n\n constructor(options: {\n paramPath: string[],\n pairedProperty: PropertyInfo<any> | null,\n applyConverter: boolean\n }) {\n super({ value: undefined });\n this.paramPath = options.paramPath;\n this.pairedProperty = options.pairedProperty;\n this.applyConverter = options.applyConverter;\n }\n}\n\nconst resolveParamPath = (paramsName: string, path: string[], data: unknown) => {\n\n let result = data as Record<string, unknown>;\n\n for (let i = 0; i < path.length; i++) {\n const name = path[i];\n\n if (result != null && typeof result === \"object\" && name in result) {\n result = result[name] as Record<string, unknown>;\n continue;\n }\n\n throw new ParamDependentParseError(ERROR_MESSAGES.PARAM_PATH_NOT_FOUND([paramsName, ...path].join(\".\"), data));\n }\n\n return result as unknown;\n}\n\n/**\n * Applies the paired property's value serializer and (optionally) its schema\n * type converter, matching how literal values are treated at parse time.\n */\nconst resolvePairedValue = (value: unknown, pairedProperty: PropertyInfo<any> | null, applyConverter: boolean) => {\n\n if (pairedProperty == null) {\n return value;\n }\n\n let result = value;\n\n if (pairedProperty.valueSerializer != null) {\n result = String(pairedProperty.valueSerializer(parseUnknown(result)));\n }\n\n if (applyConverter) {\n result = converters[pairedProperty.type](result);\n }\n\n return result;\n}\n\n// #endregion\n\n// #region Parser\n\n/**\n * Recursive descent parser over the token stream. Produces an expression\n * template: literal values are fully resolved, parameter values are represented\n * as ParamReferenceExpression placeholders so the template can be cached and\n * re-bound with different params.\n */\nclass ExpressionParser {\n\n private readonly schema: CompiledSchema<any>;\n private readonly stream: TokenStream;\n private readonly entityName: string;\n private readonly paramsName: string | null;\n private readonly params: unknown;\n\n /** Set when a param value shaped the tree itself (e.g. x[p.name]) — such templates cannot be cached. */\n structurallyDependsOnParams: boolean = false;\n\n constructor(schema: CompiledSchema<any>, stream: TokenStream, entityName: string, paramsName: string | null, params: unknown) {\n this.schema = schema;\n this.stream = stream;\n this.entityName = entityName;\n this.paramsName = paramsName;\n this.params = params;\n }\n\n parse(): Expression {\n const expression = this.parseOr();\n\n if (!this.stream.isAtEnd) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`unexpected token '${this.stream.peek()?.value}'`));\n }\n\n return expression;\n }\n\n // || binds loosest, so it sits at the root of the parse\n private parseOr(): Expression {\n let left = this.parseAnd();\n\n while (this.stream.matchPunctuation(\"||\")) {\n const right = this.parseAnd();\n\n // A tautology (`true`) absorbs the whole disjunction\n if (Expression.isEmpty(left) || Expression.isEmpty(right)) {\n left = Expression.EMPTY;\n continue;\n }\n\n left = new OperatorExpression({ operator: \"||\", left, right });\n }\n\n return left;\n }\n\n private parseAnd(): Expression {\n let left = this.parseUnary();\n\n while (this.stream.matchPunctuation(\"&&\")) {\n const right = this.parseUnary();\n\n // A tautology (`true`) is the identity of a conjunction\n if (Expression.isEmpty(left)) {\n left = right;\n continue;\n }\n\n if (Expression.isEmpty(right)) {\n continue;\n }\n\n left = new OperatorExpression({ operator: \"&&\", left, right });\n }\n\n return left;\n }\n\n private parseUnary(): Expression {\n if (this.stream.matchPunctuation(\"!\")) {\n return this.negateExpression(this.parseUnary());\n }\n\n return this.parseComparison();\n }\n\n /**\n * Applies `!` to an already-parsed expression: comparators flip their\n * negated flag, compound expressions distribute via De Morgan's laws.\n */\n private negateExpression(expression: Expression): Expression {\n if (expression instanceof ComparatorExpression) {\n expression.negated = !expression.negated;\n return expression;\n }\n\n if (expression instanceof OperatorExpression && expression.left != null && expression.right != null) {\n return new OperatorExpression({\n operator: expression.operator === \"&&\" ? \"||\" : \"&&\",\n left: this.negateExpression(expression.left),\n right: this.negateExpression(expression.right)\n });\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"'!' on this expression\"));\n }\n\n private parseComparison(): Expression {\n\n // Parenthesized group\n if (this.stream.matchPunctuation(\"(\")) {\n const expression = this.parseOr();\n this.stream.expectPunctuation(\")\");\n\n const trailing = this.stream.peek();\n if (trailing != null && trailing.kind === \"punctuation\" && COMPARISON_OPERATORS[trailing.value] != null) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"comparison against a parenthesized expression\"));\n }\n\n return expression;\n }\n\n const left = this.parseOperand();\n const operatorToken = this.stream.peek();\n\n if (operatorToken != null && operatorToken.kind === \"punctuation\" && COMPARISON_OPERATORS[operatorToken.value] != null) {\n this.stream.next();\n const right = this.parseOperand();\n return this.buildComparison(left, COMPARISON_OPERATORS[operatorToken.value], right);\n }\n\n return this.buildStandalone(left);\n }\n\n private parseOperand(): Operand {\n const token = this.stream.peek();\n\n if (token == null) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"unexpected end of expression\"));\n }\n\n if (token.kind === \"string\") {\n this.stream.next();\n return this.withValueTransformer({ kind: \"value\", value: token.value, transformer: null, locale: null });\n }\n\n if (token.kind === \"number\") {\n this.stream.next();\n return { kind: \"value\", value: Number(token.value), transformer: null, locale: null };\n }\n\n if (token.kind === \"punctuation\" && token.value === \"-\") {\n this.stream.next();\n const numberToken = this.stream.next();\n\n if (numberToken.kind !== \"number\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"unary '-' on a non-number\"));\n }\n\n return { kind: \"value\", value: -Number(numberToken.value), transformer: null, locale: null };\n }\n\n if (token.kind === \"punctuation\" && token.value === \"[\") {\n return this.parseArrayLiteralOperand();\n }\n\n if (token.kind === \"identifier\") {\n return this.parseIdentifierOperand();\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(String(token.value)));\n }\n\n /**\n * Parses an inline array of literals, e.g. `[\"active\", \"pending\"]`, and the\n * membership test that follows it: `[...].includes(entity.property)`.\n */\n private parseArrayLiteralOperand(): Operand {\n this.stream.expectPunctuation(\"[\");\n const elements: unknown[] = [];\n\n while (!this.stream.isPunctuation(\"]\")) {\n const element = this.parseOperand();\n\n if (element.kind !== \"value\" || element.transformer != null) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"a non-literal element in an array literal\"));\n }\n\n elements.push(element.value);\n\n if (!this.stream.matchPunctuation(\",\")) {\n break;\n }\n }\n\n this.stream.expectPunctuation(\"]\");\n\n const array: ValueOperand = { kind: \"value\", value: elements, transformer: null, locale: null };\n\n // The only supported use is a membership test on a schema property\n if (this.stream.isPunctuation(\".\") || this.stream.isPunctuation(\"?.\")) {\n this.stream.next();\n const method = this.stream.next();\n\n if (method.kind !== \"identifier\" || method.value !== \"includes\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'.${method.value}' on an array literal`));\n }\n\n this.stream.expectPunctuation(\"(\");\n const argument = this.parseOperand();\n this.stream.expectPunctuation(\")\");\n\n if (argument.kind === \"method-call\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"nested method call inside .includes()\"));\n }\n\n return { kind: \"method-call\", target: array, method: \"includes\", argument };\n }\n\n return array;\n }\n\n private parseIdentifierOperand(): Operand {\n const root = this.stream.next().value;\n\n // Keyword literals\n if (root === \"true\" || root === \"false\") {\n return { kind: \"value\", value: root === \"true\", transformer: null, locale: null };\n }\n\n if (root === \"null\") {\n return { kind: \"value\", value: null, transformer: null, locale: null };\n }\n\n if (root === \"undefined\") {\n return { kind: \"value\", value: undefined, transformer: null, locale: null };\n }\n\n if (root === \"void\") {\n this.stream.next(); // the '0'\n return { kind: \"value\", value: undefined, transformer: null, locale: null };\n }\n\n if (root === this.entityName) {\n return this.parseChain({ kind: \"property\", root });\n }\n\n if (this.paramsName != null && root === this.paramsName) {\n return this.parseChain({ kind: \"param\", root });\n }\n\n // A bare variable from the outer scope — its value cannot be derived from source text\n throw new Error(ERROR_MESSAGES.VARIABLE_VALUE(root));\n }\n\n /**\n * Parses the segments after an entity/params root: dot access, bracket\n * access, transform methods and comparator methods.\n */\n private parseChain(options: { kind: \"property\" | \"param\", root: string }): Operand {\n const path: string[] = [];\n let transformer: Transformer | null = null;\n let locale: string | null = null;\n\n while (true) {\n if (this.stream.matchPunctuation(\".\") || this.stream.matchPunctuation(\"?.\")) {\n const segment = this.stream.next();\n\n if (segment.kind !== \"identifier\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`'.${segment.value}'`));\n }\n\n // Method call\n if (this.stream.isPunctuation(\"(\")) {\n const method = segment.value;\n\n if (TRANSFORM_METHODS[method] != null) {\n this.stream.expectPunctuation(\"(\");\n this.stream.expectPunctuation(\")\");\n transformer = TRANSFORM_METHODS[method].transformer;\n locale = TRANSFORM_METHODS[method].locale;\n continue;\n }\n\n if (COMPARATOR_METHODS[method] != null) {\n this.stream.expectPunctuation(\"(\");\n const argument = this.parseOperand();\n this.stream.expectPunctuation(\")\");\n\n if (argument.kind === \"method-call\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`nested method call inside .${method}()`));\n }\n\n return {\n kind: \"method-call\",\n target: this.resolveChain(options.kind, path, transformer, locale),\n method: method as MethodCallOperand[\"method\"],\n argument\n };\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`method '.${method}()'`));\n }\n\n if (transformer != null) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"property access after a transform method\"));\n }\n\n path.push(segment.value);\n continue;\n }\n\n if (this.stream.matchPunctuation(\"[\")) {\n path.push(this.parseBracketSegment(options.kind));\n this.stream.expectPunctuation(\"]\");\n continue;\n }\n\n break;\n }\n\n return this.resolveChain(options.kind, path, transformer, locale);\n }\n\n private parseBracketSegment(kind: \"property\" | \"param\"): string {\n const token = this.stream.next();\n\n // Literal segment: entity[\"name\"]\n if (token.kind === \"string\") {\n return token.value;\n }\n\n // Param-driven segment: entity[p.name] — the property depends on the\n // param VALUE, so the resulting template is tied to these params.\n // Stryker disable next-line all: documented equivalent cluster (see\n // docs/mutation-backlog.md) — every mutation of this four-conjunct guard reroutes\n // bracket access between two paths that both collapse to NOT_PARSABLE; the\n // experiment recorded there aimed 30 tests at this line and killed none.\n if (kind === \"property\" && token.kind === \"identifier\" && this.paramsName != null && token.value === this.paramsName) {\n const paramPath: string[] = [];\n\n while (this.stream.matchPunctuation(\".\") || this.stream.matchPunctuation(\"?.\")) {\n paramPath.push(this.stream.next().value);\n }\n\n const resolved = resolveParamPath(this.paramsName, paramPath, this.params);\n\n if (typeof resolved !== \"string\") {\n throw new ParamDependentParseError(ERROR_MESSAGES.PROPERTY_NOT_FOUND(paramPath.join(\".\")));\n }\n\n this.structurallyDependsOnParams = true;\n return resolved;\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`bracket access '[${token.value}]'`));\n }\n\n private resolveChain(kind: \"property\" | \"param\", path: string[], transformer: Transformer | null, locale: string | null): PropertyOperand | ParamOperand {\n\n if (kind === \"param\") {\n if (path.length === 0) {\n // `params` alone is a variable, not a value we can resolve\n throw new Error(ERROR_MESSAGES.PARAM_PATH_NOT_FOUND(this.paramsName ?? \"params\", this.params));\n }\n\n return { kind: \"param\", path, transformer, locale };\n }\n\n const pathString = path.join(\".\");\n const property = this.schema.properties.find(w => w.getAssignmentPath() == pathString);\n\n if (property == null) {\n // `.length` on a string/array property — a real schema property named\n // `length` wins (checked above); otherwise treat it as a transformer\n if (path.length > 1 && path[path.length - 1] === \"length\" && transformer == null) {\n const parentPath = path.slice(0, -1).join(\".\");\n const parent = this.schema.properties.find(w => w.getAssignmentPath() == parentPath);\n\n // Vector is deliberately absent. Its length is the dimension count declared\n // in the schema — a constant, not data — so a filter on it answers a question\n // nobody asks, and pushing it down would need `json_array_length` on a\n // backend storing JSON and something else entirely on one with a native\n // vector column. Not parsing it leaves a clear error instead of a dialect gap.\n if (parent != null && (parent.type === SchemaTypes.String || parent.type === SchemaTypes.Array)) {\n return { kind: \"property\", property: parent, transformer: \"length\", locale: null };\n }\n }\n\n throw new Error(ERROR_MESSAGES.PROPERTY_NOT_FOUND(pathString));\n }\n\n return { kind: \"property\", property, transformer, locale };\n }\n\n private withValueTransformer(operand: ValueOperand): ValueOperand {\n if (this.stream.isPunctuation(\".\")) {\n const method = this.stream.peek(1);\n\n // Stryker disable next-line all: documented equivalent cluster (see\n // docs/mutation-backlog.md) — the guard's conjuncts each route to a rejection that\n // collapses to NOT_PARSABLE with an indistinguishable message; 18 targeted tests\n // killed none of these.\n if (method != null && method.kind === \"identifier\" && TRANSFORM_METHODS[method.value] != null) {\n this.stream.next(); // .\n this.stream.next(); // method name\n this.stream.expectPunctuation(\"(\");\n this.stream.expectPunctuation(\")\");\n\n operand.transformer = TRANSFORM_METHODS[method.value].transformer;\n operand.locale = TRANSFORM_METHODS[method.value].locale;\n }\n }\n\n return operand;\n }\n\n // #region Condition building\n\n private buildComparison(left: Operand, operator: { comparator: Comparator, negated: boolean, strict: boolean }, right: Operand): Expression {\n\n // methodCall == true/false — fold the boolean into negation\n if (left.kind === \"method-call\") {\n if (operator.comparator === \"equals\" && right.kind === \"value\" && typeof right.value === \"boolean\") {\n const comparator = this.buildMethodComparator(left);\n const comparedToFalse = right.value === false;\n comparator.negated = comparator.negated !== (operator.negated !== comparedToFalse);\n return comparator;\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"comparing a method call to a non-boolean\"));\n }\n\n if (right.kind === \"method-call\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"method call on the right side of a comparison\"));\n }\n\n if (left.kind === \"property\" && right.kind === \"property\") {\n // Casing transformers are only valid with string-matching comparators,\n // which cannot produce a property-to-property comparison\n if (left.transformer === \"to-lower-case\" || left.transformer === \"to-upper-case\" ||\n right.transformer === \"to-lower-case\" || right.transformer === \"to-upper-case\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"transform method outside of startsWith/endsWith/includes\"));\n }\n\n return new ComparatorExpression({\n comparator: operator.comparator,\n negated: operator.negated,\n strict: operator.strict,\n left: this.createPropertyExpression(left),\n right: this.createPropertyExpression(right)\n });\n }\n\n if (left.kind === \"property\" && right.kind !== \"property\") {\n return this.buildPropertyComparator(left, operator, right, /* applyConverter */ true);\n }\n\n if (right.kind === \"property\" && left.kind !== \"property\") {\n const swapped = { ...operator, comparator: SWAPPED_COMPARATORS[operator.comparator] };\n return this.buildPropertyComparator(right, swapped, left, /* applyConverter */ true);\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"comparison requires a schema property on at least one side\"));\n }\n\n private buildStandalone(operand: Operand): Expression {\n\n if (operand.kind === \"method-call\") {\n return this.buildMethodComparator(operand);\n }\n\n if (operand.kind === \"property\") {\n // Truthy shorthand on `.length`: a length is truthy exactly when > 0\n if (operand.transformer === \"length\") {\n return this.buildPropertyComparator(operand, COMPARISON_OPERATORS[\">\"], { kind: \"value\", value: 0, transformer: null, locale: null }, /* applyConverter */ true);\n }\n\n // Truthy shorthand: `w.isActive` → isActive === true\n return this.buildPropertyComparator(operand, COMPARISON_OPERATORS[\"===\"], { kind: \"value\", value: true, transformer: null, locale: null }, /* applyConverter */ true);\n }\n\n // Constant `true` — a tautology, which parseAnd/parseOr simplify away\n if (operand.kind === \"value\" && operand.value === true && operand.transformer == null) {\n return Expression.EMPTY;\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"a filter condition must reference a schema property\"));\n }\n\n private buildMethodComparator(operand: MethodCallOperand): ComparatorExpression {\n const { target, method, argument } = operand;\n\n if (target.kind === \"property\") {\n if (argument.kind === \"property\") {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`.${method}() comparing two schema properties`));\n }\n\n // Method arguments skip type conversion — only the value serializer applies\n return this.buildPropertyComparator(target, { comparator: COMPARATOR_METHODS[method], negated: false, strict: false }, argument, /* applyConverter */ false);\n }\n\n // [\"a\", \"b\"].includes(x.prop) / params.list.includes(x.prop) —\n // membership test with the collection on the left\n if (method === \"includes\" && argument.kind === \"property\") {\n if (target.transformer != null) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"transform method on a collection used with .includes()\"));\n }\n\n return new ComparatorExpression({\n comparator: \"includes\",\n negated: false,\n strict: false,\n left: this.createValueExpression(target, argument.property, /* applyConverter */ false),\n right: this.createPropertyExpression(argument)\n });\n }\n\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(`.${method}() on a non-property target`));\n }\n\n private buildPropertyComparator(property: PropertyOperand, operator: { comparator: Comparator, negated: boolean, strict: boolean }, value: ValueOperand | ParamOperand, applyConverter: boolean): ComparatorExpression {\n\n const isStringMatch = operator.comparator === \"starts-with\" || operator.comparator === \"ends-with\" || operator.comparator === \"includes\";\n\n // `.length` compares a NUMBER, so the paired property's serializer and\n // type converter must not touch the value; and a length has no meaning\n // inside a string-matching comparator\n if (property.transformer === \"length\") {\n if (isStringMatch) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"'.length' with startsWith/endsWith/includes\"));\n }\n\n return new ComparatorExpression({\n comparator: operator.comparator,\n negated: operator.negated,\n strict: operator.strict,\n left: this.createPropertyExpression(property),\n right: this.createValueExpression(value, null, /* applyConverter */ false)\n });\n }\n\n // Casing transformers on a property are only meaningful with string-matching\n // comparators; on relational comparators the plugins would silently\n // ignore them and return wrong data\n if (property.transformer != null && !isStringMatch) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"transform method outside of startsWith/endsWith/includes\"));\n }\n\n return new ComparatorExpression({\n comparator: operator.comparator,\n negated: operator.negated,\n strict: operator.strict,\n left: this.createPropertyExpression(property),\n right: this.createValueExpression(value, property.property, applyConverter)\n });\n }\n\n private createPropertyExpression(operand: PropertyOperand): PropertyExpression {\n const expression = new PropertyExpression({ property: operand.property });\n expression.transformer = operand.transformer;\n expression.locale = operand.locale;\n return expression;\n }\n\n private createValueExpression(operand: ValueOperand | ParamOperand, pairedProperty: PropertyInfo<any> | null, applyConverter: boolean): ValueExpression {\n\n if (operand.kind === \"param\") {\n const expression = new ParamReferenceExpression({ paramPath: operand.path, pairedProperty, applyConverter });\n expression.transformer = operand.transformer;\n expression.locale = operand.locale;\n return expression;\n }\n\n const expression = new ValueExpression({ value: resolvePairedValue(operand.value, pairedProperty, applyConverter) });\n expression.transformer = operand.transformer;\n expression.locale = operand.locale;\n return expression;\n }\n\n // #endregion\n}\n\n// #endregion\n\n// #region Template binding\n\n/**\n * Deep-clones a template into a consumer-facing tree, resolving parameter\n * placeholders against the supplied params. Always clones so cached templates\n * can never be mutated by consumers.\n */\nconst bindExpression = (expression: Expression, paramsName: string | null, params: unknown): Expression => {\n\n if (expression instanceof ParamReferenceExpression) {\n const raw = resolveParamPath(paramsName ?? \"params\", expression.paramPath, params);\n const bound = new ValueExpression({ value: resolvePairedValue(raw, expression.pairedProperty, expression.applyConverter) });\n bound.transformer = expression.transformer;\n bound.locale = expression.locale;\n return bound;\n }\n\n if (expression instanceof ValueExpression) {\n const clone = new ValueExpression({ value: expression.value });\n clone.transformer = expression.transformer;\n clone.locale = expression.locale;\n return clone;\n }\n\n if (expression instanceof PropertyExpression) {\n const clone = new PropertyExpression({ property: expression.property });\n clone.transformer = expression.transformer;\n clone.locale = expression.locale;\n return clone;\n }\n\n if (expression instanceof ComparatorExpression) {\n return new ComparatorExpression({\n comparator: expression.comparator,\n negated: expression.negated,\n strict: expression.strict,\n left: expression.left ? bindExpression(expression.left, paramsName, params) : undefined,\n right: expression.right ? bindExpression(expression.right, paramsName, params) : undefined\n });\n }\n\n if (expression instanceof OperatorExpression) {\n return new OperatorExpression({\n operator: expression.operator,\n left: expression.left ? bindExpression(expression.left, paramsName, params) : undefined,\n right: expression.right ? bindExpression(expression.right, paramsName, params) : undefined\n });\n }\n\n return expression;\n}\n\n// #endregion\n\n// #region Function source handling\n\ntype FunctionShape = {\n entityName: string;\n paramsName: string | null;\n body: string;\n}\n\n/**\n * Splits stringified filter source into parameter names and the expression\n * body, unwrapping single-return block bodies.\n */\nconst resolveFunctionShape = (stringifiedFunction: string, hasParams: boolean): FunctionShape => {\n\n const source = stringifiedFunction.trim();\n\n let parameterNames: string;\n let body: string;\n\n // `function (x) { ... }` / `function name(x) { ... }` — what ES5-targeting\n // transpilers rewrite every arrow filter into\n const functionHead = /^function\\b[^(]*\\(/.exec(source);\n\n if (functionHead != null) {\n const parametersEnd = source.indexOf(\")\", functionHead[0].length);\n\n if (parametersEnd === -1) {\n throw new Error(\"Invalid Function\");\n }\n\n parameterNames = source.slice(functionHead[0].length, parametersEnd).trim();\n body = source.slice(parametersEnd + 1).trim();\n } else {\n const arrowIndex = source.indexOf(\"=>\");\n\n if (arrowIndex === -1) {\n throw new Error(\"Invalid Function\");\n }\n\n parameterNames = source.substring(0, arrowIndex).trim();\n body = source.substring(arrowIndex + 2).trim();\n\n // Strip wrapping parens: (entity) or ([x, p])\n if (parameterNames.startsWith(\"(\") && parameterNames.endsWith(\")\")) {\n parameterNames = parameterNames.slice(1, -1).trim();\n }\n }\n\n let entityName: string;\n let paramsName: string | null = null;\n\n if (parameterNames.startsWith(\"[\") && parameterNames.endsWith(\"]\")) {\n const destructured = parameterNames.slice(1, -1).split(\",\").map(w => w.trim());\n entityName = destructured[0];\n\n if (hasParams) {\n paramsName = destructured[1] ?? null;\n }\n } else {\n entityName = parameterNames;\n }\n\n if (entityName == null || entityName.length === 0) {\n throw new Error(\"Invalid Function\");\n }\n\n // Unwrap a single-return block body: { return <expression>; }\n if (body.startsWith(\"{\")) {\n const inner = body.slice(1, body.lastIndexOf(\"}\")).trim();\n\n if (!inner.startsWith(\"return\")) {\n throw new Error(ERROR_MESSAGES.UNSUPPORTED(\"block body without a single return statement\"));\n }\n\n body = inner.slice(\"return\".length).trim();\n\n if (body.endsWith(\";\")) {\n body = body.slice(0, -1).trim();\n }\n }\n\n return { entityName, paramsName, body };\n}\n\n// #endregion\n\n// #region Cache\n\ntype ParsedTemplate = {\n template: Expression;\n paramsName: string | null;\n}\n\n// Keyed by schema instance so identical filter source on different schemas can\n// never collide; entries live only as long as the schema does\nconst templateCache = new WeakMap<CompiledSchema<any>, Map<string, ParsedTemplate>>();\nconst MAX_CACHED_TEMPLATES_PER_SCHEMA = 1024;\n\nconst getCachedTemplate = (schema: CompiledSchema<any>, source: string): ParsedTemplate | null => {\n return templateCache.get(schema)?.get(source) ?? null;\n}\n\nconst setCachedTemplate = (schema: CompiledSchema<any>, source: string, entry: ParsedTemplate) => {\n let bySource = templateCache.get(schema);\n\n if (bySource == null) {\n bySource = new Map<string, ParsedTemplate>();\n templateCache.set(schema, bySource);\n }\n\n // Filter source strings come from static code, so this cap should never be\n // hit in practice — it only guards against unbounded dynamic generation.\n // Stryker disable next-line all: the cap is a pure resource bound — every mutation of\n // it (never clear, always clear, off-by-one) parses identically and differs only in\n // memory growth, which no observable boundary can assert.\n if (bySource.size >= MAX_CACHED_TEMPLATES_PER_SCHEMA) {\n bySource.clear();\n }\n\n bySource.set(source, entry);\n}\n\n// #endregion\n\nexport const combineExpressions = (...expressions: Expression[]): Expression => {\n\n if (expressions.length === 0) {\n throw new Error(\"combineExpressions requires at least 1 expression\");\n }\n\n\n if (expressions.length === 1) {\n return expressions[0];\n }\n\n // Start with the first expression\n let result = expressions[0];\n\n // Loop through remaining expressions and combine them\n for (let i = 1; i < expressions.length; i++) {\n result = new OperatorExpression({\n operator: \"&&\",\n left: result,\n right: expressions[i]\n });\n }\n\n return result;\n};\n\n/**\n * Parses an expression SOURCE FRAGMENT against one schema and one root name.\n *\n * `toExpression` starts from a function and works out its own roots. This starts from text, which\n * is what a caller has when it has split a larger predicate apart — `p.rank > 10` lifted out of\n * `([p, m]) => p.rank > 10 && m.won === true`.\n *\n * **A fragment naming anything other than `rootName` returns `NOT_PARSABLE`, and that is the\n * point.** It is how a caller discovers which side of a join a conjunct belongs to: parse it\n * against each side in turn, and exactly one succeeds for a single-side condition. A condition\n * spanning both fails against both, which is the correct answer — it cannot be pushed to either.\n *\n * No params: a fragment carrying a params reference has no bag to resolve it against here, so it\n * fails rather than binding to nothing.\n *\n * Deliberately NOT cached. The cache is keyed by function source, and a fragment is not a function\n * — two different lambdas can contain the same fragment text against different schemas.\n */\nexport const parseFragment = (schema: CompiledSchema<any>, body: string, rootName: string): Expression => {\n try {\n const stream = new TokenStream(tokenize(body));\n const parser = new ExpressionParser(schema, stream, rootName, null, undefined);\n\n return parser.parse();\n } catch {\n // The failure is expected and informative — see above — so it is not logged. A caller that\n // parses one conjunct against two schemas would otherwise warn on every successful split.\n return Expression.NOT_PARSABLE;\n }\n};\n\nexport const toExpression = <T extends any, P extends any>(schema: CompiledSchema<any>, fn: Filter<T> | ParamsFilter<T, P>, params?: P) => {\n const stringifiedFunction = fn.toString();\n\n const warn = (error: unknown) => logger.warn(\"Error parsing expression\", {\n error,\n collectionName: schema.collectionName,\n params,\n selector: stringifiedFunction\n });\n\n const cached = getCachedTemplate(schema, stringifiedFunction);\n\n if (cached != null) {\n // A cached failure — the warning was already logged when it was discovered\n if (Expression.isNotParsable(cached.template)) {\n return Expression.NOT_PARSABLE;\n }\n\n try {\n return bindExpression(cached.template, cached.paramsName, params);\n } catch (error) {\n // Binding failures are param-dependent by nature — never cached\n warn(error);\n return Expression.NOT_PARSABLE;\n }\n }\n\n let paramsName: string | null = null;\n let template: Expression;\n let structurallyDependsOnParams: boolean;\n\n try {\n const shape = resolveFunctionShape(stringifiedFunction, params != null);\n const stream = new TokenStream(tokenize(shape.body));\n const parser = new ExpressionParser(schema, stream, shape.entityName, shape.paramsName, params);\n paramsName = shape.paramsName;\n template = parser.parse();\n structurallyDependsOnParams = parser.structurallyDependsOnParams;\n } catch (error) {\n // Cache the failure so a hot query on an unsupported filter doesn't\n // re-parse and re-warn on every execution. Param-dependent failures are\n // exempt: the same source can succeed with different params.\n if (!(error instanceof ParamDependentParseError)) {\n setCachedTemplate(schema, stringifiedFunction, { template: Expression.NOT_PARSABLE, paramsName: null });\n }\n\n warn(error);\n return Expression.NOT_PARSABLE;\n }\n\n // Templates whose structure was resolved from param values are only\n // valid for this exact params object — parse those fresh every time\n if (!structurallyDependsOnParams) {\n setCachedTemplate(schema, stringifiedFunction, { template, paramsName });\n }\n\n try {\n return bindExpression(template, paramsName, params);\n } catch (error) {\n warn(error);\n return Expression.NOT_PARSABLE;\n }\n}\n","import { QueryOptionExecutionTarget } from \"../plugins\";\nimport { CompiledSchemaCore, PropertyInfo } from \"../schema\";\n\n/**\n * JSON-safe form of a literal. Tagged only where JSON cannot carry the value as it is.\n *\n * See `Expression.toJson`.\n */\nexport type SerializedValue =\n | { k: \"raw\"; v: string | number | boolean | null }\n | { k: \"date\"; v: string }\n | { k: \"undefined\" }\n | { k: \"number\"; v: \"NaN\" | \"Infinity\" | \"-Infinity\" }\n | { k: \"array\"; v: SerializedValue[] };\n\n/** JSON-safe form of an expression tree. See `Expression.toJson`. */\nexport type SerializedExpression =\n | { t: \"empty\" }\n | { t: \"not-parsable\" }\n | { t: \"operator\"; operator: Operator; left?: SerializedExpression; right?: SerializedExpression }\n | {\n t: \"comparator\";\n comparator: Comparator;\n negated: boolean;\n strict: boolean;\n left?: SerializedExpression;\n right?: SerializedExpression;\n }\n | { t: \"property\"; path: string; transformer: Transformer | null; locale: string | null }\n | { t: \"value\"; value: SerializedValue; transformer: Transformer | null; locale: string | null };\n\nconst valueToJson = (value: unknown): SerializedValue => {\n if (value === undefined) {\n return { k: \"undefined\" };\n }\n\n if (value === null) {\n return { k: \"raw\", v: null };\n }\n\n if (value instanceof Date) {\n // ISO rather than epoch millis: it survives a human reading the payload, and an invalid\n // Date has no ISO form — so it is caught here rather than becoming a silent `null`.\n return { k: \"date\", v: value.toISOString() };\n }\n\n if (Array.isArray(value)) {\n return { k: \"array\", v: value.map(valueToJson) };\n }\n\n if (typeof value === \"number\" && Number.isFinite(value) === false) {\n // `JSON.stringify` turns all three of these into `null`, which would compare as a different\n // value entirely rather than failing.\n return { k: \"number\", v: Number.isNaN(value) ? \"NaN\" : value > 0 ? \"Infinity\" : \"-Infinity\" };\n }\n\n if (typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\") {\n return { k: \"raw\", v: value };\n }\n\n throw new Error(\n `Cannot serialize this filter value: only strings, numbers, booleans, null, undefined, Dates and arrays of those can cross a wire. ` +\n `Received: ${Object.prototype.toString.call(value)}`\n );\n};\n\nconst valueFromJson = (value: SerializedValue): unknown => {\n if (value.k === \"undefined\") {\n return undefined;\n }\n\n if (value.k === \"date\") {\n return new Date(value.v);\n }\n\n if (value.k === \"array\") {\n return value.v.map(valueFromJson);\n }\n\n if (value.k === \"number\") {\n return value.v === \"NaN\" ? Number.NaN : value.v === \"Infinity\" ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;\n }\n\n return value.v;\n};\n\nexport type ParsedExpression = {\n expression: Expression;\n // Will be memory when trying to query on an untracked computed property or on a function\n executionTarget: QueryOptionExecutionTarget;\n}\n\n/**\n * The base class for all expression types.\n */\nexport abstract class Expression {\n /** The type of the expression. */\n abstract readonly type: ExpressionType;\n /** The left-hand side of the expression (if applicable). */\n left?: Expression;\n /** The right-hand side of the expression (if applicable). */\n right?: Expression;\n\n constructor(left?: Expression, right?: Expression) {\n this.left = left;\n this.right = right;\n }\n\n static get EMPTY() {\n return new EmptyExpression();\n }\n\n static get NOT_PARSABLE() {\n return new NotParsableExpression();\n }\n\n static isEmpty(expression: Expression) {\n return expression.type === \"empty\" || expression instanceof EmptyExpression;\n }\n\n static isNotParsable(expression: Expression) {\n return expression.type === \"not-parsable\" || expression instanceof NotParsableExpression;\n }\n\n /**\n * Turns a tree into plain JSON, so a whole query can cross a wire.\n *\n * On the class rather than beside it, because this is the type's own REPRESENTATION — there is one\n * right answer and it belongs with the thing being represented, next to `EMPTY` and `isEmpty`.\n * Rendering a tree into some other language (`toSql`, `toMql`, `evaluate`) is a different kind of\n * thing: there are many, each belongs to its consumer, and none of them is canonical.\n *\n * ## Why it is this small\n *\n * Of the six node types a bound tree can contain, exactly one holds anything JSON cannot carry:\n * `PropertyExpression`, whose live `PropertyInfo` has functions, a parent chain and caches. It\n * reduces to a property PATH — `PropertyInfo.id` IS the dotted path, and `getProperty` is keyed by\n * exactly that — so rebinding is one lookup.\n *\n * `ParamReferenceExpression` never appears: it is a parse-time placeholder that binding replaces\n * with a plain `ValueExpression` holding the resolved value. A serialized tree is always already\n * bound, so there is no params object to send alongside it.\n *\n * Switches on `type` rather than using the `isXExpression` guards, which live in `../assertions`\n * and import this module — the guards test the same discriminant, so nothing is lost.\n */\n static toJson(expression: Expression): SerializedExpression {\n\n if (expression.type === \"operator\") {\n const operator = expression as OperatorExpression;\n\n return {\n t: \"operator\",\n operator: operator.operator,\n ...(operator.left != null && { left: Expression.toJson(operator.left) }),\n ...(operator.right != null && { right: Expression.toJson(operator.right) }),\n };\n }\n\n if (expression.type === \"comparator\") {\n const comparator = expression as ComparatorExpression;\n\n return {\n t: \"comparator\",\n comparator: comparator.comparator,\n negated: comparator.negated,\n strict: comparator.strict,\n ...(comparator.left != null && { left: Expression.toJson(comparator.left) }),\n ...(comparator.right != null && { right: Expression.toJson(comparator.right) }),\n };\n }\n\n if (expression.type === \"property\") {\n const property = expression as PropertyExpression;\n\n return {\n t: \"property\",\n // The dotted path, which is exactly the key `getProperty` is looking up\n path: property.property.id,\n transformer: property.transformer,\n locale: property.locale,\n };\n }\n\n if (expression.type === \"value\") {\n const value = expression as ValueExpression;\n\n return {\n t: \"value\",\n value: valueToJson(value.value),\n transformer: value.transformer,\n locale: value.locale,\n };\n }\n\n return expression.type === \"empty\" ? { t: \"empty\" } : { t: \"not-parsable\" };\n }\n\n /**\n * Rebuilds a tree from JSON, rebinding every property against `schema`.\n *\n * The schema is SUPPLIED rather than read out of the payload. A filter always belongs to a known\n * collection, and the RECEIVER's schema is the authority on what its properties are — taking an\n * id from the payload would mean rebinding against a schema the sender chose, which is backwards\n * for anything crossing a trust boundary.\n *\n * @throws when a property path is not declared by `schema`. Not `NOT_PARSABLE`: on a receiver, a\n * filter that silently stops filtering returns rows the requester excluded, which is the one\n * failure here worse than an error.\n */\n static fromJson(json: SerializedExpression, schema: CompiledSchemaCore<any>): Expression {\n\n const child = (node: SerializedExpression | undefined) => node == null ? undefined : Expression.fromJson(node, schema);\n\n if (json.t === \"operator\") {\n return new OperatorExpression({ operator: json.operator, left: child(json.left), right: child(json.right) });\n }\n\n if (json.t === \"comparator\") {\n return new ComparatorExpression({\n comparator: json.comparator,\n negated: json.negated,\n strict: json.strict,\n left: child(json.left),\n right: child(json.right),\n });\n }\n\n if (json.t === \"property\") {\n const property = schema.getProperty(json.path);\n\n if (property == null) {\n throw new Error(\n `Cannot deserialize a filter: this schema does not declare the property it names. ` +\n `Property: ${json.path}, Collection: ${schema.collectionName}. ` +\n `The two sides disagree about the shape of the data, so the filter cannot be applied.`\n );\n }\n\n const rebuilt = new PropertyExpression({ property });\n rebuilt.transformer = json.transformer;\n rebuilt.locale = json.locale;\n\n return rebuilt;\n }\n\n if (json.t === \"value\") {\n const rebuilt = new ValueExpression({ value: valueFromJson(json.value) });\n rebuilt.transformer = json.transformer;\n rebuilt.locale = json.locale;\n\n return rebuilt;\n }\n\n return json.t === \"empty\" ? Expression.EMPTY : Expression.NOT_PARSABLE;\n }\n}\n\nexport class EmptyExpression extends Expression {\n readonly type = \"empty\" as const;\n}\n\nexport class NotParsableExpression extends Expression {\n readonly type = \"not-parsable\" as const;\n}\n\n/**\n * A class representing a comparison operation (e.g., equals, greater-than).\n */\nexport class ComparatorExpression extends Expression {\n /** The type of the expression (always 'comparator'). */\n readonly type = \"comparator\" as const;\n /** The comparator operation (e.g., equals, greater-than). */\n comparator: Comparator;\n /** Whether the comparison is negated (e.g., not equals). */\n negated: boolean;\n /** Whether the comparison is strict (type-sensitive). */\n strict: boolean;\n\n constructor(\n options: {\n comparator: Comparator,\n negated: boolean,\n strict: boolean,\n left?: Expression,\n right?: Expression\n }\n ) {\n super(options.left, options.right);\n this.comparator = options.comparator;\n this.negated = options.negated;\n this.strict = options.strict;\n }\n}\n\n/**\n * A class representing a logical operator (e.g., &&, ||).\n */\nexport class OperatorExpression extends Expression {\n /** The type of the expression (always 'operator'). */\n readonly type = \"operator\" as const;\n /** The logical operator. */\n operator: Operator;\n\n constructor(options: { operator: Operator, left?: Expression, right?: Expression }) {\n super(options.left, options.right);\n this.operator = options.operator;\n }\n}\n\n/**\n * A class representing a property path.\n */\nexport class PropertyExpression extends Expression {\n /** The type of the expression (always 'property'). */\n readonly type = \"property\" as const;\n /** The property info for the path. */\n property: PropertyInfo<any>;\n transformer: Transformer | null = null;\n locale: string | null = null;\n\n constructor(options: { property: PropertyInfo<any> }) {\n super();\n this.property = options.property;\n }\n}\n\n/**\n * A class representing a literal value.\n */\nexport class ValueExpression extends Expression {\n /** The type of the expression (always 'value'). */\n readonly type = \"value\" as const;\n /** The literal value. */\n value: unknown;\n\n transformer: Transformer | null = null;\n locale: string | null = null;\n\n constructor(options: {\n value: unknown\n }) {\n super();\n this.value = options.value;\n }\n}\n\n\n/**\n * The set of possible expression types.\n */\nexport type ExpressionType = \"operator\" | \"comparator\" | \"property\" | \"value\" | \"empty\" | \"not-parsable\";\n\n/**\n * Supported value transformations that can be applied to values.\n * `length` reads the length of a string or array property.\n */\nexport type Transformer = \"to-lower-case\" | \"to-upper-case\" | \"length\";\n\n/**\n * Supported comparator operations for expressions.\n */\nexport type Comparator =\n | \"equals\"\n | \"starts-with\"\n | \"includes\"\n | \"ends-with\"\n | \"greater-than\"\n | \"greater-than-equals\"\n | \"less-than\"\n | \"less-than-equals\";\n\n/**\n * Supported logical operators for expressions.\n */\nexport type Operator = \"&&\" | \"||\";\n\n/**\n * A function that filters a value of type T and returns a boolean.\n */\nexport type Filter<T extends any> = (value: T) => boolean;\n\n/**\n * A function that filters a value of type T with additional parameters P.\n */\nexport type ParamsFilter<T extends any, P> = (payload: [T, P]) => boolean;\n\n/**\n * A filter that can be either a simple filter or a parameterized filter.\n */\nexport type CompositeFilter<T extends any, P = never> = Filter<T> | ParamsFilter<T, P>;\n\n/**\n * An object that can be filtered using a composite filter and optional parameters.\n */\nexport type Filterable<T extends any, P = any> = {\n /** The filter function. */\n filter: CompositeFilter<T, P>;\n /** Optional parameters for the filter. */\n params?: P;\n};","import { PropertyInfo } from \"../schema\";\nimport { Expression, PropertyExpression } from \"./types\";\n\n/**\n * Extracts all properties referenced in an expression\n * @param expression The expression to analyze\n * @returns Array of PropertyInfo objects referenced in the expression\n */\nexport function getProperties(expression: Expression): PropertyInfo<any>[] {\n const properties: PropertyInfo<any>[] = [];\n\n function traverse(expr: Expression) {\n // If this is a property expression, add it to our collection\n if (expr.type === \"property\") {\n properties.push((expr as PropertyExpression).property);\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n traverse(expr.left);\n }\n if (expr.right) {\n traverse(expr.right);\n }\n }\n\n traverse(expression);\n return properties;\n}\n\nexport function forEach(expression: Expression, callback: (expression: Expression) => boolean) {\n function traverse(expr: Expression): boolean {\n // Call the callback for this expression\n // If callback returns false, stop traversing\n if (!callback(expr)) {\n return false;\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n if (!traverse(expr.left)) {\n return false;\n }\n }\n if (expr.right) {\n if (!traverse(expr.right)) {\n return false;\n }\n }\n\n return true;\n }\n\n traverse(expression);\n}","import { logger } from \"../utilities\";\n\nconst measurements: Record<string, number> = {}\n\nexport const now = (): number => {\n if (typeof performance !== 'undefined' && performance.now) {\n // Browser or modern Node.js\n return performance.now();\n }\n\n // Fallback for older environments\n return Date.now();\n}\n\nexport const measure = {\n start: (name: string): void => {\n measurements[name] = now();\n },\n end: (name: string): void => {\n const start = measurements[name];\n\n delete measurements[name];\n\n const delta = now() - start;\n\n logger.log(`[ROUTIER] - Performance: ${name} took ${delta}`);\n }\n}","import { logger } from \"../utilities\";\nimport { CallbackResult, Result, ResultType } from \"../results\";\n\n/**\n * Type definition for an asynchronous function that takes data and a callback.\n * TIn: The input data type.\n * TOut: The output data type (passed to the callback).\n */\nexport type Processor<TIn, TOut> = (data: TIn, callback: (result: TOut, error?: any) => void) => void;\n\n// Return type for a step execution: Either the next step function or null if waiting/done.\ntype StepResult<TData> = TrampolineStep<TData> | null;\ntype TrampolineStep<TData> = () => StepResult<TData>;\n\nexport class TrampolinePipeline<TInitial, TCurrent = TInitial> {\n private _list: Processor<any, any>[] = [];\n private _hasErrored: boolean = false; // Flag to prevent calling done on error\n\n filter<TFinal>(initialData: TInitial, done: (data: TFinal, error?: any) => void) {\n\n this._hasErrored = false; // Reset error flag on new execution\n\n if (this._list.length === 0) {\n done(initialData as unknown as TFinal);\n return;\n }\n\n let index = 0;\n let currentData: any = initialData;\n let isRunning = false; // Guard against overlapping trampoline calls\n\n try {\n // --- Revised Completion Logic --- (Moved up for clarity)\n const finalStepSentinel = (): StepResult<any> => { // A special step function for the very end\n // Only call done if no error has occurred\n if (!this._hasErrored) {\n done(currentData as TFinal);\n }\n return null; // Stop the trampoline\n };\n\n const createStepRevised = (idx: number): TrampolineStep<any> => {\n return () => {\n if (this._hasErrored) return null; // Stop if an error occurred elsewhere\n\n if (idx >= this._list.length) {\n return finalStepSentinel(); // Execute the dedicated final step\n }\n\n const processor = this._list[idx];\n // Initialize syncCallbackResult to null to satisfy StepResult type\n let syncCallbackResult: StepResult<any> = null;\n let calledSync = false;\n\n try {\n processor(currentData, (result, error) => {\n // --- Error Handling ---\n if (error) {\n logger.error(`Error reported by processor at index ${idx}:`, error);\n this._hasErrored = true; // Set flag\n // Throw the error to be caught by outer try...catch blocks\n throw error;\n }\n // --- /Error Handling ---\n\n // If no error, proceed as before\n currentData = result;\n index = idx + 1; // Update index for the next step\n const nextStep = createStepRevised(index); // Use updated index\n\n if (isRunning) {\n // Callback was synchronous\n syncCallbackResult = nextStep; // Store next step function\n calledSync = true;\n } else {\n // Callback was asynchronous, restart trampoline\n trampoline(nextStep);\n }\n });\n } catch (error) {\n if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback\n logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);\n this._hasErrored = true;\n }\n // Rethrow to be caught by the trampoline's catch block\n throw error;\n }\n\n if (calledSync) {\n // Return the next step function for the sync loop\n return syncCallbackResult;\n } else {\n // Pause trampoline for async, loop will stop as step returns null\n return null;\n }\n };\n };\n\n // The trampoline loop\n const trampoline = (step: TrampolineStep<any> | null) => {\n\n if (isRunning) {\n return;\n }\n\n isRunning = true;\n let currentStep = step;\n\n while (currentStep !== null) {\n try {\n // Stop immediately if an error was flagged elsewhere\n if (this._hasErrored) {\n currentStep = null;\n break;\n }\n currentStep = currentStep(); // Execute step, get next step or null\n } catch (trampolineError) {\n // Catch errors propagated from step execution (processor or callback errors)\n if (!this._hasErrored) { // Avoid double logging\n logger.error(\"Error during trampoline step execution:\", trampolineError);\n this._hasErrored = true;\n }\n currentStep = null; // Stop the loop\n\n // Report the failure to the caller.\n //\n // This used to break without calling `done`, on the reasoning that\n // the application should handle the uncaught exception. It cannot:\n // the error is caught right here, so nothing escapes to be handled,\n // and every caller awaiting the callback waits forever. A hang is\n // strictly worse than an error — it gives the caller nothing to act\n // on and no way to time out.\n //\n // `done` runs exactly once per execution: this path returns\n // immediately, and finalStepSentinel checks `_hasErrored` before\n // reporting success, so the two are mutually exclusive.\n isRunning = false;\n done(currentData as TFinal, trampolineError);\n return;\n }\n }\n // Loop ends when currentStep is null or loop is broken by error\n isRunning = false;\n\n // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.\n };\n\n // --- Start the process ---\n index = 0; // Reset index\n currentData = initialData; // Reset data\n trampoline(createStepRevised(0)); // Start with the revised step creator\n } catch (error: any) {\n done(currentData, error);\n }\n }\n\n pipe<TNext>(processor: Processor<TCurrent, TNext>) {\n this._list.push(processor);\n return this as unknown as TrampolinePipeline<TInitial, TNext>;\n }\n\n pipeEach(items: TCurrent[], fn: (payload: ResultType<TCurrent>, done: CallbackResult<TCurrent>) => void, map: (previous: ResultType<TCurrent>, current: ResultType<TCurrent>) => ResultType<TCurrent>) {\n for (let i = 0, length = items.length; i < length; i++) {\n\n this.pipe<ResultType<TCurrent>>((previous, done) => {\n\n fn(map(previous as ResultType<TCurrent>, Result.success(items[i])), done);\n });\n }\n }\n}\n\nexport type UnitOfWork = (done: CallbackResult<never>) => void;\n\n/**\n * Processes functions with callbacks asynchronously.\n * \n * This pipeline handles work items that contain callback functions,\n * executing them in an asynchronous manner while maintaining proper\n * flow control and error handling.\n */\nexport class WorkPipeline {\n private unitsOfWork: UnitOfWork[] = [];\n private _hasErrored: boolean = false; // Flag to prevent calling done on error\n\n filter(done: CallbackResult<never>) {\n\n this._hasErrored = false; // Reset error flag on new execution\n\n if (this.unitsOfWork.length === 0) {\n done(Result.success());\n return;\n }\n\n let index = 0;\n let isRunning = false; // Guard against overlapping trampoline calls\n\n try {\n // --- Revised Completion Logic --- (Moved up for clarity)\n const finalStepSentinel = (): StepResult<never> => { // A special step function for the very end\n // Only call done if no error has occurred\n if (!this._hasErrored) {\n done(Result.success());\n }\n return null; // Stop the trampoline\n };\n\n const createStepRevised = (idx: number): TrampolineStep<any> => {\n return () => {\n if (this._hasErrored) return null; // Stop if an error occurred elsewhere\n\n if (idx >= this.unitsOfWork.length) {\n return finalStepSentinel(); // Execute the dedicated final step\n }\n\n const processor = this.unitsOfWork[idx];\n // Initialize syncCallbackResult to null to satisfy StepResult type\n let syncCallbackResult: StepResult<any> = null;\n let calledSync = false;\n\n try {\n processor((result) => {\n // --- Error Handling ---\n if (result.ok === Result.ERROR) {\n logger.error(`Error reported by AsyncPipeline at index ${idx}:`, result.error);\n this._hasErrored = true; // Set flag\n // Throw the error to be caught by outer try...catch blocks\n throw result.error;\n }\n // --- /Error Handling ---\n\n // If no error, proceed as before\n index = idx + 1; // Update index for the next step\n const nextStep = createStepRevised(index); // Use updated index\n\n if (isRunning) {\n // Callback was synchronous\n syncCallbackResult = nextStep; // Store next step function\n calledSync = true;\n } else {\n // Callback was asynchronous, restart trampoline\n trampoline(nextStep);\n }\n });\n } catch (error) {\n if (!this._hasErrored) { // Check flag to avoid double logging if error was from callback\n logger.error(`Error thrown by processor at index ${idx} or its callback:`, error);\n this._hasErrored = true;\n }\n // Rethrow to be caught by the trampoline's catch block\n throw error;\n }\n\n if (calledSync) {\n // Return the next step function for the sync loop\n return syncCallbackResult;\n } else {\n // Pause trampoline for async, loop will stop as step returns null\n return null;\n }\n };\n };\n\n // The trampoline loop\n const trampoline = (step: TrampolineStep<any> | null) => {\n\n if (isRunning) {\n return;\n }\n\n isRunning = true;\n let currentStep = step;\n\n while (currentStep !== null) {\n try {\n // Stop immediately if an error was flagged elsewhere\n if (this._hasErrored) {\n currentStep = null;\n break;\n }\n currentStep = currentStep(); // Execute step, get next step or null\n } catch (trampolineError) {\n // Catch errors propagated from step execution (processor or callback errors)\n if (!this._hasErrored) { // Avoid double logging\n logger.error(\"Error during trampoline step execution:\", trampolineError);\n this._hasErrored = true;\n }\n currentStep = null; // Stop the loop\n\n // Report the failure to the caller. See the note on the same path in\n // TrampolinePipeline: swallowing the error here left every caller\n // awaiting `done` hanging instead of receiving a failure.\n isRunning = false;\n done(Result.error(trampolineError));\n return;\n }\n }\n // Loop ends when currentStep is null or loop is broken by error\n isRunning = false;\n\n // Completion check is now handled by finalStepSentinel ensuring `done` isn't called on error.\n };\n\n // --- Start the process ---\n index = 0; // Reset index\n trampoline(createStepRevised(0)); // Start with the revised step creator\n } catch (error: any) {\n done(Result.error(error));\n }\n }\n\n pipe(work: UnitOfWork) {\n this.unitsOfWork.push(work);\n }\n}","export type SyncronousUnitOfWork = (done: () => void) => void\n\nexport class SyncronousQueue {\n\n private readonly _queue: SyncronousUnitOfWork[] = [];\n private _current: SyncronousUnitOfWork | null = null;\n\n enqueue(unitOfWork: SyncronousUnitOfWork) {\n this._queue.push(unitOfWork);\n this._next();\n }\n\n private _next() {\n if (this._current != null || this._queue.length === 0) {\n return;\n }\n\n // Take first item\n this._current = this._queue.shift() ?? null;\n\n if (this._current == null) {\n return;\n }\n\n this._current(() => {\n this._current = null;\n this._next();\n })\n }\n}","export * from './SyncronousQueue';\nexport * from './TrampolinePipeline';","import { ITranslatedValue } from './types';\n\nexport class TranslatedArrayValue<T> implements ITranslatedValue<T> {\n\n readonly value: T;\n readonly isTransformed: boolean;\n readonly isEmpty: boolean;\n\n constructor(value: unknown, isTransformed: boolean) {\n this.value = value as T;\n this.isEmpty = value == null || (Array.isArray(value) && value.length === 0);\n this.isTransformed = isTransformed;\n }\n\n forEach(callback: (item: unknown) => unknown): void {\n const data = this.value as unknown[];\n for (let i = 0, length = data.length; i < length; i++) {\n const result = callback(data[i]);\n\n if (result) {\n // reassign if the callback returns a result\n data[i] = result;\n }\n }\n }\n}","import { ITranslatedValue } from './types';\n\nexport class TranslatedGroupValue<T> implements ITranslatedValue<T> {\n\n readonly value: T;\n readonly isTransformed: boolean;\n readonly isEmpty: boolean;\n\n constructor(value: unknown, isTransformed: boolean) {\n this.value = value as T;\n this.isEmpty = value == null;\n this.isTransformed = isTransformed;\n }\n\n forEach(callback: (item: unknown) => unknown): void {\n const group = this.value as Record<string, unknown[]>;\n const keys = Object.keys(group);\n for (let i = 0, length = keys.length; i < length; i++) {\n const key = keys[i];\n const data = group[key];\n\n for (let j = 0, len = data.length; j < len; j++) {\n\n const result = callback(data[j]);\n\n if (result) {\n // reassign if the callback returns a result\n data[j] = result;\n }\n }\n }\n }\n}","import { ITranslatedValue } from './types';\n\nexport class TranslatedSingleValue<T> implements ITranslatedValue<T> {\n\n value: T;\n readonly isTransformed: boolean;\n readonly isEmpty: boolean;\n\n constructor(value: unknown, isTransformed: boolean) {\n this.value = value as T;\n this.isEmpty = value == null;\n this.isTransformed = isTransformed;\n }\n\n forEach(callback: (item: unknown) => unknown): void {\n const result = callback(this.value) as T;\n\n if (result) {\n this.value = result;\n }\n }\n}","import { QueryOption, QueryOptionName } from \"../query/types\";\nimport { IQuery } from \"../types\";\nimport { TranslatedArrayValue } from \"./TranslatedArrayValue\";\nimport { TranslatedGroupValue } from \"./TranslatedGroupValue\";\nimport { TranslatedSingleValue } from \"./TranslatedSingleValue\";\nimport { ITranslatedValue } from \"./types\";\n\nexport abstract class DataTranslator<TRoot extends {}, TShape> {\n\n protected query: IQuery<TRoot, TShape>;\n private functionMap: Record<QueryOptionName, (data: unknown, option: QueryOption<any, any>) => TShape> = {\n count: (data: unknown, option: QueryOption<TShape, \"count\">) => this.count<any>(data, option),\n distinct: (data: unknown, option: QueryOption<TShape, \"distinct\">) => this.distinct(data, option),\n filter: (data: unknown, option: QueryOption<TShape, \"filter\">) => this.filter(data, option),\n map: (data: unknown, option: QueryOption<TShape, \"map\">) => this.map(data, option),\n max: (data: unknown, option: QueryOption<TShape, \"max\">) => this.max<any>(data, option),\n min: (data: unknown, option: QueryOption<TShape, \"min\">) => this.min<any>(data, option),\n skip: (data: unknown, option: QueryOption<TShape, \"skip\">) => this.skip(data, option),\n sort: (data: unknown, option: QueryOption<TShape, \"sort\">) => this.sort(data, option),\n sum: (data: unknown, option: QueryOption<TShape, \"sum\">) => this.sum<any>(data, option),\n take: (data: unknown, option: QueryOption<TShape, \"take\">) => this.take(data, option),\n group: (data: unknown, option: QueryOption<TShape, \"group\">) => this.group(data, option),\n nearest: (data: unknown, option: QueryOption<TShape, \"nearest\">) => this.nearest(data, option),\n join: (data: unknown, option: QueryOption<TShape, \"join\">) => this.join(data, option)\n };\n\n constructor(query: IQuery<TRoot, TShape>) {\n this.query = query;\n }\n\n // Terminators\n abstract count<TResult extends number>(data: unknown, option: QueryOption<TShape, \"count\">): TResult;\n abstract min<TResult extends string | number | Date>(data: unknown, option: QueryOption<TShape, \"min\">): TResult;\n abstract max<TResult extends string | number | Date>(data: unknown, option: QueryOption<TShape, \"max\">): TResult;\n abstract sum<TResult extends number>(data: unknown, option: QueryOption<TShape, \"sum\">): TResult;\n abstract distinct<TResult>(data: unknown, option: QueryOption<TShape, \"distinct\">): TResult;\n\n // Shapers\n abstract filter<TResult>(data: unknown, option: QueryOption<TShape, \"filter\">): TResult;\n abstract skip(data: unknown, option: QueryOption<TShape, \"skip\">): TShape;\n abstract take(data: unknown, option: QueryOption<TShape, \"take\">): TShape;\n abstract sort(data: unknown, option: QueryOption<TShape, \"sort\">): TShape;\n abstract map(data: unknown, option: QueryOption<TShape, \"map\">): TShape;\n abstract group(data: unknown, option: QueryOption<TShape, \"group\">): TShape;\n /**\n * Abstract on purpose, unlike the pass-throughs a storage translator can usually inherit.\n *\n * Every other shaper degrades safely when a backend ignores it — an unsorted result is\n * still the right rows. A similarity search is not: it is the only option whose value is\n * ENTIRELY in the ordering and the limit, so a translator that quietly passes the data\n * through returns every row in insertion order and calls it the ten nearest.\n *\n * Requiring an answer here means a new translator cannot be written without deciding\n * whether its backend performed the search, and the compiler asks the question.\n */\n abstract nearest(data: unknown, option: QueryOption<TShape, \"nearest\">): TShape;\n\n /**\n * Abstract for the same reason as `nearest`, one step further.\n *\n * A translator that quietly passed a join through would not return an unsorted or unlimited\n * result — it would return the OUTER rows, one object each where the contract says tuples,\n * and every `([outer, inner]) => ...` lambda downstream would destructure the outer entity\n * instead. Nothing errors; the answer is simply a different query's answer.\n *\n * So the compiler asks the question. Every translator must state how its backend joins:\n * natively (pass through the rows the SQL already paired), in memory (the shared hash join\n * over rows the plugin supplies), or not at all (throw, loudly, naming the backend).\n *\n * The output contract, whichever answer: an array of `[outer, inner]` tuples, each half\n * fully deserialized into its OWN schema's entity shape.\n */\n abstract join(data: unknown, option: QueryOption<TShape, \"join\">): TShape;\n\n translate(data: unknown): ITranslatedValue<TShape> {\n\n const isTransformed = this.query.options.hasTransformations();\n\n this.query.options.forEach(item => {\n data = this.functionMap[item.name](data, item);\n });\n\n if (Array.isArray(data)) {\n return new TranslatedArrayValue<TShape>(data, isTransformed);\n }\n\n if (this.query.options.has(\"group\")) {\n return new TranslatedGroupValue<TShape>(data, isTransformed);\n }\n\n return new TranslatedSingleValue<TShape>(data, isTransformed);\n }\n}","import { logger } from \"../../utilities\";\n\n/**\n * Cosine distance, and the ordering rules that go with it.\n *\n * One implementation, shared by every in-memory path, because the promise the feature makes\n * is that a backend with no vector support returns the SAME ROWS IN THE SAME ORDER as one\n * that pushes the search down. Two copies of this arithmetic would drift, and the drift would\n * only ever show up as a conformance failure nobody could localise.\n *\n * The tie-breaking and degenerate cases below are chosen to match pgvector rather than to be\n * independently reasonable — parity is the point.\n */\n\n/**\n * Distance in `[0, 2]`, or `Infinity` for a value that cannot be compared.\n *\n * `Infinity` covers three cases, and they all sort LAST, which is what PostgreSQL does too:\n * a missing value (`NULL` sorts last under `ASC` by default), a zero-magnitude vector\n * (pgvector's `<=>` yields `NaN`, which PostgreSQL orders after every real number), and a\n * stored vector of the wrong width.\n *\n * The width case cannot happen on a native `vector(n)` column — the engine rejects the write —\n * so it only arises on a backend storing JSON, where the data was written by something other\n * than this schema. Sorting it last rather than throwing keeps one corrupt row from failing a\n * query that is otherwise answerable.\n */\nexport const cosineDistance = (left: readonly number[] | null | undefined, right: readonly number[]): number => {\n if (left == null || left.length !== right.length) {\n return Infinity;\n }\n\n let dot = 0;\n let leftMagnitude = 0;\n let rightMagnitude = 0;\n\n for (let i = 0, length = right.length; i < length; i++) {\n const l = left[i];\n const r = right[i];\n\n dot += l * r;\n leftMagnitude += l * l;\n rightMagnitude += r * r;\n }\n\n if (leftMagnitude === 0 || rightMagnitude === 0) {\n return Infinity;\n }\n\n return 1 - (dot / (Math.sqrt(leftMagnitude) * Math.sqrt(rightMagnitude)));\n};\n\n/**\n * The `count` rows closest to `vector`, nearest first.\n *\n * Distances are computed once per row rather than inside the comparator: a comparison-time\n * computation runs O(n log n) times over vectors that are commonly 1536 wide, which turns an\n * ordering into the dominant cost of the query.\n *\n * The sort is stable, so rows at equal distance keep the order the backend returned them in.\n * That is not a guarantee worth relying on across backends — two engines can hand back the\n * same rows in different orders — but it does mean this function never introduces a\n * difference of its own.\n */\nexport const nearestBy = <T>(\n rows: readonly T[],\n vector: number[],\n count: number,\n select: (row: T) => readonly number[] | null | undefined\n): T[] => {\n if (count <= 0) {\n return [];\n }\n\n /**\n * Rows whose stored vector is the wrong width, counted so the query can say so once.\n *\n * `cosineDistance` already handles them safely — they score `Infinity` and sort last, the\n * way PostgreSQL orders `NULL` — and that is deliberately not an error, because one corrupt\n * row must not fail a query that is otherwise answerable.\n *\n * The problem is that it is also SILENT. A row written at the wrong width is never returned\n * by any search and never reported by one, so an embedding model that changed its output\n * size degrades results steadily with nothing to notice. Counting costs a length comparison\n * per row against a vector that is commonly 1536 wide, and the warning is emitted once per\n * query rather than once per row.\n */\n let mismatched = 0;\n\n const scored = rows.map((row, index) => {\n const stored = select(row);\n\n if (stored != null && stored.length !== vector.length) {\n mismatched++;\n }\n\n return { row, index, distance: cosineDistance(stored, vector) };\n });\n\n if (mismatched > 0) {\n logger.warn(\n `nearest(): ${mismatched} of ${rows.length} stored vectors are not ${vector.length} wide, ` +\n `so they cannot be scored and sort last. They will never be returned by a search. ` +\n `This usually means the rows were written with a different embedding model.`\n );\n }\n\n scored.sort((a, b) => {\n if (a.distance === b.distance) {\n // Infinity === Infinity, so unscoreable rows fall through to insertion order\n // rather than to `Infinity - Infinity`, which is NaN and would leave the\n // comparator inconsistent — V8 is free to produce any permutation from that.\n return a.index - b.index;\n }\n\n return a.distance - b.distance;\n });\n\n return scored.slice(0, count).map(x => x.row);\n};\n","\nimport { CompiledSchema } from '../../schema';\nimport { IQuery } from '../types';\nimport { QueryOptionsCollection } from './QueryOptionsCollection';\n\nexport class Query<TRoot extends {}, TShape> implements IQuery<TRoot, TShape> {\n\n readonly options: QueryOptionsCollection<TShape>;\n readonly schema: CompiledSchema<TRoot>;\n private enableChangeTrackingOverride?: boolean\n\n constructor(\n options: QueryOptionsCollection<TShape>,\n schema: CompiledSchema<TRoot>,\n enableChangeTrackingOverride?: boolean,\n ) {\n this.schema = schema;\n this.options = options;\n this.enableChangeTrackingOverride = enableChangeTrackingOverride;\n }\n\n // boolean value whether or not change tracking can be enabled on the query result\n get changeTracking(): boolean {\n\n if (this.enableChangeTrackingOverride != null) {\n return this.enableChangeTrackingOverride;\n }\n\n const map = this.options.getValues(\"map\");\n const count = this.options.has(\"count\");\n const max = this.options.has(\"max\");\n const min = this.options.has(\"min\");\n const sum = this.options.has(\"sum\");\n\n if (map.some(x => x.fields.length > 0)) {\n return false\n }\n\n // A join returns TUPLES, not entities of this query's root schema. Attaching one would\n // hand the change tracker a two-element array to find an id on, and freezing or\n // membership-capturing it means reading the root schema's id off something that has no\n // properties at all. Join results are read-only projections, like `.map()` results.\n if (this.options.has(\"join\")) {\n return false;\n }\n\n if (count === true ||\n max === true ||\n min === true ||\n sum === true) {\n return false\n }\n\n return true;\n }\n\n static EMPTY<T extends {}, S>(schema: CompiledSchema<T>) {\n return new Query<T, S>(QueryOptionsCollection.EMPTY<S>(), schema);\n }\n\n static isEmpty<T extends {}, S>(query: IQuery<T, S>) {\n return QueryOptionsCollection.isEmpty(query.options);\n }\n\n static toString<TRoot extends {}, TShape>(query: IQuery<TRoot, TShape>) {\n return JSON.stringify({\n options: query.options.items,\n schema: {\n id: query.schema.id,\n collectionName: query.schema.collectionName\n },\n changeTracking: query.changeTracking\n })\n }\n}","import { CompiledSchemaCore, InferType, PropertyInfo } from \"../../schema\";\nimport { ComparatorExpression, Expression, ParamsFilter, PropertyExpression, ValueExpression } from \"../../expressions\";\nimport { UnknownRecord } from \"../../utilities\";\nimport { PluginEventCallbackResult, PluginEventResult } from \"../../results\";\nimport type { DbPluginQueryEvent } from \"../types\";\nimport type { ITranslatedValue } from \"../translators/types\";\nimport { TranslatedArrayValue } from \"../translators/TranslatedArrayValue\";\nimport { Query } from \"./Query\";\nimport { QueryOptionsCollection } from \"./QueryOptionsCollection\";\nimport { QueryOptionValueMap } from \"./types\";\n\nexport type JoinKind = \"inner\" | \"left\";\n\n/**\n * One side's join key, as a property path plus the resolved property.\n *\n * The path is what survives serialization; the `PropertyInfo` is the live handle that reads\n * the value and resolves a `from`-renamed storage name. Both, because a key read has to work\n * on either side of the wire.\n */\nexport type JoinKeyReference = {\n propertyName: string;\n property: PropertyInfo<any> | null;\n};\n\nexport type JoinQueryOptionValue = QueryOptionValueMap<any>[\"join\"];\n\n/**\n * The inner side of a join, as the PLUGIN sees it.\n *\n * Supplied by the plugin rather than fetched by the translator, because loading rows is the one\n * part of a join that is backend-specific: a memory plugin resolves a collection, Dexie opens a\n * store, Mongo reads a collection. Everything after that — deserializing, applying the inner\n * scopes, pairing — is identical, so it lives here and runs once.\n *\n * Rows arrive in STORAGE shape, exactly as the plugin holds them; the translator deserializes\n * them with `innerSchema`, which the outer query's own deserialization would never do.\n */\nexport type JoinInnerSide = {\n innerSchema: CompiledSchemaCore<any>;\n innerRows: readonly unknown[];\n};\n\n/**\n * `undefined` when the query has no join at all, which is the common case and not an error.\n */\nexport type JoinInnerSideResult =\n | { ok: \"success\"; innerSide?: JoinInnerSide }\n | { ok: \"error\"; error: unknown };\n\n/**\n * A joined pair, each half fully deserialized into its own schema's ENTITY shape.\n *\n * The wire contract for every interpretation of a join: a native SQL join, an in-plugin hash\n * join, and the datastore's cross-plugin join all produce exactly this. Flat combined rows\n * never leave a translator — see `specs/joins.md`.\n */\nexport type JoinTuple = [UnknownRecord, UnknownRecord | undefined];\n\n/**\n * Turns storage-shape records into entity-shape values, one side of a join at a time.\n *\n * The inner side does NOT pass through the outer query's normal deserialization —\n * `DatabaseDataAccessStrategy.query` transforms against the outer schema only — so each side\n * is deserialized with its own schema here, which is what makes the two halves of a tuple\n * readable by the same property names the caller wrote in the selectors.\n *\n * `\"diff\"` rather than `\"proxy\"`: join results are read-only projections and never attach to\n * the change tracker, so there is nothing for a tracking proxy to record.\n */\nexport const toEntityShape = (schema: CompiledSchemaCore<any>, rows: readonly unknown[]): UnknownRecord[] => {\n const result: UnknownRecord[] = Array.from({ length: rows.length });\n\n for (let i = 0, length = rows.length; i < length; i++) {\n result[i] = schema.postprocess(rows[i] as InferType<any>, \"diff\") as UnknownRecord;\n }\n\n return result;\n};\n\n/**\n * Reads a join key off an entity-shape row.\n *\n * Through the `PropertyInfo` when there is one, so a nested path (`a.b.id`) resolves the same\n * way every other option resolves it. The string fallback exists for an option that crossed a\n * wire without its schema; it walks the same path by name.\n */\nexport const readJoinKey = (row: UnknownRecord | undefined, reference: JoinKeyReference): unknown => {\n if (row == null) {\n return null;\n }\n\n if (reference.property != null) {\n return reference.property.getValue(row);\n }\n\n const path = reference.propertyName.split(\".\");\n let current: unknown = row;\n\n for (let i = 0, length = path.length; i < length; i++) {\n if (current == null) {\n return null;\n }\n\n current = (current as UnknownRecord)[path[i]];\n }\n\n return current;\n};\n\n/**\n * Whether a key value can participate in a match at all.\n *\n * `null`/`undefined` never match anything (semantics table in `specs/joins.md`), and `NaN` is\n * excluded for a subtler reason: a `Map` compares keys by SameValueZero, under which `NaN`\n * equals itself, while the specified comparison is strict `===`, under which it does not. A\n * `NaN` key that matched here would be the one value where the in-memory hash join and a SQL\n * join disagree.\n */\nconst isMatchableKey = (value: unknown): boolean => {\n if (value == null) {\n return false;\n }\n\n return typeof value !== \"number\" || Number.isNaN(value) === false;\n};\n\n/**\n * Applies an inner side's own filters to its rows.\n *\n * **This is the correctness trap of the whole feature.** Every interpretation of a join\n * bypasses the inner collection's normal datastore read path, so the inner side's soft-delete\n * scope and `.scope()` filters exist ONLY because `innerOptions` carries them. An interpreter\n * that skips this returns soft-deleted rows.\n *\n * Filters only. Nothing else reaches `innerOptions` today — scopes are filters — and applying\n * a `skip`/`take` recorded against the inner collection to the rows feeding a join would\n * change which pairs exist rather than which rows are visible.\n */\nexport const applyInnerOptions = (rows: UnknownRecord[], innerOptions: QueryOptionsCollection<any>): UnknownRecord[] => {\n let filtered = rows;\n\n for (const { option } of innerOptions.get(\"filter\")) {\n const { filter, params } = option.value;\n\n if (filter == null) {\n continue;\n }\n\n if (params == null) {\n filtered = filtered.filter(filter as (row: unknown) => boolean);\n continue;\n }\n\n const selector = filter as ParamsFilter<unknown, {}>;\n filtered = filtered.filter(row => selector([row, params]));\n }\n\n return filtered;\n};\n\n/**\n * The join itself: one hash join, written once, called from every interpreter.\n *\n * O(n + m) rather than a nested loop, which is the whole reason the API takes explicit key\n * selectors instead of a free-form predicate. Both key properties are `string` or `number` by\n * a build-time rule, so the keys are hashable and compare the same way in JS and in SQL.\n *\n * Semantics, exactly as `specs/joins.md` states them:\n *\n * - **Null keys** never match. Under `left` the outer row still appears, paired with\n * `undefined`.\n * - **Duplicates** produce every pair: the full cross product per key group.\n * - **Ordering** is outer order, then inner order within a key group. Undefined by contract —\n * a caller who cares sorts.\n */\nexport const hashJoin = (options: {\n kind: JoinKind;\n outerRows: UnknownRecord[];\n innerRows: UnknownRecord[];\n outerKey: JoinKeyReference;\n innerKey: JoinKeyReference;\n}): JoinTuple[] => {\n const { kind, outerRows, innerRows, outerKey, innerKey } = options;\n const isLeft = kind === \"left\";\n\n const buckets = new Map<unknown, UnknownRecord[]>();\n\n for (let i = 0, length = innerRows.length; i < length; i++) {\n const row = innerRows[i];\n const key = readJoinKey(row, innerKey);\n\n if (isMatchableKey(key) === false) {\n continue;\n }\n\n const bucket = buckets.get(key);\n\n if (bucket == null) {\n buckets.set(key, [row]);\n continue;\n }\n\n bucket.push(row);\n }\n\n const tuples: JoinTuple[] = [];\n\n for (let i = 0, length = outerRows.length; i < length; i++) {\n const outer = outerRows[i];\n const key = readJoinKey(outer, outerKey);\n const matches = isMatchableKey(key) ? buckets.get(key) : undefined;\n\n if (matches == null) {\n if (isLeft) {\n tuples.push([outer, undefined]);\n }\n\n continue;\n }\n\n for (let j = 0, matchLength = matches.length; j < matchLength; j++) {\n tuples.push([outer, matches[j]]);\n }\n }\n\n return tuples;\n};\n\n/**\n * How many distinct outer keys are still worth turning into an `IN (...)` prefilter.\n *\n * A cost decision, never a correctness one: above the threshold the inner side is read under its\n * own scopes and the hash join discards the surplus, which is the same answer by a slower route.\n * 500 because a bound-parameter list is cheap in the hundreds and starts costing more than the\n * scan it saves in the thousands — and some engines refuse a list that long outright.\n */\nexport const DEFAULT_SEMI_JOIN_KEY_THRESHOLD = 500;\n\n/**\n * The distinct join keys of the outer rows, or `null` when there are too many to be worth sending.\n *\n * `null` means \"do not prefilter\", not \"no keys\" — an empty SET is a real answer meaning the inner\n * side cannot match anything.\n *\n * @param column The key's STORAGE column name when `rows` are storage-shaped, or its property name\n * when they are entity-shaped. The caller knows which it holds.\n */\nexport const distinctJoinKeys = (\n rows: readonly UnknownRecord[],\n reference: JoinKeyReference,\n threshold: number = DEFAULT_SEMI_JOIN_KEY_THRESHOLD,\n options?: { storageShape?: boolean }\n): Set<unknown> | null => {\n const keys = new Set<unknown>();\n\n const read = options?.storageShape === true\n ? (row: UnknownRecord) => row[reference.property?.getResolvedName() ?? reference.propertyName]\n : (row: UnknownRecord) => readJoinKey(row, reference);\n\n for (const row of rows) {\n const key = read(row);\n\n // A null key matches nothing, so it never belongs in the prefilter — and including it\n // would widen the inner read to rows that cannot pair.\n if (isMatchableKey(key) === false) {\n continue;\n }\n\n keys.add(key);\n\n if (keys.size > threshold) {\n return null;\n }\n }\n\n return keys;\n};\n\n/**\n * A filter restricting the inner side to rows whose key is one the outer side actually has.\n *\n * Built as an expression tree by hand rather than parsed from generated source, for the reason\n * `softDeleteScope` gives: generating source needs `new Function`, which a Content-Security-Policy\n * blocks, and the shape is known here so there is nothing to parse. An `includes` comparator over\n * an array value is what every translator already turns into `IN (...)` or `$in`, so this pushes\n * down on the backends that can take it and runs as the closure on the ones that cannot.\n *\n * Cost only. Every pair it removes from the inner read is one the hash join would have discarded.\n */\nexport const semiJoinFilter = (\n reference: JoinKeyReference,\n keys: ReadonlySet<unknown>\n): QueryOptionValueMap<any>[\"filter\"] => {\n const values = [...keys];\n const propertyName = reference.propertyName;\n\n const expression = reference.property == null\n ? Expression.NOT_PARSABLE\n : new ComparatorExpression({\n comparator: \"includes\",\n negated: false,\n strict: true,\n left: new ValueExpression({ value: values }),\n right: new PropertyExpression({ property: reference.property }),\n });\n\n // Read through the PropertyInfo when there is one so a nested path resolves; the Set is closed\n // over rather than rebuilt per row.\n const read = reference.property != null\n ? (row: UnknownRecord) => reference.property!.getValue(row)\n : (row: UnknownRecord) => readJoinKey(row, { propertyName, property: null });\n\n return {\n filter: ((row: UnknownRecord) => keys.has(read(row))) as never,\n expression,\n params: undefined\n };\n};\n\n/**\n * Loads a join's inner side by asking the plugin to run an ORDINARY query for it.\n *\n * The generic way for a plugin to interpret a join — one call, no join-specific reading code.\n * The inner side is just \"this collection, under these filters\", which is a query every plugin\n * already knows how to answer, through whatever indexes and scoping it normally applies.\n *\n * Only the DATABASE half of `innerOptions` is sent. The memory half would mean nothing to the\n * plugin, and `executeJoin` re-applies every filter regardless — filters are pure, so the second\n * pass costs a walk over the survivors and guarantees the inner scopes are honoured even if the\n * plugin silently ignored them.\n *\n * The inner query carries no `join` option of its own, so this cannot recurse.\n *\n * @param query How this plugin runs a query. **Not necessarily `plugin.query`**: a plugin that\n * serializes queries through a work queue must pass its UN-QUEUED path, or this call waits behind\n * the outer query that is still holding the queue and the plugin deadlocks.\n */\nexport const loadJoinInnerSide = <TRoot extends {}, TShape>(\n event: DbPluginQueryEvent<TRoot, TShape>,\n query: (innerEvent: DbPluginQueryEvent<UnknownRecord, UnknownRecord>, done: PluginEventCallbackResult<ITranslatedValue<UnknownRecord>>) => void,\n done: (result: JoinInnerSideResult) => void,\n /**\n * The outer side's distinct keys, when the caller already has them.\n *\n * Only a plugin that runs its outer query FIRST can supply these, and most run this loader\n * before anything else — so it is optional, and its absence costs a wider inner read rather\n * than a wrong one.\n */\n outerKeys?: ReadonlySet<unknown> | null\n): void => {\n\n const joinOption = event.operation.options.getLast(\"join\");\n\n if (joinOption == null) {\n done({ ok: \"success\" });\n return;\n }\n\n const innerSchema = event.schemas.get(joinOption.value.innerSchemaId);\n\n if (innerSchema == null) {\n done({\n ok: \"error\",\n error: new Error(`Cannot join: the inner collection's schema is not registered in this store. SchemaId: ${joinOption.value.innerSchemaId}`)\n });\n return;\n }\n\n const innerOptions = joinOption.value.innerOptions.split().database;\n\n if (outerKeys != null) {\n innerOptions.add(\"filter\", semiJoinFilter(joinOption.value.innerKey, outerKeys));\n }\n\n const innerEvent: DbPluginQueryEvent<UnknownRecord, UnknownRecord> = {\n operation: new Query(innerOptions, innerSchema) as unknown as DbPluginQueryEvent<UnknownRecord, UnknownRecord>[\"operation\"],\n schemas: event.schemas,\n id: `${event.id}-inner`,\n source: event.source,\n action: \"query\",\n reason: \"join inner side\",\n explain: event.explain,\n // The same array the outer read pushes into, so a join reports BOTH reads in execution\n // order. Built fresh rather than spread, so this has to be carried explicitly.\n executedQueries: event.executedQueries\n };\n\n query(innerEvent, result => {\n if (result.ok === PluginEventResult.ERROR) {\n done({ ok: \"error\", error: result.error });\n return;\n }\n\n done({ ok: \"success\", innerSide: { innerSchema, innerRows: result.data.value as unknown as unknown[] } });\n });\n};\n\n/**\n * Interprets a join by running TWO ordinary queries through the plugin's own read path.\n *\n * The whole of interpretation 2 for a plugin that has no reason to do anything cleverer, and the\n * shape every non-SQL backend should prefer:\n *\n * ```ts\n * query(event, done) {\n * if (event.operation.options.has(\"join\")) {\n * joinInPlugin(event, (e, d) => this.query(e, d), done);\n * return;\n * }\n * // ...the ordinary single-collection path\n * }\n * ```\n *\n * **The outer side runs FIRST, and that ordering is the optimization.** Its keys are what narrow\n * the inner read to rows that can actually pair — and they do not exist until the outer filters\n * have run. Loading the inner side first, which is what a naive implementation does, means reading\n * and materializing a whole collection to pair it with three rows.\n *\n * Neither query carries the join option, so both take the plugin's normal path: its indexes, its\n * pushdown decisions, its retries. Nothing recurses, because the option is stripped before either\n * goes out.\n *\n * @param query How this plugin runs a query. NOT necessarily `plugin.query` — a plugin that\n * serializes queries through a work queue must pass its UN-QUEUED path, or the two reads below\n * wait on the slot this one is holding.\n */\nexport const joinInPlugin = <TRoot extends {}, TShape>(\n event: DbPluginQueryEvent<TRoot, TShape>,\n query: (innerEvent: DbPluginQueryEvent<UnknownRecord, UnknownRecord>, done: PluginEventCallbackResult<ITranslatedValue<UnknownRecord>>) => void,\n done: PluginEventCallbackResult<ITranslatedValue<TShape>>\n): void => {\n\n const { before, at } = event.operation.options.splitAt(\"join\");\n\n if (at == null) {\n done(PluginEventResult.error(event.id, new Error(\"joinInPlugin was called for a query with no join option.\")));\n return;\n }\n\n const innerSchema = event.schemas.get(at.value.innerSchemaId);\n\n if (innerSchema == null) {\n done(PluginEventResult.error(event.id, new Error(\n `Cannot join: the inner collection's schema is not registered in this store. SchemaId: ${at.value.innerSchemaId}`\n )));\n return;\n }\n\n /**\n * The outer side, as the ordinary query it would have been without the join.\n *\n * `before` is everything recorded ahead of the join — the outer filters, and any sort or\n * window. Those belong to the outer ROWS, and running them here rather than around a joined\n * result is what makes `.take(2).join(...)` pair the first two rows on every backend.\n */\n const outerEvent = {\n ...event,\n id: `${event.id}-outer`,\n reason: \"join outer side\",\n operation: new Query(before, event.operation.schema)\n } as unknown as DbPluginQueryEvent<UnknownRecord, UnknownRecord>;\n\n query(outerEvent, outerResult => {\n try {\n if (outerResult.ok === PluginEventResult.ERROR) {\n done(PluginEventResult.error(event.id, outerResult.error));\n return;\n }\n\n const outerRows = (outerResult.data.value ?? []) as unknown as UnknownRecord[];\n\n // Storage shape: the plugin returns rows as it holds them, and deserialization is what\n // `executeJoin` does per side below.\n const outerKeys = distinctJoinKeys(outerRows, at.value.outerKey, at.value.semiJoinKeyThreshold, { storageShape: true });\n\n loadJoinInnerSide(event, query, innerResult => {\n try {\n if (innerResult.ok === \"error\") {\n done(PluginEventResult.error(event.id, innerResult.error));\n return;\n }\n\n const tuples = executeJoin({\n option: at.value,\n outerRows: toEntityShape(event.operation.schema, outerRows),\n innerRows: toEntityShape(innerSchema, innerResult.innerSide?.innerRows ?? [])\n });\n\n // Nothing else can be in the database half — everything after a join ratchets\n // to memory — so these tuples are the whole of this plugin's answer.\n done(PluginEventResult.success(event.id, new TranslatedArrayValue<TShape>(tuples as never[], false)));\n } catch (e) {\n done(PluginEventResult.error(event.id, e));\n }\n }, outerKeys);\n } catch (e) {\n done(PluginEventResult.error(event.id, e));\n }\n });\n};\n\n/**\n * A join over rows both sides have already deserialized, with the inner side's scopes applied.\n *\n * The one entry point every interpreter uses: `JsonTranslator.join` inside a plugin, and the\n * datastore's own memory half for a cross-plugin join. Callers hand over ENTITY-shape rows —\n * `toEntityShape` is separate because a caller may already have paid for it.\n */\nexport const executeJoin = (options: {\n option: JoinQueryOptionValue;\n outerRows: UnknownRecord[];\n innerRows: UnknownRecord[];\n}): JoinTuple[] => {\n const { option, outerRows, innerRows } = options;\n\n return hashJoin({\n kind: option.kind,\n outerRows,\n innerRows: applyInnerOptions(innerRows, option.innerOptions),\n outerKey: option.outerKey,\n innerKey: option.innerKey\n });\n};\n","import { DataTranslator } from \"./DataTranslator\";\nimport { QueryOption } from \"../query/types\";\nimport { nearestBy } from \"../query/similarity\";\nimport { executeJoin, JoinInnerSide, toEntityShape } from \"../query/join\";\nimport { assertIsArray } from \"../../assertions\";\nimport { ParamsFilter } from \"../../expressions\";\nimport { isDate, UnknownRecord } from \"../../utilities\";\nimport { IdType } from \"../../schema\";\nimport { IQuery } from \"../types\";\n\nexport class JsonTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {\n\n private readonly innerSide?: JoinInnerSide;\n\n /**\n * @param innerSide The inner collection's rows, when this query carries a `join` option.\n * A plugin that omits it for a query that HAS a join gets a throw from `join()` rather than\n * a silently un-joined result.\n */\n constructor(query: IQuery<TRoot, TShape>, innerSide?: JoinInnerSide) {\n super(query);\n this.innerSide = innerSide;\n }\n\n /**\n * The hash join itself, over rows already in memory — the floor every non-SQL backend\n * stands on.\n *\n * Both halves are deserialized here, each with its own schema, because that is where the\n * `===` on key values is specified to happen: in entity shape, by the property names the\n * caller wrote in the key selectors. A `from`-renamed column reads correctly for free.\n */\n override join<TResult>(data: unknown, option: QueryOption<TShape, \"join\">): TResult {\n\n if (Array.isArray(data) === false) {\n return data as TResult;\n }\n\n if (this.innerSide == null) {\n throw new Error(\n `Cannot join: this plugin did not supply the inner collection's rows. ` +\n `A plugin whose translator inherits JsonTranslator.join must construct it with the inner side ` +\n `(new JsonTranslator(operation, { innerSchema, innerRows })) when the query carries a join option.`\n );\n }\n\n const { innerSchema, innerRows } = this.innerSide;\n\n return executeJoin({\n option: option.value,\n outerRows: toEntityShape(this.query.schema, data),\n innerRows: toEntityShape(innerSchema, innerRows)\n }) as TResult;\n }\n\n override filter<TResult>(data: unknown, option: QueryOption<TShape, \"filter\">): TResult {\n\n assertIsArray(data);\n\n if (option.value.filter) {\n\n if (option.value.params == null) {\n // standard filtering\n return data.filter(option.value.filter) as TResult;\n }\n\n // params filtering\n const selector = option.value.filter as ParamsFilter<unknown, {}>\n return data.filter(w => selector([w, option.value.params])) as TResult;\n }\n\n return data as TResult;\n }\n\n override map<T>(data: unknown, option: QueryOption<T, \"map\">): T {\n\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only map an array of data\");\n }\n\n const response = Array.from({ length: data.length });\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value\n const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;\n field.property.setValue(data[i], resolvedValue);\n }\n }\n }\n\n response[i] = option.value.selector(data[i]);\n }\n\n return response as T;\n }\n\n override group<T>(data: unknown, option: QueryOption<T, \"group\">): T {\n\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only group an array of data\");\n }\n\n const group: Record<IdType, unknown[]> = {};\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n const keyValue = option.value.selector(data[i]) as IdType;\n\n if (!group[keyValue]) {\n group[keyValue] = [];\n }\n\n const item: UnknownRecord = {};\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n // Some types do not support deserialization (Array, Function, Computed, etc), just directly set the incoming value\n const resolvedValue = field.property.supportsDeserialization ? field.property.deserialize(value) : value;\n field.property.setValue(item, resolvedValue);\n continue;\n }\n\n // The property exists, lets set it to the value (null/undefined)\n if (Object.hasOwn(data[i], field.destinationName)) {\n field.property.setValue(item, value);\n }\n }\n }\n\n group[keyValue].push(item);\n }\n\n return group as T;\n }\n\n override count<TResult extends number>(data: unknown, _: QueryOption<TShape, \"count\">): TResult {\n\n if (Array.isArray(data)) {\n return data.length as TResult;\n }\n\n throw new Error(\"Cannot count resulting data, it must be an array. Please return array of data for function: count()\");\n }\n\n // Relational comparison instead of subtraction, for the same reason as sort():\n // subtraction is NaN for strings, which made min()/max() return an arbitrary element.\n // Nulls order first ascending — min() of a column with nulls is null, max() is the\n // largest value — matching what sort() does with the same data.\n override min<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"min\">): TResult {\n return this._minMax(data, \"min\", (a: any, b: any) => {\n if (a === b) {\n return 0;\n }\n\n if (a == null) {\n return -1;\n }\n\n if (b == null) {\n return 1;\n }\n\n return a < b ? -1 : 1;\n });\n }\n\n override max<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"max\">): TResult {\n return this._minMax(data, \"max\", (a: any, b: any) => {\n if (a === b) {\n return 0;\n }\n\n if (a == null) {\n return 1;\n }\n\n if (b == null) {\n return -1;\n }\n\n return a < b ? 1 : -1;\n });\n }\n\n override sort<TResult>(data: unknown, option: QueryOption<TShape, \"sort\">): TResult {\n\n if (Array.isArray(data)) {\n const direction = option.value.direction === \"asc\" ? 1 : -1;\n\n // Relational comparison instead of subtraction — subtraction is NaN\n // for strings, which leaves the array unsorted\n data.sort((x, y) => {\n const a = option.value.selector(x) as any;\n const b = option.value.selector(y) as any;\n\n if (a === b) {\n return 0;\n }\n\n if (a == null) {\n return -1 * direction;\n }\n\n if (b == null) {\n return 1 * direction;\n }\n\n return (a < b ? -1 : 1) * direction;\n });\n }\n\n return data as TResult;\n }\n\n /**\n * The similarity search itself, over values already in memory.\n *\n * This is the floor the whole feature stands on: it is reached whenever the backend did\n * not do the search, which is every backend except the ones with a native vector index.\n * It reads the property through the option's selector, so it works on any shape the rows\n * arrive in.\n */\n override nearest<TResult>(data: unknown, option: QueryOption<TShape, \"nearest\">): TResult {\n\n if (Array.isArray(data) === false) {\n return data as TResult;\n }\n\n const { selector, vector, count } = option.value;\n\n return nearestBy(data, vector, count, row => selector(row) as unknown as number[] | null) as TResult;\n }\n\n override sum<TResult extends number>(data: unknown, _: QueryOption<TShape, \"sum\">): TResult {\n\n assertIsArray(data, this._formatDataNotArrayError(\"sum\"));\n\n if (data.length === 0) {\n throw new Error(\"Cannot perform operation on empty array, result query contains no data\")\n }\n\n const map = this.query.options.getLast(\"map\");\n\n let sum = 0;\n const field = this._getSelectionField(\"sum\", map);\n\n for (let i = 0, length = data.length; i < length; i++) {\n const value = data[i];\n\n if (typeof value !== \"number\") {\n throw new Error(`Cannot sum, property is not a number. Property: ${field.sourceName}`);\n }\n\n sum += value;\n }\n\n return sum as TResult;\n }\n\n override distinct<TResult>(data: unknown, _: QueryOption<TShape, \"distinct\">): TResult {\n\n assertIsArray(data, this._formatDataNotArrayError(\"distinct\"));\n\n const result = new Set<string | number | Date>();\n\n // would be nice to have property info here for type detection\n let needsDateConversion = false;\n\n for (let i = 0, length = data.length; i < length; i++) {\n const value = data[i];\n\n if (typeof value === \"number\" || typeof value === \"string\") {\n result.add(value);\n continue;\n }\n\n if (isDate(value)) {\n needsDateConversion = true;\n result.add(value.toISOString());\n continue;\n }\n\n }\n\n if (needsDateConversion) {\n return [...result].map(w => new Date(w)) as TResult;\n }\n\n return [...result] as TResult\n }\n\n override skip<TResult>(data: unknown, option: QueryOption<TShape, \"skip\">): TResult {\n\n if (Array.isArray(data)) {\n\n if (option.value > 0) {\n\n if (data.length < option.value) {\n // We don't have enough data to skip, return an empty array\n return [] as TResult;\n }\n\n return data.slice(option.value) as TResult;\n }\n\n return data as TResult;\n }\n\n return data as TResult;\n }\n\n override take<TResult>(data: unknown, option: QueryOption<TShape, \"take\">): TResult {\n if (Array.isArray(data)) {\n\n if (option.value > 0) {\n\n if (data.length < option.value) {\n return data as TResult;\n }\n\n return data.slice(0, option.value) as TResult;\n }\n\n return data as TResult;\n }\n\n return data as TResult;\n }\n\n private _getSelectionField(name: string, mapOption: QueryOption<TShape, \"map\"> | null) {\n\n if (mapOption == null ||\n mapOption.value.fields.length === 0 ||\n mapOption.value.fields.length > 1) {\n throw new Error(`${name}() operation can only be performed when one field is mapped for a result. Ex. myset.map(x => x.someNumberOrDateOrString).${name}()`)\n }\n\n return mapOption.value.fields[0];\n }\n\n private _minMax<T extends string | number | Date>(data: unknown, name: string, sort: (a: any, b: any) => any): T {\n\n assertIsArray(data, this._formatDataNotArrayError(name));\n\n if (data.length === 0) {\n throw new Error(\"Cannot perform operation on empty array, result query contains no data\")\n }\n\n // A single pass, not sort-and-take-first: O(n) for an O(n) question, and it does not\n // MUTATE the array the caller handed us — the sort did. The caller's comparator is\n // reused so min and max keep their null ordering from one body.\n let best = data[0];\n\n for (let i = 1, length = data.length; i < length; i++) {\n const value = data[i];\n\n // Array.prototype.sort moves undefined elements to the END without consulting the\n // comparator. Mirror that: undefined is never selected unless every element is.\n if (value === undefined) {\n continue;\n }\n\n if (best === undefined || sort(value, best) < 0) {\n best = value;\n }\n }\n\n return best as T;\n }\n\n private _formatDataNotArrayError(functionName: string) {\n return `Cannot sum resulting data, it must be an array. Please return array of data for function: ${functionName}()`\n }\n}","import { IdType } from \"../../schema/types\";\nimport { UnknownRecord } from \"../../utilities/types\";\nimport { QueryOption } from \"../query/types\";\nimport { nearestBy } from \"../query/similarity\";\nimport { IQuery } from \"../types\";\nimport { DataTranslator } from \"./DataTranslator\";\n\n/**\n * A stored vector as a list of numbers, whatever the driver handed back.\n *\n * Three shapes reach here and all are legitimate. A JSON column decoded by\n * `decodeJsonColumns` is already an array. A driver with no type parser for its native vector\n * type returns the literal text — `pg` does exactly this for pgvector, giving `\"[1,2,3]\"`,\n * which happens to be JSON. Anything else is not a vector, and `null` sorts it last rather\n * than throwing.\n */\nconst toVector = (value: unknown): number[] | null => {\n if (Array.isArray(value)) {\n return value as number[];\n }\n\n if (typeof value !== \"string\") {\n return null;\n }\n\n try {\n const parsed = JSON.parse(value);\n\n return Array.isArray(parsed) ? parsed as number[] : null;\n } catch {\n return null;\n }\n};\n\n/**\n * What the statement that produced these rows actually did.\n *\n * Supplied by the plugin because only its query builder knows: an extension may be missing, a\n * window may have made a pushdown unsafe, an inner filter may have had no column to compare\n * against. Every flag defaults to false — the safe direction, since doing the work twice is slow\n * and skipping it is wrong.\n */\nexport type SqlPushdown = {\n /** The statement contained a real `INNER JOIN`/`LEFT JOIN` and its rows are already tuples. */\n join?: boolean;\n};\n\nexport class SqlTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {\n\n protected readonly pushedDown: SqlPushdown;\n\n constructor(query: IQuery<TRoot, TShape>, pushedDown: SqlPushdown = {}) {\n super(query);\n this.pushedDown = pushedDown;\n }\n\n count<TResult extends number>(data: unknown, _: QueryOption<TShape, \"count\">): TResult {\n if (Array.isArray(data) && data.length > 0) {\n // Count is returned as the property alias on the query.\n //\n // Driver-specific coercion does NOT belong here. Some drivers return COUNT(*)\n // as a bigint string rather than a number; which ones is a fact about those\n // drivers, so a plugin whose driver deviates overrides this method. Naming them\n // here is how engine knowledge starts accumulating in a storage-agnostic\n // package — one bug fix at a time.\n return data[0].count;\n }\n\n return data as TResult;\n }\n\n min<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"min\">): TResult {\n return this.shapeResult(data);\n }\n\n max<TResult extends string | number | Date>(data: unknown, _: QueryOption<TShape, \"max\">): TResult {\n return this.shapeResult(data);\n }\n\n sum<TResult extends number>(data: unknown, _: QueryOption<TShape, \"sum\">): TResult {\n return this.shapeResult(data);\n }\n\n private shapeResult<TResult>(data: unknown) {\n if (Array.isArray(data) && data.length > 0) {\n // Shape the result\n return data[0];\n }\n\n return data as TResult;\n }\n\n distinct<TResult>(data: unknown, _: QueryOption<TShape, \"distinct\">): TResult {\n return data as TResult;\n }\n\n filter<TResult>(data: unknown, _: QueryOption<TShape, \"filter\">): TResult {\n return data as TResult;\n }\n\n skip(data: unknown, _: QueryOption<TShape, \"skip\">): TShape {\n return data as TShape;\n }\n\n take(data: unknown, _: QueryOption<TShape, \"take\">): TShape {\n return data as TShape;\n }\n\n sort(data: unknown, _: QueryOption<TShape, \"sort\">): TShape {\n return data as TShape;\n }\n\n /**\n * Scores in memory, unlike every other shaper here.\n *\n * The pass-throughs above are safe because the SQL that produced these rows contained the\n * corresponding clause. No `sql-core` statement contains a similarity ordering — engines\n * that can express one are the exception, not the rule — so passing the data through\n * would return whatever order the engine happened to produce.\n *\n * A plugin whose engine DID push the search down overrides this with a pass-through,\n * gated on `option.target`. Postgres is the only one today.\n *\n * Rows arrive keyed by storage column name and are read that way rather than through the\n * option's selector, because the selector is written against the entity shape and these\n * rows have not been deserialized into it yet.\n */\n nearest(data: unknown, option: QueryOption<TShape, \"nearest\">): TShape {\n\n if (Array.isArray(data) === false) {\n return data as TShape;\n }\n\n const { property, propertyName, vector, count } = option.value;\n const column = property?.getResolvedName() ?? propertyName;\n\n return nearestBy(data, vector, count, row => toVector((row as UnknownRecord)[column])) as TShape;\n }\n\n /**\n * Passes through only when the statement really did contain the `JOIN`, and refuses otherwise.\n *\n * The pass-throughs above are safe unconditionally because the SQL that produced these rows\n * contained the corresponding clause. A join is not like that: if the plugin did not emit one,\n * these rows are the outer side alone, and passing them through hands the caller entities\n * where the contract says tuples — every `([outer, inner]) => ...` lambda downstream then\n * destructures the wrong object, and nothing errors.\n *\n * So the plugin has to say, and the default is to refuse. A plugin that DID emit the join has\n * already split each flat row into its two deserialized halves (`splitJoinRows` in\n * `@routier/sql-plugin-core`), so by the time the option is walked the work is done.\n */\n join(data: unknown, option: QueryOption<TShape, \"join\">): TShape {\n if (this.pushedDown.join === true && option.target === \"database\") {\n return data as TShape;\n }\n\n throw new Error(\n `This SQL plugin did not push the join down, so it cannot produce the pairs. Kind: ${option.value.kind}. ` +\n `Emitting the JOIN is the plugin's job: build the joined statement with buildJoinStatement, split the rows with ` +\n `splitJoinRows, and construct this translator with { join: true }.`\n );\n }\n\n group<T>(data: unknown, option: QueryOption<T, \"group\">): T {\n\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only group an array of data\");\n }\n\n const group: Record<IdType, unknown[]> = {};\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n const keyValue = option.value.selector(data[i]) as IdType;\n\n if (!group[keyValue]) {\n group[keyValue] = [];\n }\n\n const item: UnknownRecord = {};\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n field.property.setValue(item, field.property.deserialize(value));\n }\n }\n }\n\n group[keyValue].push(item);\n }\n\n return group as T;\n }\n\n map(data: unknown, option: QueryOption<TShape, \"map\">): TShape {\n if (Array.isArray(data) == false) {\n throw new Error(\"Can only map an array of data\");\n }\n\n if (this.query.options.has(\"count\") && data.length === 1) {\n // data here is the shape of { count: number }[] and will map to nothing. \n // Return the original data and let count take care of this\n return data as TShape;\n }\n\n const response = [];\n\n for (let i = 0, length = data.length; i < length; i++) {\n\n for (let j = 0, l = option.value.fields.length; j < l; j++) {\n const field = option.value.fields[j];\n\n if (field.property != null) {\n const value = field.property.getValue(data[i]);\n\n if (value != null) {\n field.property.setValue(data[i], field.property.deserialize(value));\n }\n }\n }\n\n response.push(option.value.selector(data[i]));\n }\n\n return response as TShape;\n }\n}","import { DataTranslator } from \"./DataTranslator\";\nimport { QueryOption } from \"../query/types\";\nimport { assertIsArray } from \"../../assertions\";\nimport { ParamsFilter } from \"../../expressions\";\n\n/**\n * The memory half's pass over JOIN TUPLES.\n *\n * `JsonTranslator` cannot do this job, and the reason is one line of it: `map` and `group` walk\n * `option.value.fields` and deserialize each field through its `PropertyInfo`. A tuple has no\n * schema and no fields — `getFields` over `([p, m]) => ({ ... })` extracts nothing meaningful —\n * so that loop would either no-op or write properties onto a two-element array.\n *\n * Everything a join query is allowed to do after the join is expressible as a plain closure\n * over the tuple, and that is all this does. The lambdas the caller wrote (`([p, m]) => ...`)\n * are applied as-is, which is also why the result is identical whichever backend produced the\n * pairs.\n *\n * Both halves are already in entity shape when the tuples arrive here (the wire contract), so\n * there is nothing left to deserialize — the reason the missing field loop costs nothing.\n *\n * The absent operations are absent by design, not by omission: `sum`/`min`/`max`/`distinct` and\n * `group` are not declared on the tuple queryable's type, so reaching them means something\n * built an option this API cannot express, and a throw naming it is the honest answer.\n */\nexport class TupleTranslator<TRoot extends {}, TShape> extends DataTranslator<TRoot, TShape> {\n\n override filter<TResult>(data: unknown, option: QueryOption<TShape, \"filter\">): TResult {\n\n assertIsArray(data);\n\n if (option.value.filter == null) {\n return data as TResult;\n }\n\n if (option.value.params == null) {\n return data.filter(option.value.filter) as TResult;\n }\n\n const selector = option.value.filter as ParamsFilter<unknown, {}>;\n return data.filter(tuple => selector([tuple, option.value.params])) as TResult;\n }\n\n override map<TResult>(data: unknown, option: QueryOption<TShape, \"map\">): TResult {\n\n assertIsArray(data, this.notAnArray(\"map\"));\n\n return data.map(tuple => option.value.selector(tuple as TShape)) as TResult;\n }\n\n override sort<TResult>(data: unknown, option: QueryOption<TShape, \"sort\">): TResult {\n\n if (Array.isArray(data) === false) {\n return data as TResult;\n }\n\n const direction = option.value.direction === \"asc\" ? 1 : -1;\n\n // Relational comparison rather than subtraction, and nulls first ascending — the same\n // ordering `JsonTranslator.sort` produces, so a sort means the same thing on either\n // side of a join.\n data.sort((x, y) => {\n const a = option.value.selector(x) as any;\n const b = option.value.selector(y) as any;\n\n if (a === b) {\n return 0;\n }\n\n if (a == null) {\n return -1 * direction;\n }\n\n if (b == null) {\n return 1 * direction;\n }\n\n return (a < b ? -1 : 1) * direction;\n });\n\n return data as TResult;\n }\n\n override skip<TResult>(data: unknown, option: QueryOption<TShape, \"skip\">): TResult {\n\n if (Array.isArray(data) === false || option.value <= 0) {\n return data as TResult;\n }\n\n return data.slice(option.value) as TResult;\n }\n\n override take<TResult>(data: unknown, option: QueryOption<TShape, \"take\">): TResult {\n\n if (Array.isArray(data) === false || option.value <= 0) {\n return data as TResult;\n }\n\n return data.slice(0, option.value) as TResult;\n }\n\n override count<TResult extends number>(data: unknown, _: QueryOption<TShape, \"count\">): TResult {\n\n assertIsArray(data, this.notAnArray(\"count\"));\n\n return data.length as TResult;\n }\n\n /**\n * Already joined by the time anything reaches here.\n *\n * The pairs were produced either by the plugin (its translator's `join`) or by the datastore\n * before this pass ran, so the option is a record of what happened rather than work to do.\n */\n override join(data: unknown, _: QueryOption<TShape, \"join\">): TShape {\n return data as TShape;\n }\n\n override group<TResult>(_: unknown, __: QueryOption<TShape, \"group\">): TResult {\n throw new Error(this.notSupported(\"toGroup\"));\n }\n\n override sum<TResult extends number>(_: unknown, __: QueryOption<TShape, \"sum\">): TResult {\n throw new Error(this.notSupported(\"sum\"));\n }\n\n override min<TResult extends string | number | Date>(_: unknown, __: QueryOption<TShape, \"min\">): TResult {\n throw new Error(this.notSupported(\"min\"));\n }\n\n override max<TResult extends string | number | Date>(_: unknown, __: QueryOption<TShape, \"max\">): TResult {\n throw new Error(this.notSupported(\"max\"));\n }\n\n override distinct<TResult>(_: unknown, __: QueryOption<TShape, \"distinct\">): TResult {\n throw new Error(this.notSupported(\"distinct\"));\n }\n\n override nearest(_: unknown, __: QueryOption<TShape, \"nearest\">): TShape {\n // A similarity search BEFORE the join stays in the outer side's options and never\n // reaches a tuple. One after it would have to score a pair, which has no vector.\n throw new Error(this.notSupported(\"nearest\"));\n }\n\n private notSupported(name: string) {\n return `${name}() is not available on a join result. Project the tuples with .map() first, then run it on the projection.`;\n }\n\n private notAnArray(name: string) {\n return `Cannot ${name} a join result, it must be an array of tuples.`;\n }\n}\n","export * from './DataTranslator';\nexport * from './JsonTranslator';\nexport * from './SqlTranslator';\nexport * from './TupleTranslator';\nexport * from './types';\nexport * from './TranslatedArrayValue';\nexport * from './TranslatedGroupValue';\nexport * from './TranslatedSingleValue';","import { Expression } from \"../../expressions/types\";\nimport { MemoryExecutionReason, QueryOption, QueryOptionExecutionTarget, QueryOptionName } from \"./types\";\nimport { QueryOptionsCollection } from \"./QueryOptionsCollection\";\n\n/**\n * One sentence per reason code, written for someone meeting pushdown for the first time.\n *\n * Beside the codes rather than in the formatter, so console output, a failing test and the\n * docs all say the same thing.\n */\nexport const MEMORY_EXECUTION_EXPLANATIONS: Record<MemoryExecutionReason, string> = {\n \"not-parsable\": \"A filter could not be parsed into an expression tree, so it and every option after it run in memory.\",\n \"unmapped-property\": \"The property is not stored in the database, so it can only be read after deserialization.\",\n \"renamed-property\": \"The property is stored under a different name, and selectors use the in-memory name, so it can only be read after deserialization.\",\n \"map-rename\": \"A map renames or drops properties, so every option after it refers to names the database does not have.\",\n \"after-nearest\": \"A similarity search orders and limits rows, and the plugin cannot report whether it performed the search, so every option after it runs in memory.\",\n \"after-join\": \"A join produces [outer, inner] tuples rather than entities, and the plugin cannot report how it joined, so every option after it runs in memory.\",\n \"cross-plugin-join\": \"The two sides of this join live on different plugins, so neither can read the other's rows and the join runs in the datastore.\"\n};\n\n/**\n * One thing a backend actually executed, in the backend's own language.\n *\n * A plugin pushes these onto `DbPluginQueryEvent.executedQueries` as it runs them, so a join —\n * which reads twice — reports both, in execution order. `text` is not required to be SQL: a\n * key-value store describes what it did in whatever terms it has.\n */\nexport type ExecutedQuery = {\n text: string;\n parameters?: unknown[];\n};\n\nexport type ExplainedOption = {\n index: number;\n name: QueryOptionName;\n detail?: Record<string, unknown>;\n};\n\nexport const EXECUTED_QUERIES_UNSUPPORTED =\n \"This plugin did not report what it executed. It may not support explain.\";\n\nexport type ExecutionStep = {\n step: number;\n of: number;\n executedIn: QueryOptionExecutionTarget;\n description: string;\n options: ExplainedOption[];\n /** Set on database steps once the plugin has reported. */\n executedQueries?: ExecutedQuery[];\n /** Set on the first database step instead, when the plugin reported nothing. */\n executedQueriesUnsupported?: string;\n /** Set on memory steps only. */\n reason?: MemoryExecutionReason;\n explanation?: string;\n};\n\nexport type QueryExplanationSummary = {\n database: number;\n memory: number;\n /** Deduped, in first-seen order. Empty when the whole query pushed down. */\n reasons: MemoryExecutionReason[];\n explanation: string;\n};\n\nexport type QueryExplanation = {\n collection: string;\n database: string;\n summary: QueryExplanationSummary;\n executionSteps: ExecutionStep[];\n plugin: { kind: string };\n};\n\nexport type ExplainContext = {\n collection: string;\n database: string;\n pluginKind: string;\n};\n\nconst DATABASE_STEP_DESCRIPTION = \"These options are sent to the plugin.\";\nconst MEMORY_STEP_DESCRIPTION = \"Routier runs these over the rows the database returned, after deserializing them.\";\nconst UNNARROWED_READ_DESCRIPTION = \"No option could be pushed down, so the plugin reads the whole collection.\";\n\n/**\n * The reportable shape of one option's value.\n *\n * Serializable facts only, never the live selector functions — an explanation is a document a\n * caller may log, diff in a test, or send to a server, and a closure survives none of that.\n */\nconst detailOf = (option: QueryOption<any, any>): Record<string, unknown> | undefined => {\n\n if (option.name === \"filter\") {\n const value = option.value as { expression?: Expression };\n\n if (value.expression == null) {\n return undefined;\n }\n\n try {\n return { expression: Expression.toJson(value.expression) };\n } catch {\n // `valueToJson` rejects a value no wire can carry. Reporting the rest of the\n // explanation beats taking the diagnostic down with the query it describes.\n return { expressionUnavailable: \"This filter holds a value that cannot be serialized.\" };\n }\n }\n\n if (option.name === \"sort\") {\n const value = option.value as { propertyName: string, direction: string };\n\n return { propertyName: value.propertyName, direction: value.direction };\n }\n\n if (option.name === \"skip\" || option.name === \"take\") {\n return { value: option.value as number };\n }\n\n if (option.name === \"nearest\") {\n const value = option.value as { propertyName: string, vector: number[], count: number };\n\n return { propertyName: value.propertyName, dimensions: value.vector.length, count: value.count };\n }\n\n if (option.name === \"join\") {\n const value = option.value as {\n kind: string,\n outerKey: { propertyName: string },\n innerKey: { propertyName: string },\n crossPlugin: boolean,\n innerOptions: QueryOptionsCollection<any>\n };\n\n return {\n kind: value.kind,\n outerKey: value.outerKey.propertyName,\n innerKey: value.innerKey.propertyName,\n crossPlugin: value.crossPlugin,\n innerOptions: explainedOptionsOf(value.innerOptions)\n };\n }\n\n if (option.name === \"map\" || option.name === \"group\") {\n const value = option.value as { fields: { sourceName: string, destinationName: string }[] };\n\n return { fields: value.fields.map(x => ({ from: x.sourceName, to: x.destinationName })) };\n }\n\n return undefined;\n};\n\nconst explainedOptionOf = (option: QueryOption<any, any>, index: number): ExplainedOption => {\n const detail = detailOf(option);\n\n return { index, name: option.name, ...(detail == null ? {} : { detail }) };\n};\n\nconst explainedOptionsOf = (options: QueryOptionsCollection<any>): ExplainedOption[] => {\n const explained: ExplainedOption[] = [];\n let index = 0;\n\n options.forEach(option => explained.push(explainedOptionOf(option, index++)));\n\n return explained;\n};\n\nconst summarize = (steps: ExecutionStep[]): QueryExplanationSummary => {\n const reasons: MemoryExecutionReason[] = [];\n let database = 0;\n let memory = 0;\n\n for (const step of steps) {\n if (step.executedIn === \"database\") {\n database += step.options.length;\n continue;\n }\n\n memory += step.options.length;\n\n if (step.reason != null && reasons.includes(step.reason) === false) {\n reasons.push(step.reason);\n }\n }\n\n const counts = `${database} ${database === 1 ? \"option ran\" : \"options ran\"} in the database, ${memory} ran in memory.`;\n const causes = reasons.map(reason => MEMORY_EXECUTION_EXPLANATIONS[reason]).join(\" \");\n\n return { database, memory, reasons, explanation: causes.length === 0 ? counts : `${counts} ${causes}` };\n};\n\n/**\n * Groups options into consecutive runs that execute in the same place.\n *\n * A step boundary is where execution moves, and a reader has to see the statement as step 1 OF\n * 2 to understand it is not the whole query. Cutting over to memory is a ratchet, so the\n * database options are always a prefix and there are at most two steps.\n *\n * A database step is emitted even when NO option pushed down, because the plugin is dispatched\n * either way — `createQueryPayload` always builds a database event. Without it, the worst case\n * the feature exists to expose reports \"0 in the database\" while the backend reads the whole\n * table, which is the opposite of the truth.\n */\nconst toExecutionSteps = (options: QueryOptionsCollection<any>): ExecutionStep[] => {\n const steps: ExecutionStep[] = [];\n let index = 0;\n\n options.forEach(option => {\n const explained = explainedOptionOf(option, index++);\n const current = steps[steps.length - 1];\n\n if (current != null && current.executedIn === option.target) {\n current.options.push(explained);\n return;\n }\n\n steps.push({\n step: steps.length + 1,\n of: 0,\n executedIn: option.target,\n description: option.target === \"database\" ? DATABASE_STEP_DESCRIPTION : MEMORY_STEP_DESCRIPTION,\n options: [explained],\n ...(option.reason == null ? {} : {\n reason: option.reason,\n explanation: MEMORY_EXECUTION_EXPLANATIONS[option.reason]\n })\n });\n });\n\n if (steps[0]?.executedIn !== \"database\") {\n steps.unshift({\n step: 0,\n of: 0,\n executedIn: \"database\",\n description: UNNARROWED_READ_DESCRIPTION,\n options: []\n });\n }\n\n for (let i = 0; i < steps.length; i++) {\n steps[i].step = i + 1;\n steps[i].of = steps.length;\n }\n\n return steps;\n};\n\n/**\n * Builds the explanation from the resolved options, with no plugin involvement.\n *\n * Takes the collection BEFORE `split()`, and throws otherwise. Splitting re-adds each half\n * into a fresh collection, which re-derives targets without the options that caused them — a\n * post-join filter alone in the memory half derives back to `\"database\"`, and the document\n * would report memory work as having run in the database.\n */\nexport const explainQuery = (options: QueryOptionsCollection<any>, context: ExplainContext): QueryExplanation => {\n\n if (options.isDerived === true) {\n throw new Error(\n \"explainQuery was given a collection produced by split() or splitAt(). Those re-derive \" +\n \"execution targets without the options that caused them, so the explanation would report \" +\n \"memory work as having run in the database. Pass the collection as it was resolved, \" +\n \"before splitting.\"\n );\n }\n\n const executionSteps = toExecutionSteps(options);\n\n return {\n collection: context.collection,\n database: context.database,\n summary: summarize(executionSteps),\n executionSteps,\n plugin: { kind: context.pluginKind }\n };\n};\n\n/**\n * Attaches what the backend reported to the step that was sent to it.\n *\n * Reporting is optional for a plugin, so an empty report is not an error: the step is marked\n * `executedQueriesUnsupported` instead, and the rest of the explanation stands — the pushdown\n * analysis comes from the options and is correct with or without the plugin's statements.\n *\n * Copies the steps rather than writing into them, so the explanation a caller already holds\n * does not gain statements after the fact. Options and their details are shared with the\n * original — nothing mutates them, and copying deeper would only look safer than it is.\n */\nexport const withExecutedQueries = (explanation: QueryExplanation, executedQueries: ExecutedQuery[]): QueryExplanation => {\n let attached = false;\n\n const executionSteps = explanation.executionSteps.map((step): ExecutionStep => {\n\n // Only the first database step: a plugin reports what IT ran, and everything it ran\n // was sent as one dispatch. Stamping the same statements onto a second database step\n // would claim they ran twice.\n if (step.executedIn !== \"database\" || attached === true) {\n return { ...step, options: [...step.options] };\n }\n\n attached = true;\n\n if (executedQueries.length === 0) {\n return { ...step, options: [...step.options], executedQueriesUnsupported: EXECUTED_QUERIES_UNSUPPORTED };\n }\n\n return { ...step, options: [...step.options], executedQueries: [...executedQueries] };\n });\n\n return { ...explanation, executionSteps };\n};\n","import { ExecutionStep, ExplainedOption, QueryExplanation } from \"./explain\";\n\nconst OPTION_LABEL_WIDTH = 8;\nconst WRAP_WIDTH = 68;\n\n/** Wraps `text` to `WRAP_WIDTH`, prefixing every line with `indent`. */\nconst wrap = (text: string, indent: string): string[] => {\n const lines: string[] = [];\n let line = \"\";\n\n for (const word of text.split(\" \")) {\n if (line.length > 0 && line.length + word.length + 1 > WRAP_WIDTH) {\n lines.push(indent + line);\n line = word;\n continue;\n }\n\n line = line.length === 0 ? word : `${line} ${word}`;\n }\n\n if (line.length > 0) {\n lines.push(indent + line);\n }\n\n return lines;\n};\n\nconst COMPARATOR_SYMBOLS: Record<string, string> = {\n \"equals\": \"===\",\n \"greater-than\": \">\",\n \"greater-than-equals\": \">=\",\n \"less-than\": \"<\",\n \"less-than-equals\": \"<=\"\n};\n\nconst describeValue = (value: any): string => {\n if (value == null) {\n return \"?\";\n }\n\n if (value.k === \"raw\") {\n return typeof value.v === \"string\" ? `\"${value.v}\"` : String(value.v);\n }\n\n if (value.k === \"date\") {\n return value.v;\n }\n\n if (value.k === \"array\") {\n return `[${(value.v as unknown[]).map(describeValue).join(\", \")}]`;\n }\n\n return value.k === \"undefined\" ? \"undefined\" : String(value.v);\n};\n\n/** Renders a serialized expression back to something close to the source predicate. */\nconst describeExpression = (expression: any): string => {\n\n if (expression == null) {\n return \"?\";\n }\n\n if (expression.t === \"operator\") {\n return `${describeExpression(expression.left)} ${expression.operator} ${describeExpression(expression.right)}`;\n }\n\n if (expression.t === \"comparator\") {\n const left = describeExpression(expression.left);\n const right = describeExpression(expression.right);\n const symbol = COMPARATOR_SYMBOLS[expression.comparator];\n\n if (symbol == null) {\n return `${left}.${expression.comparator}(${right})${expression.negated === true ? \" === false\" : \"\"}`;\n }\n\n return `${left} ${expression.negated === true ? \"!==\" : symbol} ${right}`;\n }\n\n if (expression.t === \"property\") {\n return expression.path;\n }\n\n if (expression.t === \"value\") {\n return describeValue(expression.value);\n }\n\n return expression.t === \"empty\" ? \"(no filter)\" : \"(not parsable)\";\n};\n\nconst describeOption = (option: ExplainedOption): string => {\n const detail = option.detail;\n\n if (detail == null) {\n return \"\";\n }\n\n if (option.name === \"filter\") {\n return detail.expression == null\n ? String(detail.expressionUnavailable ?? \"\")\n : describeExpression(detail.expression);\n }\n\n if (option.name === \"sort\") {\n return `${detail.propertyName} ${detail.direction}`;\n }\n\n if (option.name === \"skip\" || option.name === \"take\") {\n return String(detail.value);\n }\n\n if (option.name === \"join\") {\n return `${detail.kind} → ${detail.outerKey} = ${detail.innerKey}`;\n }\n\n if (option.name === \"nearest\") {\n return `${detail.propertyName}, ${detail.count} nearest`;\n }\n\n if (option.name === \"map\" || option.name === \"group\") {\n const fields = detail.fields as { from: string, to: string }[];\n\n return fields.map(x => x.from === x.to ? x.from : `${x.from} → ${x.to}`).join(\", \");\n }\n\n return \"\";\n};\n\nconst formatStep = (step: ExecutionStep, lines: string[]) => {\n const reason = step.reason == null ? \"\" : ` [${step.reason}]`;\n\n lines.push(` STEP ${step.step} of ${step.of} — ${step.executedIn}${reason}`);\n lines.push(...wrap(step.description, \" \"));\n\n if (step.explanation != null) {\n lines.push(...wrap(step.explanation, \" \"));\n }\n\n lines.push(\"\");\n\n for (const option of step.options) {\n lines.push(` ${option.name.padEnd(OPTION_LABEL_WIDTH)} ${describeOption(option)}`.trimEnd());\n }\n\n for (const executed of step.executedQueries ?? []) {\n lines.push(\"\");\n lines.push(...executed.text.split(\"\\n\").map(line => ` ${line}`));\n\n if (executed.parameters != null && executed.parameters.length > 0) {\n lines.push(` parameters: ${JSON.stringify(executed.parameters)}`);\n }\n }\n\n if (step.executedQueriesUnsupported != null) {\n lines.push(\"\");\n lines.push(...wrap(step.executedQueriesUnsupported, \" \"));\n }\n\n lines.push(\"\");\n};\n\n/**\n * Renders an explanation for a terminal.\n *\n * The STEP headers carry the whole lesson: a reader who has never heard of pushdown still sees\n * that the statement in step 1 is not the entire query. Nobody should have to notice a missing\n * ORDER BY to work that out.\n */\nexport const formatExplanation = (explanation: QueryExplanation): string => {\n const { collection, database, summary, executionSteps } = explanation;\n const stepCount = `${executionSteps.length} ${executionSteps.length === 1 ? \"step\" : \"steps\"}`;\n const lines: string[] = [`${collection} · ${database} · ${stepCount}`, \"\"];\n\n for (const step of executionSteps) {\n formatStep(step, lines);\n }\n\n lines.push(...wrap(summary.explanation, \" \"));\n\n return lines.join(\"\\n\");\n};\n","import { Expression, Filter, ParamsFilter } from \"../../expressions\";\nimport { PropertyInfo, SchemaId } from \"../../schema\";\nimport { GenericFunction } from \"../../types\";\nimport type { JoinKeyReference, JoinKind } from \"./join\";\nimport type { QueryOptionsCollection } from \"./QueryOptionsCollection\";\n\nexport enum QueryOrdering {\n Descending = \"desc\",\n Ascending = \"asc\"\n}\n\n/**\n * Field mapping for a query result, including source and destination names and a getter function.\n */\nexport type QueryField = {\n sourceName: string,\n destinationName: string,\n isRename: boolean;\n property?: PropertyInfo<unknown>;\n getter: <T>(data: Record<string, unknown>) => T;\n};\n\nexport type QueryOptionExecutionTarget = \"database\" | \"memory\";\nexport type QueryOptionName = keyof QueryOptionValueMap<unknown>;\n\n/**\n * Why an option runs in memory rather than in the database.\n *\n * A code rather than a sentence, so a test can assert on it — the sentences live in\n * `MEMORY_EXECUTION_EXPLANATIONS`. Every cause is a ratchet, because `nextExecutionTarget`\n * never returns to `\"database\"`, so the code recorded is the FIRST cause and it stays on every\n * option after it. Reporting a later one would name a symptom of this one.\n */\nexport type MemoryExecutionReason =\n | \"not-parsable\"\n | \"unmapped-property\"\n | \"renamed-property\"\n | \"map-rename\"\n | \"after-nearest\"\n | \"after-join\"\n | \"cross-plugin-join\";\n\nexport type QueryOption<T, K extends QueryOptionName> = {\n name: QueryOptionName;\n value: QueryOptionValueMap<T>[K],\n target: QueryOptionExecutionTarget;\n /** Set only when `target` is `\"memory\"`. */\n reason?: MemoryExecutionReason;\n}\n\nexport type QueryOptionValueMap<T extends {}> = {\n skip: number;\n take: number;\n sort: { selector: GenericFunction<T, T[keyof T]>, direction: QueryOrdering, propertyName: string, property?: PropertyInfo<T> | null };\n map: { selector: GenericFunction<T, any>, fields: QueryField[] };\n group: { selector: GenericFunction<T, any>, key: QueryField, fields: QueryField[] };\n filter: { params?: {}, filter: ParamsFilter<T, {}> | Filter<T>, expression: Expression };\n /**\n * Similarity search: an ordering plus a limit, never a filter.\n *\n * `count` is part of the option rather than a separate `take` because the two are one\n * operation to a backend that can push this down — `ORDER BY ... LIMIT n` is what makes an\n * approximate index usable, and splitting them would order every row before limiting.\n */\n nearest: { selector: GenericFunction<T, T[keyof T]>, propertyName: string, property?: PropertyInfo<T> | null, vector: number[], count: number };\n /**\n * An equi-join against a second collection, interpreted by whoever receives it.\n *\n * A first-class query option rather than a datastore side-path: a SQL backend emits a real\n * `INNER JOIN`/`LEFT JOIN`, every other backend loads the rows it needs and the shared hash\n * join runs inside the plugin, and a cross-plugin join runs in the datastore's memory half.\n * All three produce the same pairs — see `specs/joins.md`.\n *\n * Serializable by construction: property paths and a schema id, never live rows, with any\n * filter's values travelling in its params object. That is what lets the whole option be\n * forwarded to a server once expression-tree serialization lands.\n */\n join: {\n kind: JoinKind;\n /** Resolved through `event.schemas`, which already carries every schema in the store. */\n innerSchemaId: SchemaId;\n outerKey: JoinKeyReference;\n innerKey: JoinKeyReference;\n /**\n * The inner side's own filters — INCLUDING its soft-delete scope and `.scope()`\n * filters. Every interpreter must apply these: it is the only place they exist, because\n * a join bypasses the inner collection's normal read path.\n */\n innerOptions: QueryOptionsCollection<any>;\n /**\n * Whether the two sides live on DIFFERENT plugin instances, in which case no plugin can\n * receive the option and the datastore is the interpreter.\n *\n * Decided by plugin instance identity at build time, never by comparing database names —\n * two plugins over one database are still two interpreters, and one name can front two\n * databases.\n */\n crossPlugin: boolean;\n /**\n * How many distinct outer keys are still worth turning into an `IN (...)` prefilter on the\n * inner read — the datastore's `semiJoinKeyThreshold`, default 500.\n *\n * Carried in the option because the decision is made where the join executes, which is\n * usually inside a plugin, and a plugin cannot see a datastore's configuration. A number\n * serializes; a reference to the store would not.\n *\n * Cost only. Above the threshold the inner side is read under its own scopes and the hash\n * join discards the surplus — the same answer by a slower route.\n */\n semiJoinKeyThreshold: number;\n };\n min: true; // True or not set\n max: true; // True or not set\n count: true; // True or not set\n sum: true; // True or not set\n distinct: true; // True or not set\n};\n\n/**\n * Sort specification for a query.\n */\nexport type QuerySort = { key: string, selector: (item: unknown) => unknown, direction: \"asc\" | \"desc\" };","export * from './explain';\nexport * from './formatExplanation';\nexport * from './join';\nexport * from './Query';\nexport * from './QueryOptionsCollection';\nexport * from './types';\nexport * from './similarity';","import { Expression, toStrictPredicate } from \"../../expressions\";\nimport { CompiledSchema } from \"../../schema\";\nimport { UnknownRecord } from \"../../utilities\";\nimport { JoinKeyReference } from \"../query/join\";\nimport { QueryOptionsCollection } from \"../query/QueryOptionsCollection\";\nimport { QueryOptionName, QueryOrdering } from \"../query/types\";\nimport { SerializedQueryOption } from \"./types\";\n\n/**\n * Which options can cross a wire, and how the rest are handled.\n *\n * Everything except `map` and `group`. Those two are defined BY a closure — the projection is the\n * option — and no data form of them exists to send. Nothing else needs its closure: a sort is a\n * property and a direction, a filter is an expression tree, `nearest` is a vector and a count.\n */\nconst SENDABLE: ReadonlySet<QueryOptionName> = new Set<QueryOptionName>([\n \"skip\", \"take\", \"sort\", \"filter\", \"nearest\", \"join\", \"count\", \"min\", \"max\", \"sum\", \"distinct\"\n]);\n\n/**\n * Splits options into the PREFIX that can be sent and the remainder that cannot.\n *\n * A prefix, not a filtered subset, and that is the whole correctness argument. Options are ordered,\n * and most are not idempotent: sending `count` while keeping `map` local would count unmapped rows,\n * and applying `take` on both sides would window twice. So the split stops at the first option that\n * cannot travel, and everything from there on runs where the closures are.\n *\n * It is the same shape as the database/memory split this composes with — one more cut of the same\n * ordered list, for one more reason.\n */\nexport const splitSendableOptions = <T>(options: QueryOptionsCollection<T>): {\n sendable: QueryOptionsCollection<T>;\n local: QueryOptionsCollection<T>;\n} => {\n const sendable = new QueryOptionsCollection<T>();\n const local = new QueryOptionsCollection<T>();\n\n let stopped = false;\n\n options.forEach(option => {\n if (stopped === false && SENDABLE.has(option.name) === false) {\n stopped = true;\n }\n\n (stopped ? local : sendable).add(option.name, option.value);\n });\n\n return { sendable, local };\n};\n\n/** The key's property path, which is what the receiver resolves against its own schema. */\nconst keyPath = (reference: JoinKeyReference) => reference.property?.id ?? reference.propertyName;\n\nexport const serializeQueryOptions = <T>(options: QueryOptionsCollection<T>): SerializedQueryOption[] => {\n const serialized: SerializedQueryOption[] = [];\n\n options.forEach(option => {\n const value = option.value as never as UnknownRecord;\n\n switch (option.name) {\n case \"skip\":\n case \"take\":\n serialized.push({ name: option.name, value: option.value as never as number });\n return;\n\n case \"sort\":\n serialized.push({\n name: \"sort\",\n value: {\n // The declared path, so the receiver can resolve its own property and rebuild\n // both the selector and the storage column name from it\n propertyName: (value.property as { id?: string } | null)?.id ?? String(value.propertyName),\n direction: value.direction as QueryOrdering\n }\n });\n return;\n\n case \"filter\": {\n const expression = value.expression as never as Expression;\n\n /**\n * A filter with no usable tree must not be SENT, and this is a hard error.\n *\n * `not-parsable` means the intent is unknown — the parser could not work out what the\n * predicate asks for. A receiver handed that has two options, and both are wrong: read\n * everything (returning rows the caller excluded) or return nothing (silently losing\n * them). Neither is a degradation worth accepting when the caller's own closure is\n * sitting right here and can answer correctly.\n *\n * In practice this is unreachable: `QueryOptionsCollection.add` targets an unparsable\n * filter at the MEMORY half, so it never reaches a plugin. The guard is here because\n * \"unreachable\" is a property of code that changes, and the failure it would let\n * through is silent.\n */\n if (Expression.isNotParsable(expression)) {\n throw new Error(\n \"Cannot send a filter whose expression could not be parsed: the receiver would have to guess whether to \" +\n \"return everything or nothing, and both answers are wrong. A filter like this belongs in the memory half, \" +\n \"where the caller's own predicate runs.\"\n );\n }\n\n serialized.push({ name: \"filter\", value: { expression: Expression.toJson(expression) } });\n return;\n }\n\n case \"nearest\":\n serialized.push({\n name: \"nearest\",\n value: {\n propertyName: (value.property as { id?: string } | null)?.id ?? String(value.propertyName),\n vector: value.vector as number[],\n count: value.count as number\n }\n });\n return;\n\n case \"join\": {\n const join = value as never as {\n kind: \"inner\" | \"left\";\n innerOptions: QueryOptionsCollection<unknown>;\n outerKey: JoinKeyReference;\n innerKey: JoinKeyReference;\n semiJoinKeyThreshold: number;\n innerCollectionName?: string;\n };\n\n serialized.push({\n name: \"join\",\n value: {\n kind: join.kind,\n // Resolved by the caller, which is the only place that can see the schema\n // collection the id refers to\n innerCollectionName: join.innerCollectionName ?? \"\",\n outerKeyPath: keyPath(join.outerKey),\n innerKeyPath: keyPath(join.innerKey),\n innerOptions: serializeQueryOptions(join.innerOptions),\n semiJoinKeyThreshold: join.semiJoinKeyThreshold\n }\n });\n return;\n }\n\n case \"count\":\n case \"min\":\n case \"max\":\n case \"sum\":\n case \"distinct\":\n serialized.push({ name: option.name, value: true });\n return;\n\n default:\n throw new Error(\n `Cannot serialize the '${option.name}' query option: it is defined by a function, which cannot cross a wire. ` +\n `Use splitSendableOptions so it runs where its closure is.`\n );\n }\n });\n\n return serialized;\n};\n\n/** How the receiver finds a collection it was sent the NAME of. */\nexport type SchemaResolver = (collectionName: string) => CompiledSchema<any> | null;\n\n/**\n * A filter the RECEIVER adds to every read of a collection, whatever the sender asked for.\n *\n * Returns `null` for a collection with nothing to add. See `createRequestHandler` for the policy\n * side; this is only how it reaches the options.\n */\nexport type ScopeProvider = (schema: CompiledSchema<any>) => Expression | null;\n\n/**\n * Rebuilds query options from their wire form, against the receiver's own schemas.\n *\n * The closures that were dropped are reconstructed here rather than sent:\n *\n * - a **sort selector** from its property, which is all `JsonTranslator.sort` reads;\n * - a **filter predicate** from its expression tree, via `toStrictPredicate` — which THROWS rather\n * than keeping a row it cannot judge, because on a receiver a filter that quietly stops filtering\n * returns rows the requester excluded.\n *\n * @throws when a named property or collection is not declared by the receiver's schemas. A payload\n * describing data this side does not have is a disagreement, and it has to be loud.\n */\nexport const deserializeQueryOptions = (\n serialized: SerializedQueryOption[],\n schema: CompiledSchema<any>,\n resolveSchema: SchemaResolver,\n /**\n * A receiver-side filter per collection, applied to this collection AND to every collection a\n * join reaches. Prepended, so it is ANDed with whatever the sender sent and there is no order of\n * options that removes it.\n */\n scopeFor?: ScopeProvider\n): QueryOptionsCollection<any> => {\n\n const options = new QueryOptionsCollection<any>();\n\n /**\n * FIRST, before anything the sender asked for.\n *\n * Position matters twice. It cannot be displaced by any option the sender chose, and being at\n * the front it is in the database half — so a backend pushes it down rather than the receiver\n * reading the whole collection and filtering afterwards.\n */\n const scope = scopeFor?.(schema) ?? null;\n\n if (scope != null) {\n options.add(\"filter\", {\n filter: toStrictPredicate(scope) as never,\n expression: scope,\n params: undefined\n } as never);\n }\n\n const propertyOf = (path: string) => {\n const property = schema.getProperty(path);\n\n if (property == null) {\n throw new Error(\n `Cannot deserialize a query: this schema does not declare the property it names. ` +\n `Property: ${path}, Collection: ${schema.collectionName}`\n );\n }\n\n return property;\n };\n\n for (const option of serialized) {\n switch (option.name) {\n case \"skip\":\n case \"take\":\n options.add(option.name, option.value as never);\n break;\n\n case \"sort\": {\n const property = propertyOf(option.value.propertyName);\n\n options.add(\"sort\", {\n selector: ((row: UnknownRecord) => property.getValue(row)) as never,\n direction: option.value.direction,\n propertyName: option.value.propertyName,\n property\n } as never);\n break;\n }\n\n case \"filter\": {\n const expression = Expression.fromJson(option.value.expression, schema);\n\n options.add(\"filter\", {\n filter: toStrictPredicate(expression) as never,\n expression,\n params: undefined\n } as never);\n break;\n }\n\n case \"nearest\": {\n const property = propertyOf(option.value.propertyName);\n\n options.add(\"nearest\", {\n selector: ((row: UnknownRecord) => property.getValue(row)) as never,\n propertyName: option.value.propertyName,\n property,\n vector: option.value.vector,\n count: option.value.count\n } as never);\n break;\n }\n\n case \"join\": {\n const innerSchema = resolveSchema(option.value.innerCollectionName);\n\n if (innerSchema == null) {\n throw new Error(\n `Cannot deserialize a join: this store has no collection named '${option.value.innerCollectionName}'.`\n );\n }\n\n options.add(\"join\", {\n kind: option.value.kind,\n innerSchemaId: innerSchema.id,\n outerKey: { propertyName: option.value.outerKeyPath, property: propertyOf(option.value.outerKeyPath) },\n innerKey: {\n propertyName: option.value.innerKeyPath,\n property: innerSchema.getProperty(option.value.innerKeyPath)\n },\n /**\n * The inner side is deserialized with the SAME scope provider, which is what\n * stops a join being a way around a scope: a sender that cannot read a\n * collection directly must not be able to read it by joining to it.\n */\n innerOptions: deserializeQueryOptions(option.value.innerOptions, innerSchema, resolveSchema, scopeFor),\n // False by construction: the receiver executes both sides against its own single\n // plugin, whatever the sender's topology was.\n crossPlugin: false,\n semiJoinKeyThreshold: option.value.semiJoinKeyThreshold\n } as never);\n break;\n }\n\n default:\n options.add(option.name, true as never);\n break;\n }\n }\n\n return options;\n};\n","import { BulkPersistChanges, BulkPersistResult } from \"../../collections\";\nimport { CompiledSchema } from \"../../schema\";\nimport { ReadonlySchemaCollection } from \"../../collections/ReadonlySchemaCollection\";\nimport { SchemaResolver } from \"./query\";\nimport { SerializedPersistRequest, SerializedResponse, SerializedSchemaChanges } from \"./types\";\n\n/**\n * Saves, in the form that survives a wire.\n *\n * Simpler than a query, because a change set holds no functions: adds, updates and removes are\n * entities, and an entity reaching a plugin has already been through `preprocess` — so it is in\n * STORAGE shape, where a Date is already an ISO string and a nested object is already whatever the\n * schema said to store. It is JSON by the time it gets here.\n *\n * Two things are deliberately left behind:\n *\n * - **Tags.** `SchemaPersistChanges.tags` is caller-side metadata for correlating a save with its\n * echo locally. The receiver has no use for it and no business seeing it.\n * - **Schema ids.** Collections are NAMED. An id is a hash of the schema's own shape, so it would\n * couple both sides to identical schema definitions; a name lets the receiver resolve its own.\n */\n\nexport const serializeBulkPersist = (\n changes: BulkPersistChanges,\n schemas: ReadonlySchemaCollection\n): SerializedPersistRequest => {\n\n const serialized: SerializedSchemaChanges[] = [];\n\n for (const [schemaId, schemaChanges] of changes) {\n if (schemaChanges.hasItems === false) {\n continue;\n }\n\n const schema = schemas.get(schemaId);\n\n if (schema == null) {\n throw new Error(`Cannot serialize a save: no schema is registered for the id it names. SchemaId: ${schemaId}`);\n }\n\n serialized.push({\n collectionName: schema.collectionName,\n adds: schemaChanges.adds as unknown[],\n updates: schemaChanges.updates.map(update => ({\n entity: update.entity,\n changeType: update.changeType,\n delta: update.delta,\n ...(update.concurrency != null && { concurrency: update.concurrency })\n })),\n removes: schemaChanges.removes as unknown[]\n });\n }\n\n return { kind: \"persist\", changes: serialized };\n};\n\n/**\n * Rebuilds a change set from its wire form, keyed by the RECEIVER's schema ids.\n *\n * @throws when a named collection is not one this store declares. A save aimed at data this side\n * does not have must not be silently dropped — the caller would be told it succeeded.\n */\nexport const deserializeBulkPersist = (\n request: SerializedPersistRequest,\n resolveSchema: SchemaResolver\n): { changes: BulkPersistChanges; schemas: CompiledSchema<any>[] } => {\n\n const changes = new BulkPersistChanges();\n const schemas: CompiledSchema<any>[] = [];\n\n for (const schemaChanges of request.changes) {\n const schema = resolveSchema(schemaChanges.collectionName);\n\n if (schema == null) {\n throw new Error(\n `Cannot apply a save: this store has no collection named '${schemaChanges.collectionName}'.`\n );\n }\n\n schemas.push(schema);\n\n const resolved = changes.resolve(schema.id);\n resolved.adds = schemaChanges.adds as never[];\n resolved.updates = schemaChanges.updates.map(update => ({\n entity: update.entity as never,\n changeType: update.changeType,\n delta: update.delta as never,\n ...(update.concurrency != null && { concurrency: update.concurrency })\n })) as never[];\n resolved.removes = schemaChanges.removes as never[];\n }\n\n return { changes, schemas };\n};\n\n/**\n * Serializes the ECHO of a save — the part the change tracker cannot do without.\n *\n * A save's result is not a receipt. It carries the rows as the database wrote them, including any\n * identity the database assigned, and the change tracker matches each one back to the addition that\n * produced it. Returning a count instead would leave every inserted entity without its key.\n */\nexport const serializePersistResult = (\n result: BulkPersistResult,\n schemas: ReadonlySchemaCollection\n): SerializedResponse => {\n\n const changes: Array<{ collectionName: string; adds: unknown[]; updates: unknown[]; removes: unknown[] }> = [];\n\n for (const [schemaId, schemaResult] of result) {\n const schema = schemas.get(schemaId);\n\n if (schema == null) {\n continue;\n }\n\n changes.push({\n collectionName: schema.collectionName,\n adds: schemaResult.adds as unknown[],\n updates: schemaResult.updates as unknown[],\n removes: schemaResult.removes as unknown[]\n });\n }\n\n return { ok: true, kind: \"persist\", changes };\n};\n\n/** Rebuilds a save's echo against the SENDER's schema ids, which is what its change tracker holds. */\nexport const deserializePersistResult = (\n response: Extract<SerializedResponse, { kind: \"persist\" }>,\n resolveSchema: SchemaResolver\n): BulkPersistResult => {\n\n const result = new BulkPersistResult();\n\n for (const schemaChanges of response.changes) {\n const schema = resolveSchema(schemaChanges.collectionName);\n\n if (schema == null) {\n throw new Error(\n `A save came back naming a collection this store does not declare: '${schemaChanges.collectionName}'.`\n );\n }\n\n const resolved = result.resolve(schema.id);\n resolved.adds = schemaChanges.adds as never[];\n resolved.updates = schemaChanges.updates as never[];\n resolved.removes = schemaChanges.removes as never[];\n }\n\n return result;\n};\n","import { ReadonlySchemaCollection } from \"../../collections/ReadonlySchemaCollection\";\nimport { Expression, Filter, ParamsFilter, toExpression, toStrictPredicate } from \"../../expressions\";\nimport { PluginEventResult, Result } from \"../../results\";\nimport { CompiledSchema } from \"../../schema\";\nimport { UnknownRecord, uuid } from \"../../utilities\";\nimport { IDbPlugin } from \"../types\";\nimport { ExecutedQuery } from \"../query/explain\";\nimport { Query } from \"../query/Query\";\nimport { deserializeBulkPersist, serializePersistResult } from \"./persist\";\nimport { deserializeQueryOptions, SchemaResolver, ScopeProvider } from \"./query\";\nimport { SerializedRequest, SerializedResponse } from \"./types\";\n\n/**\n * The receiving half: takes a serialized request, executes it, returns a serialized response.\n *\n * Deliberately not a server. It is one async function from JSON to JSON, with no notion of HTTP, so\n * the same handler sits behind Express, a Cloudflare Worker, a Lambda, a WebSocket message, or a\n * worker `postMessage`. Transport is the caller's business; this is the part that would otherwise be\n * rewritten per framework.\n *\n * ```ts\n * const handle = createRequestHandler({ plugin, schemas });\n *\n * app.post(\"/routier\", async (req, res) => res.json(await handle(req.body)));\n * ```\n *\n * ## Security is YOURS, and this gives you the two places to put it\n *\n * There is no built-in notion of a user, a tenant, a role or a token, and there should not be: this\n * library cannot know what your identities are or what they may see. What it can do is make sure\n * there is nowhere for a decision to be forgotten. Two hooks, and both receive a `context` you built\n * from the request:\n *\n * - **`authorize`** — may this caller do this at all? Called once per request, before anything is\n * deserialized or executed, with the action and every collection the request touches.\n * - **`scope`** — which ROWS may this caller see? A filter the receiver ANDs into every read of a\n * collection, and checks every written row against.\n *\n * With neither supplied, the endpoint answers anything for anyone. That is the correct default for a\n * function with no idea who is calling it — and the moment you name a context type, passing one\n * becomes required, so a policy cannot be half-wired.\n *\n * ```ts\n * const handle = createRequestHandler<{ tenantId: string }>({\n * plugin,\n * schemas,\n * authorize: ({ action, context }) => context.tenantId != null || \"not signed in\",\n * scope: ({ context }) => ({ filter: ([row, p]) => row.tenantId === p.tenantId, params: context }),\n * });\n *\n * app.post(\"/routier\", async (req, res) => {\n * const context = { tenantId: req.user?.tenantId }; // from the REQUEST, never from the body\n * res.json(await handle(req.body, context));\n * });\n * ```\n *\n * ## Errors are values\n *\n * A failure comes back as `{ ok: false, error }` rather than as a rejected promise, so a transport\n * cannot accidentally turn a query error into a 500 with no body. The caller decides the status.\n */\n\n/** What a hook is told about the request it is judging. */\nexport type RequestInfo<TContext> = {\n action: \"query\" | \"persist\" | \"destroy\";\n /** Every collection this request touches, including the inner side of any join. */\n collectionNames: string[];\n /** Whatever the transport built from the request — a user, a tenant, a token. Never the body. */\n context: TContext;\n /** The raw request, for a policy that needs to look closer. Treat it as caller-controlled input. */\n request: SerializedRequest;\n};\n\n/**\n * May this request proceed?\n *\n * `true` to allow. `false` or a string to refuse — a string becomes the error message, which is the\n * cheapest way to say WHY without inventing an error type. Throwing also refuses.\n *\n * Called once, before deserialization, so a refused request never reaches a schema or a plugin.\n */\nexport type AuthorizeHook<TContext> = (info: RequestInfo<TContext>) => boolean | string | Promise<boolean | string>;\n\n/** What a scope hook is asked. One collection at a time, since each may be scoped differently. */\nexport type ScopeInfo<TContext> = {\n collectionName: string;\n schema: CompiledSchema<any>;\n context: TContext;\n action: \"query\" | \"persist\";\n};\n\n/**\n * The rows of one collection this caller may touch, as a filter.\n *\n * Written exactly like a collection's own `.scope()` — a filter, optionally with params — so the same\n * expression is pushed into the database on reads and checked against each row on writes. Return\n * `null` for a collection this caller may see in full.\n *\n * ```ts\n * scope: ({ collectionName, context }) =>\n * collectionName === \"orders\"\n * ? { filter: ([row, p]) => row.tenantId === p.tenantId, params: { tenantId: context.tenantId } }\n * : null\n * ```\n */\nexport type ScopeHook<TContext> = (info: ScopeInfo<TContext>) =>\n | { filter: Filter<any> | ParamsFilter<any, any>; params?: {} }\n | null;\n\nexport type RequestHandlerOptions<TContext> = {\n /** The plugin that actually holds the data. Anything implementing `IDbPlugin`. */\n plugin: IDbPlugin;\n /** Every collection this endpoint will answer for. A name absent from here is refused. */\n schemas: ReadonlySchemaCollection;\n /** May this caller do this? See `AuthorizeHook`. Absent means yes, to everyone. */\n authorize?: AuthorizeHook<TContext>;\n /** Which rows may this caller touch? See `ScopeHook`. Absent means all of them. */\n scope?: ScopeHook<TContext>;\n /**\n * Whether a `destroy` request may drop the database. **Defaults to false.**\n *\n * `HttpTransportDbPlugin` never sends one, but an endpoint answers whatever arrives — and a\n * hand-written `{\"kind\":\"destroy\"}` would otherwise wipe the store for anyone who could reach\n * the route. Destroying a database is not something a remote caller should be able to ask for by\n * default, so it is opt-in and still passes through `authorize`.\n */\n allowDestroy?: boolean;\n};\n\nexport type RequestHandler<TContext> = (request: SerializedRequest, context: TContext) => Promise<SerializedResponse>;\n\n/** Every collection a request touches, joins included — what `authorize` is given. */\nconst collectionsIn = (request: SerializedRequest): string[] => {\n if (request.kind === \"destroy\") {\n return [];\n }\n\n if (request.kind === \"persist\") {\n return request.changes.map(change => change.collectionName);\n }\n\n const names = [request.collectionName];\n\n const walk = (options: typeof request.options) => {\n for (const option of options) {\n if (option.name === \"join\") {\n names.push(option.value.innerCollectionName);\n walk(option.value.innerOptions);\n }\n }\n };\n\n walk(request.options);\n\n return names;\n};\n\nexport const createRequestHandler = <TContext = void>(options: RequestHandlerOptions<TContext>): RequestHandler<TContext> => {\n const { plugin, schemas, authorize, scope, allowDestroy = false } = options;\n\n const byName = new Map<string, CompiledSchema<any>>();\n\n for (const [, schema] of schemas) {\n byName.set(schema.collectionName, schema as CompiledSchema<any>);\n }\n\n const resolveSchema: SchemaResolver = (collectionName) => byName.get(collectionName) ?? null;\n\n const failed = (error: unknown): SerializedResponse => ({\n ok: false,\n error: error instanceof Error ? error.message : String(error)\n });\n\n /**\n * Turns a scope hook's filter into an expression, once per collection per request.\n *\n * `toExpression` rather than only keeping the closure, because an expression is what a backend\n * can push down — a scope that could only run in memory would mean reading the whole collection\n * to hide most of it. A filter that cannot be parsed is REFUSED rather than silently degraded:\n * a scope is the boundary, and one that quietly stops applying is worse than an error.\n */\n const scopeExpressionFor = (schema: CompiledSchema<any>, context: TContext, action: \"query\" | \"persist\"): Expression | null => {\n if (scope == null) {\n return null;\n }\n\n const declared = scope({ collectionName: schema.collectionName, schema, context, action });\n\n if (declared == null) {\n return null;\n }\n\n const expression = toExpression(schema, declared.filter as never, declared.params as never);\n\n if (Expression.isNotParsable(expression)) {\n throw new Error(\n `The scope declared for '${schema.collectionName}' cannot be expressed as a filter, so it cannot be enforced. ` +\n `Scopes must be parseable — they are the boundary between callers, and one that cannot be applied must not be ignored.`\n );\n }\n\n return expression;\n };\n\n return async (request, context) => {\n try {\n if (request.kind === \"destroy\" && allowDestroy === false) {\n return failed(new Error(\n \"This endpoint does not allow destroy. Dropping the database is opt-in: pass allowDestroy to createRequestHandler if a remote caller really should be able to ask for it.\"\n ));\n }\n\n if (authorize != null) {\n const verdict = await authorize({\n action: request.kind,\n collectionNames: collectionsIn(request),\n context,\n request\n });\n\n if (verdict !== true) {\n return failed(new Error(typeof verdict === \"string\" ? verdict : \"Not authorized.\"));\n }\n }\n\n if (request.kind === \"query\") {\n const schema = resolveSchema(request.collectionName);\n\n if (schema == null) {\n return failed(new Error(`This endpoint has no collection named '${request.collectionName}'.`));\n }\n\n const queryOptions = deserializeQueryOptions(\n request.options,\n schema,\n resolveSchema,\n // Applied to the outer collection AND to every collection a join reaches, so a\n // join cannot be used to read around a scope\n (target) => scopeExpressionFor(target, context, \"query\")\n );\n\n const executedQueries: ExecutedQuery[] = [];\n\n return await new Promise<SerializedResponse>(resolve => {\n plugin.query({\n // `false`: nothing here attaches to a change tracker — the tracker lives on\n // the caller, on the other side of the wire.\n operation: new Query(queryOptions, schema, false),\n schemas: schemas as never,\n id: uuid(8),\n source: \"RequestHandler\",\n action: \"query\",\n explain: request.explain,\n executedQueries\n }, result => {\n if (result.ok === PluginEventResult.ERROR) {\n resolve(failed(result.error));\n return;\n }\n\n resolve({\n ok: true,\n kind: \"query\",\n value: result.data.value as unknown,\n // Only when asked, and only what the plugin reported. A plugin\n // that reported nothing sends nothing, and the caller marks the\n // remote step as not reported.\n ...(request.explain === true && executedQueries.length > 0 ? { executedQueries } : {})\n });\n });\n });\n }\n\n if (request.kind === \"persist\") {\n const { changes } = deserializeBulkPersist(request, resolveSchema);\n\n /**\n * A scope has to be enforced on WRITES too, and differently.\n *\n * On a read it narrows what comes back. On a write there is nothing to narrow — the\n * rows are supplied by the caller — so each one is CHECKED against the same\n * expression, and a single row outside the scope refuses the whole save. Without\n * this, a caller who can only read their own rows could still write somebody else's.\n *\n * All-or-nothing on purpose: a partial save would leave the caller believing the\n * rejected rows were stored.\n */\n for (const [schemaId, schemaChanges] of changes) {\n const schema = schemas.get(schemaId);\n\n if (schema == null) {\n continue;\n }\n\n const expression = scopeExpressionFor(schema as CompiledSchema<any>, context, \"persist\");\n\n if (expression == null) {\n continue;\n }\n\n const permitted = toStrictPredicate(expression);\n\n const rows = [\n ...schemaChanges.adds as UnknownRecord[],\n ...schemaChanges.updates.map(update => update.entity as UnknownRecord),\n ...schemaChanges.removes as UnknownRecord[]\n ];\n\n for (const row of rows) {\n if (permitted(row) === false) {\n return failed(new Error(\n `This save was refused: a row of '${schema.collectionName}' falls outside the scope allowed for this caller.`\n ));\n }\n }\n }\n\n return await new Promise<SerializedResponse>(resolve => {\n plugin.bulkPersist({\n operation: changes,\n schemas: schemas as never,\n id: uuid(8),\n source: \"RequestHandler\",\n action: \"persist\"\n }, result => {\n if (result.ok === Result.ERROR) {\n resolve(failed(result.error));\n return;\n }\n\n // A PARTIAL result carries data AND an error. Reported as a failure, because\n // the caller must not treat a half-applied save as a success.\n if (result.ok === Result.PARTIAL) {\n resolve(failed(result.error));\n return;\n }\n\n resolve(serializePersistResult(result.data, schemas));\n });\n });\n }\n\n return await new Promise<SerializedResponse>(resolve => {\n plugin.destroy({\n schemas: schemas as never,\n id: uuid(8),\n source: \"RequestHandler\",\n action: \"destroy\"\n }, result => {\n if (result.ok === PluginEventResult.ERROR) {\n resolve(failed(result.error));\n return;\n }\n\n resolve({ ok: true, kind: \"destroy\" });\n });\n });\n } catch (error) {\n return failed(error);\n }\n };\n};\n\n/** Re-exported so a caller can type its own scope provider without reaching for the query module. */\nexport type { ScopeProvider };\n","export * from './types';\nexport * from './query';\nexport * from './persist';\nexport * from './handler';\n","import { BulkPersistResult, SchemaCollection } from \"../collections\";\nimport { OptimisticConcurrencyError } from \"../errors\";\nimport { DbPluginBulkPersistEvent, DbPluginEvent, DbPluginQueryEvent, IDbPlugin, ITranslatedValue } from \".\";\nimport { Query } from \"./query/Query\";\nimport { PluginEventCallbackPartialResult, PluginEventCallbackResult } from \"../results\";\nimport { CompiledSchema, IdType, InferType, PropertyInfo, SchemaId, SchemaTypes } from \"../schema\";\n\n/**\n * Optimistic concurrency as a wrapper plugin — the whole opt-in is one wrap:\n *\n * ```ts\n * class Bank extends DataStore {\n * constructor() {\n * super(new ConcurrencyDbPlugin(new SqlitePlugin('bank.db')));\n * }\n * }\n * ```\n *\n * Nothing is declared on the schema and nothing on the collection builder: the plugin\n * maintains a hidden `__version` column in the SAME tables/records as the data, entirely\n * below the entity surface. Rows start at version 1; every update is applied ONLY IF the\n * stored version still matches what this store last read (and bumps it); a stale write\n * rejects the save with `OptimisticConcurrencyError` naming the rows instead of silently\n * overwriting another writer. Recovery is always: re-read, reapply, save again.\n *\n * ## How the hidden column exists without schema changes\n *\n * The wrapper hands the inner plugin an AUGMENTED VIEW of each compiled schema — the same\n * object via prototype delegation, with one synthetic `__version` property appended to\n * `properties`. That list is exactly what the storage plugins read to build DDL, INSERT\n * and SELECT column lists, so the column materializes and round-trips through completely\n * unmodified plugin code. Above the wrapper the real schema is untouched, and the\n * datastore's generated deserialize/enrich drop undeclared fields, so `__version` never\n * reaches an entity a caller holds.\n *\n * The synthetic property carries `from: '__version'` on purpose: EphemeralDataPlugin\n * deep-copies query results with `structuredClone` (rather than the generated clone, which\n * drops undeclared fields) when any property is renamed — which is what lets the hidden\n * column survive reads from the in-process plugins so this wrapper can observe it.\n *\n * ## What this store \"read\"\n *\n * `expected` is per store instance: the version this wrapper last saw for the row, from a\n * query result or a persist echo. A row updated WITHOUT ever being read through this store\n * (rare — an attach of a foreign instance) has no expected value and is written unchecked,\n * initializing its token; the row is protected from the next read on.\n *\n * ## Enforcement and limits\n *\n * The conditional check itself is performed by the INNER plugin via the\n * `EntityUpdateInfo.concurrency` contract — memory, file-system, sqlite and postgresql\n * enforce it (see specs/optimistic-concurrency.md for the not-yet list). Existing SQL\n * tables created before the wrapper was adopted lack the column and need\n * `ALTER TABLE ... ADD COLUMN \"__version\" <number type>` — new tables get it from the\n * augmented DDL automatically.\n */\nexport class ConcurrencyDbPlugin implements IDbPlugin {\n\n static readonly VERSION_COLUMN = \"__version\";\n\n private readonly plugin: IDbPlugin;\n /** Augmented schema views, one per schema — identity matters, so they are cached. */\n private readonly augmentedSchemas = new Map<SchemaId, CompiledSchema<any>>();\n /** collectionName -> rowId -> the version this store last observed for the row. */\n private readonly observedVersions = new Map<string, Map<IdType, number>>();\n\n constructor(plugin: IDbPlugin) {\n this.plugin = plugin;\n }\n\n get databaseName(): string {\n return this.plugin.databaseName;\n }\n\n query<TRoot extends {}, TShape extends any = TRoot>(event: DbPluginQueryEvent<TRoot, TShape>, done: PluginEventCallbackResult<ITranslatedValue<TShape>>): void {\n const schema = event.operation.schema;\n\n const augmentedEvent: DbPluginQueryEvent<TRoot, TShape> = {\n ...event,\n schemas: this.augmentSchemas(event.schemas),\n operation: new Query<TRoot, TShape>(\n event.operation.options,\n this.augment(schema),\n // Preserve the override rather than letting the getter re-derive it\n (event.operation as unknown as { enableChangeTrackingOverride?: boolean }).enableChangeTrackingOverride\n ),\n };\n\n this.plugin.query(augmentedEvent, result => {\n if (result.ok !== \"error\") {\n // Query rows are plugin-made copies, so the hidden column can be removed in\n // place after its value is recorded.\n this.captureAndStrip(schema, this.rowsOf(result.data), { strip: true });\n }\n\n done(result);\n });\n }\n\n bulkPersist(event: DbPluginBulkPersistEvent, done: PluginEventCallbackPartialResult<BulkPersistResult>): void {\n const schemaIds: SchemaId[] = [];\n\n for (const [schemaId, changes] of event.operation) {\n schemaIds.push(schemaId);\n\n if (changes == null || changes.hasItems === false) {\n continue;\n }\n\n const schema = event.schemas.get(schemaId);\n const versions = this.versionsFor(schema.collectionName);\n\n for (const add of changes.adds) {\n (add as Record<string, unknown>)[ConcurrencyDbPlugin.VERSION_COLUMN] = 1;\n }\n\n for (const update of changes.updates) {\n const entity = update.entity as Record<string, unknown>;\n const id = schema.getId(update.entity as InferType<{}>);\n const expected = versions.get(id);\n // An EMPTY delta means \"write the whole entity\" (the plugins' fallback);\n // adding the column would silently narrow the write to the token alone.\n const deltaCarriesColumns = Object.keys(update.delta as Record<string, unknown>).length > 0;\n\n if (typeof expected === \"number\") {\n entity[ConcurrencyDbPlugin.VERSION_COLUMN] = expected + 1;\n if (deltaCarriesColumns) {\n (update.delta as Record<string, unknown>)[ConcurrencyDbPlugin.VERSION_COLUMN] = expected + 1;\n }\n update.concurrency = { column: ConcurrencyDbPlugin.VERSION_COLUMN, expected };\n } else {\n // Never observed through this store — initialize the token, unchecked.\n entity[ConcurrencyDbPlugin.VERSION_COLUMN] = 1;\n if (deltaCarriesColumns) {\n (update.delta as Record<string, unknown>)[ConcurrencyDbPlugin.VERSION_COLUMN] = 1;\n }\n }\n }\n }\n\n const augmentedEvent: DbPluginBulkPersistEvent = {\n ...event,\n schemas: this.augmentSchemas(event.schemas),\n };\n\n this.plugin.bulkPersist(augmentedEvent, result => {\n if (result.ok === \"success\") {\n for (const schemaId of schemaIds) {\n const schema = event.schemas.get(schemaId);\n const buckets = result.data.get(schemaId);\n\n // Echoed rows can BE the stored records (the in-process plugins echo by\n // reference), so the hidden column is recorded but never deleted here —\n // the datastore's generated deserialize drops it before any caller sees\n // it, and deleting it would erase the stored token itself.\n this.captureAndStrip(schema, buckets.adds as unknown[], { strip: false });\n this.captureAndStrip(schema, buckets.updates as unknown[], { strip: false });\n\n for (const removed of buckets.removes as unknown[]) {\n this.forget(schema, removed);\n }\n }\n } else if (OptimisticConcurrencyError.is(result.error)) {\n // The expected values that lost the race are stale; drop them so the\n // caller's re-read re-arms the check with fresh observations.\n const conflicted = result.error as OptimisticConcurrencyError;\n const versions = this.observedVersions.get(conflicted.collectionName);\n\n if (versions != null) {\n for (const id of conflicted.conflicts) {\n versions.delete(id);\n }\n }\n }\n\n done(result);\n });\n }\n\n destroy(event: DbPluginEvent, done: PluginEventCallbackResult<never>): void {\n this.observedVersions.clear();\n this.plugin.destroy(event, done);\n }\n\n private versionsFor(collectionName: string) {\n let versions = this.observedVersions.get(collectionName);\n\n if (versions == null) {\n versions = new Map<IdType, number>();\n this.observedVersions.set(collectionName, versions);\n }\n\n return versions;\n }\n\n /** Extracts entity rows from a translated query result; scalars/aggregates have none. */\n private rowsOf(data: ITranslatedValue<unknown>): unknown[] {\n const value = (data as { value?: unknown }).value;\n\n if (Array.isArray(value)) {\n return value;\n }\n\n if (value != null && typeof value === \"object\") {\n return [value];\n }\n\n return [];\n }\n\n private captureAndStrip(schema: CompiledSchema<any>, rows: unknown[], options: { strip: boolean }) {\n const versions = this.versionsFor(schema.collectionName);\n\n for (const row of rows) {\n if (row == null || typeof row !== \"object\") {\n continue;\n }\n\n const record = row as Record<string, unknown>;\n const version = record[ConcurrencyDbPlugin.VERSION_COLUMN];\n\n if (typeof version === \"number\") {\n try {\n versions.set(schema.getId(record as InferType<{}>), version);\n } catch {\n // Projected rows may not carry the key; nothing to observe.\n }\n }\n\n if (options.strip) {\n delete record[ConcurrencyDbPlugin.VERSION_COLUMN];\n }\n }\n }\n\n private forget(schema: CompiledSchema<any>, row: unknown) {\n if (row == null || typeof row !== \"object\") {\n return;\n }\n\n try {\n this.observedVersions.get(schema.collectionName)?.delete(schema.getId(row as InferType<{}>));\n } catch {\n // Removals without a resolvable id have nothing recorded.\n }\n }\n\n /** A SchemaCollection whose every schema is the augmented view. */\n private augmentSchemas(schemas: SchemaCollection): SchemaCollection {\n const augment = (schema: CompiledSchema<any>) => this.augment(schema);\n\n return new Proxy(schemas, {\n get(target, property, receiver) {\n if (property === \"get\") {\n return (id: SchemaId) => augment(target.get(id));\n }\n\n return Reflect.get(target, property, receiver);\n },\n });\n }\n\n /**\n * The augmented view of a compiled schema: the same object via prototype delegation,\n * with a synthetic `__version` property appended to `properties`. Everything else —\n * generated functions, ids, id properties — delegates to the real schema.\n */\n private augment<T extends {}>(schema: CompiledSchema<T>): CompiledSchema<T> {\n const cached = this.augmentedSchemas.get(schema.id);\n\n if (cached != null) {\n return cached as CompiledSchema<T>;\n }\n\n const synthetic = {\n name: ConcurrencyDbPlugin.VERSION_COLUMN,\n parent: null,\n type: SchemaTypes.Number,\n isKey: false,\n isIdentity: false,\n isDistinct: false,\n isNullable: true,\n isOptional: false,\n isReadonly: false,\n isUnmapped: false,\n isConcurrency: false,\n indexes: [] as string[],\n tags: [] as string[],\n literals: [] as unknown[],\n // Non-null `from` makes EphemeralDataPlugin structural-copy query results\n // (the generated clone would drop the hidden column before this wrapper\n // could observe it). The resolved name is unchanged.\n from: ConcurrencyDbPlugin.VERSION_COLUMN,\n valueSerializer: null,\n valueDeserializer: null,\n injected: null,\n defaultValue: null,\n getResolvedName: () => ConcurrencyDbPlugin.VERSION_COLUMN,\n getValue: (entity: Record<string, unknown>) => entity[ConcurrencyDbPlugin.VERSION_COLUMN],\n } as unknown as PropertyInfo<T>;\n\n const view = Object.create(schema) as CompiledSchema<T> & { properties: PropertyInfo<T>[] };\n Object.defineProperty(view, \"properties\", {\n value: [...schema.properties, synthetic],\n enumerable: true,\n });\n\n this.augmentedSchemas.set(schema.id, view);\n\n return view;\n }\n}\n","import { assertIsNotNull } from '../assertions';\nimport { OptimisticConcurrencyError } from '../errors';\nimport { BulkPersistResult, SchemaPersistChanges } from '../collections';\nimport { WorkPipeline } from '../pipeline';\nimport { DbPluginBulkPersistEvent, DbPluginEvent, DbPluginQueryEvent, distinctJoinKeys, IDbPlugin, ITranslatedValue, JoinInnerSide, JsonTranslator } from '.';\nimport { PluginEventCallbackPartialResult, PluginEventCallbackResult, PluginEventResult, Result } from '../results';\nimport { CompiledSchema, IdType, InferCreateType } from '../schema';\nimport { isComparatorExpression, isPropertyExpression, isValueExpression } from '../assertions';\nimport { DeepPartial } from '../types';\nimport { MemoryDataCollection } from '../collections/MemoryDataCollection';\nimport { UnknownRecord } from '../utilities';\n\n/**\n * Extracts the key value from a parsed filter expression when the whole filter\n * is a single non-negated equality on the schema's key property. Returns null\n * for anything else — compound filters, transformed properties, or filters that\n * could not be parsed.\n */\nconst getKeyEqualityValue = (expression: unknown): { value: IdType } | null => {\n\n // Type guards over the `type` discriminant, not instanceof — expression\n // instances can originate from a different bundled copy of the classes\n if (!isComparatorExpression(expression)) {\n return null;\n }\n\n if (expression.comparator !== \"equals\" || expression.negated === true) {\n return null;\n }\n\n const { left, right } = expression;\n\n if (!isPropertyExpression(left) || !isValueExpression(right)) {\n return null;\n }\n\n if (left.property.isKey !== true || left.transformer != null || right.value == null) {\n return null;\n }\n\n return { value: right.value as IdType };\n}\n\nexport abstract class EphemeralDataPlugin implements IDbPlugin {\n\n protected readonly _databaseName: string;\n\n constructor(databaseName: string) {\n this._databaseName = databaseName;\n }\n\n /**\n * See `IDbPlugin.databaseName`. A getter rather than the field itself so a subclass whose\n * database is identified by more than a name can widen it — `FileSystemPlugin` returns the\n * resolved file path, because one name in two directories is two databases.\n */\n get databaseName(): string {\n return this._databaseName;\n }\n\n protected abstract resolveCollection<TEntity extends {}>(schema: CompiledSchema<TEntity>): MemoryDataCollection;\n\n /**\n * All-or-nothing across every collection in the save.\n *\n * The naive shape — validate/apply/save one schema at a time — leaks partial saves:\n * a conflict in the SECOND collection left the first collection's changes applied\n * (measured in the finance stress app as one orphan ledger row per conflict). So the\n * work is phased: every collection loads and validates BEFORE anything is applied,\n * mutations apply with an undo log, and a failure anywhere reverts the memory state\n * (and re-saves any files already written) so the caller sees a save that did nothing.\n *\n * The remaining honesty gap is crash-safety across FILES: a process dying between two\n * file writes can leave disk partially updated. Guarding that needs a journal, which\n * a memory-first plugin does not pretend to have.\n */\n bulkPersist(event: DbPluginBulkPersistEvent, done: PluginEventCallbackPartialResult<BulkPersistResult>) {\n try {\n const bulkPersistResult = event.operation.toResult();\n const schemas = event.schemas;\n\n type StagedSchema = {\n schema: CompiledSchema<UnknownRecord>;\n collection: MemoryDataCollection;\n changes: SchemaPersistChanges<Record<string, unknown>>;\n result: ReturnType<BulkPersistResult[\"get\"]>;\n };\n\n const staged: StagedSchema[] = [];\n\n for (const [schemaId, changes] of event.operation) {\n if (!changes.hasItems) {\n continue;\n }\n\n const schema = schemas.get(schemaId);\n assertIsNotNull(schema);\n\n staged.push({\n schema: schema as CompiledSchema<UnknownRecord>,\n collection: this.resolveCollection(schema),\n changes: changes as SchemaPersistChanges<Record<string, unknown>>,\n result: bulkPersistResult.get(schemaId),\n });\n }\n\n if (staged.length === 0) {\n done(PluginEventResult.success(event.id, bulkPersistResult));\n return;\n }\n\n const pipeline = new WorkPipeline();\n\n // Phase 1 — load every collection that needs its stored data (updates/removes,\n // and any conditional update), before anything is validated or applied.\n //\n // An ADD-ONLY batch is skipped: an add needs no prior state, and for the memory\n // backing this class was written against, loading is free anyway.\n //\n // ⚠ SUBCLASSES THAT PERSIST WHOLE COLLECTIONS MUST HYDRATE IN `save()`.\n // If `save()` serializes `this.records` over the entire stored value — a JSON\n // file, one localStorage key, a blob — then a collection instance that has\n // never loaded holds only this batch's adds, and writing it DELETES everything\n // previously persisted. The skip above means `save()` cannot assume `load()`\n // ran. Hydrate first (load-once, then `addIfAbsent` so stored rows never\n // clobber pending mutations); `FileSystemDbCollection.save` and\n // `BrowserStorageCollection.save` both do exactly that.\n //\n // This has now been a data-loss defect twice — known-defects #18\n // (file-system) and #30 (browser-storage).\n for (const { collection, changes } of staged) {\n if (changes.updates.length === 0 && changes.removes.length === 0) {\n continue;\n }\n\n pipeline.pipe((d) => {\n collection.load(readResult => {\n if (readResult.ok === Result.ERROR) {\n d(readResult);\n return;\n }\n d(Result.success());\n });\n });\n }\n\n // Phase 2 — validate everything, then apply everything, then save everything.\n pipeline.pipe((d) => {\n try {\n // Validate: optimistic-concurrency checks for EVERY collection run\n // before ANY collection is touched, so a conflict rejects the whole\n // save with nothing written anywhere.\n for (const { schema, collection, changes } of staged) {\n const conflicts: IdType[] = [];\n\n for (const { entity, concurrency } of changes.updates) {\n if (concurrency == null) {\n continue;\n }\n\n const id = schema.getId(entity as never);\n const stored = collection.getByIds([id]) as Record<string, unknown> | null;\n\n // A missing row is not a token conflict — it falls through\n // to the same no-op an unconditional update would be.\n if (stored != null && stored[concurrency.column] !== concurrency.expected) {\n conflicts.push(id);\n }\n }\n\n if (conflicts.length > 0) {\n d(Result.error(new OptimisticConcurrencyError(schema.collectionName, conflicts)));\n return;\n }\n }\n\n // Apply, recording the inverse of every mutation. The in-memory maps\n // make undo exact: an add is removed, an update or remove restores the\n // captured prior record.\n const undo: (() => void)[] = [];\n\n const revert = () => {\n for (let i = undo.length - 1; i >= 0; i--) {\n undo[i]();\n }\n };\n\n try {\n for (const { schema, collection, changes, result } of staged) {\n const { adds, updates, removes } = changes;\n\n result.adds = Array.from({ length: adds.length });\n result.updates = Array.from({ length: updates.length });\n result.removes = Array.from({ length: removes.length });\n\n for (let j = 0; j < adds.length; j++) {\n const item = adds[j];\n collection.add(item);\n undo.push(() => collection.remove(item));\n result.adds[j] = item as DeepPartial<InferCreateType<UnknownRecord>>;\n }\n\n for (let j = 0; j < updates.length; j++) {\n const item = updates[j].entity;\n const prior = collection.getByIds(schema.getIds(item as never)) as Record<string, unknown> | undefined;\n collection.update(item);\n undo.push(prior != null ? () => collection.update(prior) : () => collection.remove(item));\n result.updates[j] = item;\n }\n\n for (let j = 0; j < removes.length; j++) {\n const item = removes[j];\n const prior = collection.getByIds(schema.getIds(item as never)) as Record<string, unknown> | undefined;\n collection.remove(item);\n if (prior != null) {\n undo.push(() => collection.update(prior));\n }\n result.removes[j] = item;\n }\n }\n } catch (applyError) {\n revert();\n d(Result.error(applyError));\n return;\n }\n\n // Save every collection. A failure reverts the memory state and\n // re-saves the files already written so disk follows it back.\n const saveNext = (index: number) => {\n if (index >= staged.length) {\n d(Result.success());\n return;\n }\n\n staged[index].collection.save(saveResult => {\n if (saveResult.ok === Result.ERROR) {\n revert();\n\n const resaveNext = (k: number) => {\n if (k >= index) {\n d(saveResult);\n return;\n }\n\n staged[k].collection.save(() => resaveNext(k + 1));\n };\n\n resaveNext(0);\n return;\n }\n\n saveNext(index + 1);\n });\n };\n\n saveNext(0);\n } catch (e) {\n d(Result.error(e));\n }\n });\n\n pipeline.filter((result) => {\n if (result.ok === Result.ERROR) {\n done(PluginEventResult.error(event.id, result.error));\n return;\n }\n done(PluginEventResult.success(event.id, bulkPersistResult));\n });\n } catch (e: any) {\n done(PluginEventResult.error(event.id, e));\n }\n }\n\n /**\n * Loads the inner side of a join, when the query carries one.\n *\n * This is the whole of \"interpretation 2\" for the ephemeral family — memory, file-system and\n * browser-storage all reach the inner collection the same way they reach the outer one, so\n * the wiring lives here once rather than in each subclass. The shared hash join in\n * `JsonTranslator.join` does everything after it.\n *\n * `load()` is called on the inner collection too: a durable subclass has nothing in memory\n * until it reads, and a join that skipped it would return no pairs on the first query after\n * a restart — an empty result, not an error.\n *\n * The rows are CLONED, like the outer side's are. Deserialization builds a new object for the\n * entity and its nested objects, but an array property can come through by reference — and\n * here that reference is the one this plugin's own storage holds, so a caller appending to a\n * joined row's array would be editing the database. The outer path has always cloned for this\n * reason; the inner path is the same read.\n *\n * @param outerKeys The distinct keys the outer rows actually hold — the semi-join prefilter.\n * Rows whose key is not among them cannot pair with anything, so they are skipped before the\n * clone rather than after the hash join, which is where the saving is. `null` means the outer\n * side had more distinct keys than `semiJoinKeyThreshold`, so every inner row is taken and the\n * join discards the surplus. Same pairs either way.\n */\n private resolveJoinInnerSide<TEntity extends {}, TShape>(\n event: DbPluginQueryEvent<TEntity, TShape>,\n outerKeys: ReadonlySet<unknown> | null,\n done: (result: { ok: \"success\", innerSide?: JoinInnerSide } | { ok: \"error\", error: unknown }) => void\n ) {\n const joinOption = event.operation.options.getLast(\"join\");\n\n if (joinOption == null) {\n done({ ok: \"success\" });\n return;\n }\n\n const innerSchema = event.schemas.get(joinOption.value.innerSchemaId);\n\n if (innerSchema == null) {\n done({\n ok: \"error\",\n error: new Error(`Cannot join: the inner collection's schema is not registered in this store. SchemaId: ${joinOption.value.innerSchemaId}`)\n });\n return;\n }\n\n const innerCollection = this.resolveCollection(innerSchema);\n\n innerCollection.load(r => {\n if (r.ok === Result.ERROR) {\n done({ ok: \"error\", error: r.error });\n return;\n }\n\n const cloneRecord = this.recordCloner(innerSchema);\n const innerRows: Record<string, unknown>[] = [];\n\n // Records are held in STORAGE shape, so the key is read by its resolved column name.\n const innerKey = joinOption.value.innerKey;\n const keyColumn = innerKey.property?.getResolvedName() ?? innerKey.propertyName;\n\n for (const record of innerCollection.values()) {\n if (outerKeys != null && outerKeys.has(record[keyColumn]) === false) {\n continue;\n }\n\n innerRows.push(cloneRecord(record));\n }\n\n const narrowing = outerKeys == null ? \"full scan\" : `narrowed by ${outerKeys.size} outer ${outerKeys.size === 1 ? \"key\" : \"keys\"}`;\n\n event.executedQueries.push({\n text: `${innerSchema.collectionName}: scanned ${innerRows.length} in-memory ${innerRows.length === 1 ? \"record\" : \"records\"} for join inner side (${narrowing})`\n });\n\n done({ ok: \"success\", innerSide: { innerSchema, innerRows } });\n });\n }\n\n /**\n * How to copy a stored record of this schema.\n *\n * Stored records use the storage shape (`from` names). `schema.clone` reads IN-MEMORY property\n * names and would silently drop renamed fields, so a schema with renames uses the cloner\n * generated against the storage shape instead. Both are generated code; the renamed case used\n * to fall back to `structuredClone`, which is roughly an order of magnitude slower and was paid\n * on EVERY read of EVERY schema that renames a property.\n */\n private recordCloner(schema: CompiledSchema<any>) {\n const hasRenamedProperties = schema.properties.some(property => property.from != null);\n\n return (hasRenamedProperties ? schema.cloneStorage : schema.clone) as (record: Record<string, unknown>) => Record<string, unknown>;\n }\n\n query<TEntity extends {}, TShape extends any = TEntity>(event: DbPluginQueryEvent<TEntity, TShape>, done: PluginEventCallbackResult<ITranslatedValue<TShape>>): void {\n this._query(event, done);\n }\n\n private _query<TEntity extends {}, TShape extends any = TEntity>(event: DbPluginQueryEvent<TEntity, TShape>, done: PluginEventCallbackResult<ITranslatedValue<TShape>>): void {\n try {\n const operation = event.operation;\n const schema = operation.schema;\n const collection = this.resolveCollection(schema);\n\n const cloneRecord = this.recordCloner(schema);\n\n collection.load(r => {\n if (r.ok === Result.ERROR) {\n done(PluginEventResult.error(event.id, r.error));\n return;\n }\n\n const orderedOptions: { name: string, value: any }[] = [];\n operation.options.forEach(o => orderedOptions.push(o));\n\n let leadingFilterCount = 0;\n\n while (leadingFilterCount < orderedOptions.length && orderedOptions[leadingFilterCount].name === \"filter\") {\n leadingFilterCount++;\n }\n\n // Key-equality fast path: when a leading filter's parsed expression pins\n // the key property to a single value, resolve that record directly from\n // the collection instead of scanning everything\n let source: Record<string, unknown>[] | null = null;\n\n if (schema.idProperties.length === 1) {\n for (let i = 0; i < leadingFilterCount; i++) {\n const id = getKeyEqualityValue(orderedOptions[i].value.expression);\n\n if (id == null) {\n continue;\n }\n\n const found = collection.getByIds([id.value]);\n source = found == null ? [] : [found];\n break;\n }\n }\n\n // Apply the leading filter options against the raw records before cloning\n // so only surviving rows pay the clone cost. Filter predicates are pure,\n // so re-running them inside translate() is a no-op pass over the survivors.\n //\n // Filter and clone are FUSED into one pass, and the unfiltered case iterates\n // the collection instead of spreading it into an array. The staged form walked\n // the collection up to four times and allocated a full-size array at each step.\n const leadingFilters: { filter: (arg: any) => unknown, params: unknown | null }[] = [];\n\n for (let i = 0; i < leadingFilterCount; i++) {\n const value = orderedOptions[i].value;\n\n if (value.filter == null) {\n continue;\n }\n\n leadingFilters.push({ filter: value.filter, params: value.params ?? null });\n }\n\n const filterCount = leadingFilters.length;\n const cloned: Record<string, unknown>[] = [];\n\n for (const record of (source ?? collection.values())) {\n let kept = true;\n\n for (let i = 0; i < filterCount; i++) {\n const { filter, params } = leadingFilters[i];\n\n // Truthiness, not === true: Array.prototype.filter keeps a row on any\n // truthy return, and these predicates are generated code that returns\n // whatever the expression evaluated to.\n if (!(params == null ? filter(record) : filter([record, params]))) {\n kept = false;\n break;\n }\n }\n\n if (kept === false) {\n continue;\n }\n\n cloned.push(cloneRecord(record));\n }\n\n /**\n * The inner side is loaded LAST, once the outer rows are known.\n *\n * That ordering is the whole semi-join: the outer keys are what narrow the inner\n * read, and they do not exist until the outer filters have run. Reading the inner\n * side first — which is what this did before — means loading and cloning a whole\n * collection to pair it with three rows.\n *\n * `cloned` is in storage shape, so the keys are read by resolved column name.\n */\n // No statement to quote — an ephemeral store walks its own records. Said\n // plainly so `.explain()` does not leave a reader wondering whether the\n // plugin simply failed to report. Before the inner side, to match execution order.\n event.executedQueries.push({\n text: `${operation.schema.collectionName}: scanned ${cloned.length} in-memory ${cloned.length === 1 ? \"record\" : \"records\"}`\n });\n\n const joinOption = operation.options.getLast(\"join\");\n const outerKeys = joinOption == null\n ? null\n : distinctJoinKeys(cloned, joinOption.value.outerKey, joinOption.value.semiJoinKeyThreshold, { storageShape: true });\n\n this.resolveJoinInnerSide(event, outerKeys, joinResult => {\n if (joinResult.ok === \"error\") {\n done(PluginEventResult.error(event.id, joinResult.error));\n return;\n }\n\n try {\n const translator = new JsonTranslator<TEntity, TShape>(operation, joinResult.innerSide);\n\n done(PluginEventResult.success(event.id, translator.translate(cloned)));\n } catch (e) {\n done(PluginEventResult.error(event.id, e));\n }\n });\n });\n } catch (e) {\n done(PluginEventResult.error(event.id, e));\n }\n }\n\n abstract destroy(event: DbPluginEvent, done: PluginEventCallbackResult<never>): void;\n}","import { BulkPersistResult } from \"../collections\";\nimport { PluginEventCallbackPartialResult, PluginEventCallbackResult, PluginEventResult } from \"../results\";\nimport { ITranslatedValue } from \"./translators\";\nimport { DbPluginBulkPersistEvent, DbPluginEvent, DbPluginQueryEvent, IDbPlugin } from \"./types\";\n\n/**\n * Retries a failed READ, and never a write.\n *\n * ## Why reads only\n *\n * A read is idempotent by construction: running the same query twice asks the same question\n * and changes nothing, so a second attempt is free apart from latency. That is what makes a\n * blanket retry safe here, and it is why this wrapper does not need to know which errors are\n * transient — see `shouldRetry`.\n *\n * A save is not. `bulkPersist` is a batch of adds, updates and removes, and a failure gives no\n * general way to know how much of it landed: a backend without atomic batches may have applied\n * part of it, and a retry then re-applies what already succeeded. Adds are the sharpest case —\n * an identity is assigned by the database, so a repeated INSERT does not collide, it\n * DUPLICATES. Rows appear that no caller asked for, no error is reported, and the change\n * tracker records a successful save.\n *\n * Retrying a write safely would need the write to carry an idempotency key the backend\n * deduplicates on, which is a property of a backend rather than something a wrapper can add.\n * So this refuses to guess, and a failed save is surfaced for the caller to decide about.\n *\n * ```ts\n * const store = new MyStore(new RetryDbPlugin(new SomeDbPlugin(...), { attempts: 3 }));\n * ```\n */\n\nexport type RetryDbPluginOptions = {\n /**\n * Total attempts, including the first. Default 3, minimum 1.\n *\n * \"Attempts\" rather than \"retries\" because off-by-one here is a real cost — the difference\n * between three calls and four against a struggling backend.\n */\n attempts?: number;\n /**\n * Milliseconds to wait before attempt `attempt` (2 for the first retry).\n *\n * Default is exponential — 50ms, 100ms, 200ms — with no jitter. Jitter matters when many\n * clients retry in lockstep after a shared outage, and a caller with that problem knows it\n * and can supply a delay; adding randomness by default would make tests non-deterministic\n * for everyone else.\n */\n delayMs?: (attempt: number) => number;\n /**\n * Whether an error is worth another attempt. Default: every error is.\n *\n * That default is deliberate and only defensible because this retries reads alone. A\n * wrapper cannot know which of a backend's errors are transient without naming that\n * backend, and guessing wrong in the cautious direction means not retrying the failure the\n * caller installed this for. Retrying a permanent error instead costs a bounded amount of\n * latency and nothing else.\n *\n * Supply this to narrow it — a syntax error in a filter will never succeed on a second try.\n */\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n};\n\nconst DEFAULT_ATTEMPTS = 3;\nconst defaultDelay = (attempt: number) => 50 * Math.pow(2, attempt - 2);\n\nexport class RetryDbPlugin implements IDbPlugin {\n\n private readonly plugin: IDbPlugin;\n private readonly attempts: number;\n private readonly delayMs: (attempt: number) => number;\n private readonly shouldRetry: (error: unknown, attempt: number) => boolean;\n\n constructor(plugin: IDbPlugin, options: RetryDbPluginOptions = {}) {\n this.plugin = plugin;\n // Floored at 1: zero attempts would never call the inner plugin and would report a\n // failure that never happened.\n this.attempts = Math.max(1, options.attempts ?? DEFAULT_ATTEMPTS);\n this.delayMs = options.delayMs ?? defaultDelay;\n this.shouldRetry = options.shouldRetry ?? (() => true);\n }\n\n get databaseName(): string {\n return this.plugin.databaseName;\n }\n\n query<TRoot extends {}, TShape extends any = TRoot>(\n event: DbPluginQueryEvent<TRoot, TShape>,\n done: PluginEventCallbackResult<ITranslatedValue<TShape>>\n ): void {\n this.attempt(event, done, 1);\n }\n\n /**\n * One attempt, scheduling the next on failure.\n *\n * Recursive rather than a loop because the inner plugin is callback-based: there is no\n * promise to await, and wrapping each attempt in one would change when errors surface.\n */\n private attempt<TRoot extends {}, TShape>(\n event: DbPluginQueryEvent<TRoot, TShape>,\n done: PluginEventCallbackResult<ITranslatedValue<TShape>>,\n attempt: number\n ): void {\n this.plugin.query<TRoot, TShape>(event, result => {\n\n if (result.ok !== PluginEventResult.ERROR) {\n done(result);\n return;\n }\n\n const isLastAttempt = attempt >= this.attempts;\n\n if (isLastAttempt || this.shouldRetry(result.error, attempt) === false) {\n // The error from the LAST attempt, not the first. It is the most recent state\n // of the world, and a caller comparing two failures wants the newer one.\n done(result);\n return;\n }\n\n const delay = this.delayMs(attempt + 1);\n\n if (delay <= 0) {\n this.attempt(event, done, attempt + 1);\n return;\n }\n\n setTimeout(() => this.attempt(event, done, attempt + 1), delay);\n });\n }\n\n bulkPersist(\n event: DbPluginBulkPersistEvent,\n done: PluginEventCallbackPartialResult<BulkPersistResult>\n ): void {\n // Straight through. See the note on this class: a partly-applied save cannot be\n // repeated safely, and a duplicated add is worse than a surfaced error.\n this.plugin.bulkPersist(event, done);\n }\n\n destroy(event: DbPluginEvent, done: PluginEventCallbackResult<never>): void {\n // Not retried either. Destroy is usually irreversible, and a second attempt against a\n // database the first one already removed reports a failure for work that succeeded.\n this.plugin.destroy(event, done);\n }\n}\n","import { BulkPersistResult } from \"../collections\";\nimport { SchemaId } from \"../schema\";\nimport { PluginEventCallbackPartialResult, PluginEventCallbackResult, PluginEventResult } from \"../results\";\nimport { ITranslatedValue } from \"./translators\";\nimport { QueryOption, QueryOptionName } from \"./query\";\nimport { DbPluginBulkPersistEvent, DbPluginEvent, DbPluginQueryEvent, IDbPlugin } from \"./types\";\n\n/**\n * A read-through LRU in front of a slower plugin.\n *\n * ## What it can and cannot promise\n *\n * Invalidation is the whole problem with a cache, and this one solves exactly one version of\n * it: **writes that go through this wrapper**. A save invalidates every cached read for the\n * schemas it touched, so a store that reads and writes through the same instance never sees\n * its own stale data.\n *\n * It cannot see anything else. A write by another process, another tab, or another store over\n * the same database leaves this cache holding rows that no longer exist, until they age out.\n * That is not a defect to fix later — a cache in front of a plugin has no way to learn about a\n * change it did not make — it is the condition for using this at all. Put it in front of data\n * that is slow to fetch and tolerant of being briefly wrong, and nowhere else.\n *\n * Invalidation is per SCHEMA rather than per row, deliberately. Deciding whether a changed row\n * would have matched a cached filter means evaluating every cached query against it, which is\n * the work the cache exists to avoid, and getting it wrong keeps a stale row visible. Dropping\n * a schema's entries is cheap and cannot be subtly wrong.\n *\n * ```ts\n * const store = new MyStore(new CacheDbPlugin(new SomeDbPlugin(...), { max: 100 }));\n * ```\n */\n\nexport type CacheDbPluginOptions = {\n /** How many query results to keep. Default 100; the least recently used is evicted. */\n max?: number;\n};\n\ntype CacheEntry = {\n readonly value: unknown;\n readonly isTransformed: boolean;\n /** The concrete translated-value class, so a hit rebuilds the same shape. */\n readonly construct: new (value: unknown, isTransformed: boolean) => ITranslatedValue<unknown>;\n};\n\n/**\n * A stable string for one query.\n *\n * Built from the option VALUES rather than by serialising the expression tree, which holds\n * `PropertyInfo` objects carrying functions and would not survive `JSON.stringify`. A filter is\n * identified by its source text plus its params, which is what the expression is derived from\n * anyway — two queries with the same source and params are the same query.\n */\nconst describeOption = (option: QueryOption<unknown, QueryOptionName>): string => {\n const value = option.value as Record<string, unknown>;\n\n switch (option.name) {\n case \"filter\":\n return `${String(value.filter)}|${JSON.stringify(value.params ?? null)}`;\n case \"sort\":\n return `${String(value.propertyName)}|${String(value.direction)}`;\n case \"nearest\":\n return `${String(value.propertyName)}|${(value.vector as number[]).join(\",\")}|${String(value.count)}`;\n case \"map\":\n case \"group\":\n return String(value.selector);\n default:\n // skip, take and the aggregates are plain values.\n return JSON.stringify(option.value ?? null);\n }\n};\n\nexport class CacheDbPlugin implements IDbPlugin {\n\n private readonly plugin: IDbPlugin;\n private readonly max: number;\n /**\n * Insertion-ordered, which is what makes this an LRU without a second structure: a hit\n * deletes and re-sets the key to move it to the end, so the oldest is always first.\n */\n private readonly entries = new Map<string, CacheEntry>();\n\n constructor(plugin: IDbPlugin, options: CacheDbPluginOptions = {}) {\n this.plugin = plugin;\n this.max = Math.max(1, options.max ?? 100);\n }\n\n get databaseName(): string {\n return this.plugin.databaseName;\n }\n\n /** `schemaId` first, so invalidating a schema is a prefix match. */\n private keyFor<TRoot extends {}, TShape>(event: DbPluginQueryEvent<TRoot, TShape>): string {\n const parts: string[] = [];\n\n event.operation.options.forEach(option => {\n parts.push(`${option.name}:${describeOption(option as QueryOption<unknown, QueryOptionName>)}`);\n });\n\n return `${String(event.operation.schema.id)}\\u0000${parts.join(\"\\u0001\")}`;\n }\n\n /**\n * A fresh translated value over a copy of the cached data.\n *\n * Never the cached object itself, and never its array. `TranslatedArrayValue.forEach`\n * REASSIGNS its own slots — that is how the change tracker swaps in attached entities —\n * so handing out the cached instance would let the first caller replace the cache's\n * contents with its own tracked proxies. The second caller would then receive entities\n * attached to somebody else's store.\n *\n * It protects a second thing that is easy to miss, so do not replace it with a shallow copy\n * or hand out the entry directly. `ConcurrencyDbPlugin` strips `__version` from result rows\n * IN PLACE after observing them. Stacked as `ConcurrencyDbPlugin(CacheDbPlugin(...))` the\n * strip therefore lands on this copy, and the cached row keeps its token — without that,\n * every hit after the first would carry no version, the observer would record nothing, and\n * the next update would be written UNCHECKED with no error anywhere.\n * Pinned by `datastore/src/collections/wrapperStacking.test.ts`.\n */\n private rebuild(entry: CacheEntry): ITranslatedValue<unknown> {\n return new entry.construct(structuredClone(entry.value), entry.isTransformed);\n }\n\n query<TRoot extends {}, TShape extends any = TRoot>(\n event: DbPluginQueryEvent<TRoot, TShape>,\n done: PluginEventCallbackResult<ITranslatedValue<TShape>>\n ): void {\n const key = this.keyFor(event);\n const cached = this.entries.get(key);\n\n if (cached != null) {\n // Re-set to move it to the end of the insertion order: most recently used.\n this.entries.delete(key);\n this.entries.set(key, cached);\n\n // Said rather than left blank. A hit means no database was touched, which is a fact\n // worth reporting — and an empty report would otherwise read as a plugin that failed\n // to say what it ran.\n event.executedQueries.push({ text: \"cache hit — no query was executed\" });\n\n done(PluginEventResult.success(event.id, this.rebuild(cached) as ITranslatedValue<TShape>));\n return;\n }\n\n this.plugin.query<TRoot, TShape>(event, result => {\n\n if (result.ok === PluginEventResult.ERROR) {\n done(result);\n return;\n }\n\n this.store(key, result.data);\n\n // The caller gets a rebuilt value too, not the one just stored, so that mutating\n // the result of a MISS cannot corrupt what the next hit returns.\n const stored = this.entries.get(key);\n\n done(PluginEventResult.success(\n event.id,\n (stored == null ? result.data : this.rebuild(stored)) as ITranslatedValue<TShape>\n ));\n });\n }\n\n private store(key: string, value: ITranslatedValue<unknown>): void {\n let snapshot: unknown;\n\n try {\n snapshot = structuredClone(value.value);\n } catch {\n // Not every result is structured-cloneable — a projection can carry anything a\n // caller's `.map()` returned, including a function. Declining to cache is the\n // only safe answer; caching a reference would share mutable state.\n return;\n }\n\n this.entries.set(key, {\n value: snapshot,\n isTransformed: value.isTransformed,\n construct: value.constructor as CacheEntry[\"construct\"],\n });\n\n if (this.entries.size > this.max) {\n // First key is the least recently used, because every hit re-inserts.\n const oldest = this.entries.keys().next();\n\n if (oldest.done === false) {\n this.entries.delete(oldest.value);\n }\n }\n }\n\n /** Drops every cached read for these schemas. */\n private invalidate(schemaIds: Iterable<SchemaId>): void {\n for (const schemaId of schemaIds) {\n const prefix = `${String(schemaId)}\\u0000`;\n\n for (const key of [...this.entries.keys()]) {\n if (key.startsWith(prefix)) {\n this.entries.delete(key);\n }\n }\n }\n }\n\n bulkPersist(\n event: DbPluginBulkPersistEvent,\n done: PluginEventCallbackPartialResult<BulkPersistResult>\n ): void {\n const touched = [...event.operation.keys()];\n\n // Invalidated BEFORE the write is attempted, not after it succeeds. A failed save can\n // still have applied part of itself on a backend without atomic batches, and a cache\n // that kept its entries because the call reported an error would then serve rows that\n // are wrong. Throwing away a still-valid cache costs one refetch; keeping an invalid\n // one is silent.\n this.invalidate(touched);\n\n this.plugin.bulkPersist(event, result => {\n this.invalidate(touched);\n done(result);\n });\n }\n\n destroy(event: DbPluginEvent, done: PluginEventCallbackResult<never>): void {\n this.entries.clear();\n this.plugin.destroy(event, done);\n }\n}\n","import { BulkPersistChanges, BulkPersistResult, SchemaCollection, SchemaPersistResult } from \"../collections\";\nimport { PluginDestroyedError } from \"../errors\";\nimport { PluginEventCallbackPartialResult, PluginEventCallbackResult, PluginEventPartialResultType, PluginEventPartialType, PluginEventResult, PluginEventSuccessType } from \"../results\";\nimport { SchemaId } from \"../schema\";\nimport { ITranslatedValue } from \"./translators\";\nimport { DbPluginBulkPersistEvent, DbPluginEvent, DbPluginQueryEvent, IDbPlugin } from \"./types\";\nimport { uuid } from \"../utilities\";\n\nexport type BatchingDbPluginOptions = {\n /**\n * The caller PROMISING that a failed `bulkPersist` beneath this wrapper leaves NOTHING\n * applied. Only then may separate callers' saves be merged into one write, because the\n * failure path re-runs a failed batch item by item — and re-running a HALF-APPLIED batch\n * applies the landed items twice, which for adds means duplicate rows under fresh\n * identities, with nothing raised.\n *\n * Omitted, the wrapper still queues and serializes; it just writes batches of one, which\n * is what happens without it in the stack at all. True of SQLite, PostgreSQL and MySQL —\n * one transaction, rolled back entire. Not true of anything that applies writes as it\n * goes without a way to undo them.\n */\n isAtomic?: boolean;\n /**\n * The most writes one drain may take. Default 100.\n *\n * A drain takes everything waiting, so a burst puts an unbounded statement set in one\n * transaction — and some engines cap that outright, D1's `batch()` in particular. Taking N\n * per pass changes none of the reasoning: the remainder is still waiting, the next drain\n * runs the moment this one returns, and a batch is still only what had already arrived.\n *\n * It also bounds the failure fallback, which costs N+1 writes for a failing batch of N.\n */\n maxBatchSize?: number;\n};\n\nconst DEFAULT_MAX_BATCH_SIZE = 100;\n\n/** A caller's write, waiting its turn. */\ntype QueuedWrite = {\n readonly event: DbPluginBulkPersistEvent;\n readonly done: PluginEventCallbackPartialResult<BulkPersistResult>;\n};\n\n/**\n * A batch of writes that may go out as ONE, with the merged event already built.\n * `items` is kept so a failure can re-run them individually and so results can be split back.\n */\ntype PreparedGroup = {\n readonly items: QueuedWrite[];\n readonly event: DbPluginBulkPersistEvent;\n};\n\n/**\n * Coalesces overlapping writes into single round trips.\n *\n * ## Why\n *\n * One logical change produces more than one write: the caller's `saveChanges`, then every view\n * reconciling in response to it. A store with three views issues four writes, none coordinated\n * with the others. On a local file that is invisible; against a server the round trip dominates\n * everything else a save does.\n *\n * ## The shape, and why it cannot cost anything\n *\n * A write arrives and joins the queue. If one is already in flight, the running drain will take\n * it. Otherwise drain immediately: take everything waiting up to `maxBatchSize` and write it,\n * then drain again for whatever arrived meanwhile and whatever the ceiling left behind.\n *\n * Nothing polls, nothing sleeps, nothing waits for a batch to fill. **A batch is only what had\n * already arrived**, so when writes do not overlap the queue is empty, the batch is one item,\n * and the write is byte for byte what happens without this wrapper. Latency cannot increase;\n * throughput improves exactly when there is contention to improve.\n *\n * ## What may be merged\n *\n * Only items whose schemas do not overlap, and only with `isAtomic`. Two writes to one\n * collection are genuinely ordered — a plugin applies removes, then updates, then adds WITHIN a\n * schema, so merging an add of a row with a later update of it would run the update first,\n * against a row that does not exist yet, and lose it silently. Items sharing a schema therefore\n * go in separate writes, in arrival order.\n *\n * That same rule is what lets a merged result be split back by SCHEMA rather than by position:\n * each schema in a merged write came from exactly one item, so no assumption about the order a\n * plugin echoes rows in is needed anywhere.\n *\n * @see specs/write-batching.md\n */\nexport class BatchingDbPlugin implements IDbPlugin {\n\n private readonly plugin: IDbPlugin;\n private readonly canMerge: boolean;\n private readonly maxBatchSize: number;\n\n private readonly queue: QueuedWrite[] = [];\n private isWriting = false;\n private isDestroyed = false;\n /** Set when `destroy` arrives mid-write; run once the in-flight batch settles. */\n private onSettled: (() => void) | null = null;\n\n constructor(plugin: IDbPlugin, options: BatchingDbPluginOptions = {}) {\n this.plugin = plugin;\n this.canMerge = options.isAtomic === true;\n // Floored at 1: a ceiling of zero would take nothing and drain forever.\n this.maxBatchSize = Math.max(1, options.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE);\n }\n\n get databaseName(): string {\n return this.plugin.databaseName;\n }\n\n /** Reads are not batched: they have no lock to contend for and no ordering to preserve. */\n query<TRoot extends {}, TShape extends any = TRoot>(\n event: DbPluginQueryEvent<TRoot, TShape>,\n done: PluginEventCallbackResult<ITranslatedValue<TShape>>\n ): void {\n this.plugin.query(event, done);\n }\n\n bulkPersist(\n event: DbPluginBulkPersistEvent,\n done: PluginEventCallbackPartialResult<BulkPersistResult>\n ): void {\n\n if (this.isDestroyed) {\n // Fails rather than passing through. The queue's contract is that an accepted write\n // is eventually answered by a live drain loop, and there is no loop left; passing it\n // down is worse still, since a plugin that creates missing tables would recreate the\n // database the destroy just deleted and report success against an empty one.\n done(PluginEventResult.error(event.id, new PluginDestroyedError(\"write submitted after destroy\")));\n return;\n }\n\n this.queue.push({ event, done });\n\n // In flight: the continuation below takes this one. Doing anything else here is what\n // turns a queue into a race.\n if (this.isWriting) {\n return;\n }\n\n this.drain();\n }\n\n /**\n * Destroys the inner plugin, answering everything this wrapper is holding first.\n *\n * `destroy` is destructive rather than graceful — the SQLite plugin deletes the database —\n * so draining first would spend round trips producing state the next call destroys, and\n * the drain loop refills, making teardown unbounded. Queued items are therefore failed\n * rather than flushed.\n *\n * An in-flight write is a different matter: it has already been sent, destroying cannot\n * un-send it, and its callers are owed the real result. So the inner `destroy` waits for it\n * to settle — dropping a `deleteDatabase` on top of an open transaction is its own failure.\n */\n destroy(event: DbPluginEvent, done: PluginEventCallbackResult<never>): void {\n this.isDestroyed = true;\n\n for (const item of this.queue.splice(0)) {\n this.answer(item, PluginEventResult.error(\n item.event.id,\n new PluginDestroyedError(\"destroyed before the write was attempted\")\n ));\n }\n\n const forward = () => this.plugin.destroy(event, done);\n\n if (this.isWriting) {\n this.onSettled = forward;\n return;\n }\n\n forward();\n }\n\n /**\n * Takes everything waiting and writes it, then schedules itself again for whatever arrived\n * while that ran.\n */\n private drain(): void {\n // Not everything — up to the ceiling. Whatever is left stays queued for the next pass,\n // which starts as soon as this one returns.\n const batch = this.queue.splice(0, this.maxBatchSize);\n\n if (batch.length === 0) {\n this.isWriting = false;\n\n const settled = this.onSettled;\n\n if (settled != null) {\n this.onSettled = null;\n settled();\n }\n\n return;\n }\n\n this.isWriting = true;\n\n // The latch's only way down. Every path below MUST reach it: an exception that escaped\n // would leave `isWriting` stuck true and every future write queued forever — a total,\n // silent write outage that nothing else would report.\n const next = () => this.drain();\n\n let groups: PreparedGroup[];\n\n try {\n groups = this.prepare(batch);\n } catch (error) {\n // A throw here is a bug in this wrapper rather than a backend failure, and — because\n // preparing is pure and happens BEFORE any write is issued — nothing has been\n // applied. Degrading to one write per item is exactly what not batching does.\n //\n // This is also why the guard stops here and does not cover `writeGroups`. If group 1\n // had already landed, re-running the batch item by item would apply it twice, which\n // is the hazard `isAtomic` exists to rule out.\n this.writeIndividually(batch, next);\n return;\n }\n\n this.writeGroups(groups, 0, next);\n }\n\n /**\n * Partitions the batch, APPEND-ONLY: an item joins the last group if none of its schemas is\n * claimed there, and otherwise closes that group and starts a new one.\n *\n * Not first-fit. Scanning every open group for one an item fits merges more, and reorders\n * doing it: with arrivals A(schema S), B(schema S), C(schema T), first-fit would put C in\n * A's group and write it before the earlier-arrived B. Nothing is lost inside a table, but a\n * caller who saved B before C could observe C land first. The last-group rule keeps arrival\n * order unconditionally — everything in group N arrived before everything in group N+1 — and\n * on the case that matters, several views over distinct schemas, both rules produce the same\n * single group.\n */\n private prepare(batch: QueuedWrite[]): PreparedGroup[] {\n const groups: QueuedWrite[][] = [];\n let claimed = new Set<SchemaId>();\n\n for (const item of batch) {\n const schemas = [...item.event.operation.keys()];\n const overlaps = schemas.some(schemaId => claimed.has(schemaId));\n\n if (groups.length === 0 || overlaps || this.canMerge === false) {\n groups.push([item]);\n claimed = new Set(schemas);\n continue;\n }\n\n groups[groups.length - 1].push(item);\n\n for (const schemaId of schemas) {\n claimed.add(schemaId);\n }\n }\n\n return groups.map(items => ({ items, event: this.mergeEvents(items) }));\n }\n\n /**\n * One event standing for several. Synthetic THROUGHOUT: its own id, its operation the union\n * of the items' operations, and its schemas the union of theirs — a plugin resolving\n * `event.schemas.get(schemaId)` must find every schema any item brought.\n *\n * A single-item group passes its own event through untouched. That is most writes, so the\n * uncontended path never reaches the merging machinery at all.\n */\n private mergeEvents(items: QueuedWrite[]): DbPluginBulkPersistEvent {\n\n if (items.length === 1) {\n return items[0].event;\n }\n\n const operation = new BulkPersistChanges();\n const schemas = new SchemaCollection();\n\n for (const item of items) {\n for (const [schemaId, changes] of item.event.operation) {\n operation.set(schemaId, changes);\n }\n\n for (const [schemaId, schema] of item.event.schemas) {\n schemas.set(schemaId, schema);\n }\n }\n\n return {\n ...items[0].event,\n // Its own id: no caller has ever seen this one, and nothing upstream may be handed it.\n id: uuid(16),\n source: \"BatchingDbPlugin\",\n reason: `merged ${items.length} writes`,\n operation,\n schemas,\n };\n }\n\n /** Groups go out in order, because two writes to one collection are genuinely ordered. */\n private writeGroups(groups: PreparedGroup[], index: number, next: () => void): void {\n\n if (index >= groups.length) {\n next();\n return;\n }\n\n const group = groups[index];\n const advance = () => this.writeGroups(groups, index + 1, next);\n\n const attempt = (result: PluginEventPartialResultType<BulkPersistResult>) => {\n\n if (result.ok === PluginEventResult.ERROR) {\n\n if (group.items.length === 1) {\n this.answer(group.items[0], result);\n advance();\n return;\n }\n\n // Coupled failure, unpicked: one caller's bad data must not fail its\n // batchmates, so the batch is re-run item by item. Costs N+1 writes for a\n // failing batch of N, paid only when something is already going wrong. Safe\n // only because `isAtomic` promised the failed batch left nothing applied.\n this.writeIndividually(group.items, advance);\n return;\n }\n\n this.split(group, result);\n advance();\n };\n\n try {\n this.plugin.bulkPersist(group.event, attempt);\n } catch (error) {\n attempt(PluginEventResult.error(group.event.id, error));\n }\n }\n\n /**\n * Hands each item its own slice of a merged result, keyed by SCHEMA.\n *\n * Disjoint schemas are what make this possible: each schema in the write came from exactly\n * one item, so there is no counting, no slicing by position, and no reliance on the order a\n * plugin echoes rows in — an assumption that is load-bearing elsewhere and would be SILENT\n * here, handing one caller another's database-assigned identities.\n */\n private split(\n group: PreparedGroup,\n result: PluginEventSuccessType<BulkPersistResult> | PluginEventPartialType<BulkPersistResult>\n ): void {\n\n if (group.items.length === 1) {\n this.answer(group.items[0], result);\n return;\n }\n\n const merged = result.data;\n // A PARTIAL from an inner plugin that promised atomicity should not happen. If it does,\n // every caller is told — splitting the data but reporting the error to all of them,\n // rather than retrying. Retrying is what would be unsafe here: partial means something\n // already landed, and re-running it applies that twice.\n const isPartial = result.ok === PluginEventResult.PARTIAL;\n\n for (const item of group.items) {\n const mine = new BulkPersistResult();\n\n for (const schemaId of item.event.operation.keys()) {\n // A schema the plugin had nothing to echo for gets an empty result, never a hole.\n mine.set(schemaId, merged?.get(schemaId) ?? new SchemaPersistResult());\n }\n\n // Answered under ITS OWN event id — the merged write ran under a synthetic one.\n this.answer(item, isPartial\n ? PluginEventResult.partial(item.event.id, mine, (result as PluginEventPartialType<BulkPersistResult>).error)\n : PluginEventResult.success(item.event.id, mine));\n }\n }\n\n /** One write per item, in arrival order — what happens with no batching at all. */\n private writeIndividually(items: QueuedWrite[], next: () => void): void {\n\n const run = (index: number): void => {\n\n if (index >= items.length) {\n next();\n return;\n }\n\n const item = items[index];\n const advance = () => run(index + 1);\n\n try {\n this.plugin.bulkPersist(item.event, result => {\n this.answer(item, result);\n advance();\n });\n } catch (error) {\n this.answer(item, PluginEventResult.error(item.event.id, error));\n advance();\n }\n };\n\n run(0);\n }\n\n /**\n * A caller's callback, guarded. One caller's `done` throwing must not eat its batchmates'\n * results, and must not strand the latch — which it would, since the continuation runs\n * after the answers.\n */\n private answer(item: QueuedWrite, result: PluginEventPartialResultType<BulkPersistResult>): void {\n try {\n item.done(result);\n } catch (error) {\n // Nobody left to tell: the caller we would report to is the one that threw.\n }\n }\n}\n","export * from './types';\nexport * from './translators';\nexport * from './query';\nexport * from './wire';\nexport * from './ConcurrencyDbPlugin';\nexport * from './EphemeralDataPlugin';\nexport * from './RetryDbPlugin';\nexport * from './CacheDbPlugin';\nexport * from './BatchingDbPlugin';\n","import { isPropertyExpression } from \"../../assertions\";\nimport { forEach } from \"../../expressions/utils\";\nimport { MemoryExecutionReason, QueryOption, QueryOptionName, QueryOptionExecutionTarget, QueryOptionValueMap } from \"./types\";\n\nexport type QueryCollectionItem<T, K extends QueryOptionName> = { index: number, option: QueryOption<T, K> };\n\nexport class QueryOptionsCollection<T> {\n\n private options: Map<QueryOptionName, QueryCollectionItem<any, any>[]> = new Map<QueryOptionName, QueryCollectionItem<any, any>[]>();\n private nextExecutionTarget: QueryOptionExecutionTarget = \"database\";\n private nextExecutionReason: MemoryExecutionReason | null = null;\n private nextIndex: number = 0;\n private enumeratedItems: QueryCollectionItem<any, any>[] = [];\n\n /** Cuts over to memory execution, keeping the first cause. See `MemoryExecutionReason`. */\n private cutOverToMemory(reason: MemoryExecutionReason) {\n this.nextExecutionTarget = \"memory\";\n\n if (this.nextExecutionReason == null) {\n this.nextExecutionReason = reason;\n }\n }\n\n /**\n * True when `split()` or `splitAt()` produced this collection.\n *\n * Those rebuild each half by re-adding its options, which re-derives execution targets\n * without the options that caused them — a post-join filter alone in the memory half\n * derives back to `\"database\"`. Anything reading `target` as a report of where work runs\n * has to reject a derived collection; see `explainQuery`.\n */\n private derived: boolean = false;\n\n get isDerived() {\n return this.derived;\n }\n\n get items() {\n return this.options;\n }\n\n get isEmpty() {\n return this.items.size === 0;\n }\n\n static EMPTY<R>() {\n return new QueryOptionsCollection<R>();\n }\n\n static isEmpty<T>(options: QueryOptionsCollection<T>) {\n return options.isEmpty;\n }\n\n add<K extends QueryOptionName>(name: K, value: QueryOption<T, K>[\"value\"]) {\n\n if (name === \"map\") {\n const mapValue = value as QueryOptionValueMap<T>[\"map\"];\n\n // Evaluate the map value to see if we are renaming properties, \n // if we are we need to perform everything after in memory\n if (mapValue.fields.some(x => x.isRename === true) || mapValue.fields.some(x => x.property?.isUnmapped === true)) {\n // Cut over to memory execution since we are renaming a property with .map\n // We do not want to figure out how the new name flows through the entire query\n this.cutOverToMemory(\"map-rename\");\n }\n }\n\n if (name === \"filter\") {\n // Need to check for unmapped and renamed properties\n const filterValue = value as QueryOptionValueMap<T>[\"filter\"];\n\n // A tautology (`x => true`) filters nothing — skip it entirely so\n // plugins never see it\n if (filterValue.expression.type === \"empty\") {\n return;\n }\n\n if (filterValue.expression.type === \"not-parsable\") {\n this.cutOverToMemory(\"not-parsable\");\n } else {\n forEach(filterValue.expression, (expression) => {\n\n if (isPropertyExpression(expression) && expression.property.isUnmapped) {\n // Cut over to memory execution, unmapped properties are not in the database and\n // cannot be queried\n this.cutOverToMemory(\"unmapped-property\");\n return false;\n }\n\n if (isPropertyExpression(expression) && expression.property.hasRenamedSegments) {\n // Cut over to memory execution: the plugin stores data under the\n // `from` (storage) names, but filter selectors reference the\n // in-memory names. Memory execution runs after deserialization,\n // where the in-memory names exist\n this.cutOverToMemory(\"renamed-property\");\n return false;\n }\n\n return true;\n });\n }\n }\n\n if (name === \"sort\") {\n const sortValue = value as QueryOptionValueMap<T>[\"sort\"];\n\n // Same rule as filters: sort selectors reference in-memory names, which\n // only exist after deserialization when the property is renamed or unmapped\n if (sortValue.property != null && sortValue.property.isUnmapped) {\n this.cutOverToMemory(\"unmapped-property\");\n } else if (sortValue.property != null && sortValue.property.hasRenamedSegments) {\n this.cutOverToMemory(\"renamed-property\");\n }\n }\n\n if (name === \"nearest\") {\n const nearestValue = value as QueryOptionValueMap<T>[\"nearest\"];\n\n // Same rule as sort, and for the same reason: the plugin stores the vector under\n // the `from` name, and an unmapped property is not stored at all. Both are only\n // readable after deserialization, which is where memory execution runs.\n //\n // This is also what lets every translator's in-memory fallback read the column by\n // its resolved name — anything whose storage name differs never reaches them.\n if (nearestValue.property != null && nearestValue.property.isUnmapped) {\n this.cutOverToMemory(\"unmapped-property\");\n } else if (nearestValue.property != null && nearestValue.property.hasRenamedSegments) {\n this.cutOverToMemory(\"renamed-property\");\n }\n }\n\n if (name === \"join\") {\n const joinValue = value as QueryOptionValueMap<T>[\"join\"];\n\n // A join whose two sides live on different plugins cannot be sent to EITHER of\n // them — neither can read the other's rows — so the option itself belongs to the\n // memory half, where the datastore interprets it.\n //\n // Set BEFORE the item is created, unlike `nearest`'s ratchet below, because this\n // moves the join option itself rather than everything after it.\n if (joinValue.crossPlugin === true) {\n this.cutOverToMemory(\"cross-plugin-join\");\n }\n }\n\n const item: QueryCollectionItem<T, K> = {\n index: this.nextIndex,\n option: {\n name,\n target: this.nextExecutionTarget,\n value,\n ...(this.nextExecutionReason == null ? {} : { reason: this.nextExecutionReason })\n }\n }\n\n this.nextIndex++;\n\n const found = this.options.get(name);\n\n this.options.set(name, [...found ?? [], item]);\n\n if (name === \"nearest\") {\n // Everything AFTER a similarity search runs in memory, whatever the backend.\n //\n // Whether the search was pushed down is a fact about the plugin, which this\n // collection cannot see — so a later option is only safe if it runs after the\n // scoring definitely happened, and in memory is the only place that is true of.\n //\n // The failure this prevents is silent. `.nearest(x => x.embedding, v, 10).take(3)`\n // sends `LIMIT 3` to a backend that ignored the ordering, so three arbitrary rows\n // come back and get scored — three real rows, in a plausible order, and not the\n // three nearest. Nothing errors.\n //\n // A plugin that DID push the search down loses nothing but the chance to also\n // push down what follows it, which is a limit over ten rows.\n this.cutOverToMemory(\"after-nearest\");\n }\n\n if (name === \"join\") {\n // Everything AFTER a join runs in memory, for the same reason as `nearest`: this\n // collection cannot see HOW the plugin executed the join, and the rows it produced\n // are TUPLES rather than entities of the root schema.\n //\n // A `take` sent to a backend that hash-joined in its translator would limit the\n // OUTER rows read, not the pairs produced — a plausible-looking result with the\n // wrong number of rows in it. Conjuncts that can safely run earlier are split off\n // by the query builder BEFORE dispatch, which is the only exception.\n this.cutOverToMemory(\"after-join\");\n }\n }\n\n /**\n * Splits the collection around the FIRST occurrence of `name`, preserving order.\n *\n * For a join: the options recorded before it operate on entity rows, the option itself\n * produces tuples, and the ones after it operate on tuples. Three different shapes, so the\n * caller has to run them in three steps rather than one pass.\n */\n splitAt<K extends QueryOptionName>(name: K): { before: QueryOptionsCollection<T>, at: QueryOption<T, K> | null, after: QueryOptionsCollection<T> } {\n this.resolveEnumeration();\n\n const sortedItems = this.enumeratedItems.toSorted((a, b) => a.index - b.index);\n const before = new QueryOptionsCollection<T>();\n const after = new QueryOptionsCollection<T>();\n\n before.derived = true;\n after.derived = true;\n let at: QueryOption<T, K> | null = null;\n\n for (let i = 0, length = sortedItems.length; i < length; i++) {\n const { option } = sortedItems[i];\n\n if (at == null && option.name === name) {\n at = option as QueryOption<T, K>;\n continue;\n }\n\n const destination = at == null ? before : after;\n destination.add(option.name, option.value);\n }\n\n return { before, at, after };\n }\n\n /**\n * Captures the collection's current state and returns a function that restores it.\n *\n * Terminal queryable operations (count, first, aggregates, …) record their option on\n * the shared collection before executing. Without restoring, a re-executed terminal —\n * the whole point of a subscribed queryable — stacks its option a second time and\n * runs it over the first execution's scalar result.\n */\n snapshot(): () => void {\n const options = new Map([...this.options.entries()].map(([key, items]): [QueryOptionName, QueryCollectionItem<any, any>[]] => [key, [...items]]));\n const nextExecutionTarget = this.nextExecutionTarget;\n const nextExecutionReason = this.nextExecutionReason;\n const nextIndex = this.nextIndex;\n\n return () => {\n this.options = new Map(options);\n this.nextExecutionTarget = nextExecutionTarget;\n this.nextExecutionReason = nextExecutionReason;\n this.nextIndex = nextIndex;\n this.enumeratedItems = [];\n };\n }\n\n split(): { memory: QueryOptionsCollection<T>, database: QueryOptionsCollection<T> } {\n this.resolveEnumeration();\n\n const sortedItems = this.enumeratedItems.toSorted((a, b) => a.index - b.index);\n const memoryQueryOptionsCollection = new QueryOptionsCollection<T>();\n const databaseQueryOptionsCollection = new QueryOptionsCollection<T>();\n\n memoryQueryOptionsCollection.derived = true;\n databaseQueryOptionsCollection.derived = true;\n\n for (let i = 0, length = sortedItems.length; i < length; i++) {\n const sortedItem = sortedItems[i];\n\n if (sortedItem.option.target === \"database\") {\n databaseQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n continue;\n }\n\n memoryQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n }\n\n return {\n memory: memoryQueryOptionsCollection,\n database: databaseQueryOptionsCollection\n }\n }\n\n hasTransformations(): boolean {\n const transformationOptions: QueryOptionName[] = [\"map\", \"group\", \"min\", \"max\", \"count\", \"sum\"];\n return transformationOptions.some((name) => this.options.has(name));\n }\n\n has<K extends QueryOptionName>(name: K): boolean {\n return this.options.has(name);\n }\n\n get<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[] {\n return this.options.get(name) ?? [] as QueryCollectionItem<T, K>[];\n }\n\n getLast<K extends QueryOptionName>(name: K): QueryOption<T, K> | null {\n this.resolveEnumeration();\n\n for (let i = this.enumeratedItems.length - 1; i >= 0; i--) {\n const item = this.enumeratedItems[i];\n\n if (item.option.name === name) {\n return item.option;\n }\n }\n\n return null\n }\n\n getValues<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[\"option\"][\"value\"][] | undefined {\n\n const found = this.options.get(name);\n\n if (found == null) {\n return [];\n }\n\n return found.map(w => w.option.value) as QueryCollectionItem<T, K>[\"option\"][\"value\"][];\n }\n\n private getEnumeration() {\n return [...this.options.values()].flat().toSorted((a, b) => a.index - b.index);\n }\n\n private resolveEnumeration() {\n if (this.enumeratedItems.length != this.nextIndex) {\n this.enumeratedItems = this.getEnumeration();\n }\n }\n\n forEach(iterator: (item: QueryCollectionItem<T, any>[\"option\"]) => void) {\n this.resolveEnumeration();\n\n for (let i = 0, length = this.enumeratedItems.length; i < length; i++) {\n iterator(this.enumeratedItems[i].option);\n }\n }\n}","import { PartialResultType, PluginEventPartialResultType, PluginEventResultType, ResultType } from \"./types\";\n\nabstract class BaseResult {\n static ERROR = \"error\" as const;\n static SUCCESS = \"success\" as const;\n static PARTIAL = \"partial\" as const;\n\n static resolve<T>(result: ResultType<T> | PartialResultType<T>, resolve: (data: T) => void, reject: (error?: any) => void) {\n if (result.ok === BaseResult.SUCCESS) {\n resolve(result.data);\n return;\n }\n\n if (result.ok === BaseResult.PARTIAL) {\n reject({\n partial: result.data,\n error: result.error\n });\n return;\n }\n\n reject(result.error);\n }\n\n static assertSuccess<T>(result: any): asserts result is { ok: \"success\"; data: T } {\n if (result.ok !== BaseResult.SUCCESS) {\n throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);\n }\n }\n}\n\nexport class Result extends BaseResult {\n static success<T>(data: T): ResultType<T>;\n static success(): ResultType<never>;\n static success<T>(data?: T): ResultType<T> {\n return {\n ok: Result.SUCCESS,\n data\n }\n }\n\n static error<T>(error: any): ResultType<T> {\n return {\n ok: Result.ERROR,\n error\n }\n }\n\n static partial<T>(data: T, error: any): PartialResultType<T> {\n return {\n ok: Result.PARTIAL,\n data,\n error\n }\n }\n}\n\nexport class PluginEventResult extends BaseResult {\n static success<T>(id: string, data: T): PluginEventResultType<T>;\n static success(id: string): PluginEventResultType<never>;\n static success<T>(id: string, data?: T): PluginEventResultType<T> {\n return {\n id,\n ok: Result.SUCCESS,\n data\n }\n }\n\n static error<T>(id: string, error: any): PluginEventResultType<T> {\n return {\n id,\n ok: Result.ERROR,\n error\n }\n }\n\n static partial<T>(id: string, data: T, error: any): PluginEventPartialResultType<T> {\n return {\n id,\n ok: Result.PARTIAL,\n data,\n error\n }\n }\n\n static assertSuccess<T>(result: PluginEventResultType<T>): asserts result is { ok: \"success\"; data: T; id: string } {\n if (result.ok !== Result.SUCCESS) {\n throw new Error(`Expected success result, but got ${result.ok}: ${result.error}`);\n }\n }\n}\n","import { Result } from \"./Result\";\nimport { CallbackResult } from \"./types\";\n\nexport function toPromise<T>(fn: (callback: CallbackResult<T>) => void) {\n return new Promise<T>((resolve, reject) => {\n fn((r) => {\n if (r.ok === Result.ERROR) {\n reject(r.error);\n return;\n }\n\n resolve(r.data);\n });\n });\n}\n","export * from './Result';\nexport * from './types';\nexport * from './utils';","import { DefaultValue, ForeignKey, FunctionBody, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes, PropertyTransform } from \"../../types\";\n\nexport abstract class SchemaBase<T extends any, TModifiers extends SchemaModifiers> {\n\n abstract instance: T;\n modifiers: TModifiers;\n\n isNullable: boolean = false;\n isUnmapped: boolean = false;\n isOptional: boolean = false;\n isKey: boolean = false;\n isIdentity: boolean = false;\n isReadonly: boolean = false;\n isDistinct: boolean = false;\n /**\n * Set by `.modify(x => x.transform(...))`. A live reference, never stringified.\n * `null` when the property is stored as it is.\n */\n transform: PropertyTransform<unknown> | null = null;\n indexes: string[] = [];\n fromPropertyName: string | null = null;\n /**\n * How many numbers a vector holds. `null` for every other type.\n *\n * Declared here rather than on `SchemaVector` because a modifier WRAPS rather than\n * extends: `s.vector(1536).optional()` is a `SchemaOptional`, and anything reachable only\n * through the original class is lost the moment a modifier is added. `type` survives for\n * exactly this reason — the copy constructor below carries it — and a dimension count has\n * to travel with it, or an optional vector reaches a backend as a vector of unknown width\n * and cannot be given a column.\n *\n * `innerSchema` is the cautionary example: it lives on `SchemaArray` alone, so a modified\n * array arrives with no element type and clones through the slow path.\n */\n dimensions: number | null = null;\n /**\n * The longest string the property is declared to hold. `null` for every other type, and\n * for a string that declares nothing.\n *\n * Declared here rather than on `SchemaString` for the same reason as `dimensions` above:\n * `s.string({ maxLength: 4000 }).optional()` is a `SchemaOptional`, so anything reachable\n * only through `SchemaString` is lost the moment a modifier is added.\n *\n * A declaration, never a validation. Core does not check a value against it and does not\n * truncate. The backend that can use the number does: MySQL gives the column\n * `VARCHAR(maxLength)` instead of the blanket `VARCHAR(255)`. Every other backend ignores\n * it, because a string column that is already unbounded cannot be made more correct by\n * knowing a bound.\n */\n maxLength: number | null = null;\n /**\n * Whether this string may be tokenised into a full-text search index.\n *\n * Set by `.searchable()`, and only ever true on a string. Eligibility, not membership: a\n * collection that never declares `.searchIndex()` indexes nothing regardless.\n *\n * Copied by the constructor below, so `s.string().searchable().optional()` stays searchable.\n * Every flag on this class is copied for the same reason: a modifier WRAPS rather than\n * extends, so anything the constructor forgets is silently dropped the moment a property\n * gains one more modifier.\n */\n isSearchable: boolean = false;\n\n foreignKeyDefinition: ForeignKey<unknown> | null = null;\n tags: string[] = [];\n injected: any = null;\n defaultValue: DefaultValue<T> | null = null;\n valueSerializer: PropertySerializer<T> | null = null;\n valueDeserializer: PropertyDeserializer<T> | null = null;\n type: SchemaTypes;\n functionBody: FunctionBody<any, T> | null;\n private _schemaBase = true;\n readonly literals: T[] = [];\n\n constructor(entity?: SchemaBase<T, TModifiers>, literals?: T[]) {\n\n if (entity != null) {\n this.valueSerializer = entity.valueSerializer;\n this.valueDeserializer = entity.valueDeserializer;\n this.functionBody = entity.functionBody;\n this.isNullable = entity.isNullable;\n this.isOptional = entity.isOptional;\n this.isKey = entity.isKey;\n this.isIdentity = entity.isIdentity;\n this.isReadonly = entity.isReadonly;\n this.defaultValue = entity.defaultValue;\n this.type = entity.type;\n this.injected = entity.injected;\n this.indexes = entity.indexes;\n this.fromPropertyName = entity.fromPropertyName;\n this.tags = entity.tags;\n this.transform = entity.transform;\n this.dimensions = entity.dimensions;\n this.maxLength = entity.maxLength;\n this.isSearchable = entity.isSearchable;\n this.isDistinct = entity.isDistinct;\n }\n\n if (literals) {\n this.literals = literals;\n }\n }\n}","import { SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\n\nexport class SchemaDistinct<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaDistinct = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isDistinct = true;\n }\n}","import { SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\n\nexport class SchemaIdentity<T, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaIdentity = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isIdentity = true;\n }\n}","import { SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaOptional } from \"./SchemaOptional\";\n\n/**\n * Marks a string property as eligible for a full-text search index.\n *\n * Eligible, not indexed. The schema says what COULD be indexed; the collection builder's\n * `.searchIndex()` says that it IS. A property marked here on a collection that never declares\n * an index costs nothing at all — no rows, no write amplification, no storage.\n *\n * Like `s.vector()`, this exists to be RECOGNISED rather than to behave. It changes nothing\n * about how the property is stored, cloned, compared, serialized or queried. The datastore\n * reads the flag off the compiled schema to decide which values to tokenise; every plugin is\n * unaware the property is any different from another string.\n *\n * Declared on `SchemaString` only, so `s.number().searchable()` is a compile error rather than\n * a runtime surprise. The one case the type system cannot catch — a searchable string nested\n * inside an `s.object()` — is rejected when the schema compiles: v1 indexes root-level string\n * properties only.\n */\nexport class SchemaSearchable<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaSearchable = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isSearchable = true;\n }\n\n /**\n * Declared here so `.searchable()` composes in BOTH senses — `.searchable().optional()` and\n * `.optional().searchable()` mean the same thing and both keep the flag. `SchemaDistinct`\n * exposes neither, which is why `.distinct().optional()` is unwritable and its copy-loss\n * (see `SchemaBase.isSearchable`) has never been noticed.\n */\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n}\n","import { PropertyDeserializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaSearchable } from \"./SchemaSearchable\";\n\nexport class SchemaOptional<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaOptional = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isOptional = true;\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n /**\n * Only callable when the property underneath is a string.\n *\n * A wrapper does not know what it wraps at runtime, but the type does: `T` is the value\n * type, so `s.number().optional()` is a `SchemaOptional<number>` and fails this `this`\n * constraint. That is the gate — there is no runtime check, because a builder that offers\n * a method it will then reject has already failed at its job.\n *\n * Constrained on `instance` alone rather than the whole class. `SchemaBase` holds `T` in\n * contravariant positions too (`valueSerializer`, `defaultValue`), so requiring the full\n * `SchemaOptional<string, ...>` would reject a literal union like\n * `s.string(\"draft\", \"published\")`, which is a perfectly good searchable string.\n *\n * An absent value contributes no tokens.\n */\n searchable(this: { instance: string }) {\n return new SchemaSearchable<T, TModifiers | \"searchable\">(this as unknown as SchemaBase<T, TModifiers>);\n }\n\n deserialize(deserializer: PropertyDeserializer<T | undefined>) {\n return new SchemaDeserialize<T | undefined, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n\n}","import { DefaultValue, PropertyDeserializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaSearchable } from \"./SchemaSearchable\";\n\nexport class SchemaNullable<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaNullable = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isNullable = true;\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n /**\n * Only callable when the property underneath is a string — see the same method on\n * `SchemaOptional` for why the constraint is on `instance` rather than the whole class.\n *\n * A null value contributes no tokens.\n */\n searchable(this: { instance: string }) {\n return new SchemaSearchable<T, TModifiers | \"searchable\">(this as unknown as SchemaBase<T, TModifiers>);\n }\n\n default<I = never>(value: DefaultValue<T | null, I>, injected?: I) {\n return new SchemaDefault<T | null, I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T | null>) {\n return new SchemaDeserialize<T | null, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n\n}","import { PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\n\nexport class SchemaSerialize<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaSerialize = true;\n\n constructor(serializer: PropertySerializer<T>, current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.valueSerializer = serializer;\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaReadonly<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaReadonly = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isReadonly = true;\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserializer(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serializer(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"deserialize\">(serializer, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaDistinct } from \"./SchemaDistinct\";\nimport { SchemaIdentity } from \"./SchemaIdentity\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaReadonly } from \"./SchemaReadonly\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaFrom<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaFrom = true;\n\n constructor(propertyName: string, current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.fromPropertyName = propertyName;\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaDeserialize<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaDeserialize = true;\n\n constructor(deserializer: PropertyDeserializer<T>, current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.valueDeserializer = deserializer;\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n default<I = never>(value: DefaultValue<T | null, I>, injected?: I) {\n return new SchemaDefault<T | null, I, TModifiers | \"default\">(value, injected, this);\n }\n\n}","import { logger } from \"../../../utilities\";\nimport { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaDefault<T extends any, I, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaDefault = true;\n\n constructor(defaultValue: DefaultValue<T, I>, injected: I, current: SchemaBase<T, TModifiers>) {\n super(current);\n\n if (defaultValue == null) {\n logger.warn(\"Do not use `.default(null)` in your schema, please use `.default(() => null)`\")\n }\n\n this.instance = current.instance;\n this.injected = injected;\n this.defaultValue = defaultValue;\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n}","import { uuidv4 } from \"../../../utilities\";\nimport { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaDistinct } from \"./SchemaDistinct\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaReadonly } from \"./SchemaReadonly\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaIndex<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaIndex = true;\n\n constructor(current: SchemaBase<T, TModifiers>, ...indexes: string[]) {\n super(current);\n this.instance = current.instance;\n\n if (indexes.length === 0) {\n indexes.push(uuidv4()); // Create our own unique index identifier\n }\n\n this.indexes = indexes;\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaArray } from \"../types\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { SchemaDeserialize } from \"./SchemaDeserialize\";\nimport { SchemaDistinct } from \"./SchemaDistinct\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaIndex } from \"./SchemaIndex\";\nimport { SchemaNullable } from \"./SchemaNullable\";\nimport { SchemaOptional } from \"./SchemaOptional\";\nimport { SchemaReadonly } from \"./SchemaReadonly\";\nimport { SchemaSerialize } from \"./SchemaSerialize\";\n\nexport class SchemaTag<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaTag = true;\n\n constructor(tags: string[], current: SchemaBase<T, TModifiers>) {\n super(current);\n this.tags = tags;\n this.instance = current.instance;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n}","import { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaDeserialize } from '../modifiers/SchemaDeserialize';\nimport { SchemaSerialize } from '../modifiers/SchemaSerialize';\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\n\nexport class SchemaArray<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T[], TModifiers> {\n\n instance: T[];\n type = SchemaTypes.Array;\n private _schemaArray = true;\n readonly innerSchema?: SchemaBase<any, any>; // we need to know the type of the array, that is what this is for\n\n constructor(entity?: SchemaBase<T[], TModifiers>, literals?: T[][]) {\n super(entity, literals);\n this.innerSchema = entity;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T[], TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T[], TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T[], TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T[], I>, injected?: I) {\n return new SchemaDefault<T[], I, TModifiers | \"default\">(value, injected, this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T[]>) {\n return new SchemaDeserialize<T[], TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T[]>) {\n return new SchemaSerialize<T[], TModifiers | \"serialize\">(serializer, this);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T[], TModifiers>(this, ...indexes);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T[], TModifiers>(tags, this);\n }\n\n\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaBoolean<T extends boolean, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Boolean;\n private _schemaBoolean = true;\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n\n\n}","import { DefaultValue, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaDate<T extends Date, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Date;\n private _schemaDate = true;\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n\n\n}","import { SchemaBase } from \"../property/base/SchemaBase\";\nimport { SchemaModifiers, SchemaTypes } from \"../types\";\n\nexport class SchemaFunction<T extends any, I, TModifiers extends SchemaModifiers = \"unmapped\"> extends SchemaBase<() => T, TModifiers> {\n instance: () => T;\n type = SchemaTypes.Function;\n private _schemaFunction = true;\n\n constructor(fn: (injected: I) => T, injected: I, current?: SchemaBase<() => T, TModifiers>) {\n super(current);\n this.injected = injected;\n this.isUnmapped = true;\n this.functionBody = fn as any;\n }\n}","import { SchemaBase } from \"../property/base/SchemaBase\";\nimport { PropertyTransform, SchemaModifiers } from \"../types\";\n\n/**\n * A two-way transform between the value your application holds and the value that is stored.\n *\n * Declared in `.modify()`, beside `computed` and `function`, because it belongs to the same\n * family: a property whose stored form is derived rather than assigned. `computed` derives one\n * way and cannot come back; a transform declares both directions.\n *\n * ```ts\n * const cipher = myEncryption(keyring); // whatever you use — {} with `to` and `from`\n *\n * const userSchema = s.define('users', {\n * id: s.string().key().identity(),\n * ssn: s.string(),\n * }).modify(x => ({\n * ssn: x.transform(cipher),\n * })).compile();\n * ```\n *\n * `to` and `from` may be async, and they are held as LIVE references — never stringified into\n * generated code the way `computed` is. So they close over whatever they need, which is why\n * there is no `injected` argument to pass and no property to repeat.\n *\n * Nothing about this is encryption. Encryption is one thing a caller might write here;\n * compression, redaction, unit conversion and a custom codec are others. The library ships no\n * behaviour of its own for this — it only carries what you supply.\n */\nexport class SchemaTransform<T extends any, TModifiers extends SchemaModifiers = never> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaTransform = true;\n\n /**\n * Bound to the property it replaces when the schema is assembled.\n *\n * You do not pass the property in. `.modify()` already knows which one you mean — it is\n * the key you assigned to — so repeating `s.string()` would be ceremony for nothing.\n */\n bindTo(underlying: SchemaBase<T, TModifiers>) {\n // The underlying property keeps its type, its key and identity flags, and its\n // modifiers. A transform changes how a value is STORED, never what it is: an\n // encrypted number is still a number, so `InferType` must not shift.\n Object.assign(this, underlying, { transform: this.transform, _schemaTransform: true });\n\n this.instance = underlying.instance;\n this.type = underlying.type;\n\n return this;\n }\n\n constructor(transform: PropertyTransform<T>) {\n super();\n this.instance = null as T;\n this.transform = transform as PropertyTransform<unknown>;\n }\n}\n\n\n","import { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaIdentity } from \"./SchemaIdentity\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { CompiledSchema, DefaultValue, InferType, SchemaModifiers } from \"../../types\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaTag } from \"./SchemaTag\";\n\nexport class SchemaForeignKey<T extends any, TModifiers extends SchemaModifiers, K extends {}> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaForeignKey = true;\n\n constructor(current: SchemaBase<T, TModifiers>, relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n super(current);\n this.instance = current.instance;\n this.foreignKeyDefinition = {\n schema: relatingSchema,\n property: relatingSchema.getProperty(String(property))\n };\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaIdentity } from \"./SchemaIdentity\";\nimport { SchemaDefault } from \"./SchemaDefault\";\nimport { DefaultValue, IdType, SchemaModifiers } from \"../../types\";\nimport { SchemaFrom } from \"./SchemaFrom\";\nimport { SchemaTag } from \"./SchemaTag\";\n\nexport class SchemaKey<T extends IdType, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n instance: T;\n private _schemaKey = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isKey = true;\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { CompiledSchema, IdType, InferType, SchemaModifiers } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaForeignKey } from \"./SchemaForeignKey\";\nimport { SchemaKey } from \"./SchemaKey\";\nimport { SchemaTag } from \"./SchemaTag\";\n\nexport class SchemaTracked<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n private _schemaTracked = true;\n\n constructor(current: SchemaBase<T, TModifiers>) {\n super(current);\n this.instance = current.instance;\n this.isUnmapped = false;\n }\n\n key(): T extends IdType ? SchemaKey<T, TModifiers | \"key\"> : never {\n return new SchemaKey(this as SchemaBase<T & IdType, TModifiers>) as T extends IdType ? SchemaKey<T, TModifiers | \"key\"> : never;\n }\n\n foreignKey<K extends {}>(relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n return new SchemaForeignKey<T, TModifiers, K>(this, relatingSchema, property);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}","import { SchemaBase } from \"../property/base/SchemaBase\";\nimport { SchemaTracked } from '../property/modifiers/SchemaTracked';\nimport { SchemaModifiers, SchemaTypes } from \"../types\";\n\nexport class SchemaComputed<T extends any, I, TModifiers extends SchemaModifiers = \"computed\"> extends SchemaBase<T, TModifiers> {\n instance: T;\n type = SchemaTypes.Computed;\n private _schemaComputed = true;\n\n constructor(fn: T, injected: I, current?: SchemaBase<T, TModifiers>) {\n super(current);\n this.injected = injected;\n this.isUnmapped = true;\n this.functionBody = fn as any;\n }\n\n tracked() {\n return new SchemaTracked<T, Exclude<TModifiers, \"unmapped\">>(this as unknown as SchemaBase<T, Exclude<TModifiers, \"unmapped\">>);\n }\n}","import { UnknownRecord } from '../utilities';\nimport { SchemaBase } from './property/base/SchemaBase';\nimport { SchemaArray } from './property/types/SchemaArray';\nimport { DefaultValue, ForeignKey, FunctionBody, PropertyDeserializer, PropertySerializer, SchemaTypes, PropertyTransform } from './types';\n\nconst SUPPORTED_DESERIALIZATION_TYPES = new Set<SchemaTypes>([\n SchemaTypes.Boolean,\n SchemaTypes.Date,\n SchemaTypes.Number,\n SchemaTypes.String,\n]);\n\n/**\n * Represents metadata and utilities for a property in a schema, including its type, name, parent, children, and serialization details.\n */\nexport class PropertyInfo<T extends {}> {\n\n get id() {\n if (this._idCache) {\n return this._idCache;\n }\n this._idCache = this.getPathArray().join(\".\");\n return this._idCache;\n }\n\n /** The name of the property. */\n readonly name: string;\n /** The name of the property we need to map from. */\n readonly from: string | null = null;\n /** The schema type of the property. */\n readonly type: SchemaTypes;\n\n /** Whether the property can be null. */\n readonly isNullable: boolean;\n /** Whether the property is optional. */\n readonly isOptional: boolean;\n /** Whether the property is a key. */\n readonly isKey: boolean;\n /** Foreign key schema and property */\n readonly foreignKeyDefinition: ForeignKey<unknown> | null;\n /** Whether the property is an identity property. */\n readonly isIdentity: boolean;\n /** Whether the property is readonly. */\n readonly isReadonly: boolean;\n /** Whether the property is unmapped. */\n readonly isUnmapped: boolean;\n /** Whether the property is distinct. */\n readonly isDistinct: boolean;\n\n\n /**\n * A two-way transform between the application value and the stored value, or `null`.\n *\n * A LIVE reference. Unlike `computed`, which is stringified into generated code, this is\n * held as-is so it can close over a key, a client, or anything else a caller needs — and\n * so it can be async, which generated code cannot be.\n */\n readonly transform: PropertyTransform<unknown> | null;\n /** Indexes associated with the property. */\n readonly indexes: string[];\n\n /** Any injected value for the property. */\n readonly injected: any | null = null;\n /** The default value for the property, if any. */\n readonly defaultValue: DefaultValue<any> | null = null;\n /** Serializer for the property value, if any. */\n readonly valueSerializer: PropertySerializer<T> | null = null;\n /** Deserializer for the property value, if any. */\n readonly valueDeserializer: PropertyDeserializer<T> | null = null;\n /** Function body for computed properties, if any. */\n readonly functionBody: FunctionBody<any, T> | null;\n /** Child properties of this property. */\n readonly children: PropertyInfo<T>[] = [];\n /** The schema this property belongs to. */\n readonly schema: SchemaBase<T, any>;\n /** The inner schema if this property is an array. */\n readonly innerSchema?: SchemaBase<unknown, any>;\n /** How many numbers this property holds if it is a vector, `null` otherwise. */\n readonly dimensions: number | null;\n /** The longest value this property is declared to hold, `null` if it declares none. */\n readonly maxLength: number | null;\n /**\n * Whether this property may be tokenised into a full-text search index.\n *\n * True only for a string. See the constructor — this is derived from the declaration and\n * the type together, not copied.\n */\n readonly isSearchable: boolean;\n /** Literal values allowed for this property. */\n readonly literals: T[];\n /** Tags passed from the schema */\n readonly tags: string[];\n\n /** The parent property, if any. */\n readonly parent?: PropertyInfo<T>;\n\n // Cached computed values for performance\n private _propertyChainCache?: PropertyInfo<T>[];\n private _pathArrayCache?: string[];\n private _parentPathArrayCache?: string[];\n private _idCache?: string;\n private _levelCache?: number;\n private _hasNullableParentsCache?: boolean;\n private _hasRenamedSegmentsCache?: boolean;\n\n constructor(schema: SchemaBase<T, any>, name: string, parent?: PropertyInfo<T> | null) {\n this.schema = schema;\n this.name = name;\n this.type = schema.type;\n this.literals = schema.literals;\n this.dimensions = schema.dimensions;\n this.maxLength = schema.maxLength;\n // Both, always. The builder already refuses `.searchable()` on anything but a string,\n // but that gate is a type and types do not exist at runtime — a schema rebuilt from\n // hand-written JSON can set the raw flag on a number. Deriving the answer here means\n // every reader gets a searchable property that is definitely a string, rather than each\n // one having to remember to check.\n this.isSearchable = schema.isSearchable && schema.type === SchemaTypes.String;\n\n if (schema instanceof SchemaArray) {\n this.innerSchema = schema.innerSchema;\n }\n\n this.isNullable = schema.isNullable;\n this.isOptional = schema.isOptional;\n this.isKey = schema.isKey;\n this.isIdentity = schema.isIdentity;\n this.isReadonly = schema.isReadonly;\n this.isUnmapped = schema.isUnmapped;\n this.injected = schema.injected;\n this.isDistinct = schema.isDistinct;\n this.transform = schema.transform;\n this.indexes = schema.indexes;\n this.from = schema.fromPropertyName;\n this.tags = schema.tags;\n this.foreignKeyDefinition = schema.foreignKeyDefinition;\n\n this.defaultValue = schema.defaultValue;\n this.valueSerializer = schema.valueSerializer;\n this.valueDeserializer = schema.valueDeserializer;\n this.functionBody = schema.functionBody;\n\n this.parent = parent;\n }\n\n /**\n * Returns the depth (level) of this property in the property tree.\n *\n * The root property has a level of 0. Each child property increases the level by 1.\n * Traverses up the parent chain, incrementing the level for each parent until the root is reached.\n * \n * @returns {number} The number of parent properties above this property (0 for root).\n */\n get level() {\n if (this._levelCache !== undefined) {\n return this._levelCache;\n }\n\n let level = 0;\n // oxlint-disable-next-line no-this-alias\n let current: PropertyInfo<T> | undefined = this;\n\n while (current) {\n if (current.parent == null) {\n this._levelCache = level;\n return level;\n }\n\n current = current.parent;\n level++;\n }\n\n this._levelCache = level;\n return level;\n }\n\n get isRenamed() {\n return !!this.from;\n }\n\n get supportsDeserialization() {\n return this.valueDeserializer != null || SUPPORTED_DESERIALIZATION_TYPES.has(this.type);\n }\n\n private _getPropertyChain(): PropertyInfo<T>[] {\n if (this._propertyChainCache) {\n return this._propertyChainCache;\n }\n\n const chain: PropertyInfo<T>[] = [];\n // oxlint-disable-next-line no-this-alias\n let current: PropertyInfo<T> | undefined = this;\n\n while (current) {\n chain.unshift(current);\n current = current.parent;\n }\n\n this._propertyChainCache = chain;\n return chain;\n }\n\n private _needsOptionalChaining(precedingProp: PropertyInfo<T> | null, assignmentType?: AssignmentType): boolean {\n if (assignmentType === \"ASSIGNMENT\") {\n return false;\n }\n\n if (assignmentType === \"FORCE_NULLABLE_OR_OPTIONAL\") {\n return true;\n }\n\n // The accessor guards the value it follows: entity.a?.c is safe when `a`\n // is nullable, entity?.a.c is not. The root can never be null.\n if (precedingProp == null) {\n return false;\n }\n\n return precedingProp.isNullable || precedingProp.isOptional;\n }\n\n private _resolvePathArray(options?: {\n root?: string,\n assignmentType?: AssignmentType\n useFromPropertyName?: boolean,\n }) {\n const propertyChain = this._getPropertyChain();\n const hasRoot = options?.root != null;\n const path: string[] = hasRoot ? [options!.root!] : [];\n let precedingProp: PropertyInfo<T> | null = null;\n\n for (const prop of propertyChain) {\n const accessor = this._needsOptionalChaining(precedingProp, options?.assignmentType) ? '?.' : '.';\n // Storage-side paths use `from` per segment; segments that were never\n // renamed keep their property name\n path.push(accessor, options?.useFromPropertyName ? (prop.from ?? prop.name) : prop.name);\n precedingProp = prop;\n }\n\n return path;\n }\n\n getResolvedName() {\n return this.from ?? this.name;\n }\n\n /**\n * Returns an array of property names representing the path from the root to this property.\n *\n * @returns {string[]} The property path as an array of names.\n */\n getPathArray() {\n if (this._pathArrayCache) {\n return this._pathArrayCache;\n }\n\n const path: string[] = [];\n const propertyChain = this._getPropertyChain();\n\n for (const prop of propertyChain) {\n path.push(prop.name);\n }\n\n this._pathArrayCache = path;\n return path;\n }\n\n /**\n * Returns an array of property names representing the path from the root to the parent of this property.\n *\n * @returns {string[]} The property path as an array of names, excluding this property.\n */\n getParentPathArray(options?: { useFromPropertyName?: boolean }) {\n if (options?.useFromPropertyName === true) {\n // Storage-side variant is uncached: `from` falls back to the property\n // name per segment\n const fromPath: string[] = [];\n const chain = this._getPropertyChain();\n\n for (let i = 0; i < chain.length - 1; i++) {\n const prop = chain[i];\n fromPath.push(prop.from ?? prop.name);\n }\n\n return fromPath;\n }\n\n if (this._parentPathArrayCache) {\n return this._parentPathArrayCache;\n }\n\n const path: string[] = [];\n const propertyChain = this._getPropertyChain();\n\n for (let i = 0; i < propertyChain.length - 1; i++) {\n const prop = propertyChain[i];\n path.push(prop.name);\n }\n\n this._parentPathArrayCache = path;\n return path;\n }\n\n /**\n * Returns true if any parent property is nullable or optional.\n *\n * @returns {boolean} True if any parent is nullable or optional, false otherwise.\n */\n get hasNullableParents() {\n if (this._hasNullableParentsCache !== undefined) {\n return this._hasNullableParentsCache;\n }\n\n let parent = this.parent;\n while (parent != null) {\n if (parent.isNullable || parent.isOptional) {\n this._hasNullableParentsCache = true;\n return true;\n }\n parent = parent.parent;\n }\n\n this._hasNullableParentsCache = false;\n return false;\n }\n\n /**\n * Returns true if this property or any parent is renamed with from().\n * Storage paths for such properties differ from their in-memory paths.\n *\n * @returns {boolean} True if any segment of the path is renamed, false otherwise.\n */\n get hasRenamedSegments(): boolean {\n if (this._hasRenamedSegmentsCache !== undefined) {\n return this._hasRenamedSegmentsCache;\n }\n\n // oxlint-disable-next-line no-this-alias\n let current: PropertyInfo<T> | undefined = this;\n while (current != null) {\n if (current.from != null) {\n this._hasRenamedSegmentsCache = true;\n return true;\n }\n current = current.parent;\n }\n\n this._hasRenamedSegmentsCache = false;\n return false;\n }\n\n /**\n * Returns true if any child property (recursively) is an identity property.\n *\n * @returns {boolean} True if any child is an identity property, false otherwise.\n */\n get hasIdentityChildren() {\n const children = [...this.children];\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n if (child.isIdentity === true) {\n return true;\n }\n if (child.children.length > 0) {\n children.push(...child.children)\n }\n }\n return false;\n }\n\n /**\n * Gets the value of this property from the given instance, following the property path.\n *\n * @param instance The object instance to retrieve the value from.\n * @returns The value of the property, or null if not found.\n */\n getValue(instance: UnknownRecord) {\n if (instance == null) {\n return null;\n }\n const pathArray = this.getPathArray();\n const length = pathArray.length;\n // Fast path for single level properties\n if (length === 1) {\n return instance[pathArray[0]];\n }\n let current: any = instance;\n for (let i = 0; i < length; i++) {\n if (current == null) {\n return null;\n }\n current = current[pathArray[i]];\n }\n return current;\n }\n\n /**\n * Sets the value of this property on the given instance, creating intermediate objects as needed.\n *\n * @param instance The object instance to set the value on.\n * @param value The value to set.\n */\n setValue(instance: UnknownRecord, value: unknown) {\n if (instance == null) {\n throw new Error('Cannot set value on null or undefined instance');\n }\n const pathArray = this.getPathArray();\n const length = pathArray.length;\n // Fast path for single level properties\n if (length === 1) {\n instance[pathArray[0]] = value;\n return;\n }\n let current: any = instance;\n let i = 0;\n // Navigate to the parent of the target property\n while (i < length - 1) {\n const prop = pathArray[i];\n const next = current[prop];\n // Only create new object if next level doesn't exist\n if (next == null) {\n current[prop] = {};\n }\n current = current[prop];\n i++;\n }\n // Set the value on the final property\n current[pathArray[length - 1]] = value;\n }\n\n /**\n * Returns a selector path string for this property, starting from the given parent variable name.\n *\n * @param options.parent The root variable name.\n * @param options.assignmentType Optional assignment type for path resolution.\n * @returns {string} The selector path string (e.g., 'parent.prop1.prop2').\n */\n getSelectrorPath(options: { parent: string, assignmentType?: AssignmentType, useFromPropertyName?: boolean, useRemappedName?: boolean }) {\n const parts = this._resolvePathArray({\n root: options.parent,\n assignmentType: options?.assignmentType,\n useFromPropertyName: options?.useFromPropertyName\n });\n return parts.join(\"\");\n }\n\n /**\n * Returns an assignment path string for this property, optionally starting from a parent variable name.\n *\n * @param options.parent Optional root variable name.\n * @returns {string} The assignment path string (e.g., 'prop1.prop2').\n */\n getAssignmentPath(options?: { parent?: string, useFromPropertyName?: boolean }) {\n const parts = this._resolvePathArray({\n root: options?.parent,\n assignmentType: \"ASSIGNMENT\",\n useFromPropertyName: options?.useFromPropertyName\n });\n\n if (options?.parent == null) {\n return parts.slice(1).join(\"\");\n }\n\n return parts.join(\"\");\n }\n\n deserialize(value: string | number) {\n\n if (this.valueDeserializer != null) {\n return this.valueDeserializer(value);\n }\n\n if (this.type === SchemaTypes.Date) {\n return new Date(value);\n }\n\n if (this.type === SchemaTypes.String) {\n return String(value);\n }\n\n if (this.type === SchemaTypes.Number) {\n return Number(value);\n }\n\n if (this.type === SchemaTypes.Boolean) {\n return Boolean(value);\n }\n\n throw new Error(`Unsupported deserialization for type. Type: ${this.type}`);\n }\n}\n\ntype AssignmentType = \"FORCE_NULLABLE_OR_OPTIONAL\" | \"ASSIGNMENT\";","export class SlotPath {\n\n private _path: string[];\n\n get path() {\n return [...this._path]\n }\n\n constructor(...pathLike: string[]) {\n this._path = pathLike;\n }\n\n push(...pathLike: string[]) {\n this._path.push(...pathLike);\n }\n\n get(up: number = 0) {\n return this._path.slice(0, this._path.length - up).join(\".\")\n }\n}","/**\n * Counts non-overlapping occurrences of a term in text.\n *\n * Behavior:\n * - Case-sensitive matching\n * - If the search term is composed entirely of word characters (A–Z, a–z, 0–9, _),\n * enforce whole-word boundaries so \"red\" does not match inside \"redder\".\n * - If the search term contains any non-word character (e.g. \"=>\", \"()\", \"::\"),\n * match anywhere without boundary checks (useful for symbols).\n * - Non-overlapping matches (after a hit, advances by term length)\n * - Optimized single-character fast path; otherwise uses indexOf loop\n *\n * Examples:\n * - countWordOccurance(\"red redder red\", \"red\") => 2\n * - countWordOccurance(\"()=>{}\", \"=>\") => 1\n * - countWordOccurance(\"aaaa\", \"aa\") => 2 (non-overlapping)\n *\n * @param text The source text to scan\n * @param word The term to match (must be non-empty)\n * @returns The number of occurrences found\n */\nexport const countWordOccurance = (text: string, word: string) => {\n const wl = word.length;\n const tl = text.length;\n\n if (wl === 0 || wl > tl) return 0;\n\n // Fast path for single-character words\n if (wl === 1) {\n let c = 0;\n const code = word.charCodeAt(0);\n for (let i = 0; i < tl; i++) if (text.charCodeAt(i) === code) c++;\n return c;\n }\n\n let count = 0;\n let i = 0;\n\n function isWordCharCode(c: number): boolean {\n return (c >= 48 && c <= 57) // 0-9\n || (c >= 65 && c <= 90) // A-Z\n || (c >= 97 && c <= 122) // a-z\n || c === 95; // _\n }\n\n // Decide whether to enforce word boundaries based on the search term\n let enforceWordBoundaries = true;\n for (let k = 0; k < wl; k++) {\n const cc = word.charCodeAt(k);\n if (!isWordCharCode(cc)) {\n enforceWordBoundaries = false;\n break;\n }\n }\n\n while (true) {\n i = text.indexOf(word, i);\n if (i === -1) break;\n\n if (enforceWordBoundaries) {\n const left = i - 1;\n const right = i + wl;\n const leftOk = left < 0 || !isWordCharCode(text.charCodeAt(left));\n const rightOk = right >= tl || !isWordCharCode(text.charCodeAt(right));\n if (leftOk && rightOk) count++;\n } else {\n // No boundary enforcement for symbol-containing terms\n count++;\n }\n i += wl; // non-overlapping word matches\n }\n\n return count;\n}","import { CodeBuilder, ContainerBlock, IfBuilder, ObjectBuilder, SlotBlock } from '..';\nimport { PropertyInfo } from '../../schema/PropertyInfo';\nimport { SlotPath } from '../SlotPath';\nimport { SchemaError } from '../../errors/SchemaError';\nimport { uuid } from '../../utilities/uuid';\nimport { countWordOccurance } from '../utils';\n\nexport interface IHandler {\n setNext(handler: IHandler): IHandler;\n\n handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null;\n}\n\n/**\n * Terminal link for chains that apply only to a subset of properties (keys,\n * identities). Returning the builder marks every other property as\n * deliberately skipped, so a null return from any chain always means a real\n * coverage gap.\n */\nexport class NotApplicableHandler implements IHandler {\n\n setNext(handler: IHandler): IHandler {\n return handler;\n }\n\n handle(_: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n return builder;\n }\n}\n\nexport abstract class PropertyInfoHandler implements IHandler {\n\n private _next: IHandler | null;\n\n setNext(handler: IHandler): IHandler {\n this._next = handler;\n\n return handler;\n }\n\n handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n try {\n if (this._next) {\n return this._next.handle(property, builder);\n }\n\n return null;\n } catch (e: any) {\n throw new SchemaError(e, `Error handling property: ${property.name}`);\n }\n }\n\n protected buildSlotPath(property: PropertyInfo<any>, path: SlotPath) {\n\n const result = new SlotPath(...path.path);\n const items: string[] = []\n let p = property;\n\n while (p.parent != null) {\n items.unshift(p.name);\n p = p.parent;\n }\n\n items.unshift(p.name);\n\n result.push(...items);\n\n return result\n }\n\n /**\n * Dotted property path from the root entity (e.g. `nested.inner`), used as the\n * change-tracking path prefix so nested writes record against the root's\n * `__tracking__` under their full path.\n */\n protected getTrackingPath(property: PropertyInfo<any>): string {\n const names: string[] = [];\n let p: PropertyInfo<any> | null = property;\n\n while (p != null) {\n names.unshift(p.name);\n p = p.parent;\n }\n\n return names.join(\".\");\n }\n\n /**\n * Emits `if (<root>.a == null) <root>.a = {};` for every ancestor of a\n * nested property, so assignments through the target object never throw when a\n * parent object is absent. The guards run root-down, so grandparents are\n * materialized before their children.\n */\n protected emitDestinationAncestorGuards(property: PropertyInfo<any>, block: IfBuilder, options?: { root?: string, useFromPropertyName?: boolean }) {\n if (property.parent == null) {\n return;\n }\n\n const root = options?.root ?? \"destination\";\n const parentPathArray = property.getParentPathArray({ useFromPropertyName: options?.useFromPropertyName });\n\n for (let i = 0; i < parentPathArray.length; i++) {\n const pathSoFar = [root, ...parentPathArray.slice(0, i + 1)].join(\".\");\n block.appendBody(`if (${pathSoFar} == null) ${pathSoFar} = {};`);\n }\n }\n\n /**\n * Emits the guarded nested-property assignment shared by the serialize handlers:\n * reads the parent through an optional-chained selector (the entity may be a\n * partial — a delta payload or a create payload with absent nested parents),\n * materializes every `result` ancestor, then assigns `valueExpression` to the\n * property's storage-side path.\n */\n protected emitSerializeNestedAssignment(property: PropertyInfo<any>, slot: SlotBlock, valueExpression: string) {\n const parentSelectPath = property.parent!.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const resultSelectorPath = property.getAssignmentPath({ parent: \"result\", useFromPropertyName: true });\n\n const ifSlot = slot.if(`${parentSelectPath} != null && Object.hasOwn(${parentSelectPath}, \"${property.name}\")`);\n\n this.emitDestinationAncestorGuards(property, ifSlot, { root: \"result\", useFromPropertyName: true });\n\n ifSlot.appendBody(`${resultSelectorPath} = ${valueExpression}`);\n }\n\n /**\n * Emits the source → destination copy for one property in the merge generator,\n * materializing destination ancestors first.\n *\n * With `onlyWhenChanged`, the assignment is skipped when both sides already hold\n * the same value (compared via `valueOf`, so equal Dates match). This preserves\n * reference identity on the destination when a merge carries no new information —\n * callers hold on to entity instances (e.g. a Date returned from add) and must not\n * see them silently replaced by an equal copy.\n */\n protected emitMergeCopy(property: PropertyInfo<any>, builder: CodeBuilder, options?: { onlyWhenChanged?: boolean }) {\n const selectorPath = property.getSelectrorPath({ parent: \"source\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"factory.function.assignments\");\n const sourcePath = property.getAssignmentPath({ parent: \"source\" });\n const destinationPath = property.getAssignmentPath({ parent: \"destination\" });\n\n const ifBlock = slot.if(`${selectorPath} != null`);\n this.emitDestinationAncestorGuards(property, ifBlock);\n\n if (options?.onlyWhenChanged === true) {\n ifBlock.appendBody(`if (${destinationPath} == null || ${destinationPath}.valueOf() !== ${sourcePath}.valueOf()) { ${destinationPath} = ${sourcePath} }`);\n return;\n }\n\n ifBlock.appendBody(`${destinationPath} = ${sourcePath}`);\n }\n\n /**\n * Slot path of the ObjectBuilder that renders `property` inside the enriched\n * literal. Builders are registered as `[enriched.<path>]` under their parent\n * builder, so the lookup path must include every ancestor segment — a flat\n * root-level lookup only works for depth-1 properties.\n */\n protected buildEnrichedObjectSlotPath(property: PropertyInfo<any>, base: SlotPath): SlotPath {\n const result = new SlotPath(...base.path);\n const chain: PropertyInfo<any>[] = [];\n let p: PropertyInfo<any> | null = property;\n\n while (p != null) {\n chain.unshift(p);\n p = p.parent;\n }\n\n for (const item of chain) {\n result.push(`[${item.getAssignmentPath({ parent: \"enriched\" })}]`);\n }\n\n return result;\n }\n\n protected setEnrichedProperty(property: PropertyInfo<any>, root: CodeBuilder) {\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n if (property.parent != null) {\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n const parentSlotPath = this.buildEnrichedObjectSlotPath(property.parent, slotPath);\n const objectBuilder = root.get<ObjectBuilder>(parentSlotPath.get());\n // Guarded read: the entity may be sparse (e.g. enrich on a create payload),\n // so the parent object cannot be assumed to exist\n const childEntityPathSelector = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n objectBuilder.property(`${property.name}: ${childEntityPathSelector}`);\n return;\n }\n\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n let enriched = root.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (enriched == null) {\n const enrichedSlot = root.get<SlotBlock>(\"factory.function.enriched\");\n enriched = enrichedSlot.variable(\"enriched\", { name: \"object\" }).object({ name: \"enriched\" });\n }\n\n enriched.property(`${property.name}: ${entitySelectorPath}`);\n }\n\n protected toNamedFunction(stringifiedFunction: string, parent: ContainerBlock) {\n const name = `_${uuid()}`;\n\n const builder = parent.function(name);\n const occurences = countWordOccurance(stringifiedFunction, \"=>\")\n\n if (occurences > 0) {\n\n const split = stringifiedFunction.split(\"=>\").map(w => w.trim());\n const parameters = split[0].replace(/\\(|\\)/g, \"\").split(\",\");\n let body = split[1];\n\n if (occurences > 1) {\n // we have a function that returns a function\n const index = stringifiedFunction.indexOf(\"=>\");\n body = stringifiedFunction.slice(index + 2, stringifiedFunction.length)\n }\n\n if (body.startsWith(\"{\") === true && body.endsWith(\"}\")) {\n\n // Remove brackets, wrapping function will have them\n builder.appendBody(body.slice(1, body.length - 1));\n\n return {\n builder,\n parameters\n };\n }\n\n builder.appendBody(`return ${body};`);\n return {\n builder,\n parameters\n }\n }\n\n throw new Error(\"Only arrow functions are allowed in the schema definition: function () {} ---> () => {}\");\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentNullableObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object && (property.isNullable || property.isOptional)) {\n\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n const nestedSlotPath = this.buildEnrichedObjectSlotPath(property, slotPath);\n\n // Generate null check for current level using parent relationships\n const entityPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const enrichedPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n\n if (ifsSlot == null) {\n throw new Error(\"Error building enricher, could not find slot for factory.function.ifs\")\n }\n\n\n // Pass the root as parent so nested writes mark the root entity dirty,\n // and the full dotted path so the change is recorded under it\n ifsSlot.if(`${entityPath} != null`).appendBody(`${enrichedPath} = enableChangeTracking(${enrichedPath} || {}, \"${this.getTrackingPath(property)}\", enriched);`);\n\n let enriched = builder.getOrDefault<ObjectBuilder>(nestedSlotPath.get());\n\n if (enriched == null) {\n if (property.parent != null) {\n // Nested object: attach to the parent's ObjectBuilder (registered as\n // `[enriched.<parentPath>]`), never to the root — attaching to the root\n // hoists the subtree to the top level of the literal\n const parentSlotPath = this.buildEnrichedObjectSlotPath(property.parent, slotPath);\n const parentBuilder = builder.get<ObjectBuilder>(parentSlotPath.get());\n enriched = parentBuilder.nested(property.name, `[${enrichedPath}]`);\n } else {\n // Create the enriched result object when this is the first property\n // iterated — handler output cannot depend on schema property order\n let enrichedRoot = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (enrichedRoot == null) {\n const enrichedSlot = builder.get<SlotBlock>(\"factory.function.enriched\");\n enrichedRoot = enrichedSlot.variable(\"enriched\", { name: \"object\" }).object({ name: \"enriched\" });\n }\n\n enriched = enrichedRoot.nested(property.name, `[${enrichedPath}]`);\n }\n }\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object && (property.isNullable || property.isOptional) === false) {\n\n const slotPath = new SlotPath(\"factory\", \"function\", \"enriched\", \"object\", \"enriched\");\n const nestedSlotPath = this.buildEnrichedObjectSlotPath(property, slotPath);\n\n // Generate null check for current level using parent relationships\n const enrichedPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n const slot = builder.get<SlotBlock>(\"factory.function.assignment\");\n\n // Pass the root as parent so nested writes mark the root entity dirty,\n // and the full dotted path so the change is recorded under it\n slot.assign(enrichedPath).value(`enableChangeTracking(${enrichedPath} || {}, \"${this.getTrackingPath(property)}\", enriched)`)\n\n let enriched = builder.getOrDefault<ObjectBuilder>(nestedSlotPath.get());\n\n if (enriched == null) {\n if (property.parent != null) {\n // Nested object: attach to the parent's ObjectBuilder (registered as\n // `[enriched.<parentPath>]`), never to the root — attaching to the root\n // hoists the subtree to the top level of the literal\n const parentSlotPath = this.buildEnrichedObjectSlotPath(property.parent, slotPath);\n const parentBuilder = builder.get<ObjectBuilder>(parentSlotPath.get());\n enriched = parentBuilder.nested(property.name, `[${enrichedPath}]`);\n } else {\n // Create the enriched result object when this is the first property\n // iterated — handler output cannot depend on schema property order\n let enrichedRoot = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (enrichedRoot == null) {\n const enrichedSlot = builder.get<SlotBlock>(\"factory.function.enriched\");\n enrichedRoot = enrichedSlot.variable(\"enriched\", { name: \"object\" }).object({ name: \"enriched\" });\n }\n\n enriched = enrichedRoot.nested(property.name, `[${enrichedPath}]`);\n }\n }\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentObjectIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true && property.type == SchemaTypes.Object) {\n // do nothing right now\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentPrimitiveIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n // Computed identity props are NOT plain identities: the database cannot run the\n // compute function, so they fall through to EnrichmentComputedValueHandler,\n // which computes them once (when absent) over the fully-built entity\n if (property.isIdentity === true && property.type != SchemaTypes.Object && property.type != SchemaTypes.Computed) {\n const selectorPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class EnrichmentPrimitiveHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n this.setEnrichedProperty(property, builder);\n\n return builder;\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n\n const parameterNames: string[] = [\"enriched\", \"collectionName\"];\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n parameterNames.push(parameter.name);\n }\n\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.declarations\");\n // Unwrap the functions to removing currying\n const defaultFunctionWithParameters = this.toNamedFunction(property.functionBody.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...parameterNames.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n const slot = builder.get<SlotBlock>(\"factory.function.assignment\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n\n slot.assign(enrichedAssignmentPath).value(defaultFunctionWithParameters.builder.toCallable());\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class EnrichmentDefaultValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.defaultValue != null && typeof property.defaultValue !== \"function\") {\n\n this.setEnrichedProperty(property, builder);\n\n // Apply the literal default when no value came in, mirroring\n // EnrichmentDefaultFunctionHandler's if-block for function defaults\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const checkPath = property.getSelectrorPath({ parent: \"enriched\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const assignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n const ifBlock = ifsSlot.if(`${checkPath} == null`);\n\n // Nested property: ensure every ancestor object exists before the assignment\n if (property.parent != null) {\n const parentPathArray = property.getParentPathArray();\n\n for (let i = 0; i < parentPathArray.length; i++) {\n const pathSoFar = [\"enriched\", ...parentPathArray.slice(0, i + 1)].join(\".\");\n ifBlock.appendBody(`if (${pathSoFar} == null) ${pathSoFar} = {};`);\n }\n }\n\n ifBlock.appendBody(`${assignmentPath} = ${renderDefaultLiteral(property.defaultValue)}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n\nconst renderDefaultLiteral = (value: unknown) => {\n\n if (value instanceof Date) {\n return `new Date(${value.getTime()})`;\n }\n\n // JSON covers strings (with escaping), numbers, booleans, plain objects and arrays\n return JSON.stringify(value);\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class EnrichmentDefaultFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.defaultValue != null && typeof property.defaultValue === \"function\") {\n\n this.setEnrichedProperty(property, builder);\n\n // we need to add the call for this function too, want to create an if\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.declarations\");\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n\n if (factory == null) {\n throw new Error(\"Error building enricher, could not find slot for factory\")\n }\n\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n const defaultFunctionWithParameters = this.toNamedFunction(property.defaultValue.toString(), declarationsSlot);\n // This is ok, defaults can only inject one parameter anyways\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map(w => ({ name: w, callName: parameter.name })));\n\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n ifsSlot.if(`${enrichedAssignmentPath} == null`).appendBody(`${enrichedAssignmentPath} = ${defaultFunctionWithParameters.builder.toCallable()}`);\n\n return builder;\n }\n\n const defaultFunction = this.toNamedFunction(property.defaultValue.toString(), declarationsSlot);\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n ifsSlot.if(`${enrichedAssignmentPath} == null`).appendBody(`${enrichedAssignmentPath} = ${defaultFunction.builder.toCallable()}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnrichmentComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed) {\n\n const parameterNames: string[] = [\"enriched\", \"collectionName\"];\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n parameterNames.push(parameter.name);\n }\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.declarations\");\n const defaultFunctionWithParameters = this.toNamedFunction(property.functionBody.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...parameterNames.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n\n // Compute-once semantics for computed keys/identities: an existing value is\n // carried into the enriched literal and never recomputed — a key must stay\n // stable once assigned (content-hash ids would otherwise churn as the\n // entity's shape moves through pipeline stages). Non-key computed props keep\n // recompute-per-enrich behavior: their value is derived presentation data\n if (property.isKey === true || property.isIdentity === true) {\n this.setEnrichedProperty(property, builder);\n }\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"enriched\" });\n ifsSlot.if(`${enrichedAssignmentPath} == null`).appendBody(`${enrichedAssignmentPath} = ${defaultFunctionWithParameters.builder.toCallable()}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { SchemaTypes } from \"../types\";\n\n/**\n * Types whose runtime value is a JS array.\n *\n * `Array` and `Vector` are the same thing to every layer that copies, compares, hashes or\n * freezes a value — a vector is a list of numbers and nothing more. They differ only where a\n * backend chooses storage, which is the one place that should ask for `SchemaTypes.Vector` by\n * name.\n *\n * This exists so adding a third array-shaped type is one edit rather than a hunt through\n * twelve handlers. Missing one of those is silent in the worst way: a vector that clones by\n * reference is shared with the change tracker's copy, so overwriting an embedding produces no\n * diff and the save reports nothing to do.\n */\nconst ARRAY_VALUED_TYPES = new Set<SchemaTypes>([\n SchemaTypes.Array,\n SchemaTypes.Vector,\n]);\n\n/** True when the property's value is a JS array and needs value rather than reference semantics. */\nexport const isArrayValued = (type: SchemaTypes) => ARRAY_VALUED_TYPES.has(type);\n\n/**\n * True when the property's elements are primitives, so a spread is a sufficient copy.\n *\n * A vector is always numbers, so it never needs the per-element deep copy an array of objects\n * or dates does.\n */\nconst PRIMITIVE_ELEMENT_TYPES = new Set<SchemaTypes | undefined>([\n SchemaTypes.String,\n SchemaTypes.Number,\n SchemaTypes.Boolean,\n]);\n\nexport const hasPrimitiveElements = (type: SchemaTypes, elementType: SchemaTypes | undefined) =>\n type === SchemaTypes.Vector || PRIMITIVE_ELEMENT_TYPES.has(elementType);\n","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo } from \"../../../schema\";\n\n/**\n * Arrays participate in change tracking: the array itself is wrapped in the tracking\n * proxy (with the root as parent) so in-place mutations — push/splice/index writes —\n * mark the root entity dirty instead of being silently lost on save.\n */\nexport class EnrichmentArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n\n // Place the property in the enriched literal like any other leaf\n this.setEnrichedProperty(property, builder);\n\n const enrichedPath = property.getAssignmentPath({ parent: \"enriched\" });\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n\n ifsSlot.if(`${enrichedPath} != null`).appendBody(`${enrichedPath} = enableChangeTracking(${enrichedPath}, \"${this.getTrackingPath(property)}\", enriched);`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { EnrichmentNullableObjectHandler } from \"./enrichment/EnrichmentNullableObjectHandler\";\nimport { EnrichmentObjectHandler } from \"./enrichment/EnrichmentObjectHandler\";\nimport { EnrichmentObjectIdentityHandler } from \"./enrichment/EnrichmentObjectIdentityHandler\";\nimport { EnrichmentPrimitiveIdentityHandler } from \"./enrichment/EnrichmentPrimitiveIdentityHandler\";\nimport { EnrichmentPrimitiveHandler } from './enrichment/EnrichmentPrimitiveHandler';\nimport { EnrichmentFunctionHandler } from './enrichment/EnrichmentFunctionHandler';\nimport { EnrichmentDefaultValueHandler } from './enrichment/EnrichmentDefaultValueHandler';\nimport { EnrichmentDefaultFunctionHandler } from './enrichment/EnrichmentDefaultFunctionHandler';\nimport { EnrichmentComputedValueHandler } from './enrichment/EnrichmentComputedValueHandler';\nimport { EnrichmentArrayHandler } from './enrichment/EnrichmentArrayHandler';\n\n/// Purpose: \nexport class EnrichmentHandlerBuilder {\n\n build() {\n const handler = new EnrichmentPrimitiveIdentityHandler();\n\n handler.setNext(new EnrichmentObjectIdentityHandler())\n .setNext(new EnrichmentObjectHandler())\n .setNext(new EnrichmentNullableObjectHandler())\n .setNext(new EnrichmentFunctionHandler())\n .setNext(new EnrichmentDefaultValueHandler())\n .setNext(new EnrichmentDefaultFunctionHandler())\n .setNext(new EnrichmentComputedValueHandler())\n .setNext(new EnrichmentArrayHandler())\n .setNext(new EnrichmentPrimitiveHandler());\n\n return handler;\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class MergeDefaultFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n // we only want this to run if the value for the property is null\n // we are changing merge to be more like enrich so we can handle injections\n // we may need to change more. Need to move towards factories\n if (property.defaultValue != null && typeof property.defaultValue === \"function\") {\n const defaultFunctionParameters: string[] = [];\n\n if (property.injected != null) {\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n defaultFunctionParameters.push(parameter.name);\n }\n\n // A defaulted property still merges from the source; the default only fills\n // the gap when neither side has a value\n this.emitMergeCopy(property, builder, { onlyWhenChanged: true });\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n // we only want to run if the destination is null; the guarded selector keeps\n // the check from throwing when a destination ancestor is absent\n const selectorPath = property.getSelectrorPath({ parent: \"destination\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const assignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.header\");\n const defaultFunctionWithParameters = this.toNamedFunction(property.defaultValue.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionParameters.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n const defaultIf = ifsSlot.if(`${selectorPath} == null`);\n this.emitDestinationAncestorGuards(property, defaultIf);\n defaultIf.appendBody(`${assignmentPath} = ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Object containers are not merged directly — their child properties merge\n * individually and materialize the destination ancestors they need.\n */\nexport class MergeObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class MergePrimitiveHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n this.emitMergeCopy(property, builder);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class MergeComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed) {\n const parameterNames: string[] = [\"source\", \"collectionName\"];\n\n if (property.injected != null) {\n\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n parameterNames.push(parameter.name);\n }\n\n const declarationsSlot = builder.get<SlotBlock>(\"factory.function.header\");\n const defaultFunctionWithParameters = this.toNamedFunction(property.functionBody.toString(), declarationsSlot);\n\n defaultFunctionWithParameters.builder.parameters(...parameterNames.map((w, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: w })));\n\n const slot = builder.get<SlotBlock>(\"factory.function.assignments\");\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n // We want to recompute the value always in case there are changes\n slot.assign(enrichedAssignmentPath).value(defaultFunctionWithParameters.builder.toCallable());\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, FunctionFactoryBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class MergeDefaultValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.defaultValue != null && typeof property.defaultValue !== \"function\") {\n const defaultFunctionParameters: string[] = [];\n\n if (property.injected != null) {\n const factory = builder.get<FunctionFactoryBuilder>(\"factory\");\n const parameter = factory.createParameter(property.injected);\n factory.parameters(parameter);\n\n defaultFunctionParameters.push(parameter.name);\n }\n\n // A defaulted property still merges from the source; the default only fills\n // the gap when neither side has a value\n this.emitMergeCopy(property, builder, { onlyWhenChanged: true });\n\n const ifsSlot = builder.get<SlotBlock>(\"factory.function.ifs\");\n // we only want to run if the destination is null; the guarded selector keeps\n // the check from throwing when a destination ancestor is absent\n const selectorPath = property.getSelectrorPath({ parent: \"destination\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const assignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n const defaultIf = ifsSlot.if(`${selectorPath} == null`);\n this.emitDestinationAncestorGuards(property, defaultIf);\n defaultIf.appendBody(`${assignmentPath} = ${typeof property.defaultValue === \"string\" ? `\"${property.defaultValue}\"` : property.defaultValue}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class MergeFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo } from \"../../../schema\";\n\n/**\n * Merges an array by copying elements INTO the destination's existing array instead of\n * replacing the reference.\n *\n * The reference matters: a change-tracked entity holds its array wrapped in a tracking\n * proxy, and merge runs paused — a plain `destination.values = source.values` discards\n * that proxy silently, so every in-place mutation made after the entity's first save\n * (afterPersist merges the plugin's echo into the canonical) was no longer tracked and\n * vanished on the next save (defect #12). Copying in place keeps the caller's array\n * reference stable and the proxy installed, and shares no reference with the source.\n *\n * When the destination has no array yet there is nothing to preserve, so the source\n * reference is adopted as-is — same as the primitive copy this replaces.\n */\nexport class MergeArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n const selectorPath = property.getSelectrorPath({ parent: \"source\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"factory.function.assignments\");\n const sourcePath = property.getAssignmentPath({ parent: \"source\" });\n const destinationPath = property.getAssignmentPath({ parent: \"destination\" });\n\n const ifBlock = slot.if(`${selectorPath} != null`);\n this.emitDestinationAncestorGuards(property, ifBlock);\n\n ifBlock.appendBody(`if (${destinationPath} == null) { ${destinationPath} = ${sourcePath} } else if (${destinationPath} !== ${sourcePath}) { ${destinationPath}.length = 0; for (let i = 0; i < ${sourcePath}.length; i++) { ${destinationPath}[i] = ${sourcePath}[i]; } }`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { MergeDefaultFunctionHandler } from \"./merge/MergeDefaultFunctionHandler\";\nimport { MergeObjectHandler } from \"./merge/MergeObjectHandler\";\nimport { MergePrimitiveHandler } from \"./merge/MergePrimitiveHandler\";\nimport { MergeComputedValueHandler } from \"./merge/MergeComputedValueHandler\";\nimport { MergeDefaultValueHandler } from \"./merge/MergeDefaultValueHandler\";\nimport { MergeFunctionHandler } from \"./merge/MergeFunctionHandler\";\nimport { MergeArrayHandler } from \"./merge/MergeArrayHandler\";\n\n/// Purpose: Should recompute computed properties\nexport class MergeHandlerBuilder {\n\n build() {\n const handler = new MergeDefaultFunctionHandler();\n handler.setNext(new MergeDefaultValueHandler())\n .setNext(new MergeFunctionHandler())\n .setNext(new MergeComputedValueHandler())\n // Before the primitive handler: arrays would otherwise fall through to its\n // reference copy, which discards the destination array's tracking proxy\n .setNext(new MergeArrayHandler())\n .setNext(new MergePrimitiveHandler())\n .setNext(new MergeObjectHandler());\n\n return handler;\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class PrepareIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true) {\n const selectorPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"assignments\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"result\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class PrepareKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey === true) {\n const selectorPath = property.getSelectrorPath({ parent: \"entity\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"assignments\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"result\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class PrepareValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n // Remap the property to the name in the database if from is set\n const name = property.from != null ? property.from : property.name;\n\n if (property.parent == null) {\n objectBuilder.property(`${name}: ${entitySelectorPath}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${name}: ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class PrepareObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"result\", \"variable\", \"object\");\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n // There is a chance this is the first property we handle,\n // if that is the case, the main result variable will not be\n // constructed yet\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n // Prepare emits the storage shape — renamed object containers keep\n // their `from` (storage) key; the block name stays the property name\n // so child lookups by name still resolve\n if (property.parent == null) {\n objectBuilder.nested(property.getResolvedName(), property.name)\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.nested(property.getResolvedName(), property.name)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n// Do nothing with the value\nexport class PrepareComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class PrepareFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions are always unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { PrepareIdentityHandler } from \"./prepare/PrepareIdentityHandler\";\nimport { PrepareKeyHandler } from \"./prepare/PrepareKeyHandler\";\nimport { PrepareValueHandler } from \"./prepare/PrepareValueHandler\";\nimport { PrepareObjectHandler } from \"./prepare/PrepareObjectHandler\";\nimport { PrepareComputedValueHandler } from \"./prepare/PrepareComputedValueHandler\";\nimport { PrepareFunctionHandler } from \"./prepare/PrepareFunctionHandler\";\n\n/// Purpose: Called before we save entities to the database. Responsible for cleaning up\n/// an entity before it is sent to the plugin\nexport class PrepareHandlerBuilder {\n\n build() {\n const handler = new PrepareIdentityHandler();\n handler\n .setNext(new PrepareFunctionHandler())\n .setNext(new PrepareComputedValueHandler())\n .setNext(new PrepareKeyHandler())\n .setNext(new PrepareObjectHandler())\n .setNext(new PrepareValueHandler());\n\n return handler;\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class StripObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"result.variable.object\");\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n if (property.parent == null) {\n objectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { PropertyInfo, SchemaTypes } from \"../../../schema\";\nimport { PropertyInfoHandler } from \"../types\";\nimport { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\n\nexport class StripValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n // There is a chance this is the first property we handle,\n // if that is the case, the main result variable will not be\n // constructed yet\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n if (property.parent == null) {\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class StripKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class StripIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Functions never persist — strip removes them along with keys and identities.\n */\nexport class StripFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Function) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Unmapped computed properties never persist — strip removes them along with\n * keys and identities.\n */\nexport class StripComputedHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { StripObjectHandler } from \"./strip/StripObjectHandler\";\nimport { StripValueHandler } from \"./strip/StripValueHandler\";\nimport { StripKeyHandler } from \"./strip/StripKeyHandler\";\nimport { StripIdentityHandler } from \"./strip/StripIdentityHandler\";\nimport { StripFunctionHandler } from \"./strip/StripFunctionHandler\";\nimport { StripComputedHandler } from \"./strip/StripComputedHandler\";\n\n/// Purpose: builds the strip function, which returns an entity without its\n/// keys, identities, and unmapped properties\nexport class StripHandlerBuilder {\n\n build() {\n const handler = new StripIdentityHandler();\n\n handler.setNext(new StripKeyHandler())\n .setNext(new StripFunctionHandler())\n .setNext(new StripComputedHandler())\n .setNext(new StripObjectHandler())\n .setNext(new StripValueHandler());\n\n return handler;\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { hasPrimitiveElements, isArrayValued, PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CloneArrayHandler extends PropertyInfoHandler {\n\n /** See `CloneValueHandler`. */\n constructor(private readonly useFromPropertyName: boolean = false) {\n super();\n }\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n\n // Arrays are leaf properties — they have no child PropertyInfos, so the\n // copy must happen here for every array, including nullable/optional ones.\n // The `!== undefined` guard below covers absent values; an explicit null is copied as\n // null (see CloneValueHandler and known-defects #66), which is why every copy\n // expression is wrapped rather than applied directly — `[...null]` throws.\n const useFromPropertyName = this.useFromPropertyName;\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\", useFromPropertyName });\n\n const slot = builder.get<SlotBlock>(\"if\");\n const resultAssignmentPath = property.getAssignmentPath({ parent: \"result\", useFromPropertyName });\n\n // Primitive elements copy with a spread; anything that can hold nested\n // references (objects, dates, nested arrays) needs a deep copy or the\n // clone shares element references with the source. Dates get an explicit\n // per-element copy rather than structuredClone: structuredClone can return\n // Dates from a foreign realm (e.g. under jest), which fail `instanceof Date`.\n // Deep copies go per ELEMENT, never structuredClone on the array itself: a\n // change-tracked entity's array is wrapped in a Proxy (and stays wrapped\n // across merges), and a Proxy cannot pass a structured-clone boundary.\n const elementType = property.innerSchema?.type;\n let copyExpression: string;\n if (hasPrimitiveElements(property.type, elementType)) {\n copyExpression = `[...${entitySelectorPath}]`;\n } else if (elementType === SchemaTypes.Date) {\n copyExpression = `${entitySelectorPath}.map(function (v) { return v == null ? v : new Date(v); })`;\n } else {\n copyExpression = `${entitySelectorPath}.map(function (v) { return v == null ? v : structuredClone(v); })`;\n }\n\n // A null array is still a null, not an empty one, and neither spread nor map survives it\n const nullSafeCopy = `${entitySelectorPath} === null ? null : ${copyExpression}`;\n\n if (property.parent == null) {\n slot.if(`${entitySelectorPath} !== undefined`).appendBody(`${resultAssignmentPath} = ${nullSafeCopy}`);\n return builder;\n }\n\n // Nested array: ensure parent exists, then assign the copy (same pattern as CloneValueHandler)\n const parentPathArray = property.getParentPathArray({ useFromPropertyName });\n const ifSlot = slot.if(`${entitySelectorPath} !== undefined`);\n\n for (let i = 0; i < parentPathArray.length; i++) {\n const pathSoFar = [\"result\", ...parentPathArray.slice(0, i + 1)].join(\".\");\n ifSlot.appendBody(`if (${pathSoFar} == null) ${pathSoFar} = {};`);\n }\n ifSlot.appendBody(`${resultAssignmentPath} = ${nullSafeCopy};`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Copies Date properties by value. A reference copy would let a mutation of the\n * clone's Date (e.g. setHours) silently change the source entity.\n */\n// See CloneValueHandler for why the guard is `!== undefined` (known-defects #66).\nexport class CloneDateHandler extends PropertyInfoHandler {\n\n /** See `CloneValueHandler`. */\n constructor(private readonly useFromPropertyName: boolean = false) {\n super();\n }\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n const slot = builder.get<SlotBlock>(\"if\");\n const useFromPropertyName = this.useFromPropertyName;\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\", useFromPropertyName });\n const resultAssignmentPath = property.getAssignmentPath({ parent: \"result\", useFromPropertyName });\n\n // Stored values can still be serialized strings; only wrap real Dates. A null falls\n // through this expression unchanged, which is what the `!== undefined` guard wants.\n const copyExpression = `${entitySelectorPath} instanceof Date ? new Date(${entitySelectorPath}.getTime()) : ${entitySelectorPath}`;\n\n if (property.parent == null) {\n slot.if(`${entitySelectorPath} !== undefined`).appendBody(`${resultAssignmentPath} = ${copyExpression}`);\n return builder;\n }\n\n // Nested property: ensure every ancestor object exists, then assign (same pattern as CloneValueHandler)\n const parentPathArray = property.getParentPathArray({ useFromPropertyName });\n const ifSlot = slot.if(`${entitySelectorPath} !== undefined`);\n\n for (let i = 0; i < parentPathArray.length; i++) {\n const pathSoFar = [\"result\", ...parentPathArray.slice(0, i + 1)].join(\".\");\n ifSlot.appendBody(`if (${pathSoFar} == null) ${pathSoFar} = {};`);\n }\n ifSlot.appendBody(`${resultAssignmentPath} = ${copyExpression};`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CloneObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n\n // Child properties will take care of this\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * `!== undefined`, not `!= null`.\n *\n * An explicit `null` is a VALUE and has to survive the copy; an absent or `undefined` property is\n * not there and must not be invented. The loose guard conflated the two and dropped every null,\n * which is how a `s.string().nullable()` written as `null` came back as `undefined` from the\n * memory family — see known-defects #66. It was invisible for a long time because the change\n * tracker merges a read into the canonical entity the caller still holds, so the null appeared to\n * survive right up until something read storage without one (a join).\n */\nexport class CloneValueHandler extends PropertyInfoHandler {\n\n /**\n * When true, emit reads and writes under the STORAGE name (`from`) instead of the\n * in-memory name. See `CloneHandlerBuilder.build`.\n */\n constructor(private readonly useFromPropertyName: boolean = false) {\n super();\n }\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n // Anything that copies by assignment. An array-valued property must not land here:\n // assigning the reference shares it with the source, which is the whole point of\n // CloneArrayHandler.\n if (property.type != SchemaTypes.Object && isArrayValued(property.type) === false) {\n const slot = builder.get<SlotBlock>(\"if\");\n const useFromPropertyName = this.useFromPropertyName;\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\", useFromPropertyName });\n const resultAssignmentPath = property.getAssignmentPath({ parent: \"result\", useFromPropertyName });\n\n if (property.parent == null) {\n // we are a first level property\n slot.if(`${entitySelectorPath} !== undefined`).appendBody(`${resultAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n // Nested property: ensure every ancestor object exists, then assign (handles depth > 2)\n const parentPathArray = property.getParentPathArray({ useFromPropertyName });\n const ifSlot = slot.if(`${entitySelectorPath} !== undefined`);\n\n for (let i = 0; i < parentPathArray.length; i++) {\n const pathSoFar = [\"result\", ...parentPathArray.slice(0, i + 1)].join(\".\");\n ifSlot.appendBody(`if (${pathSoFar} == null) ${pathSoFar} = {};`);\n }\n ifSlot.appendBody(`${resultAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CloneArrayHandler } from \"./clone/CloneArrayHandler\";\nimport { CloneDateHandler } from \"./clone/CloneDateHandler\";\nimport { CloneObjectHandler } from \"./clone/CloneObjectHandler\";\nimport { CloneValueHandler } from \"./clone/CloneValueHandler\";\n\n/// Purpose: builds the handler chain for the generated clone function, which\n/// deep-copies an entity so callers can never mutate stored data by reference\nexport class CloneHandlerBuilder {\n\n /**\n * @param useFromPropertyName Emit the STORAGE shape rather than the in-memory shape.\n *\n * A record that has not been read back into memory yet still carries its `from` names, so a\n * cloner generated from in-memory names would read `undefined` for every renamed property and\n * silently drop it. Passing true swaps both the reads and the writes to the storage name, which\n * gives a copier for records in that shape. Everything else about the chain is identical —\n * the same handlers, in the same order, with the same null and Date semantics.\n */\n build(useFromPropertyName: boolean = false) {\n const handler = new CloneObjectHandler();\n handler\n .setNext(new CloneDateHandler(useFromPropertyName))\n .setNext(new CloneValueHandler(useFromPropertyName))\n .setNext(new CloneArrayHandler(useFromPropertyName));\n\n return handler;\n }\n}\n","import { AndBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo } from \"../../../schema\";\n\nexport class CompareArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n let compare = builder.getOrDefault<AndBuilder>(\"result.variable.compare\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n if (compare == null) {\n compare = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n // Named \"compare\" so every compare handler finds the same block\n // regardless of which property type is iterated first\n .and(`JSON.stringify(${leftCompare}) === JSON.stringify(${rightCompare})`, { name: \"compare\" });\n return builder;\n }\n\n compare.and(`JSON.stringify(${leftCompare}) === JSON.stringify(${rightCompare})`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Unmapped computed properties are excluded from comparison — they derive from\n * other properties, which are compared directly.\n */\nexport class CompareComputedHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { AndBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CompareDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n let compare = builder.getOrDefault<AndBuilder>(\"result.variable.compare\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n if (compare == null) {\n compare = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n // Named \"compare\" so every compare handler finds the same block\n // regardless of which property type is iterated first\n .and(`${leftCompare}?.toISOString() === ${rightCompare}?.toISOString()`, { name: \"compare\" });\n return builder;\n }\n\n compare.and(`${leftCompare}?.toISOString() === ${rightCompare}?.toISOString()`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Functions are excluded from comparison — enrichment assigns a fresh closure\n * per entity, so a reference comparison would report every pair as different.\n */\nexport class CompareFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Function) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CompareObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { AndBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class CompareValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object) {\n let compare = builder.getOrDefault<AndBuilder>(\"result.variable.compare\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n if (compare == null) {\n compare = builder.get<SlotBlock>(\"result\")\n .assign(\"const result\", { name: \"variable\" })\n .and(`${leftCompare} === ${rightCompare}`, { name: \"compare\" });\n return builder;\n }\n\n compare.and(`${leftCompare} === ${rightCompare}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CompareArrayHandler } from \"./compare/CompareArrayHandler\";\nimport { CompareComputedHandler } from \"./compare/CompareComputedHandler\";\nimport { CompareDateHandler } from \"./compare/CompareDateHandler\";\nimport { CompareFunctionHandler } from \"./compare/CompareFunctionHandler\";\nimport { CompareObjectHandler } from \"./compare/CompareObjectHandler\";\nimport { CompareValueHandler } from \"./compare/CompareValueHandler\";\n\nexport class CompareHandlerBuilder {\n\n build() {\n const handler = new CompareObjectHandler();\n handler.setNext(new CompareFunctionHandler())\n .setNext(new CompareComputedHandler())\n .setNext(new CompareArrayHandler())\n .setNext(new CompareDateHandler())\n .setNext(new CompareValueHandler());\n\n return handler;\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"result.variable.object\");\n\n // Create the result object when this is the first property iterated —\n // handler output cannot depend on schema property order\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const entity\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n // The output entity is the in-memory shape — its keys are property\n // names; `from` names only appear on the unserialized (read) side\n if (property.parent == null) {\n objectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.nested(property.name, property.name)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object && property.type != SchemaTypes.Date) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n // Deserialize maps storage shape -> in-memory shape: read the incoming\n // record by `from` (storage) name; the selector path adds `?.` so\n // absent nullable parents read as undefined instead of throwing\n const entitySelectorPath = property.getSelectrorPath({ parent: \"unserialized\", useFromPropertyName: true });\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const entity\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n if (property.parent == null) {\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${property.name}: ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ContainerBlock, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Handles converting a string value from a database to a Date value\n */\nexport class DeserializeDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n const slotPath = new SlotPath(\"result.variable.object\");\n\n // Create the result object when this is the first property iterated —\n // handler output cannot depend on schema property order\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const entity\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n // Deserialize maps storage shape -> in-memory shape: read the incoming\n // record by `from` (storage) name, write the entity by property name\n const entitySelectorPath = property.getSelectrorPath({ parent: \"unserialized\", useFromPropertyName: true });\n const entityAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n const assignment = `${property.name}: typeof ${entitySelectorPath} === \"string\" ? new Date(${entitySelectorPath}) : ${entitySelectorPath}`;\n\n // if it is nullable or optional, assign in an if block, otherwise we\n // could unintentionally assign a property that does not exist. An explicit null IS\n // assigned — a stored null is a value, and dropping it is known-defects #66. The\n // expression passes null through, since null is not a string.\n if (property.isOptional || property.isNullable) {\n const ifAssignment = `${entityAssignmentPath} = typeof ${entitySelectorPath} === \"string\" ? new Date(${entitySelectorPath}) : ${entitySelectorPath}`;\n const rootPath = new SlotPath(\"if\");\n builder.get<ContainerBlock>(rootPath.get()).if(`${entitySelectorPath} !== undefined`).appendBody(ifAssignment);\n return builder;\n }\n\n // A date cannot be a nested object, just do the assignment\n if (property.parent == null) {\n objectBuilder.property(assignment);\n\n return builder;\n }\n\n slotPath.push(...property.getParentPathArray());\n const nestedObjectBuilder = builder.get<ObjectBuilder>(slotPath.get());\n nestedObjectBuilder.property(assignment)\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n // Do nothing with the value\n if (property.functionBody != null && property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class DeserializeFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions are always unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class DeserializeDeserializerHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.valueDeserializer != null) {\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(\"result.variable.object\");\n const assignmentBuilder = builder.getOrDefault<SlotBlock>(\"functions\");\n // Read the incoming record by `from` (storage) name\n const entitySelectorPath = property.getSelectrorPath({ parent: \"unserialized\", useFromPropertyName: true });\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const entity\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n const defaultFunctionWithParameters = this.toNamedFunction(property.valueDeserializer.toString(), assignmentBuilder);\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map((_, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: entitySelectorPath })));\n\n if (property.parent == null) {\n objectBuilder.property(`${property.name}: ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n const slotPath = new SlotPath(...property.getParentPathArray());\n objectBuilder = objectBuilder.get<ObjectBuilder>(slotPath.get());\n objectBuilder.property(`${property.name}: ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, ContainerBlock, ObjectBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Deserializes arrays per element instead of copying the reference:\n *\n * - Date elements are revived from strings (same convention as DeserializeDateHandler).\n * - Everything else is copied with a spread, so the entity shares no references with\n * the storage record.\n */\nexport class DeserializeArrayHandler extends PropertyInfoHandler {\n\n private copyExpression(property: PropertyInfo<any>, selector: string): string {\n const elementType = property.innerSchema?.type;\n\n if (elementType === SchemaTypes.Date) {\n return `${selector}.map(function (v) { return typeof v === \"string\" ? new Date(v) : v; })`;\n }\n\n return `[...${selector}]`;\n }\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n const slotPath = new SlotPath(\"result.variable.object\");\n\n // Create the result object when this is the first property iterated —\n // handler output cannot depend on schema property order\n let objectBuilder = builder.getOrDefault<ObjectBuilder>(slotPath.get());\n\n if (objectBuilder == null) {\n objectBuilder = builder.get<SlotBlock>(\"result\")\n .assign(\"const entity\", { name: \"variable\" })\n .object({ name: \"object\" });\n }\n\n // Deserialize maps storage shape -> in-memory shape: read the incoming\n // record by `from` (storage) name, write the entity by property name\n const entitySelectorPath = property.getSelectrorPath({ parent: \"unserialized\", useFromPropertyName: true });\n const entityAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n const valueExpression = `${entitySelectorPath} == null ? ${entitySelectorPath} : ${this.copyExpression(property, entitySelectorPath)}`;\n\n // if it is nullable or optional, assign in an if block, otherwise we\n // could unintentionally assign a property that does not exist. An explicit null IS\n // assigned — a stored null is a value, and dropping it is known-defects #66.\n // `valueExpression` rather than the bare copy: neither a spread nor a map survives a\n // null, so the copy has to stay behind its own null check.\n if (property.isOptional || property.isNullable) {\n const rootPath = new SlotPath(\"if\");\n builder.get<ContainerBlock>(rootPath.get()).if(`${entitySelectorPath} !== undefined`).appendBody(`${entityAssignmentPath} = ${valueExpression}`);\n return builder;\n }\n\n if (property.parent == null) {\n objectBuilder.property(`${property.name}: ${valueExpression}`);\n return builder;\n }\n\n const nestedSlotPath = new SlotPath(...property.getParentPathArray());\n const nestedObjectBuilder = objectBuilder.get<ObjectBuilder>(nestedSlotPath.get());\n nestedObjectBuilder.property(`${property.name}: ${valueExpression}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { DeserializeObjectHandler } from \"./deserialize/DeserializeObjectHandler\";\nimport { DeserializeValueHandler } from \"./deserialize/DeserializeValueHandler\";\nimport { DeserializeDateHandler } from \"./deserialize/DeserializeDateHandler\";\nimport { DeserializeComputedValueHandler } from \"./deserialize/DeserializeComputedValueHandler\";\nimport { DeserializeFunctionHandler } from \"./deserialize/DeserializeFunctionHandler\";\nimport { DeserializeDeserializerHandler } from \"./deserialize/DeserializeDeserializerHandler\";\nimport { DeserializeArrayHandler } from \"./deserialize/DeserializeArrayHandler\";\n\n/// Purpose:\nexport class DeserializeHandlerBuilder {\n\n build() {\n const handler = new DeserializeObjectHandler();\n handler\n .setNext(new DeserializeDeserializerHandler())\n .setNext(new DeserializeComputedValueHandler())\n .setNext(new DeserializeFunctionHandler())\n .setNext(new DeserializeArrayHandler())\n .setNext(new DeserializeValueHandler())\n .setNext(new DeserializeDateHandler());\n\n return handler;\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class HashTypeValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey && property.isIdentity) {\n const slot = builder.get<SlotBlock>(\"ifs\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n slot.if(`${entitySelectorPath} == null`).appendBody(`return \"Object\"`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { NotApplicableHandler } from \"./types\";\nimport { HashTypeValueHandler } from \"./hashType/HashTypeValueHandler\";\n\n/// Purpose: \nexport class HashTypeHandlerBuilder {\n\n build() {\n const handler = new HashTypeValueHandler();\n\n handler.setNext(new NotApplicableHandler());\n\n return handler;\n }\n}","import { ArrayBuilder, CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class IdSelectorValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey) {\n let arrayBuilder = builder.getOrDefault<ArrayBuilder>(\"result.variable.array\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n\n if (arrayBuilder == null) {\n arrayBuilder = builder.get<SlotBlock>(\"result\")\n .variable(\"result\", { name: \"variable\" })\n .array(`${entitySelectorPath}`, { name: \"array\" });\n\n return builder;\n }\n\n\n arrayBuilder.append(`${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { NotApplicableHandler } from \"./types\";\nimport { IdSelectorValueHandler } from \"./idSelector/IdSelectorValueHandler\";\n/// Purpose: \nexport class IdSelectorHandlerBuilder {\n\n build() {\n const handler = new IdSelectorValueHandler();\n\n handler.setNext(new NotApplicableHandler());\n\n return handler;\n }\n}","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class HashKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey === true) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-id-if.if-body.variable.string\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-id-if.if-body\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(\"${\" + entitySelectorPath + \"}\")\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type !== SchemaTypes.Object) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-object-return.variable.string\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-object-return\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(\"${\" + entitySelectorPath + \"}\")\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-object-return.variable.string\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-object-return\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(\"${stringifyDate(\" + entitySelectorPath + \")}\")\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class HashIdentityHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isIdentity === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions are always unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class HashComputedValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo } from \"../../../schema\";\n\n/**\n * Hashes array contents via JSON — template interpolation of an array of\n * objects would collapse every value to \"[object Object]\" and collide.\n */\nexport class HashArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-object-return.variable.string\");\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-object-return\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(\"${JSON.stringify(\" + entitySelectorPath + \")}\")\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Object containers are not hashed directly — their child properties hash\n * individually, which keeps the hash stable across key insertion order.\n */\nexport class HashObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * A file takes no part in the hash that correlates an addition with what came back.\n *\n * The hash exists to match a submitted entity against the row the database echoed, which is\n * why identity values are already excluded: the database assigns them, so they differ on the\n * two sides by design.\n *\n * A file is the same situation one step out. What is submitted is content; what is stored, and\n * echoed, is a reference. Hashing the VALUE produced two different hashes for the same\n * addition and the change tracker reported \"Cannot find internal addition\" on every save with\n * a file.\n *\n * It contributes a constant rather than nothing at all. The `result` string is created by\n * whichever handler runs first, so a schema whose only non-identity properties are files —\n * an assets row holding an original and a thumbnail, say — would emit no declaration and then\n * return it: `ReferenceError: result is not defined` at the first add. A constant keeps the\n * hash stable across the content-to-reference swap while still declaring the variable.\n */\nexport class HashFileHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.File) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-object-return.variable.string\");\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-object-return\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n // The property's NAME, not its value: stable on both sides of the swap, and still\n // distinct from a schema that does not have this file at all.\n stringBuilder.append(`file:${property.name}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder, SlotBlock, StringBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\n/**\n * A transformed property takes no part in the hash that correlates an addition with its echo.\n *\n * The hash matches a submitted entity against the row the database echoed, which is why\n * identity values are already excluded: the database assigns them, so the two sides differ by\n * design.\n *\n * A transform is the same situation. What is submitted is the application value and what is\n * stored is the transformed one, and a ONE-WAY transform — no `from` — never converts back, so\n * the echo legitimately differs and every save reported \"Cannot find internal addition\". A\n * two-way transform happens to restore the value before the comparison, but relying on that\n * would make correlation depend on whether a caller supplied `from`.\n *\n * It contributes the property NAME rather than nothing, so a schema whose only non-identity\n * properties are transformed still declares the `result` string the generated function\n * returns.\n */\nexport class HashTransformHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.transform != null) {\n let stringBuilder = builder.getOrDefault<StringBuilder>(\"hash-object-return.variable.string\");\n\n if (stringBuilder == null) {\n stringBuilder = builder.get<SlotBlock>(\"hash-object-return\")\n .assign(\"const result\", { name: \"variable\" })\n .string(\"template\", { name: \"string\" });\n }\n\n stringBuilder.append(`transform:${property.name}`);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { HashKeyHandler } from \"./hash/HashKeyHandler\";\nimport { HashValueHandler } from \"./hash/HashValueHandler\";\nimport { HashDateHandler } from \"./hash/HashDateHandler\";\nimport { HashIdentityHandler } from \"./hash/HashIdentityHandler\";\nimport { HashFunctionHandler } from \"./hash/HashFunctionHandler\";\nimport { HashComputedValueHandler } from \"./hash/HashComputedValueHandler\";\nimport { HashArrayHandler } from \"./hash/HashArrayHandler\";\nimport { HashObjectHandler } from \"./hash/HashObjectHandler\";\nimport { HashFileHandler } from \"./hash/HashFileHandler\";\nimport { HashTransformHandler } from \"./hash/HashTransformHandler\";\n\n/// Purpose:\n// Should ignore Id's and Identities for type Object because we want\n// to comare a new addition with what was saved in the database.\n// Files are ignored for the same reason: content goes in, a reference comes back.\n// So are transformed properties, whose stored form differs from the value submitted.\nexport class HashHandlerBuilder {\n\n build() {\n const handler = new HashKeyHandler();\n\n handler\n .setNext(new HashComputedValueHandler())\n .setNext(new HashFunctionHandler())\n .setNext(new HashIdentityHandler())\n .setNext(new HashFileHandler())\n .setNext(new HashTransformHandler())\n .setNext(new HashDateHandler())\n .setNext(new HashArrayHandler())\n .setNext(new HashObjectHandler())\n .setNext(new HashValueHandler());\n\n return handler;\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnableChangeTrackingObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const assignmentSlot = builder.get<SlotBlock>(\"assignment\");\n const childSelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const childAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n\n // Pass the root as parent so nested writes mark the root entity dirty,\n // and the full dotted path so the change is recorded under it\n assignmentSlot.if(`${childSelectorPath} != null`).appendBody(`${childAssignmentPath} = enableChangeTracking(${childAssignmentPath}, \"${this.getTrackingPath(property)}\", entity);`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo } from \"../../../schema\";\n\n/**\n * Arrays participate in change tracking: the array itself is wrapped in the tracking\n * proxy (with the root as parent) so in-place mutations — push/splice/index writes —\n * mark the root entity dirty instead of being silently lost on save.\n */\nexport class EnableChangeTrackingArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n const assignmentSlot = builder.get<SlotBlock>(\"assignment\");\n const childSelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const childAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n\n assignmentSlot.if(`${childSelectorPath} != null`).appendBody(`${childAssignmentPath} = enableChangeTracking(${childAssignmentPath}, \"${this.getTrackingPath(property)}\", entity);`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class EnableChangeTrackingPrimitiveValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type !== SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { EnableChangeTrackingObjectHandler } from \"./enableChangeTracking/EnableChangeTrackingObjectHandler\";\nimport { EnableChangeTrackingArrayHandler } from \"./enableChangeTracking/EnableChangeTrackingArrayHandler\";\nimport { EnableChangeTrackingPrimitiveValueHandler } from \"./enableChangeTracking/EnableChangeTrackingPrimitiveValueHandler\";\n\n/// Purpose:\nexport class EnableChangeTrackingHandlerBuilder {\n\n build() {\n const handler = new EnableChangeTrackingObjectHandler();\n handler.setNext(new EnableChangeTrackingArrayHandler()).setNext(new EnableChangeTrackingPrimitiveValueHandler());\n\n return handler;\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class FreezePrimitiveValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type !== SchemaTypes.Object) {\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class FreezeObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const assignmentSlot = builder.get<SlotBlock>(\"assignment\");\n const childSelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const childAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n\n assignmentSlot.if(`${childSelectorPath} != null`).unshiftBody(`${childAssignmentPath} = Object.freeze(${childAssignmentPath});`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo } from \"../../../schema\";\n\nexport class FreezeArrayHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n const assignmentSlot = builder.get<SlotBlock>(\"assignment\");\n const childSelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const childAssignmentPath = property.getAssignmentPath({ parent: \"entity\" });\n\n assignmentSlot.if(`${childSelectorPath} != null`).unshiftBody(`${childAssignmentPath} = Object.freeze(${childAssignmentPath});`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { FreezePrimitiveValueHandler } from \"./freeze/FreezePrimitiveValueHandler\";\nimport { FreezeObjectHandler } from \"./freeze/FreezeObjectHandler\";\nimport { FreezeArrayHandler } from \"./freeze/FreezeArrayHandler\";\n\n/// Purpose:\nexport class FreezeHandlerBuilder {\n\n build() {\n const handler = new FreezeObjectHandler();\n handler.setNext(new FreezeArrayHandler()).setNext(new FreezePrimitiveValueHandler());\n\n return handler;\n }\n}","import { CodeBuilder, ContainerBlock, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Handles converting a Date value from JavaScript to a string value. Should handle remapping here because it is the lowest level in the code here.\n * Remapping higher up could break lower level code\n */\nexport class SerializeDateHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Date) {\n let objectBuilder = builder.get<SlotBlock>(\"if\");\n // Serialize maps in-memory shape -> storage shape: read the entity by\n // property name, write the result by `from` (storage) name\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const entityAssignmentPath = property.getAssignmentPath({\n parent: \"result\",\n useFromPropertyName: true\n });\n\n // if it is nullable or optional, assign in an if block, otherwise we\n // could unintentionally assign a property that does not exist. An explicit null IS\n // assigned — it is a legal value, and dropping it here is known-defects #66. The\n // expression already passes null through, since null is not `instanceof Date`.\n if (property.isOptional || property.isNullable) {\n const ifAssignment = `${entityAssignmentPath} = ${entitySelectorPath} instanceof Date ? ${entitySelectorPath}.toISOString() : ${entitySelectorPath}`;\n const rootPath = new SlotPath(\"if\");\n builder.get<ContainerBlock>(rootPath.get()).if(`${entitySelectorPath} !== undefined`).appendBody(ifAssignment);\n return builder;\n }\n\n if (property.parent == null) {\n const dateExpr = `${entitySelectorPath} instanceof Date ? ${entitySelectorPath}.toISOString() : ${entitySelectorPath}`;\n objectBuilder.if(`Object.hasOwn(entity, \"${property.name}\")`).appendBody(`${entityAssignmentPath} = ${dateExpr}`);\n return builder;\n }\n\n // Nested date: same pattern as SerializeValueHandler — if block for parent existence, then assign with toISOString\n const dateExprNested = `${entitySelectorPath} instanceof Date ? ${entitySelectorPath}.toISOString() : ${entitySelectorPath}`;\n this.emitSerializeNestedAssignment(property, objectBuilder, dateExprNested);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { SlotPath } from '../../SlotPath';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\nexport class SerializeObjectHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Object) {\n const slotPath = new SlotPath(\"assignments\");\n // The result is the storage shape — materialize the container under\n // its `from` (storage) name\n const childPath = property.getAssignmentPath({\n parent: \"result\",\n useFromPropertyName: true\n });\n\n if (property.isNullable || property.isOptional) {\n // Do nothing if it's nullable or optional as property assignments will check\n // and create if it does not exist. This way we can handle null/optional\n return builder;\n }\n\n const slot = builder.get<SlotBlock>(slotPath.get());\n slot.assign(`${childPath}`, { name: `[${childPath}]` }).value(\"{}\");\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class SerializeValueHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type != SchemaTypes.Object && property.type != SchemaTypes.Date) {\n const slot = builder.getOrDefault<SlotBlock>(\"if\");\n // Serialize maps in-memory shape -> storage shape: read the entity by\n // property name, write the result by `from` (storage) name\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const resultSelectorPath = property.getAssignmentPath({ parent: \"result\", useFromPropertyName: true });\n\n if (property.parent == null) {\n // Only assign if the incoming entity has the property, this allows partial serialization\n // Basically only serialize what is there\n slot.if(`Object.hasOwn(entity, \"${property.name}\")`).appendBody(`${resultSelectorPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n this.emitSerializeNestedAssignment(property, slot, entitySelectorPath);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class SerializeSerializerHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.valueSerializer != null) {\n const slot = builder.getOrDefault<SlotBlock>(\"if\");\n const assignmentBuilder = builder.getOrDefault<SlotBlock>(\"functions\");\n // Serialize maps in-memory shape -> storage shape: read the entity by\n // property name, write the result by `from` (storage) name\n const entitySelectorPath = property.getSelectrorPath({ parent: \"entity\" });\n const resultSelectorPath = property.getAssignmentPath({ parent: \"result\", useFromPropertyName: true });\n\n const defaultFunctionWithParameters = this.toNamedFunction(property.valueSerializer.toString(), assignmentBuilder);\n defaultFunctionWithParameters.builder.parameters(...defaultFunctionWithParameters.parameters.map((_, i) => ({ name: defaultFunctionWithParameters.parameters[i], callName: entitySelectorPath })));\n\n if (property.parent == null) {\n slot.if(`Object.hasOwn(entity, \"${property.name}\")`).appendBody(`${resultSelectorPath} = ${defaultFunctionWithParameters.builder.toCallable()}`);\n return builder;\n }\n\n // Nested serializer: same pattern as SerializeValueHandler — if block for parent existence, then assign via serializer\n this.emitSerializeNestedAssignment(property, slot, defaultFunctionWithParameters.builder.toCallable());\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class SerializeFunctionHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.functionBody != null && property.type === SchemaTypes.Function) {\n // Functions should not be serialized\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo, SchemaTypes } from \"../../../schema\";\n\nexport class SerializeComputedHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.type === SchemaTypes.Computed && property.isUnmapped === true) {\n // Do not serialize computed properties that are unmapped\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { isArrayValued, PropertyInfo, SchemaTypes } from \"../../../schema\";\n\n/**\n * Serializes arrays per element instead of copying the reference:\n *\n * - Date elements become ISO strings (same convention as SerializeDateHandler).\n * - Object elements are deep-copied so the storage payload shares no references\n * with the entity.\n * - Primitive elements are copied with a spread.\n *\n * Producing a NEW array also matters for change tracking: tracked entities hold\n * arrays wrapped in a Proxy, which cannot pass a structured-clone boundary\n * (BroadcastChannel.postMessage) — the serialized payload must be plain data.\n */\nexport class SerializeArrayHandler extends PropertyInfoHandler {\n\n private copyExpression(property: PropertyInfo<any>, selector: string): string {\n const elementType = property.innerSchema?.type;\n\n if (elementType === SchemaTypes.Date) {\n return `${selector}.map(function (v) { return v instanceof Date ? v.toISOString() : v; })`;\n }\n\n if (elementType === SchemaTypes.Object || elementType === SchemaTypes.Array || elementType === SchemaTypes.Definition) {\n return `${selector}.map(function (v) { return v == null ? v : structuredClone(v); })`;\n }\n\n return `[...${selector}]`;\n }\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (isArrayValued(property.type)) {\n const slot = builder.get<SlotBlock>(\"if\");\n // Serialize maps in-memory shape -> storage shape: read the entity by\n // property name, write the result by `from` (storage) name\n const entitySelectorPath = property.getAssignmentPath({ parent: \"entity\" });\n const resultSelectorPath = property.getAssignmentPath({ parent: \"result\", useFromPropertyName: true });\n\n // Null propagates as-is (nullable arrays); only real arrays are copied\n const valueExpression = `${entitySelectorPath} == null ? ${entitySelectorPath} : ${this.copyExpression(property, entitySelectorPath)}`;\n\n if (property.parent == null) {\n // Only assign if the incoming entity has the property, this allows partial\n // serialization (delta payloads carry only changed keys)\n slot.if(`Object.hasOwn(entity, \"${property.name}\")`).appendBody(`${resultSelectorPath} = ${valueExpression}`);\n return builder;\n }\n\n this.emitSerializeNestedAssignment(property, slot, valueExpression);\n\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}\n","import { SerializeDateHandler } from \"./serialize/SerializeDateHandler\";\nimport { SerializeObjectHandler } from \"./serialize/SerializeObjectHandler\";\nimport { SerializeValueHandler } from \"./serialize/SerializeValueHandler\";\nimport { SerializeSerializerHandler } from \"./serialize/SerializeSerializerHandler\";\nimport { SerializeFunctionHandler } from \"./serialize/SerializeFunctionHandler\";\nimport { SerializeComputedHandler } from \"./serialize/SerializeComputedHandler\";\nimport { SerializeArrayHandler } from \"./serialize/SerializeArrayHandler\";\n\n/// Purpose:\nexport class SerializeHandlerBuilder {\n\n build() {\n const handler = new SerializeSerializerHandler();\n handler\n .setNext(new SerializeComputedHandler())\n .setNext(new SerializeFunctionHandler())\n .setNext(new SerializeDateHandler())\n .setNext(new SerializeArrayHandler())\n .setNext(new SerializeValueHandler())\n .setNext(new SerializeObjectHandler());\n\n return handler;\n }\n}","import { now } from \"../../performance\";\nimport { Branded, uuid } from \"../../utilities\";\nimport { CompiledSchemaCore, ISchemaSubscription, SchemaId, SubscriptionChanges } from \"../types\";\n\ntype BroadcastChannelReceiverId = Branded<string, \"BroadcastChannelReceiverId\">;\ntype SubscriptionListenerCallback<T> = (changes: StampedChanges<T>) => void;\ntype BroadcastChannelType = InstanceType<typeof BroadcastChannel>;\ninterface ISubscriptionAction<T> {\n action(changes: StampedChanges<T>): void\n}\ntype StampedChanges<T> = { data: SubscriptionChanges<T>, timestamp: number };\n\nexport type SchemaSubscriptionOptions = {\n /**\n * Whether changes must reach listeners OUTSIDE this process — another browser tab, or\n * another worker thread in Node. Default `true`, which is the historical behaviour.\n *\n * It cannot be inferred. A BroadcastChannel gives a sender no way to ask who is on the\n * other end, so `send` can only count the listeners registered in THIS process. When\n * this is `true`, `send` must assume a listener it cannot see and always publish. When\n * a caller sets it to `false`, it promises there is no such listener, and `send` skips\n * the whole preprocess-and-post step whenever nobody local is listening.\n */\n crossTabSync?: boolean;\n};\n\nconst registry: Record<string, SchemaChannel<unknown>> = {};\n\n/**\n * Channels are scoped by schema AND database: two databases holding the same schema must not\n * see each other's change notifications, while instances of the same database (another tab, a\n * worker) share a scope and stay connected.\n *\n * Every datastore path supplies a scope — `IDbPlugin.databaseName` is required, so there is no\n * longer a plugin that leaves it out. The unscoped key remains for callers who create a\n * subscription directly off a schema without a database in hand; it is a channel per schema\n * across the whole process, which is what asking for no scope means. A SENDER that omits the\n * scope will not reach datastore listeners, because they are on `schema|databaseName`.\n */\nconst getChannelKey = (schemaId: SchemaId, scope?: string) => scope == null ? String(schemaId) : `${schemaId}|${scope}`;\n\nconst getChannelRegistry = <T>(schemaId: SchemaId, scope?: string): SchemaChannel<T> => {\n\n const key = getChannelKey(schemaId, scope);\n\n if (registry[key]) {\n return registry[key] as SchemaChannel<T>;\n }\n\n const channel = new SchemaChannel<T>(key);\n\n registry[key] = channel;\n\n return channel;\n}\n\n// Must have a sender and receiver. Sender cannot listen for it's own message\nclass SchemaChannel<T> {\n\n readonly sender: SchemaChannelSender<T>;\n readonly receiver: SchemaChannelReceiver<T>;\n\n // An open BroadcastChannel keeps the event loop alive. Channels are shared per schema,\n // so the pair can only close once every subscription using them has been disposed —\n // hence a count rather than a boolean.\n private subscribers: number = 0;\n\n constructor(channelKey: string) {\n this.sender = new SchemaChannelSender<T>(channelKey);\n this.receiver = new SchemaChannelReceiver<T>(channelKey);\n }\n\n /**\n * How many callbacks in THIS process are waiting on the channel.\n *\n * Deliberately not `subscribers`: that counts SchemaSubscription instances, and a\n * DataStore constructs one per collection up front purely to SEND from, so it never\n * reaches zero. Only `onMessage` registers a listener, which is the thing a sender\n * can be skipped for. See `SchemaSubscription.send`.\n */\n get listenerCount() {\n return this.receiver.listenerCount;\n }\n\n retain() {\n this.subscribers++;\n }\n\n /** Returns true when the last subscriber released the channel. */\n release() {\n this.subscribers--;\n return this.subscribers <= 0;\n }\n\n close() {\n this.sender.close();\n this.receiver.close();\n }\n}\n\n/**\n * Stops a channel from holding the process open.\n *\n * A DataStore opens a sender and a receiver per collection, and in Node an open\n * BroadcastChannel is a referenced handle. Without this, any script that builds a store and\n * does not call `destroyAsync()` runs to the end of its code and then hangs forever with two\n * live MessagePorts per collection — including the example in the README.\n *\n * `unref` is Node-only; the browser's BroadcastChannel has no such method and needs none.\n * A channel that is unreferenced still sends and receives normally. It only stops being a\n * reason for the process to stay alive, which is the correct default for a library: a program\n * with no work left should exit.\n */\nconst unreference = (channel: BroadcastChannelType) => {\n const maybeUnref = (channel as { unref?: () => void }).unref;\n\n if (typeof maybeUnref === 'function') {\n maybeUnref.call(channel);\n }\n};\n\nclass SchemaChannelSender<T> {\n\n private readonly broadcastChannel: BroadcastChannelType;\n\n constructor(channelKey: string) {\n this.broadcastChannel = new BroadcastChannel(`__routier-schema-subscription-channel:${channelKey}`);\n unreference(this.broadcastChannel);\n }\n\n send(changes: StampedChanges<T>) {\n this.broadcastChannel.postMessage(changes)\n }\n\n close() {\n this.broadcastChannel.close();\n }\n}\n\nclass SchemaChannelReceiver<T> {\n\n private readonly broadcastChannel: BroadcastChannelType;\n private subscriptions: SubscriptionListener<T>[] = [];\n\n constructor(channelKey: string) {\n this.broadcastChannel = new BroadcastChannel(`__routier-schema-subscription-channel:${channelKey}`);\n unreference(this.broadcastChannel);\n\n this.broadcastChannel.onmessage = (e) => {\n\n // We can't send to the same instance it is not possbile\n const stampedChanges = e.data as StampedChanges<T>;\n\n for (let i = 0, length = this.subscriptions.length; i < length; i++) {\n const subscription = this.subscriptions[i];\n\n subscription.action(stampedChanges);\n }\n };\n }\n\n get listenerCount() {\n return this.subscriptions.length;\n }\n\n addListener(id: BroadcastChannelReceiverId, listener: SubscriptionListenerCallback<T>) {\n this.subscriptions.push(new SubscriptionListener<T>(id, listener));\n }\n\n removeListeners(id: BroadcastChannelReceiverId) {\n this.subscriptions = this.subscriptions.filter(w => w.id !== id);\n }\n\n close() {\n this.subscriptions = [];\n this.broadcastChannel.onmessage = null;\n this.broadcastChannel.close();\n }\n}\n\nclass SubscriptionListener<T> implements ISubscriptionAction<T> {\n\n readonly id: BroadcastChannelReceiverId;\n private readonly listener: SubscriptionListenerCallback<T>;\n\n constructor(id: BroadcastChannelReceiverId, listener: SubscriptionListenerCallback<T>) {\n this.id = id;\n this.listener = listener;\n }\n\n action(changes: StampedChanges<T>) {\n this.listener(changes);\n }\n}\n\nexport class SchemaSubscription<T extends {}> implements ISchemaSubscription<T> {\n\n private readonly id: BroadcastChannelReceiverId;\n private readonly schema: CompiledSchemaCore<T>;\n private readonly scope?: string;\n private readonly createdAt: number;\n private readonly crossTabSync: boolean;\n private isDisposed: boolean = false;\n\n constructor(schema: CompiledSchemaCore<T>, signal?: AbortSignal, scope?: string, options?: SchemaSubscriptionOptions) {\n this.createdAt = now();\n this.id = uuid(8) as BroadcastChannelReceiverId;\n this.schema = schema;\n this.scope = scope;\n this.crossTabSync = options?.crossTabSync ?? true;\n\n getChannelRegistry<T>(schema.id, scope).retain();\n\n signal?.addEventListener(\"abort\", () => {\n this.dispose();\n }, { once: true });\n }\n\n send(changes: SubscriptionChanges<T>) {\n const regisry = getChannelRegistry<T>(this.schema.id, this.scope);\n\n // Preprocessing runs over every add, update, removal and unknown, and it ran on every\n // saveChanges even when the message had nowhere to go. Measured on this branch, skipping\n // it is worth ~18% on diff-update-1000 and ~10% on insert-1000.\n //\n // The guard lives here rather than at the call sites so every caller — CollectionBase,\n // View, and anything added later — gets it without repeating the condition.\n if (this.crossTabSync === false && regisry.listenerCount === 0) {\n return;\n }\n\n // cannot send raw data, needs to be preprocessed\n const preprocessedChanges: SubscriptionChanges<T> = {\n adds: Array.from({ length: changes.adds.length }),\n removals: Array.from({ length: changes.removals.length }),\n unknown: Array.from({ length: changes.unknown.length }),\n updates: Array.from({ length: changes.updates.length }),\n };\n\n for (let i = 0, length = changes.adds.length; i < length; i++) {\n preprocessedChanges.adds[i] = this.schema.preprocess(changes.adds[i]);\n }\n\n for (let i = 0, length = changes.removals.length; i < length; i++) {\n preprocessedChanges.removals[i] = this.schema.preprocess(changes.removals[i]);\n }\n\n for (let i = 0, length = changes.unknown.length; i < length; i++) {\n preprocessedChanges.unknown[i] = this.schema.preprocess(changes.unknown[i]);\n }\n\n for (let i = 0, length = changes.updates.length; i < length; i++) {\n preprocessedChanges.updates[i] = this.schema.preprocess(changes.updates[i]);\n }\n\n // Send message to all listeners.\n // Since we create a new listener when we do onMessage,\n // we don't need to worry about sending to ourselves, it \n // can't happen\n regisry.sender.send({\n data: preprocessedChanges,\n timestamp: now()\n });\n }\n\n onMessage(callback: (changes: SubscriptionChanges<T>) => void) {\n\n const regisry = getChannelRegistry<T>(this.schema.id, this.scope);\n\n // Link the callback to an instance\n regisry.receiver.addListener(this.id, ({ data, timestamp }) => {\n\n if (timestamp < this.createdAt) {\n // Sent before the receiver was even created\n return;\n }\n\n // Changes were preprocessed before they were sent, need to postprocess them.\n // \"diff\" enriches and deserializes without attaching a change-tracking proxy\n // or freezing: these entities belong to another instance's unit of work, and\n // subscribers only read them (or reseed them to re-run a query), never persist\n // mutations through them.\n const postProcessedChanges: SubscriptionChanges<T> = {\n adds: Array.from({ length: data.adds.length }),\n removals: Array.from({ length: data.removals.length }),\n unknown: Array.from({ length: data.unknown.length }),\n updates: Array.from({ length: data.updates.length }),\n };\n\n for (let i = 0, length = data.adds.length; i < length; i++) {\n postProcessedChanges.adds[i] = this.schema.postprocess(data.adds[i], \"diff\");\n }\n\n for (let i = 0, length = data.removals.length; i < length; i++) {\n postProcessedChanges.removals[i] = this.schema.postprocess(data.removals[i], \"diff\");\n }\n\n for (let i = 0, length = data.unknown.length; i < length; i++) {\n postProcessedChanges.unknown[i] = this.schema.postprocess(data.unknown[i], \"diff\");\n }\n\n for (let i = 0, length = data.updates.length; i < length; i++) {\n postProcessedChanges.updates[i] = this.schema.postprocess(data.updates[i], \"diff\");\n }\n\n callback(postProcessedChanges);\n });\n }\n\n dispose() {\n this[Symbol.dispose]();\n }\n\n [Symbol.dispose](): void {\n // Dispose is idempotent, and it must be: a second release would drop the shared\n // channel's count below zero and close it out from under live subscriptions.\n if (this.isDisposed) {\n return;\n }\n this.isDisposed = true;\n\n const regisry = getChannelRegistry<T>(this.schema.id, this.scope);\n\n // Remove listeners for this instance only\n regisry.receiver.removeListeners(this.id);\n\n // An open BroadcastChannel holds the event loop open, so the last subscription out\n // closes the pair and drops it from the registry.\n if (regisry.release()) {\n regisry.close();\n delete registry[getChannelKey(this.schema.id, this.scope)];\n }\n }\n}","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema\";\n\nexport class CompareIdsKeyHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<unknown>, builder: CodeBuilder): CodeBuilder | null {\n\n if (property.isKey) {\n const slot = builder.get<SlotBlock>(\"ifs\");\n const leftCompare = property.getSelectrorPath({ parent: \"a\" });\n const rightCompare = property.getSelectrorPath({ parent: \"b\" });\n\n slot.if(`${leftCompare} != ${rightCompare}`).appendBody(\"return false;\");\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { NotApplicableHandler } from \"./types\";\nimport { CompareIdsKeyHandler } from \"./compareIds/CompareIdsKeyHandler\";\n\nexport class CompareIdsHandlerBuilder {\n\n build() {\n const handler = new CompareIdsKeyHandler();\n\n handler.setNext(new NotApplicableHandler());\n\n return handler;\n }\n}","import { PropertyInfo } from '../PropertyInfo';\nimport { CompiledSchema, InferCreateType, InferType, SchemaTypes } from '../types';\nimport { SchemaBase } from '../property/base/SchemaBase';\nimport { SchemaArray } from '../property/types/SchemaArray';\nimport { SchemaDefinition } from '../SchemaDefinition';\nimport { s } from '../builder';\n\n/**\n * Standard JSON Schema V1 interface types\n * Based on https://standardschema.dev/json-schema\n */\nexport interface StandardTypedV1<Input = unknown, Output = Input> {\n readonly '~standard': StandardTypedV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardTypedV1 {\n export interface Props<Input = unknown, Output = Input> {\n readonly version: 1;\n readonly vendor: string;\n readonly types?: Types<Input, Output> | undefined;\n }\n\n export interface Types<Input = unknown, Output = Input> {\n readonly input: Input;\n readonly output: Output;\n }\n}\n\nexport interface StandardJSONSchemaV1<Input = unknown, Output = Input> {\n readonly '~standard': StandardJSONSchemaV1.Props<Input, Output>;\n}\n\nexport declare namespace StandardJSONSchemaV1 {\n export interface Props<Input = unknown, Output = Input>\n extends StandardTypedV1.Props<Input, Output> {\n readonly jsonSchema: StandardJSONSchemaV1.Converter;\n }\n\n export interface Converter {\n readonly input: (\n options: StandardJSONSchemaV1.Options\n ) => Record<string, unknown>;\n readonly output: (\n options: StandardJSONSchemaV1.Options\n ) => Record<string, unknown>;\n }\n\n export type Target =\n | 'draft-2020-12'\n | 'draft-07'\n | 'openapi-3.0'\n | ({} & string);\n\n export interface Options {\n readonly target: Target;\n readonly libraryOptions?: Record<string, unknown> | undefined;\n }\n}\n\n/**\n * Context for property conversion\n */\ninterface ConversionContext {\n target: StandardJSONSchemaV1.Target;\n visited: Set<string>;\n useOutputType: boolean;\n convertProperty: (property: PropertyInfo<any>) => Record<string, unknown>;\n}\n\n/**\n * Strategy interface for converting property types to JSON Schema\n */\ntype PropertyConverter = (\n property: PropertyInfo<any>,\n context: ConversionContext\n) => Record<string, unknown>;\n\n/**\n * Converts a primitive property with optional enum/literals\n */\nfunction createPrimitiveConverter(\n jsonType: 'string' | 'number' | 'boolean'\n): PropertyConverter {\n return (property, _context) => {\n const jsonSchema: Record<string, unknown> = { type: jsonType };\n if (property.literals && property.literals.length > 0) {\n jsonSchema.enum = property.literals;\n }\n return jsonSchema;\n };\n}\n\n/**\n * Converts a Date property to JSON Schema\n */\nconst dateConverter: PropertyConverter = (_property, _context) => {\n return {\n type: 'string',\n format: 'date-time'\n };\n};\n\n/**\n * Converts an Object property to JSON Schema\n */\nconst objectConverter: PropertyConverter = (property, context) => {\n const jsonSchema: Record<string, unknown> = { type: 'object' };\n\n if (property.children && property.children.length > 0) {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n for (const child of property.children) {\n // Skip computed and function properties for input schemas\n // Include them in output schemas as they represent derived values\n if (!context.useOutputType && (child.type === SchemaTypes.Computed || child.type === SchemaTypes.Function)) {\n continue;\n }\n\n const childSchema = context.convertProperty(child);\n\n // Skip empty schemas (e.g., computed properties that return empty for input)\n if (Object.keys(childSchema).length === 0) {\n continue;\n }\n\n const propertyName = child.from || child.name;\n properties[propertyName] = childSchema;\n\n // Add to required if not optional and not nullable\n // Computed/function properties are never required in JSON Schema\n if (!child.isOptional && !child.isNullable &&\n child.type !== SchemaTypes.Computed && child.type !== SchemaTypes.Function) {\n required.push(propertyName);\n }\n }\n\n if (Object.keys(properties).length > 0) {\n jsonSchema.properties = properties;\n }\n if (required.length > 0) {\n jsonSchema.required = required;\n }\n } else {\n // Empty object or unknown structure\n jsonSchema.properties = {};\n }\n\n return jsonSchema;\n};\n\n/**\n * Converts array inner schema to JSON Schema items\n * Attempts to fully recurse into object schemas when possible\n */\nfunction convertArrayItems(\n innerSchema: SchemaBase<any, any>,\n context: ConversionContext\n): Record<string, unknown> {\n const innerType = innerSchema.type;\n\n switch (innerType) {\n case SchemaTypes.String:\n return { type: 'string' };\n case SchemaTypes.Number:\n return { type: 'number' };\n case SchemaTypes.Boolean:\n return { type: 'boolean' };\n case SchemaTypes.Date:\n return { type: 'string', format: 'date-time' };\n case SchemaTypes.Object:\n // Try to extract object structure from innerSchema.instance\n // For SchemaObject, instance contains the property definitions\n if (innerSchema.instance && typeof innerSchema.instance === 'object') {\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n // Iterate through the instance properties\n for (const [key, value] of Object.entries(innerSchema.instance)) {\n if (value && typeof value === 'object' && 'type' in value) {\n // This is a SchemaBase - try to convert it\n const schemaBase = value as SchemaBase<any, any>;\n const tempProperty = new PropertyInfo(schemaBase, key);\n\n // Skip computed/function for input schemas\n if (!context.useOutputType &&\n (tempProperty.type === SchemaTypes.Computed || tempProperty.type === SchemaTypes.Function)) {\n continue;\n }\n\n const itemSchema = context.convertProperty(tempProperty);\n if (Object.keys(itemSchema).length > 0) {\n properties[key] = itemSchema;\n if (!tempProperty.isOptional && !tempProperty.isNullable &&\n tempProperty.type !== SchemaTypes.Computed && tempProperty.type !== SchemaTypes.Function) {\n required.push(key);\n }\n }\n }\n }\n\n if (Object.keys(properties).length > 0) {\n return {\n type: 'object',\n properties,\n ...(required.length > 0 ? { required } : {})\n };\n }\n }\n // Fallback for unknown object structure\n return {\n type: 'object',\n properties: {},\n description: 'Array item object schema'\n };\n case SchemaTypes.Array:\n // Nested arrays - recursively handle\n if (innerSchema instanceof SchemaArray && innerSchema.innerSchema) {\n return {\n type: 'array',\n items: convertArrayItems(innerSchema.innerSchema, context)\n };\n }\n return {\n type: 'array',\n items: { type: 'object' } // Simplified fallback\n };\n default:\n return { type: 'object' };\n }\n}\n\n/**\n * Converts an Array property to JSON Schema\n */\n/**\n * Converts a Vector property to JSON Schema.\n *\n * The dimension count is expressible here in a way it is not in the type system, so it is\n * emitted: a consumer validating against this schema rejects a wrong-width embedding, which\n * is the earliest anything can.\n */\nconst vectorConverter: PropertyConverter = (property, _context) => {\n const jsonSchema: Record<string, unknown> = {\n type: 'array',\n items: { type: 'number' }\n };\n\n if (property.dimensions != null) {\n jsonSchema.minItems = property.dimensions;\n jsonSchema.maxItems = property.dimensions;\n }\n\n return jsonSchema;\n};\n\nconst arrayConverter: PropertyConverter = (property, context) => {\n const jsonSchema: Record<string, unknown> = { type: 'array' };\n\n if (property.innerSchema) {\n jsonSchema.items = convertArrayItems(property.innerSchema, context);\n } else {\n jsonSchema.items = { type: 'object' };\n }\n\n return jsonSchema;\n};\n\n/**\n * Converts computed/function properties to JSON Schema\n * For input schemas, these return empty (should be skipped)\n * For output schemas, we include them with a generic object type\n */\nconst computedConverter: PropertyConverter = (property, context) => {\n // For input schemas, computed/function properties are not part of the data shape\n if (!context.useOutputType) {\n return {};\n }\n\n // For output schemas, include computed properties\n // We can't know the exact return type without executing the function,\n // so we use a generic object type with a note\n const routierMeta: Record<string, unknown> = {\n isComputed: property.type === SchemaTypes.Computed,\n isFunction: property.type === SchemaTypes.Function\n };\n\n // Store function source code for rehydration\n if (property.functionBody) {\n try {\n routierMeta.functionSource = property.functionBody.toString();\n } catch {\n // If function can't be serialized, store a placeholder\n routierMeta.functionSource = null;\n }\n }\n\n // Store injected value if it's serializable\n if (property.injected !== null && property.injected !== undefined) {\n try {\n // Try to serialize the injected value\n JSON.stringify(property.injected);\n routierMeta.injected = property.injected;\n } catch {\n // If injected value can't be serialized, store null\n routierMeta.injected = null;\n }\n } else {\n routierMeta.injected = null;\n }\n\n return {\n type: 'object',\n description: property.type === SchemaTypes.Computed\n ? 'Computed property (derived value)'\n : 'Function property (derived value)',\n 'x-routier': routierMeta\n };\n};\n\n/**\n * Default converter for unknown types\n */\nconst defaultConverter: PropertyConverter = () => {\n return { type: 'object' };\n};\n\n/**\n * Factory registry mapping SchemaTypes to converters\n */\nconst converterRegistry = new Map<SchemaTypes, PropertyConverter>([\n [SchemaTypes.String, createPrimitiveConverter('string')],\n [SchemaTypes.Number, createPrimitiveConverter('number')],\n [SchemaTypes.Boolean, createPrimitiveConverter('boolean')],\n [SchemaTypes.Date, dateConverter],\n [SchemaTypes.Object, objectConverter],\n [SchemaTypes.Array, arrayConverter],\n [SchemaTypes.Vector, vectorConverter],\n [SchemaTypes.Computed, computedConverter],\n [SchemaTypes.Function, computedConverter],\n]);\n\n/**\n * Applies nullable handling to a JSON Schema based on the target draft version\n */\nfunction applyNullable(\n jsonSchema: Record<string, unknown>,\n property: PropertyInfo<any>,\n target: StandardJSONSchemaV1.Target\n): void {\n if (!property.isNullable) {\n return;\n }\n\n if (target === 'draft-2020-12') {\n if (Array.isArray(jsonSchema.type)) {\n (jsonSchema.type as string[]).push('null');\n } else {\n jsonSchema.type = [jsonSchema.type as string, 'null'];\n }\n } else {\n jsonSchema.nullable = true;\n }\n}\n\n/**\n * Applies Routier-specific metadata to a JSON Schema\n */\nfunction applyRoutierMetadata(\n jsonSchema: Record<string, unknown>,\n property: PropertyInfo<any>\n): void {\n // Don't overwrite existing x-routier metadata (e.g., from computed properties)\n if (!jsonSchema['x-routier']) {\n jsonSchema['x-routier'] = {};\n }\n const routierMeta = jsonSchema['x-routier'] as Record<string, unknown>;\n\n // Only add metadata if it doesn't already exist (to preserve computed property metadata)\n if (property.isKey && !routierMeta.isKey) {\n routierMeta.isKey = true;\n }\n if (property.isIdentity && !routierMeta.isIdentity) {\n routierMeta.isIdentity = true;\n }\n if (property.isReadonly && !routierMeta.isReadonly) {\n routierMeta.isReadonly = true;\n }\n if (property.isDistinct && !routierMeta.isDistinct) {\n routierMeta.isDistinct = true;\n }\n if (property.isSearchable && !routierMeta.isSearchable) {\n routierMeta.isSearchable = true;\n }\n if (property.indexes && property.indexes.length > 0 && !routierMeta.indexes) {\n routierMeta.indexes = property.indexes;\n }\n if ((property.valueSerializer || property.valueDeserializer) && !routierMeta.hasCustomSerialization) {\n routierMeta.hasCustomSerialization = true;\n }\n if (property.defaultValue != null && !routierMeta.hasDefault) {\n routierMeta.hasDefault = true;\n // Note: We can't serialize function defaults, only note their presence\n if (typeof property.defaultValue === 'function') {\n routierMeta.defaultIsFunction = true;\n } else {\n // For static defaults, we can include the actual value\n // Note: This includes falsy values like 0, false, empty string, etc.\n routierMeta.defaultValue = property.defaultValue;\n }\n }\n // Store the Routier property name in metadata (may differ from JSON Schema key if from() is used)\n if (!routierMeta.propertyName) {\n routierMeta.propertyName = property.name;\n }\n if (property.from != null && !routierMeta.from) {\n routierMeta.from = property.from;\n }\n}\n\n/**\n * Converts a Routier PropertyInfo to a JSON Schema property definition.\n */\nexport function propertyInfoToJsonSchema(\n property: PropertyInfo<any>,\n target: StandardJSONSchemaV1.Target,\n visited: Set<string> = new Set(),\n useOutputType: boolean = false\n): Record<string, unknown> {\n // Create conversion context with recursive converter\n const context: ConversionContext = {\n target,\n visited,\n useOutputType,\n convertProperty: (prop) => propertyInfoToJsonSchema(prop, target, visited, useOutputType)\n };\n\n // Get converter from factory registry\n const converter = converterRegistry.get(property.type) ?? defaultConverter;\n\n // Convert the property\n const jsonSchema = converter(property, context);\n\n // Apply nullable handling\n applyNullable(jsonSchema, property, target);\n\n // Apply Routier-specific metadata\n applyRoutierMetadata(jsonSchema, property);\n\n return jsonSchema;\n}\n\n/**\n * Converts a CompiledSchema to a JSON Schema object schema.\n */\nexport function compiledSchemaToJsonSchema<T extends {}>(\n compiledSchema: CompiledSchema<T>,\n target: StandardJSONSchemaV1.Target,\n useOutputType: boolean = false\n): Record<string, unknown> {\n const jsonSchema: Record<string, unknown> = {\n $schema: target === 'draft-2020-12'\n ? 'https://json-schema.org/draft/2020-12/schema'\n : target === 'draft-07'\n ? 'http://json-schema.org/draft-07/schema#'\n : 'http://json-schema.org/draft-04/schema#',\n type: 'object',\n properties: {} as Record<string, unknown>,\n required: [] as string[]\n };\n\n const properties: Record<string, unknown> = {};\n const required: string[] = [];\n\n // Iterate through all properties\n for (const property of compiledSchema.properties) {\n // Skip computed and function properties for input schema\n // For output schema, we include computed properties\n if (!useOutputType && (property.type === SchemaTypes.Computed || property.type === SchemaTypes.Function)) {\n continue;\n }\n\n // Skip unmapped properties (except computed/function properties in output schema)\n if (property.isUnmapped && !(useOutputType && (property.type === SchemaTypes.Computed || property.type === SchemaTypes.Function))) {\n continue;\n }\n\n const propertySchema = propertyInfoToJsonSchema(property, target, new Set(), useOutputType);\n\n // Skip empty schemas (e.g., computed properties that return empty)\n if (Object.keys(propertySchema).length === 0) {\n continue;\n }\n\n const propertyName = property.from || property.name;\n properties[propertyName] = propertySchema;\n\n // Add to required if not optional and not nullable\n if (!property.isOptional && !property.isNullable) {\n required.push(propertyName);\n }\n }\n\n jsonSchema.properties = properties;\n if (required.length > 0) {\n jsonSchema.required = required;\n }\n\n // Add Routier-specific metadata\n jsonSchema['x-routier'] = {\n collectionName: compiledSchema.collectionName,\n idProperties: compiledSchema.idProperties.map(p => p.name),\n hasIdentities: compiledSchema.hasIdentities,\n hasIdentityKeys: compiledSchema.hasIdentityKeys\n };\n\n return jsonSchema;\n}\n\n/**\n * Creates Standard JSON Schema V1 props for a compiled schema.\n */\nexport function createStandardJsonSchemaProps<T extends {}>(\n compiledSchema: CompiledSchema<T>\n): StandardJSONSchemaV1.Props<InferCreateType<T>, InferType<T>> {\n return {\n version: 1,\n vendor: 'routier',\n types: {\n input: undefined as any as InferCreateType<T>,\n output: undefined as any as InferType<T>\n },\n jsonSchema: {\n input: (options: StandardJSONSchemaV1.Options): Record<string, unknown> => {\n return compiledSchemaToJsonSchema(compiledSchema, options.target, false);\n },\n output: (options: StandardJSONSchemaV1.Options): Record<string, unknown> => {\n return compiledSchemaToJsonSchema(compiledSchema, options.target, true);\n }\n }\n };\n}\n\n/**\n * Parses a JSON string containing a JSON Schema and rehydrates it into a Routier SchemaDefinition.\n * This is a convenience wrapper around `rehydrateSchemaFromJsonSchema` that handles JSON parsing.\n * \n * @param jsonString - The JSON string containing the JSON Schema\n * @param collectionName - The collection name for the schema (if not in x-routier metadata)\n * @returns A SchemaDefinition that can be compiled\n * @throws Error if the JSON string is invalid or doesn't contain a valid JSON Schema\n */\nexport function rehydrateSchemaFromJsonString(\n jsonString: string,\n collectionName?: string\n): SchemaDefinition<any> {\n try {\n const jsonSchema = JSON.parse(jsonString) as Record<string, unknown>;\n return rehydrateSchemaFromJsonSchema(jsonSchema, collectionName);\n } catch (error) {\n if (error instanceof SyntaxError) {\n throw new Error(`Invalid JSON string: ${error.message}`);\n }\n throw error;\n }\n}\n\n/**\n * Rehydrates a JSON Schema back into a Routier SchemaDefinition.\n * This parses the JSON Schema structure and reconstructs the schema using Routier's builder API.\n * \n * @param jsonSchema - The JSON Schema object to rehydrate\n * @param collectionName - The collection name for the schema (if not in x-routier metadata)\n * @returns A SchemaDefinition that can be compiled\n */\nexport function rehydrateSchemaFromJsonSchema(\n jsonSchema: Record<string, unknown>,\n collectionName?: string\n): SchemaDefinition<any> {\n // Extract collection name - provided collectionName takes precedence over metadata\n const routierMeta = jsonSchema['x-routier'] as Record<string, unknown> | undefined;\n const finalCollectionName = collectionName || (routierMeta?.collectionName as string) || 'unknown';\n\n if (!jsonSchema.properties || typeof jsonSchema.properties !== 'object') {\n throw new Error('JSON Schema must have a properties object');\n }\n\n const properties = jsonSchema.properties as Record<string, unknown>;\n const required = (jsonSchema.required as string[] | undefined) || [];\n const schemaDefinition: Record<string, any> = {};\n const computedProperties: Array<{ name: string; isComputed: boolean; functionSource: string | null; injected: any }> = [];\n\n // Get idProperties from schema-level metadata as fallback\n const idProperties = (routierMeta?.idProperties as string[] | undefined) || [];\n\n for (const [propName, propSchema] of Object.entries(properties)) {\n const prop = propSchema as Record<string, unknown>;\n const isRequired = required.includes(propName);\n const routierPropMeta = prop['x-routier'] as Record<string, unknown> | undefined;\n\n // Use Routier property name from metadata if available, otherwise use JSON Schema property name\n const routierPropName = (routierPropMeta?.propertyName as string | undefined) || propName;\n\n // Check if this is a computed or function property\n if (routierPropMeta?.isComputed || routierPropMeta?.isFunction) {\n computedProperties.push({\n name: routierPropName,\n isComputed: routierPropMeta.isComputed === true,\n functionSource: (routierPropMeta.functionSource as string | null) || null,\n injected: routierPropMeta.injected !== undefined ? routierPropMeta.injected : null\n });\n continue;\n }\n\n // Convert JSON Schema property to Routier schema\n let schemaBuilder: any = convertJsonSchemaPropertyToRoutier(prop);\n\n // Apply Routier-specific modifiers (using type assertion for method chaining)\n // Note: Apply key() first as it's required for schema compilation\n // Check both property-level metadata and schema-level idProperties list\n const isKey = routierPropMeta?.isKey === true || idProperties.includes(routierPropName);\n if (isKey && typeof schemaBuilder.key === 'function') {\n schemaBuilder = schemaBuilder.key();\n }\n // Apply from() mapping early, as it's a fundamental property mapping\n if (routierPropMeta?.from && typeof schemaBuilder.from === 'function') {\n schemaBuilder = schemaBuilder.from(routierPropMeta.from as string);\n }\n if (routierPropMeta?.isIdentity && typeof schemaBuilder.identity === 'function') {\n schemaBuilder = schemaBuilder.identity();\n }\n if (routierPropMeta?.isReadonly && typeof schemaBuilder.readonly === 'function') {\n schemaBuilder = schemaBuilder.readonly();\n }\n if (routierPropMeta?.isDistinct && typeof schemaBuilder.distinct === 'function') {\n schemaBuilder = schemaBuilder.distinct();\n }\n // Before `.optional()` below, which is safe because `isSearchable` survives a wrapping\n // modifier — see `SchemaBase.isSearchable`. Rebuilding a schema that silently dropped\n // this would take a property's terms out of the index and change what queries match.\n if (routierPropMeta?.isSearchable && typeof schemaBuilder.searchable === 'function') {\n schemaBuilder = schemaBuilder.searchable();\n }\n // Apply optional if property is not required (nullable and optional are independent)\n if (!isRequired && typeof schemaBuilder.optional === 'function') {\n schemaBuilder = schemaBuilder.optional();\n }\n // Apply nullable if property allows null (nullable and optional are independent)\n if (prop.nullable === true || (Array.isArray(prop.type) && prop.type.includes('null'))) {\n if (typeof schemaBuilder.nullable === 'function') {\n schemaBuilder = schemaBuilder.nullable();\n }\n }\n if (routierPropMeta?.indexes && Array.isArray(routierPropMeta.indexes)) {\n if (typeof schemaBuilder.index === 'function') {\n schemaBuilder = schemaBuilder.index(...(routierPropMeta.indexes as string[]));\n }\n }\n\n // Apply default value if present (only static defaults, not function defaults)\n // hasDefault=true and defaultIsFunction=false means we have a static default value stored\n if (routierPropMeta?.hasDefault && !routierPropMeta.defaultIsFunction && routierPropMeta.hasOwnProperty('defaultValue')) {\n if (typeof schemaBuilder.default === 'function') {\n schemaBuilder = schemaBuilder.default(routierPropMeta.defaultValue);\n }\n }\n\n schemaDefinition[routierPropName] = schemaBuilder;\n }\n\n // Build base schema\n let schema = s.define(finalCollectionName, schemaDefinition);\n\n // Add computed properties via modify()\n if (computedProperties.length > 0) {\n schema = schema.modify(x => {\n const computedDefs: Record<string, any> = {};\n\n for (const computedProp of computedProperties) {\n if (computedProp.functionSource) {\n // Recreate the function from source code\n // The function signature is: (entity, collectionName, injected) => result\n // We use new Function() to create the function, but wrap it so toString() returns the arrow function\n let recreatedFn: any;\n try {\n const functionSource = computedProp.functionSource;\n\n // Parse the arrow function to extract parameters and body\n const arrowMatch = functionSource.match(/^\\(([^)]*)\\)\\s*=>\\s*(.+)$/s);\n\n if (!arrowMatch) {\n throw new Error('Function source is not an arrow function');\n }\n\n // Parse parameters\n const paramsStr = arrowMatch[1].trim();\n const params = paramsStr ? paramsStr.split(',').map(p => p.trim()).filter(p => p) : [];\n const body = arrowMatch[2].trim();\n\n // Create function body - if it's a block (starts with {), use as-is, otherwise wrap in return\n const functionBody = body.startsWith('{')\n ? body.slice(1, -1) // Remove outer braces\n : `return ${body}`;\n\n // Create the function using new Function()\n // If no parameters, call with just the body; otherwise spread the params\n const fn = params.length > 0\n ? new Function(...params, functionBody)\n : new Function(functionBody);\n\n // Wrap it so toString() returns the original arrow function string\n // This is needed because the schema system validates that functions are arrow functions\n recreatedFn = Object.assign(fn, {\n toString: () => functionSource\n });\n } catch (e) {\n // If we can't recreate the function, create a placeholder arrow function that throws\n recreatedFn = () => {\n throw new Error(`Cannot recreate computed property ${computedProp.name}: ${e instanceof Error ? e.message : 'unknown error'}`);\n };\n // Ensure toString returns an arrow function for validation\n Object.assign(recreatedFn, {\n toString: () => `() => { throw new Error(\"Cannot recreate computed property ${computedProp.name}\"); }`\n });\n }\n\n // Add computed property with optional injected value\n if (computedProp.isComputed) {\n computedDefs[computedProp.name] = x.computed(recreatedFn, computedProp.injected);\n } else {\n computedDefs[computedProp.name] = x.function(recreatedFn, computedProp.injected);\n }\n } else {\n // No function source available - create a placeholder\n computedDefs[computedProp.name] = computedProp.isComputed\n ? x.computed(() => {\n throw new Error(`Computed property ${computedProp.name} could not be rehydrated: function source not available`);\n })\n : x.function(() => {\n throw new Error(`Function property ${computedProp.name} could not be rehydrated: function source not available`);\n });\n }\n }\n\n return computedDefs;\n });\n }\n\n return schema;\n}\n\n/**\n * Converts a JSON Schema property definition to a Routier schema builder.\n */\nfunction convertJsonSchemaPropertyToRoutier(\n prop: Record<string, unknown>\n): SchemaBase<any, any> {\n const type = Array.isArray(prop.type)\n ? (prop.type as string[]).find(t => t !== 'null') || prop.type[0]\n : prop.type as string;\n\n // Check for date type - dates are serialized as string with format 'date-time'\n if (type === 'string' && prop.format === 'date-time') {\n return s.date();\n }\n\n switch (type) {\n case 'string':\n if (prop.enum && Array.isArray(prop.enum)) {\n return s.string(...(prop.enum as string[]));\n }\n return s.string();\n\n case 'number':\n case 'integer':\n if (prop.enum && Array.isArray(prop.enum)) {\n return s.number(...(prop.enum as number[]));\n }\n return s.number();\n\n case 'boolean':\n return s.boolean();\n\n case 'object':\n // Recurse into object properties\n if (prop.properties && typeof prop.properties === 'object') {\n const objectProps = prop.properties as Record<string, unknown>;\n const objectSchema: Record<string, any> = {};\n\n for (const [key, value] of Object.entries(objectProps)) {\n objectSchema[key] = convertJsonSchemaPropertyToRoutier(value as Record<string, unknown>);\n }\n\n return s.object(objectSchema);\n }\n return s.object({});\n\n case 'array':\n // Handle array items\n if (prop.items && typeof prop.items === 'object') {\n const itemsSchema = convertJsonSchemaPropertyToRoutier(prop.items as Record<string, unknown>);\n return s.array(itemsSchema as any);\n }\n return s.array(s.object({}) as any);\n\n default:\n // Fallback to object for unknown types\n return s.object({});\n }\n}\n\n/**\n * Attempts to extract type information from a compiled schema for better type inference.\n * \n * Note: TypeScript types are compile-time only, so we can't extract actual type information at runtime.\n * The Standard JSON Schema spec allows libraries to advertise their inferred types via the `types` property,\n * but this requires compile-time type information that isn't available at runtime.\n * \n * For proper type inference, consumers should use TypeScript's type system:\n * ```typescript\n * const schema = s.define(\"users\", { ... }).compile();\n * type User = InferType<typeof schema>;\n * type CreateUser = InferCreateType<typeof schema>;\n * ```\n * \n * @param compiledSchema - The compiled schema to extract type info from\n * @returns A description of the type names (for documentation purposes only)\n */\nexport function extractTypeInfo<T extends {}>(\n compiledSchema: CompiledSchema<T>\n): { inputType: string; outputType: string } {\n return {\n inputType: `InferCreateType<${compiledSchema.collectionName}>`,\n outputType: `InferType<${compiledSchema.collectionName}>`\n };\n}\n","import { CodeBuilder, SlotBlock } from '../../blocks';\nimport { PropertyInfoHandler } from \"../types\";\nimport { PropertyInfo } from \"../../../schema/PropertyInfo\";\nimport { SchemaTypes } from \"../../../schema/types\";\n\nconst allowedTypes = new Set<SchemaTypes>([\n SchemaTypes.Array,\n SchemaTypes.Boolean,\n SchemaTypes.Date,\n SchemaTypes.Number,\n SchemaTypes.Object,\n SchemaTypes.String,\n SchemaTypes.Vector\n]);\n\nexport class SetComplexHandler extends PropertyInfoHandler {\n\n override handle(property: PropertyInfo<any>, builder: CodeBuilder): CodeBuilder | null {\n\n if (allowedTypes.has(property.type)) {\n const selectorPath = property.getSelectrorPath({ parent: \"source\", assignmentType: \"FORCE_NULLABLE_OR_OPTIONAL\" });\n const slot = builder.get<SlotBlock>(\"assignments\");\n const entitySelectorPath = property.getAssignmentPath({ parent: \"source\" });\n const enrichedAssignmentPath = property.getAssignmentPath({ parent: \"destination\" });\n\n slot.if(`${selectorPath} != null`).appendBody(`${enrichedAssignmentPath} = ${entitySelectorPath}`);\n return builder;\n }\n\n return super.handle(property, builder);\n }\n}","import { NotApplicableHandler } from \"./types\";\nimport { SetComplexHandler } from \"./set/SetComplexHandler\";\n\nexport class SetHandlerBuilder {\n\n build() {\n const handler = new SetComplexHandler();\n\n handler.setNext(new NotApplicableHandler());\n\n return handler;\n }\n}","import { SchemaFunction } from './table/SchemaFunction';\nimport { SchemaTransform } from './table/SchemaTransform';\nimport { SchemaComputed } from './table/SchemaComputed';\nimport { SchemaBase } from \"./property/base/SchemaBase\";\nimport { PropertyInfo } from './PropertyInfo';\nimport { CodeBuilder, FunctionBuilder, SlotBlock } from '../codegen';\nimport { EnrichmentHandlerBuilder } from '../codegen/handlers/EnrichmentHandlerBuilder';\nimport { MergeHandlerBuilder } from '../codegen/handlers/MergeHandlerBuilder';\nimport { PrepareHandlerBuilder } from '../codegen/handlers/PrepareHandlerBuilder';\nimport { StripHandlerBuilder } from '../codegen/handlers/StripHandlerBuilder';\nimport { CloneHandlerBuilder } from '../codegen/handlers/CloneHandlerBuilder';\nimport { CompareHandlerBuilder } from '../codegen/handlers/CompareHandlerBuilder';\nimport { DeserializeHandlerBuilder } from '../codegen/handlers/DeserializeHandlerBuilder';\nimport { HashTypeHandlerBuilder } from '../codegen/handlers/HashTypeHandlerBuilder';\nimport { IdSelectorHandlerBuilder } from '../codegen/handlers/IdSelectorHandlerBuilder';\nimport { HashHandlerBuilder } from '../codegen/handlers/HashHandlerBuilder';\nimport { EnableChangeTrackingHandlerBuilder } from '../codegen/handlers/EnableChangeTrackingHandlerBuilder';\nimport { FreezeHandlerBuilder } from '../codegen/handlers/FreezeHandlerBuilder';\nimport { SchemaError } from '../errors/SchemaError';\nimport { SerializeHandlerBuilder } from \"../codegen/handlers/SerializeHandlerBuilder\";\nimport { hash, logger } from \"../utilities\";\nimport { CollectionName, CompiledSchema, CompiledSchemaCore, CompiledSchemaWithMetadata, GetHashTypeFunction, HashFunction, HashType, IdType, Index, InferCreateType, InferType, Prepare, Preprocess, SchemaId, SchemaTypes, SetProperties, PropertyTransform } from './types';\nimport { DeepPartial } from '../types';\nimport { SchemaSubscription, SchemaSubscriptionOptions } from './communication/broadcast';\nimport { CompareIdsHandlerBuilder } from '../codegen/handlers/CompareIdsHandlerBuilder';\nimport { StandardJSONSchemaV1, createStandardJsonSchemaProps, rehydrateSchemaFromJsonString } from './utils/standardJsonSchema';\nimport { SetHandlerBuilder } from '../codegen/handlers';\n\nfunction assertPropertyHandled(generatorName: string, property: PropertyInfo<any>, result: unknown): asserts result is {} {\n if (result == null) {\n throw new Error(`Schema compilation failed: no '${generatorName}' code generator handles property '${property.getAssignmentPath()}' (type: ${property.type}). Add a handler for this property shape or mark it not applicable in the ${generatorName} chain.`);\n }\n}\n\nfunction createChangeTracker() {\n const DIRTY_ENTITY_MARKER: string = \"isDirty\";\n const CHANGES_ENTITY_KEY: string = \"changes\";\n const ORIGINAL_ENTITY_KEY: string = \"original\";\n const PAUSED_ENTITY_KEY: string = \"isPaused\";\n const TRACKING_KEY: string = \"__tracking__\";\n const PROXY_MARKER: string = \"__isProxy__\";\n\n return <TEntity extends {}>(entity: TEntity, path?: string, parent?: TEntity) => {\n\n const proxyHandler: ProxyHandler<TEntity> = {\n set(entity, property, value) {\n const indexableEntity: { [key: string]: any } = entity;\n\n // if values are the same, do nothing\n //\n // Checked before `String(property)` on purpose. A write that changes\n // nothing is the common case, not the exception: `schema.merge` copies\n // every property of a re-read row into the attached entity, and on an\n // unchanged row every one of those writes lands here and returns.\n // Building the string key first made that path cost 156ns a write, of\n // which 125ns was the `String()` call alone; checking first takes it to\n // 31ns, against a 14ns floor for the same writes on a plain object.\n // Indexing by `property` rather than by `key` reads the same slot for\n // string keys, and the correct one for symbols (which `String()` would\n // have mangled into a \"Symbol(x)\" lookup).\n const originalValue = indexableEntity[property as string];\n\n if (originalValue === value) {\n return true;\n }\n\n const key = String(property);\n const resolvedParent: { [key: string]: any } = parent ?? entity;\n\n if (resolvedParent[TRACKING_KEY] == null) {\n // defineProperty, not assignment: a plain assignment creates an ENUMERABLE\n // property, and this is the lazy path that runs on the first tracked write —\n // so every entity the caller had edited came back from a query with\n // `__tracking__` visible to Object.entries, JSON.stringify and any deep\n // compare (defect #26). Both bootstrap paths below already define it\n // non-enumerable; this one was the outlier.\n Object.defineProperty(resolvedParent, TRACKING_KEY, {\n value: {\n [CHANGES_ENTITY_KEY]: {},\n [DIRTY_ENTITY_MARKER]: false,\n [ORIGINAL_ENTITY_KEY]: {},\n [PAUSED_ENTITY_KEY]: false\n },\n configurable: true,\n writable: true,\n enumerable: false\n });\n }\n\n if (key == TRACKING_KEY) {\n return true;\n }\n\n if (resolvedParent[TRACKING_KEY] != null && resolvedParent[TRACKING_KEY][PAUSED_ENTITY_KEY] === true) {\n Reflect.set(indexableEntity, property, value);\n return true;\n }\n\n const resolvedPath = path == null ? key : `${path}.${key}`;\n const changes = resolvedParent[TRACKING_KEY];\n\n if (changes[CHANGES_ENTITY_KEY][resolvedPath] != null) {\n\n if (changes[ORIGINAL_ENTITY_KEY][resolvedPath] === value) {\n // we are changing the value back to the original value, remove the change\n //\n // These two stay `delete`, unlike the `__tracking__` sites on the entity\n // itself. Assigning undefined here would be read as \"still changed\" by\n // the isDirty count below, which asks Object.keys — and a key assigned\n // undefined is still a key. Counting only defined values does not rescue\n // it either: an original value of undefined is legitimate (a property\n // that was unset and then given a value), so a defined-value count would\n // report a genuinely dirty entity as clean. Removing the key is the only\n // representation that keeps \"present\" and \"changed\" the same question.\n //\n // The cost is bounded in a way the entity sites are not: these bags hold\n // one key per changed path, they are internal to the tracking record, and\n // this branch only runs when a value is set BACK to its original.\n delete changes[ORIGINAL_ENTITY_KEY][resolvedPath];\n delete changes[CHANGES_ENTITY_KEY][resolvedPath];\n } else {\n // track the change\n changes[CHANGES_ENTITY_KEY][resolvedPath] = value;\n }\n\n } else if (changes[CHANGES_ENTITY_KEY][resolvedPath] == null) {\n // don't keep updating, keep the original value\n changes[CHANGES_ENTITY_KEY][resolvedPath] = value;\n changes[ORIGINAL_ENTITY_KEY][resolvedPath] = originalValue;\n }\n\n const isDirty = Object.keys(changes[ORIGINAL_ENTITY_KEY]).length > 0;\n changes[DIRTY_ENTITY_MARKER] = isDirty;\n\n Reflect.set(indexableEntity, property, value);\n\n return true;\n },\n get(target, property, receiver) {\n\n if (property === PROXY_MARKER) {\n return true;\n }\n\n return Reflect.get(target, property, receiver);\n }\n }\n\n return new Proxy(entity, proxyHandler) as TEntity;\n }\n}\n\n\nexport class SchemaDefinition<T extends {}> extends SchemaBase<T, any> {\n\n instance: T;\n type = SchemaTypes.Definition;\n collectionName: CollectionName;\n\n constructor(collectionName: CollectionName, schema: T) {\n super();\n this.collectionName = collectionName;\n this.instance = schema;\n this.isNullable = false;\n this.isOptional = false;\n }\n\n /**\n * Creates a SchemaDefinition from a JSON string containing a JSON Schema.\n * Parses the JSON string, rehydrates the schema structure, and compiles it.\n * \n * @param jsonString - The JSON string containing the JSON Schema (typically from `schema['~standard'].jsonSchema.input()` or `output()`)\n * @param collectionName - Optional collection name override (if not present in JSON Schema metadata)\n * @returns A compiled schema ready to use\n * @throws Error if the JSON string is invalid or doesn't contain a valid JSON Schema\n * \n * @example\n * ```typescript\n * // Serialize a schema to JSON\n * const jsonSchema = mySchema['~standard'].jsonSchema.input({ target: 'draft-2020-12' });\n * const jsonString = JSON.stringify(jsonSchema);\n * \n * // Rehydrate from JSON string\n * const rehydratedSchema = SchemaDefinition.fromJson(jsonString);\n * // Schema is already compiled and ready to use\n * ```\n */\n static fromJson(jsonString: string, collectionName?: string): CompiledSchema<any> {\n const schemaDefinition = rehydrateSchemaFromJsonString(jsonString, collectionName);\n return schemaDefinition.compile();\n }\n\n /**\n * Standard JSON Schema V1 implementation.\n * Provides JSON Schema conversion for Routier schemas.\n */\n get '~standard'(): StandardJSONSchemaV1.Props<InferCreateType<T>, InferType<T>> {\n const schema = this.compile();\n\n return createStandardJsonSchemaProps(schema);\n }\n\n private createReturnFunction<TResult>(builder: CodeBuilder): TResult {\n const body = builder.toString();\n try {\n return Function(`return ${body}`) as TResult;\n } catch (e) {\n logger.error(`Error compiling schema function. Function Body: ${body}`)\n throw e;\n }\n }\n\n private createFunction<TResult>(builder: CodeBuilder, ...fnArgs: string[]): TResult {\n const body = builder.toString();\n\n try {\n return Function(...fnArgs, body) as TResult;\n } catch (e) {\n logger.error(`Error compiling schema function. Function Body: ${body}`)\n throw e;\n }\n }\n\n modify<R>(builder: (d: {\n function: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected: I) => UU, injected?: I) => SchemaFunction<UU, I, \"unmapped\">;\n computed: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected: I) => UU, injected?: I) => SchemaComputed<UU, I, \"computed\" | \"unmapped\">;\n /**\n * Replaces a property with a transformed version of itself.\n *\n * `computed` derives a value one way and cannot come back. A transform declares both\n * directions, so the property keeps its type and only its STORED form changes.\n *\n * ```ts\n * .modify(x => ({\n * ssn: x.transform(s.string(), {\n * to: (value, keys) => myEncrypt(value, keys),\n * from: (text, keys) => myDecrypt(text, keys),\n * stores: SchemaTypes.String,\n * }, myKeys),\n * }))\n * ```\n *\n * `to` and `from` may be async and are held as live references, so they can close\n * over whatever they need. `injected` is there for when passing it explicitly reads\n * better than capturing it.\n */\n transform: <UU>(transform: PropertyTransform<UU>) => SchemaTransform<UU>;\n }) => R) {\n\n const b = {\n function: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected?: I) => UU, injected?: I) => new SchemaFunction<UU, I, \"unmapped\">(fn as any, injected),\n computed: <UU, I = never>(fn: (entity: InferType<CompiledSchema<T>>, collectionName: CollectionName, injected?: I) => UU, injected?: I) => new SchemaComputed<UU, I, \"computed\" | \"unmapped\">(fn as any, injected),\n transform: <UU>(transform: PropertyTransform<UU>) => new SchemaTransform<UU>(transform)\n }\n\n const r = builder(b) as Record<string, unknown>;\n\n /**\n * A transform replaces the property it was assigned to, so it is bound here rather\n * than being handed its own property to repeat. `.modify()` already knows which one\n * is meant — it is the key.\n */\n for (const [name, value] of Object.entries(r)) {\n if (value instanceof SchemaTransform) {\n const underlying = (this.instance as Record<string, unknown>)[name];\n\n if (underlying == null) {\n throw new Error(\n `transform() was assigned to '${name}', which is not a property of ` +\n `'${this.collectionName}'. A transform replaces an existing property; ` +\n 'to add a new one, use computed().'\n );\n }\n\n value.bindTo(underlying as never);\n }\n }\n\n return new SchemaDefinition<R & T>(this.collectionName, { ...this.instance, ...r } as R & T);\n }\n\n private _iterate(\n instance: SchemaBase<any, any>,\n callback: (property: PropertyInfo<any>) => void\n ) {\n const explore: {\n path: string | null;\n instance:\n | SchemaBase<any, any>\n | { [key: string]: SchemaBase<any, any> };\n parents: {\n schema: { [key: string]: SchemaBase<any, any> };\n propertyInfo: PropertyInfo<any>;\n }[];\n propertyInfo: PropertyInfo<any> | null;\n }[] = [\n { path: null, instance, parents: [], propertyInfo: null }\n ];\n const properties: PropertyInfo<any>[] = [];\n\n for (let i = 0; i < explore.length; i++) {\n const item = explore[i];\n\n if (item.instance.type === SchemaTypes.Definition) {\n explore.push({\n path: null,\n instance: item.instance.instance,\n parents: [],\n propertyInfo: null\n });\n continue;\n }\n\n const instanceObj = item.instance as {\n [key: string]: SchemaBase<any, any>;\n };\n for (const key in instanceObj) {\n const propertyInstance = instanceObj[key] as SchemaBase<any, any>;\n const previousParent =\n item.parents.length === 0\n ? null\n : item.parents[item.parents.length - 1].propertyInfo;\n\n if (propertyInstance.type === SchemaTypes.Object) {\n const propertyInfo = new PropertyInfo<any>(\n propertyInstance,\n key,\n previousParent\n );\n explore.push({\n path: [item.path, key].filter((w) => w != null).join(\".\"),\n instance: propertyInstance.instance,\n parents: [\n ...item.parents,\n { schema: instanceObj, propertyInfo: propertyInfo }\n ],\n propertyInfo\n });\n\n if (previousParent === null) {\n properties.push(propertyInfo);\n continue;\n }\n\n previousParent.children.push(propertyInfo);\n continue;\n }\n\n const childPrimitivePropertyInfo = new PropertyInfo<any>(\n (item.instance as any)[key],\n key,\n previousParent\n );\n if (previousParent === null) {\n properties.push(childPrimitivePropertyInfo);\n continue;\n }\n\n previousParent.children.push(childPrimitivePropertyInfo);\n }\n }\n\n // Recursively trigger callbacks on properties and their children\n function recursiveCallback(prop: PropertyInfo<any>) {\n callback(prop);\n for (const child of prop.children) {\n recursiveCallback(child);\n }\n }\n\n for (const prop of properties) {\n recursiveCallback(prop);\n }\n }\n\n compile<TMetadata>(metadata: TMetadata): CompiledSchemaWithMetadata<T, TMetadata>\n compile(): CompiledSchema<T>;\n compile<TMetadata>(metadata?: TMetadata): CompiledSchema<T> | CompiledSchemaWithMetadata<T, TMetadata> {\n\n try {\n const properties: PropertyInfo<T>[] = [];\n const propertyMap: Map<string, PropertyInfo<T>> = new Map<string, PropertyInfo<T>>();\n\n const enrichmentHandlerBuilder = new EnrichmentHandlerBuilder();\n const mergeHandlerFactory = new MergeHandlerBuilder();\n const prepareHandlerBuilder = new PrepareHandlerBuilder();\n const stripHandlerBuilder = new StripHandlerBuilder();\n const cloneHandlerBuilder = new CloneHandlerBuilder();\n const compareHandlerBuilder = new CompareHandlerBuilder();\n const deserializeHandlerBuilder = new DeserializeHandlerBuilder();\n const hashTypeHandlerBuilder = new HashTypeHandlerBuilder();\n const idSelectorHandlerBuilder = new IdSelectorHandlerBuilder();\n const hashHandlerBuilder = new HashHandlerBuilder();\n const enableChangeTrackingHandlerBuilder = new EnableChangeTrackingHandlerBuilder();\n const freezeHandlerBuilder = new FreezeHandlerBuilder();\n const serializeHandlerBuilder = new SerializeHandlerBuilder();\n const compareIdsHandlerBuilder = new CompareIdsHandlerBuilder();\n const setHandlerBuilder = new SetHandlerBuilder();\n\n const enricher = enrichmentHandlerBuilder.build();\n const merge = mergeHandlerFactory.build();\n const prepare = prepareHandlerBuilder.build();\n const strip = stripHandlerBuilder.build();\n const clone = cloneHandlerBuilder.build();\n const compare = compareHandlerBuilder.build();\n const deserialize = deserializeHandlerBuilder.build();\n const hashTypeHandler = hashTypeHandlerBuilder.build();\n const idSelectorHandler = idSelectorHandlerBuilder.build();\n const hashHandler = hashHandlerBuilder.build();\n const enableChangeTrackingHandler = enableChangeTrackingHandlerBuilder.build();\n const freezeHandler = freezeHandlerBuilder.build();\n const serializeHandler = serializeHandlerBuilder.build();\n const compareIdsHandler = compareIdsHandlerBuilder.build();\n const setHandlerHanlder = setHandlerBuilder.build();\n\n const changeTrackingCodeBuilder = new CodeBuilder();\n changeTrackingCodeBuilder.raw(`${createChangeTracker.toString()}`);\n changeTrackingCodeBuilder.slot(\"declarations\").variable(\"enableChangeTracking\").value('createChangeTracker()');\n // Nested proxies are installed by assigning through already-proxied parents;\n // pause tracking during setup so those writes don't register as changes\n changeTrackingCodeBuilder.slot(\"pause\").raw('\\tconst hadTracking = entity.__tracking__ != null;\\n\\tif (!hadTracking) { Object.defineProperty(entity, \"__tracking__\", { value: { changes: {}, isDirty: false, original: {}, isPaused: false }, configurable: true, writable: true, enumerable: false }); }\\n\\tconst wasPaused = entity.__tracking__.isPaused;\\n\\tentity.__tracking__.isPaused = true;');\n changeTrackingCodeBuilder.slot(\"assignment\");\n // Tracking metadata is created lazily on the first real write; only restore\n // what already existed, never leave the bootstrap behind.\n //\n // Cleared by redefining the property, not by `delete`. `delete` moves the object\n // into V8 dictionary mode permanently — it never returns to fast properties, so\n // every later read of every property on the entity pays a dictionary lookup,\n // measured at ~43% slower reads.\n //\n // defineProperty rather than plain assignment because `entity` here is whatever\n // the caller passed, and enableChangeTracking is public API, so it may already be\n // a change-tracking proxy. That proxy's set trap answers writes to `__tracking__`\n // with a bare `return true` and drops them, which would leave this bootstrap\n // behind. The handler defines no defineProperty trap, so this reaches the target,\n // and repeating the descriptor keeps the property non-enumerable.\n changeTrackingCodeBuilder.slot(\"return\").raw('\\tif (hadTracking) { entity.__tracking__.isPaused = wasPaused; } else { delete entity.__tracking__; }\\n\\treturn enableChangeTracking(entity);');\n\n const freezeCodeBuilder = new CodeBuilder();\n freezeCodeBuilder.slot(\"assignment\");\n freezeCodeBuilder.slot(\"return\").raw('\\treturn Object.freeze(entity);');\n\n const enricherCodeBuilder = new CodeBuilder();\n\n const enricherFunctionRoot = enricherCodeBuilder.factory(\"factory\", { name: \"factory\" }).parameters({ name: \"collectionName\", value: this.collectionName });\n enricherFunctionRoot.slot(\"changeTracker\").raw(`${createChangeTracker.toString()}`);\n enricherFunctionRoot.slot(\"changeTrackerFunction\").raw(`\\tconst changeTracker = createChangeTracker();`);\n const enricherFunctionBody = enricherFunctionRoot.function(undefined, { name: \"function\" }).parameters(\"entity\", \"changeTrackingType\").return();\n\n enricherFunctionBody.slot(\"enableChangeTracking\")\n .variable(\"enableChangeTracking\")\n .value('changeTrackingType === \"proxy\" ? changeTracker : e => e');\n\n enricherFunctionBody.slot(\"append\");\n enricherFunctionBody.slot(\"enriched\");\n // Nested proxies are installed by assigning through already-proxied parents;\n // pause tracking during setup so those writes don't register as changes.\n // Non-enumerable: computed properties run after this and may JSON.stringify\n // the entity (e.g. content-hash ids) — the bootstrap must not change their input\n enricherFunctionBody.slot(\"declarations\").raw('\\tif (changeTrackingType === \"proxy\") { Object.defineProperty(enriched, \"__tracking__\", { value: { changes: {}, isDirty: false, original: {}, isPaused: true }, configurable: true, writable: true, enumerable: false }); }');\n enricherFunctionBody.slot(\"assignment\");\n enricherFunctionBody.slot(\"ifs\");\n enricherFunctionBody.slot(\"tracking\").if('changeTrackingType === \"immutable\"', { name: \"freeze\" });\n // The paused bootstrap tracking is removed rather than unpaused: tracking\n // metadata is created lazily on the first real write, and callers assert\n // an untouched entity carries none. Proxy mode recreates it on the first\n // tracked write (see defect #2).\n //\n // Cleared by assignment rather than `delete`, because `delete` drops the entity\n // into V8 dictionary mode for the rest of its life — and this line runs on EVERY\n // entity that comes off a read. Assignment keeps the non-enumerable descriptor\n // installed above, so the property still stays out of Object.keys and JSON.\n //\n // The condition is now \"proxy\" rather than \"not immutable\", which is the same set\n // of entities in practice: `enriched` is a fresh object literal built from schema\n // properties, so ONLY the proxy branch above ever puts `__tracking__` on it. Under\n // `delete` the wider condition was harmless because deleting an absent property is\n // a no-op; under assignment it would CREATE an enumerable `__tracking__` on every\n // diff- and readonly-tracked entity and leak it into persistence. Defect #16's\n // stray `{ isPaused: false }` residue stays fixed — nothing is left behind here.\n enricherFunctionBody.slot(\"return\").raw('\\tif (changeTrackingType === \"proxy\") { enriched.__tracking__ = undefined; }\\n\\treturn enableChangeTracking(enriched);');\n\n const preprocessCodeBuilder = new CodeBuilder();\n preprocessCodeBuilder.slot(\"main\");\n preprocessCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const postprocessCodeBuilder = new CodeBuilder();\n postprocessCodeBuilder.slot(\"main\");\n postprocessCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const setCodeBuilder = new CodeBuilder();\n setCodeBuilder.slot(\"assignments\");\n setCodeBuilder.slot(\"ifs\");\n\n const mergeCodeBuilder = new CodeBuilder();\n\n const mergeFunctionRoot = mergeCodeBuilder.factory(\"factory\", { name: \"factory\" }).parameters({ name: \"collectionName\", value: this.collectionName });\n const mergeFunctionBody = mergeFunctionRoot.function(undefined, { name: \"function\" }).parameters(\"destination\", \"source\").return();\n\n // The pause bootstrap exists so a PROXIED destination does not record the\n // merge's own writes as changes. A destination with no tracking (diff and\n // immutable modes) gets a temporary bootstrap so the same generated code runs —\n // and unpause() DELETES it again, because leaving it behind is the\n // `{ isPaused: false }` residue of defect #16, this time on the merge path.\n const pauseFunctionBody = mergeFunctionBody.function(\"pause\")\n .appendBody(\"// initiate change tracking if needed\");\n\n pauseFunctionBody.if(\"destination.__tracking__ == null\")\n // Non-enumerable for the same reason the enricher's bootstrap is: computed\n // properties can JSON.stringify the entity while this is installed, and the\n // bootstrap must not change their input. It is removed again below either way.\n .appendBody('Object.defineProperty(destination, \"__tracking__\", { value: {}, configurable: true, writable: true, enumerable: false });')\n .appendBody(\"installedTrackingBootstrap = true;\");\n\n pauseFunctionBody.appendBody(\"destination.__tracking__.isPaused = true;\");\n\n const unpauseFunctionBody = mergeFunctionBody.function(\"unpause\")\n .appendBody(\"// unpause change tracking, removing a bootstrap this merge installed\");\n\n // Redefined to undefined rather than deleted, so the merged entity keeps its fast\n // properties — `delete` would put it in dictionary mode for good.\n //\n // It must be defineProperty and NOT assignment. `destination` is an attached,\n // proxied entity, and the change tracker's set trap answers writes to\n // `__tracking__` with a bare `return true`, dropping them. Assigning here is\n // therefore a silent no-op that leaves the `{}` bootstrap installed by pause() in\n // place — and the next write through the proxy reads `changes.changes` off that\n // bootstrap and throws. defineProperty is not intercepted, because the handler\n // declares no defineProperty trap.\n unpauseFunctionBody.if(\"installedTrackingBootstrap === true\")\n .appendBody(\"delete destination.__tracking__;\")\n .appendBody(\"return;\");\n\n unpauseFunctionBody.if(\"destination.__tracking__ != null\")\n .appendBody(\"destination.__tracking__.isPaused = false;\");\n\n mergeFunctionBody.slot(\"header\").raw(`let installedTrackingBootstrap = false;\n pause()`);\n mergeFunctionBody.slot(\"assignments\");\n mergeFunctionBody.slot(\"ifs\");\n mergeFunctionBody.slot(\"return\").raw(`\n unpause();\n\n return destination;`);\n\n const prepareCodeBuilder = new CodeBuilder();\n prepareCodeBuilder.slot(\"result\");\n prepareCodeBuilder.slot(\"assignments\");\n prepareCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const stripCodeBuilder = new CodeBuilder();\n stripCodeBuilder.slot(\"result\");\n stripCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const cloneCodeBuilder = new CodeBuilder();\n cloneCodeBuilder.slot(\"result\").raw(\"const result = {};\");;\n cloneCodeBuilder.slot(\"assignments\");\n cloneCodeBuilder.slot(\"if\");\n cloneCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const compareCodeBuilder = new CodeBuilder();\n compareCodeBuilder.slot(\"result\");\n compareCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const compareIdsCodeBuilder = new CodeBuilder();\n compareIdsCodeBuilder.slot(\"ifs\");\n compareIdsCodeBuilder.slot(\"return\").raw(` return true;`);\n\n const deserializeCodeBuilder = new CodeBuilder();\n deserializeCodeBuilder.slot(\"functions\");\n deserializeCodeBuilder.slot(\"result\");\n deserializeCodeBuilder.slot(\"if\");\n deserializeCodeBuilder.slot(\"return\").raw(` return entity;`);\n\n const serializeCodeBuilder = new CodeBuilder();\n serializeCodeBuilder.slot(\"result\").raw(\"const result = {};\");\n serializeCodeBuilder.slot(\"assignments\");\n serializeCodeBuilder.slot(\"functions\");\n serializeCodeBuilder.slot(\"if\");\n serializeCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const idSelectorCodeBuilder = new CodeBuilder();\n idSelectorCodeBuilder.slot(\"result\");\n idSelectorCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const hashTypeCodeBuilder = new CodeBuilder();\n hashTypeCodeBuilder.slot(\"ifs\");\n hashTypeCodeBuilder.slot(\"return\").raw(` return \"Ids\";`);\n\n const hashCodeBuilder = new CodeBuilder();\n hashCodeBuilder.slot(\"functions\").raw(`\n function stringifyDate(d) {\n\n if (d == null) {\n return \"\";\n }\n\n if (typeof d === \"string\") {\n return d;\n }\n\n if (d.getTime != null) {\n return \"\" + d.getTime();\n }\n\n return d.toString();\n } \n`);\n const hashCodeBuilderIfBlock = hashCodeBuilder.if(`type === \"Ids\"`, { name: \"hash-id-if\" });\n hashCodeBuilderIfBlock.slot(\"if-body\");\n hashCodeBuilderIfBlock.appendBody(\"return result\");\n hashCodeBuilder.slot(\"hash-object-return\");\n hashCodeBuilder.raw(` return result;`)\n\n const idProperties: PropertyInfo<any>[] = [];\n const allPropertyNamesAndPaths: string[] = [];\n let hashType: HashType = HashType.Ids;\n let hasIdentities = false;\n let hasIdentityKeys = false;\n\n this._iterate(this, (property) => {\n\n properties.push(property);\n propertyMap.set(property.id, property);\n allPropertyNamesAndPaths.push(property.getSelectrorPath({ parent: \"entity\" }));\n\n if (property.isIdentity === true) {\n hasIdentities = true;\n }\n\n if (property.isKey === true) {\n idProperties.push(property);\n }\n\n if (property.isKey === true && property.isIdentity === true) {\n hasIdentityKeys = true;\n }\n\n // Every chain must claim every property. A null return means no\n // handler matched, and silently omitting the property from the\n // generated function corrupts data — fail the compile instead.\n assertPropertyHandled(\"enrich\", property, enricher.handle(property, enricherCodeBuilder));\n assertPropertyHandled(\"merge\", property, merge.handle(property, mergeCodeBuilder));\n assertPropertyHandled(\"prepare\", property, prepare.handle(property, prepareCodeBuilder));\n assertPropertyHandled(\"strip\", property, strip.handle(property, stripCodeBuilder));\n assertPropertyHandled(\"clone\", property, clone.handle(property, cloneCodeBuilder));\n assertPropertyHandled(\"compare\", property, compare.handle(property, compareCodeBuilder));\n assertPropertyHandled(\"deserialize\", property, deserialize.handle(property, deserializeCodeBuilder));\n assertPropertyHandled(\"serialize\", property, serializeHandler.handle(property, serializeCodeBuilder))\n assertPropertyHandled(\"hashType\", property, hashTypeHandler.handle(property, hashTypeCodeBuilder));\n assertPropertyHandled(\"idSelector\", property, idSelectorHandler.handle(property, idSelectorCodeBuilder));\n assertPropertyHandled(\"hash\", property, hashHandler.handle(property, hashCodeBuilder));\n assertPropertyHandled(\"enableChangeTracking\", property, enableChangeTrackingHandler.handle(property, changeTrackingCodeBuilder));\n assertPropertyHandled(\"freeze\", property, freezeHandler.handle(property, freezeCodeBuilder));\n assertPropertyHandled(\"compareIds\", property, compareIdsHandler.handle(property, compareIdsCodeBuilder));\n assertPropertyHandled(\"set\", property, setHandlerHanlder.handle(property, setCodeBuilder));\n });\n\n if (idProperties.length === 0) {\n throw new Error(`Schema must have a key. Use .key() to mark a property as a key. Collection Name: ${this.collectionName}`)\n }\n\n /**\n * The two things `.searchable()` cannot express in its own type.\n *\n * It is NOT checked here that the property is a string. The builder gates that:\n * `searchable()` exists on `SchemaString`, and on `SchemaOptional`/`SchemaNullable`\n * only when their `instance` is a string, so `s.number().optional().searchable()`\n * does not compile. A builder that offers a method and then throws has gated\n * nothing.\n *\n * A string nested in an `s.object()` does type-check, and cannot be indexed: v1\n * keys index rows by a ROOT property name, so a nested one has nowhere to be\n * recorded. Rejected rather than ignored — a silently unindexed property returns no\n * rows for a query the caller believes is covered.\n *\n * A property NAME longer than 100 characters breaks the index key's length budget.\n * The key is `${term}|${field}|${sourceId}` in a column declared `VARCHAR(255)`, and\n * the field name is the only unbounded part of it. See \"The index collection\" in\n * specs/full-text-search.md.\n */\n for (const property of properties) {\n\n if (property.isSearchable === false) {\n continue;\n }\n\n if (property.parent != null) {\n throw new Error(\n `searchable() is declared on '${property.getAssignmentPath()}', which is nested inside another property. ` +\n `Full-text search indexes root-level string properties only. Collection Name: ${this.collectionName}`\n );\n }\n\n if (property.name.length > 100) {\n throw new Error(\n `searchable() is declared on '${property.name}', whose name is ${property.name.length} characters. ` +\n `A searchable property name must be 100 characters or fewer, so the search index key fits its column. ` +\n `Collection Name: ${this.collectionName}`\n );\n }\n\n // The index key is `${term}|${field}|${sourceId}`, and it is only unambiguous\n // because no part of it can contain the separator. The default tokenizer cannot\n // emit one — it splits on anything that is not a letter or digit — so the field\n // name is the only piece that could.\n if (property.name.includes(\"|\")) {\n throw new Error(\n `searchable() is declared on '${property.name}', whose name contains '|'. ` +\n `That character separates the parts of a search index key and cannot appear in a field name. ` +\n `Collection Name: ${this.collectionName}`\n );\n }\n }\n\n const enrichParams = enricherFunctionRoot.getParameters();\n const mergeParams = mergeFunctionRoot.getParameters();\n\n const enrichGenerator = this.createReturnFunction<Function>(enricherCodeBuilder);\n const mergeGenerator = this.createReturnFunction<Function>(mergeCodeBuilder);\n\n // After enricher is used, we modify it to be deserialize and enrich\n enricherFunctionBody.get<SlotBlock>(\"append\").insert(deserializeCodeBuilder.get<SlotBlock>(\"functions\"));\n enricherFunctionBody.get<SlotBlock>(\"append\").insert(deserializeCodeBuilder.get<SlotBlock>(\"result\"));\n enricherFunctionBody.get<SlotBlock>(\"append\").insert(deserializeCodeBuilder.get<SlotBlock>(\"if\"));\n enricherFunctionRoot.replace(\"function\", new FunctionBuilder(undefined).parameters(\"unserialized\", \"changeTrackingType\").return());\n\n const postProcessGenerator = this.createReturnFunction<Function>(enricherCodeBuilder);\n const postProcessParams = enricherFunctionRoot.getParameters();\n\n // Combine prepare and serialize\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(prepareCodeBuilder.get<SlotBlock>(\"result\"));\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(prepareCodeBuilder.get<SlotBlock>(\"assignments\"));\n\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(serializeCodeBuilder.get<SlotBlock>(\"assignments\"));\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(serializeCodeBuilder.get<SlotBlock>(\"functions\"));\n preprocessCodeBuilder.get<SlotBlock>(\"main\").insert(serializeCodeBuilder.get<SlotBlock>(\"if\"));\n\n const getIdsFunction = this.createFunction<(entity: InferType<T>) => [IdType]>(idSelectorCodeBuilder, \"entity\");\n const getHashTypeFunction = this.createFunction<GetHashTypeFunction<T>>(hashTypeCodeBuilder, \"entity\");\n const prepareFunction = this.createFunction<Prepare<T>>(prepareCodeBuilder, \"entity\");\n const cloneFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(cloneCodeBuilder, \"entity\");\n\n /**\n * `clone`, but for records that are still in the STORAGE shape.\n *\n * Built on first use rather than at compile time. Generating it costs a full pass over\n * the property tree plus a `Function` compile, and only stores that hold records in\n * storage shape ever ask for it, so a schema that is never read through one pays\n * nothing. After the first call it is the same generated function as `clone`.\n */\n let storageCloneFunction: ((entity: InferType<T>) => InferType<T>) | null = null;\n const cloneStorageFunction = (entity: InferType<T>): InferType<T> => {\n\n if (storageCloneFunction == null) {\n const storageCloneCodeBuilder = new CodeBuilder();\n\n // Undeclared columns are carried across; declared ones are left to the\n // generated deep-copy code below. This is the one place this differs from\n // `clone`, and both halves of it matter.\n //\n // Carrying them at all: a stored record can hold columns the schema never\n // declared, and this copier replaces `structuredClone`, which kept them.\n // ConcurrencyDbPlugin depends on exactly that — it appends a synthetic\n // `__version` property carrying a `from` name for the express purpose of\n // pushing reads onto this path, so its hidden column survives the copy and the\n // wrapper can observe the row's version. Drop the token and every read looks\n // unversioned, so optimistic concurrency stops detecting conflicts silently.\n //\n // Skipping the declared ones: a blanket `{ ...entity }` would seed the result\n // with the SOURCE's nested objects, and the child handlers then write their\n // copies into those shared references — mutating the record the caller was\n // copying to get away from.\n // Compared inline rather than against a Set: the set would be rebuilt on every\n // call, and this runs once per record on every read.\n const isDeclared = properties\n .filter(property => property.parent == null)\n .map(property => `key === ${JSON.stringify(property.getResolvedName())}`)\n .join(\" || \");\n\n const skipDeclared = isDeclared.length === 0 ? \"\" : `if (${isDeclared}) { continue; }\\n `;\n\n storageCloneCodeBuilder.slot(\"result\").raw(\n `const result = {};\\n` +\n ` for (const key in entity) {\\n` +\n ` if (Object.hasOwn(entity, key) === false) { continue; }\\n` +\n ` ${skipDeclared}result[key] = entity[key];\\n` +\n ` }`\n );\n storageCloneCodeBuilder.slot(\"assignments\");\n storageCloneCodeBuilder.slot(\"if\");\n storageCloneCodeBuilder.slot(\"return\").raw(` return result;`);\n\n const storageClone = cloneHandlerBuilder.build(true);\n\n for (let i = 0, length = properties.length; i < length; i++) {\n assertPropertyHandled(\"cloneStorage\", properties[i], storageClone.handle(properties[i], storageCloneCodeBuilder));\n }\n\n storageCloneFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(storageCloneCodeBuilder, \"entity\");\n }\n\n return storageCloneFunction(entity);\n };\n const deserializeFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(deserializeCodeBuilder, \"unserialized\");\n const serializeFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(serializeCodeBuilder, \"entity\");\n const compareFunction = this.createFunction<(a: InferType<T>, b: InferType<T>) => boolean>(compareCodeBuilder, \"a\", \"b\");\n const stripFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(stripCodeBuilder, \"entity\");\n const hashFunction = this.createFunction<HashFunction<T>>(hashCodeBuilder, \"entity\", \"type\");\n const enableChangeTrackingFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(changeTrackingCodeBuilder, \"entity\");\n const freezeFunction = this.createFunction<(entity: InferType<T>) => InferType<T>>(freezeCodeBuilder, \"entity\");\n const compareIdsFunction = this.createFunction<(a: InferType<T>, b: InferType<T>) => boolean>(compareIdsCodeBuilder, \"a\", \"b\");\n const preprocessFunction = this.createFunction<Preprocess<T>>(preprocessCodeBuilder, \"entity\");\n const setFunction = this.createFunction<SetProperties<T>>(setCodeBuilder, \"destination\", \"source\");\n\n const enricherFactoryFunction = enrichGenerator();\n const postProcessFactoryFunction = postProcessGenerator();\n const mergeFactoryFunction = mergeGenerator();\n const postProcessFunction = postProcessFactoryFunction(...postProcessParams.map(w => w.value))\n const enricherFunction = enricherFactoryFunction(...enrichParams.map(w => w.value));\n const mergeFunction = mergeFactoryFunction(...mergeParams.map(w => w.value));\n\n const idPropertyNames = idProperties.map(w => w.name);\n const getId = (entity: InferType<T>) => {\n if (idPropertyNames.length > 1) {\n return hashFunction(entity, HashType.Ids) as IdType;\n }\n\n return getIdsFunction(entity as any)[0] as IdType;\n }\n\n const getProperty = (id: string) => propertyMap.get(id);\n const id = hash([...allPropertyNamesAndPaths, this.collectionName].join(\",\")) as SchemaId;\n\n // memoize this by the validProperties\n // TODO: See if we can generate a function to do this and eliminate loops\n const deserializePartial = (item: Record<string, unknown>, properties: PropertyInfo<T>[]) => {\n\n for (let i = 0, length = properties.length; i < length; i++) {\n const property = properties[i];\n const value = property.getValue(item);\n\n if (value == null) {\n continue;\n }\n\n const deserialized = property.deserialize(value);\n property.setValue(item, deserialized);\n }\n\n return item as DeepPartial<InferType<T>>;\n }\n\n const result: CompiledSchemaCore<T> = {\n preprocess: preprocessFunction,\n postprocess: postProcessFunction,\n set: setFunction,\n getId,\n getProperty,\n properties,\n idProperties,\n hasIdentities,\n hashType,\n getHashType: getHashTypeFunction,\n merge: mergeFunction,\n prepare: prepareFunction,\n clone: cloneFunction,\n cloneStorage: cloneStorageFunction,\n deserializePartial,\n deserialize: deserializeFunction,\n serialize: serializeFunction,\n compare: compareFunction,\n compareIds: compareIdsFunction,\n strip: stripFunction,\n hash: hashFunction,\n id,\n getIds: getIdsFunction,\n enrich: enricherFunction,\n collectionName: this.collectionName,\n hasIdentityKeys,\n freeze: freezeFunction,\n enableChangeTracking: enableChangeTrackingFunction,\n definition: this,\n getIndexes: () => {\n\n const indexes: Index[] = [];\n\n for (let i = 0, length = properties.length; i < length; i++) {\n const property = properties[i];\n\n if (property.indexes.length === 0) {\n continue; // No Index\n }\n\n for (let j = 0, l = property.indexes.length; j < l; j++) {\n const indexName = property.indexes[j];\n\n // Test for compound indexes\n const connections = properties.filter(w =>\n w !== property && // Don't match with self\n w.indexes.some(index => index === indexName)\n );\n\n const indexedProperties = [property, ...connections];\n\n if (indexedProperties.length === 1) {\n // Not a compound property\n if (indexedProperties[0].isKey) {\n indexes.push({\n properties: indexedProperties,\n type: \"primary-key\",\n name: indexName\n });\n continue;\n }\n\n if (indexedProperties[0].isDistinct) {\n indexes.push({\n properties: indexedProperties,\n type: \"unique\",\n name: indexName\n });\n continue;\n }\n\n indexes.push({\n properties: indexedProperties,\n type: \"single\",\n name: indexName\n });\n continue;\n }\n\n if (indexes.some(w => w.name === indexName)) {\n continue; // Already in a compound index\n }\n\n indexes.push({\n properties: indexedProperties,\n type: \"compound\",\n name: indexName\n });\n }\n }\n\n return indexes;\n }\n };\n\n if (metadata != null) {\n\n const compiledSchemaWithMetadata: CompiledSchemaWithMetadata<T, TMetadata> = {\n ...result,\n createSubscription: (signal?: AbortSignal, scope?: string, options?: SchemaSubscriptionOptions) => new SchemaSubscription(result, signal, scope, options),\n metadata\n };\n\n return compiledSchemaWithMetadata;\n }\n\n const compiledSchema = {\n createSubscription: (signal?: AbortSignal, scope?: string, options?: SchemaSubscriptionOptions) => new SchemaSubscription(result, signal, scope, options),\n ...result\n };\n\n return compiledSchema;\n } catch (e) {\n throw new SchemaError(e, `Error compiling schema for collection: ${this.collectionName}`);\n }\n }\n}\n","import { CompiledSchema, DefaultValue, InferType, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaForeignKey } from \"../modifiers/SchemaForeignKey\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIdentity } from \"../modifiers/SchemaIdentity\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaKey } from \"../modifiers/SchemaKey\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaNumber<T extends number, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Number;\n private _schemaNumber = true;\n\n constrain<K extends T>() {\n return new SchemaNumber<K, TModifiers>(this as unknown as SchemaBase<K, TModifiers>);\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n key() {\n return new SchemaKey<T, TModifiers | \"key\">(this);\n }\n\n foreignKey<K extends {}>(relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n return new SchemaForeignKey<T, TModifiers, K>(this, relatingSchema, property);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n\n\n}","import { DefaultValue, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIdentity } from \"../modifiers/SchemaIdentity\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaObject<T extends {}, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Object;\n private _schemaObject = true;\n\n constructor(schema: T) {\n super();\n this.instance = schema;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n\n\n}","import { DefaultValue, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\n\n/**\n * A file: content on the way in, a reference on the way out.\n *\n * This is the one property type whose write shape differs from its stored shape. You assign\n * a `File`, a `Blob`, a `Uint8Array` or a string; what is stored, and what a query gives\n * back, is a reference — where the bytes live and what they are.\n *\n * ```ts\n * const documentSchema = s.define('documents', {\n * id: s.string().key().identity(),\n * title: s.string(),\n * file: s.file(),\n * }).compile();\n *\n * await store.documents.addAsync({ title: 'Q3', file: fileFromInput });\n * await store.saveChangesAsync();\n *\n * doc.file.size // 2_400_112\n * doc.file.contentType // 'application/pdf'\n * ```\n *\n * ## Why this cannot be `s.object({ key, size, ... })`\n *\n * The generated `preprocess` rebuilds an object property field by field from its declared\n * children — `result.file = {}` and then one assignment per child. Content assigned there is\n * therefore discarded by construction, before any plugin sees the entity: the property does\n * not arrive mangled, it does not arrive at all.\n *\n * A file is a LEAF here, with no child properties, so the generated code passes it through\n * untouched. The bytes survive as far as the plugin, which is the only place an upload can\n * happen — `preprocess` is synchronous and is called from the change tracker and the\n * broadcast path, so it cannot await one.\n *\n * ## What actually stores it\n *\n * Nothing in core uploads anything. `@routier/blob-plugin` wraps your real plugin, swaps\n * pending content for a reference during `bulkPersist`, and hands the reference down. Without\n * that wrapper a file property stores whatever you assigned, which is a mistake this type\n * cannot detect on its own.\n */\nexport class SchemaFile<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.File;\n private _schemaFile = true;\n\n constructor() {\n super();\n this.instance = null as T;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}\n","import { CompiledSchema, DefaultValue, InferType, PropertyDeserializer, PropertySerializer, SchemaModifiers, SchemaTypes, StringOptions } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaDeserialize } from \"../modifiers/SchemaDeserialize\";\nimport { SchemaDistinct } from \"../modifiers/SchemaDistinct\";\nimport { SchemaForeignKey } from \"../modifiers/SchemaForeignKey\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaIdentity } from \"../modifiers/SchemaIdentity\";\nimport { SchemaIndex } from \"../modifiers/SchemaIndex\";\nimport { SchemaKey } from \"../modifiers/SchemaKey\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaSearchable } from \"../modifiers/SchemaSearchable\";\nimport { SchemaSerialize } from \"../modifiers/SchemaSerialize\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\nimport { SchemaArray } from \"./SchemaArray\";\n\nexport class SchemaString<T extends string, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.String;\n private _schemaString = true;\n\n /**\n * @param entity Copied from when a modifier wraps this property.\n * @param literals The allowed values, when the string is a literal union.\n * @param options Declarations a backend may use. See `StringOptions`.\n */\n constructor(entity?: SchemaBase<T, TModifiers> | null, literals?: T[], options?: StringOptions) {\n super(entity, literals);\n\n if (options?.maxLength != null) {\n\n if (Number.isInteger(options.maxLength) === false || options.maxLength <= 0) {\n // Thrown at schema construction rather than at the first save, matching\n // `s.vector()`: a bad length is a typo in a declaration, and the stack is only\n // useful next to it.\n throw new Error(`A string's maxLength must be a positive whole number. Received: ${options.maxLength}`);\n }\n\n this.maxLength = options.maxLength;\n }\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n constrain<K extends T>() {\n return new SchemaString<K, TModifiers>(this as unknown as SchemaBase<K, TModifiers>);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n key() {\n return new SchemaKey<T, TModifiers | \"key\">(this);\n }\n\n foreignKey<K extends {}>(relatingSchema: CompiledSchema<K>, property: keyof InferType<CompiledSchema<K>>) {\n return new SchemaForeignKey<T, TModifiers, K>(this, relatingSchema, property);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n deserialize(deserializer: PropertyDeserializer<T>) {\n return new SchemaDeserialize<T, TModifiers | \"deserialize\">(deserializer, this);\n }\n\n serialize(serializer: PropertySerializer<T>) {\n return new SchemaSerialize<T, TModifiers | \"serialize\">(serializer, this);\n }\n\n identity() {\n return new SchemaIdentity<T, TModifiers | \"identity\" | \"readonly\">(this);\n }\n\n array() {\n return new SchemaArray<typeof this, TModifiers>(this as unknown as SchemaArray<typeof this, TModifiers>);\n }\n\n index(...indexes: string[]) {\n return new SchemaIndex<T, TModifiers>(this, ...indexes);\n }\n\n distinct() {\n return new SchemaDistinct<T, TModifiers | \"distinct\">(this);\n }\n\n /**\n * Marks this string as eligible for the collection's full-text search index.\n *\n * ```ts\n * title: s.string().searchable(),\n * body: s.string({ maxLength: 4000 }).searchable(),\n * ```\n *\n * Nothing is indexed until the collection declares `.searchIndex()`. Combines with\n * `.optional()` and `.nullable()` in either sense — an absent or null value contributes no\n * tokens.\n */\n searchable() {\n return new SchemaSearchable<T, TModifiers | \"searchable\">(this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n\n\n}","import { DefaultValue, SchemaModifiers, SchemaTypes } from \"../../types\";\nimport { SchemaBase } from \"../base/SchemaBase\";\nimport { SchemaDefault } from \"../modifiers/SchemaDefault\";\nimport { SchemaFrom } from \"../modifiers/SchemaFrom\";\nimport { SchemaNullable } from \"../modifiers/SchemaNullable\";\nimport { SchemaOptional } from \"../modifiers/SchemaOptional\";\nimport { SchemaReadonly } from \"../modifiers/SchemaReadonly\";\nimport { SchemaTag } from \"../modifiers/SchemaTag\";\n\n/**\n * An embedding: a fixed-length list of numbers you can search by similarity.\n *\n * ```ts\n * const documentSchema = s.define('documents', {\n * id: s.string().key().identity(),\n * title: s.string(),\n * embedding: s.vector(1536),\n * }).compile();\n *\n * const similar = await store.documents\n * .nearest(x => x.embedding, queryEmbedding, 10)\n * .toArrayAsync();\n * ```\n *\n * ## Why this is not `s.array(s.number())`\n *\n * By value it is exactly that, and every codegen handler treats the two the same on purpose —\n * a vector clones with a spread, compares by JSON and freezes like any other array. What an\n * array cannot carry is the DIMENSION COUNT, and a backend that stores vectors natively needs\n * it at DDL time: pgvector's column type is `vector(1536)`, not `vector`.\n *\n * So this exists to be RECOGNISED, not to behave differently. A backend that knows what a\n * vector is stores one; every other backend sees a list of numbers and stores JSON, which is\n * why the feature works everywhere rather than only on PostgreSQL.\n *\n * ## Dimensions are not enforced here\n *\n * `dimensions` is a declaration, and core never checks a value against it. The check belongs\n * where the cost of being wrong is paid: a backend with a native `vector(n)` column rejects a\n * mismatched write itself, with an error naming the column. Validating in core would duplicate\n * that on the backends that already do it and add a per-save array scan to the ones that\n * cannot use the information at all.\n *\n * ## Similarity is cosine, and it is not a filter\n *\n * `.nearest()` is an ordering plus a limit — it returns the closest rows, not the matching\n * ones. Distance itself is not exposed: the entity shape is fixed, and the ordering is what\n * callers act on. A backend with no vector support scores in memory, so the answer is the\n * same everywhere; only the amount of data read differs.\n */\nexport class SchemaVector<T extends any, TModifiers extends SchemaModifiers> extends SchemaBase<T, TModifiers> {\n\n instance: T;\n type = SchemaTypes.Vector;\n private _schemaVector = true;\n\n constructor(dimensions: number) {\n super();\n\n if (Number.isInteger(dimensions) === false || dimensions <= 0) {\n // Thrown at schema construction rather than at the first save: a bad dimension\n // count is a typo in a declaration, and the stack is only useful next to it.\n throw new Error(`A vector needs a positive whole number of dimensions. Received: ${dimensions}`);\n }\n\n this.dimensions = dimensions;\n this.instance = null as T;\n }\n\n from(propertyName: string) {\n return new SchemaFrom<T, TModifiers>(propertyName, this);\n }\n\n optional() {\n return new SchemaOptional<T, TModifiers | \"optional\">(this);\n }\n\n nullable() {\n return new SchemaNullable<T, TModifiers | \"nullable\">(this);\n }\n\n readonly() {\n return new SchemaReadonly<T, TModifiers | \"readonly\">(this);\n }\n\n default<I = never>(value: DefaultValue<T, I>, injected?: I) {\n return new SchemaDefault<T, I, TModifiers | \"default\">(value, injected, this);\n }\n\n tag(...tags: string[]) {\n return new SchemaTag<T, TModifiers>(tags, this);\n }\n}\n","import { SchemaArray } from \"./property/types/SchemaArray\";\nimport { SchemaBase } from \"./property/base/SchemaBase\";\nimport { SchemaBoolean } from \"./property/types/SchemaBoolean\";\nimport { SchemaDate } from \"./property/types/SchemaDate\";\nimport { SchemaDefinition } from \"./SchemaDefinition\";\nimport { SchemaNumber } from \"./property/types/SchemaNumber\";\nimport { SchemaObject } from \"./property/types/SchemaObject\";\nimport { SchemaFile } from \"./property/types/SchemaFile\";\nimport { SchemaString } from \"./property/types/SchemaString\";\nimport { SchemaVector } from \"./property/types/SchemaVector\";\nimport { CollectionName, FileReferenceValue, StringOptions, VectorValue } from \"./types\";\n\n/**\n * A string, optionally declaring how long it can be and which values it may take.\n *\n * ```ts\n * s.string() // any string\n * s.string(\"draft\", \"published\") // a literal union\n * s.string({ maxLength: 4000 }) // any string, declared long\n * s.string({ maxLength: 8 }, \"a\", \"b\") // both\n * ```\n *\n * The options object is a leading parameter rather than a `.maxLength()` modifier so the\n * declaration stays on the factory, next to the literals. A modifier would also have to survive\n * being wrapped by another modifier, which is the trap `SchemaBase.maxLength` documents.\n */\nfunction string<T extends string[] = string[]>(...literals: T): SchemaString<T[number] extends never ? string : T[number], never>;\nfunction string<T extends string[] = string[]>(options: StringOptions, ...literals: T): SchemaString<T[number] extends never ? string : T[number], never>;\nfunction string(optionsOrLiteral?: StringOptions | string, ...rest: string[]) {\n\n // A literal is a string and options is an object, so the first argument decides which\n // overload was called. Nothing else can be passed, which is why this needs no flag and no\n // second factory.\n if (typeof optionsOrLiteral === \"string\") {\n return new SchemaString<string, never>(null, [optionsOrLiteral, ...rest]);\n }\n\n if (optionsOrLiteral == null) {\n return new SchemaString<string, never>(null, []);\n }\n\n return new SchemaString<string, never>(null, rest, optionsOrLiteral);\n}\n\nexport const s = {\n number: <T extends number[] = number[]>(...literals: T) => new SchemaNumber<T[number] extends never ? number : T[number], never>(null, literals),\n string,\n boolean: <T extends boolean = boolean>() => new SchemaBoolean<T, never>(),\n date: <T extends Date = Date>() => new SchemaDate<T, never>(),\n array: <T extends any>(schema: SchemaBase<T, never>) => new SchemaArray<SchemaBase<T, never>, never>(schema as any),\n object: <T extends {} = {}>(schema: T) => new SchemaObject<T, never>(schema),\n /**\n * A file. Assign content, read back a reference.\n *\n * Needs `@routier/blob-plugin` wrapping your plugin to turn the one into the other; core\n * only carries the value through untouched.\n */\n file: () => new SchemaFile<FileReferenceValue, never>(),\n /**\n * An embedding of `dimensions` numbers, searchable with `.nearest()`.\n *\n * Every backend supports it. One with a native vector column uses it; the rest store the\n * numbers as JSON and score the search in memory, which returns the same rows.\n */\n vector: (dimensions: number) => new SchemaVector<VectorValue, never>(dimensions),\n define: <T extends {}>(collectionName: string, schema: T) => new SchemaDefinition<T>(collectionName as CollectionName, schema),\n}","export * from './SchemaComputed';\nexport * from './SchemaFunction';\nexport * from './SchemaTransform';\n","export * from './SchemaBase';","export * from './SchemaDefault';\nexport * from './SchemaDeserialize';\nexport * from './SchemaDistinct';\nexport * from './SchemaIdentity';\nexport * from './SchemaIndex';\nexport * from './SchemaKey';\nexport * from './SchemaNullable';\nexport * from './SchemaOptional';\nexport * from './SchemaReadonly';\nexport * from './SchemaSearchable';\nexport * from './SchemaSerialize';\nexport * from './SchemaTracked';\nexport * from './SchemaFrom';\nexport * from './SchemaTag';\nexport * from './SchemaForeignKey';\n","export * from './SchemaArray';\nexport * from './SchemaBoolean';\nexport * from './SchemaDate';\nexport * from './SchemaNumber';\nexport * from './SchemaObject';\nexport * from './SchemaString';\nexport * from './SchemaFile';\nexport * from './SchemaVector';\n","export * from './builder';\nexport * from './table';\nexport * from './property/base';\nexport * from './property/modifiers';\nexport * from './property/types';\nexport * from './PropertyInfo';\nexport * from './types';\nexport type { SchemaSubscriptionOptions } from './communication/broadcast';\nexport * from './utils/standardJsonSchema';\nexport * from './utils/propertyKind';\nexport * from './SchemaDefinition';","import type { SchemaDefinition } from \"./SchemaDefinition\";\nimport type { SchemaBase } from \"./property/base/SchemaBase\";\nimport type { SchemaArray } from \"./property/types/SchemaArray\";\nimport type { SchemaVector } from \"./property/types/SchemaVector\";\nimport type { SchemaObject } from \"./property/types/SchemaObject\";\nimport type { PropertyInfo } from \"./PropertyInfo\";\nimport type { DeepPartial } from \"../types\";\nimport type { SchemaFunction } from \"./table\";\nimport type { SchemaOptional, SchemaTag } from \"./property/modifiers\";\nimport type { Branded } from \"../utilities/types\";\nimport type { SchemaSubscriptionOptions } from \"./communication/broadcast\";\n\nexport type DefaultValue<T, I = never> = T | ((injected: I) => T);\nexport type FunctionBody<TEntity, TResult> = (entity: TEntity, collectionName: CollectionName) => TResult;\nexport type IdType = string | number;\nexport type ForeignKey<T extends {}> = { \n schema: CompiledSchema<T>, \n property: PropertyInfo<T> \n};\n\nexport enum SchemaTypes {\n Array = \"Array\",\n Boolean = \"Boolean\",\n Date = \"Date\",\n Number = \"Number\",\n Object = \"Object\",\n String = \"String\",\n Definition = \"Definition\",\n Function = \"Function\",\n Computed = \"Computed\",\n /**\n * Content in, reference out. The only type whose write shape differs from its stored\n * shape, and a leaf on purpose — see `SchemaFile`.\n */\n File = \"File\",\n /**\n * A fixed-length list of numbers, carrying its dimension count — see `SchemaVector`.\n *\n * Value-shaped exactly like `s.array(s.number())`, which is why every array codegen\n * handler accepts it. It is a distinct type only so a backend can recognise it and store\n * it natively; nothing else needs to tell the two apart.\n */\n Vector = \"Vector\"\n}\n\nexport type ArrayShape = string | number | Date | {};\n\n\n/**\n * What a file property gives back: where the bytes are and what they are.\n *\n * Declared in core so `InferType` can name it. Core never reads or writes the bytes — it only\n * carries this shape — and `@routier/blob-plugin` is what puts one here.\n */\nexport type FileReferenceValue = {\n /** Where the bytes live, content-addressed by the blob plugin. */\n key: string;\n /** Byte length. */\n size: number;\n /** Media type as supplied at upload. */\n contentType: string;\n /** SHA-256 of the bytes, lowercase hex. */\n checksum: string;\n /** The name to show a user. Not part of the key. */\n fileName: string;\n};\n\n/**\n * What a file property ACCEPTS: content, or a reference you already have.\n *\n * `Blob` covers `File`, which is what an `<input type=\"file\">` yields. A reference is accepted\n * too, so re-saving an entity that was read from the database does not have to re-upload it.\n */\nexport type FileContentValue =\n | FileReferenceValue\n | Uint8Array\n | ArrayBuffer\n | Blob\n | string;\n\n/**\n * What a vector property holds, in and out: a plain list of numbers.\n *\n * Named rather than written inline because the inference rules have to recognise it after a\n * modifier has erased which class produced it — the same problem `FileReferenceValue` solves\n * above, and for the same reason.\n */\nexport type VectorValue = number[];\n\n/**\n * What `s.string({ ... })` accepts.\n *\n * Declarations only. Core stores them and never acts on them; a backend that can use one does.\n */\nexport type StringOptions = {\n /**\n * The longest value the property is declared to hold.\n *\n * MySQL uses it for `VARCHAR(maxLength)`; without it every string column is\n * `VARCHAR(255)`, which silently truncates longer values. Other backends ignore it. Core\n * never validates a value against it — see `SchemaBase.maxLength`.\n */\n maxLength?: number;\n};\n\nexport type ExpandedProperty = ExpandedChildProperty & {\n assignmentPath: string;\n selectorPath: string;\n properties: Map<string, ExpandedChildProperty>;\n childDegree: number;\n};\n\nexport type ExpandedChildProperty = {\n propertyName: string;\n type: SchemaTypes;\n isNullableOrOptional: boolean;\n isReadonly: boolean;\n isIdentity: boolean;\n isUnmapped: boolean;\n}\n\nexport enum HashType {\n Ids = \"Ids\",\n Object = \"Object\"\n}\n\nexport type HashFunction<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>, type: HashType.Object): string;\n (entity: InferType<TEntity>, type: HashType.Ids): string;\n}\n\nexport type GetHashTypeFunction<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>): HashType.Object;\n (entity: InferType<TEntity>): HashType.Ids;\n}\n\nexport type ChangeTrackingType = \"proxy\" | \"diff\" | \"immutable\";\n\nexport type IndexType = \"single\" | \"compound\" | \"unique\" | \"primary-key\"\nexport type Index = {\n properties: PropertyInfo<any>[],\n type: IndexType;\n name: string;\n}\n\n/**\n * Represents changes to subscriptions, categorizing them by modifications to\n * entities (additions, updates, removals) or query-driven removals.\n * @template T - The type of the entities in the subscription.\n */\nexport type SubscriptionChanges<T extends {}> = {\n /**\n * Entities that have been added to the subscription.\n */\n adds: InferType<T>[];\n /**\n * Entities that have been updated within the subscription.\n */\n updates: InferType<T>[];\n /**\n * Entities that have been removed from the subscription.\n */\n removals: InferType<T>[];\n /**\n * Entities that have been added/updated/removed from the subscription and it is unknown \n * if the entities have been added/updated/removed.\n */\n unknown: InferType<T>[];\n}\n\nexport interface ISchemaSubscription<T extends {}> extends Disposable {\n send(changes: SubscriptionChanges<T>): void;\n onMessage(callback: (changes: SubscriptionChanges<T>) => void): void;\n}\n\nexport type Enrich<TEntity extends {}> = {\n (entity: InferType<TEntity>, changeTrackingType: ChangeTrackingType): InferType<TEntity>;\n (entity: InferCreateType<TEntity>, changeTrackingType: ChangeTrackingType): InferCreateType<TEntity>;\n}\nexport type Prepare<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>): InferCreateType<TEntity>;\n (entity: InferType<TEntity>): InferType<TEntity>;\n}\nexport type Preprocess<TEntity extends {}> = {\n (entity: InferCreateType<TEntity>): InferType<TEntity>;\n (entity: InferType<TEntity>): InferType<TEntity>;\n}\n\nexport type SetProperties<TEntity extends {}> = (destination: DeepPartial<InferType<TEntity> | InferCreateType<TEntity>>, source: DeepPartial<InferType<TEntity> | InferCreateType<TEntity>>) => void;\n\nexport type CompiledSchemaCore<TEntity extends {}> = Omit<CompiledSchema<TEntity>, \"createSubscription\">;\n\nexport type CompiledSchemaWithMetadata<TEntity extends {}, TMetadata> = {\n readonly metadata: TMetadata;\n} & CompiledSchema<TEntity>;\n\n/**\n * Represents a fully compiled schema with all utilities and metadata for an entity type.\n */\nexport type CompiledSchema<TEntity extends {}> = {\n\n deserializePartial: (item: Record<string, unknown>, properties: PropertyInfo<TEntity>[]) => DeepPartial<InferType<TEntity>>;\n\n createSubscription: (abortSignal?: AbortSignal, scope?: string, options?: SchemaSubscriptionOptions) => ISchemaSubscription<TEntity>;\n /** Returns the property info for a given id (full path) */\n getProperty: (id: string) => PropertyInfo<TEntity>;\n /** Returns the ID of the given entity. */\n getId: (entity: InferType<TEntity>) => IdType;\n /** Returns a deep clone of the given entity. */\n clone: (entity: InferType<TEntity>) => InferType<TEntity>;\n /**\n * Returns a deep clone of a record that is still in the STORAGE shape — renamed properties\n * under their `from` names rather than their in-memory names.\n *\n * `clone` reads in-memory names, so it returns `undefined` for every renamed property of a\n * stored record. Use this when copying rows a store holds before they have been deserialized.\n * Generated on first call; schemas that are never cloned in storage shape never build it.\n */\n cloneStorage: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Removes unmapped or extraneous properties from the entity. */\n strip: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Prepares a new entity for creation, applying defaults and transformations. */\n prepare: Prepare<TEntity>;\n /** Merges the source entity into the destination entity. */\n merge: (destination: InferType<TEntity> | InferCreateType<TEntity>, source: InferType<TEntity>) => InferType<TEntity>;\n /** Indicates if the schema has identity properties. */\n hasIdentities: boolean;\n /** List of properties that are identity keys. */\n idProperties: PropertyInfo<TEntity>[];\n /** All property metadata for the schema. */\n properties: PropertyInfo<TEntity>[],\n /** The hash type used for this schema. */\n hashType: HashType;\n /** Computes a hash for the given entity. */\n hash: HashFunction<TEntity>;\n /** Returns the hash type for the given entity. */\n getHashType: GetHashTypeFunction<TEntity>;\n /** Compares two entities for equality. */\n compare: (a: InferType<TEntity>, fromDb: InferType<TEntity>) => boolean;\n /** Deserializes an entity from storage format. */\n deserialize: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Sets 1 or many properties from the source object onto the destination object with change tracking. */\n set: SetProperties<TEntity>;\n /** Combines serializing and preparing an entity for saving. */\n preprocess: Preprocess<TEntity>;\n /** Combines deserializing and enriching an entity for selection. */\n postprocess: Enrich<TEntity>;\n\n /** Serializes an entity to storage format. */\n serialize: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Unique id for the schema. */\n id: SchemaId,\n /** The name of the collection for this schema. */\n collectionName: CollectionName;\n /** Returns all IDs for the given entity (usually a single-element tuple). */\n getIds: (entity: InferType<TEntity>) => [IdType];\n /** Enriches the entity with change tracking or other metadata. */\n enrich: Enrich<TEntity>;\n /** Indicates if the schema has identity keys. */\n hasIdentityKeys: boolean;\n /** Returns a deeply frozen (immutable) version of the entity. */\n freeze: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** Enables change tracking on the entity. */\n enableChangeTracking: (entity: InferType<TEntity>) => InferType<TEntity>;\n /** The schema definition object. */\n definition: SchemaDefinition<TEntity>;\n /** Returns all indexes defined for this schema. */\n getIndexes: () => Index[];\n /** Compares two entities for Id equality. */\n compareIds: (a: InferType<TEntity>, b: InferType<TEntity>) => boolean;\n}\n\nexport type PropertySerializer<T extends any> = (value: T) => string | number;\nexport type PropertyDeserializer<T extends any> = (value: string | number) => T;\n\n/**\n * A two-way transform between the application value and the stored value.\n *\n * Both directions may be async. Held as a live reference rather than stringified, so a\n * closure works and `injected` is a convenience rather than the only way in.\n */\nexport type PropertyTransform<T extends any> = {\n /**\n * Application value to stored value. Runs before the plugin sees it. May be async.\n *\n * `entity` is there for the one-way case: a transform with no `from` derives a value\n * rather than converting one, which is what `computed` does.\n */\n to: (value: T, entity: Record<string, unknown>) => unknown | Promise<unknown>;\n\n /**\n * Stored value back to application value. Runs after the plugin returns it.\n *\n * Optional. Leave it out and the transform is one-way: the stored value is the value.\n */\n from?: (value: unknown) => T | Promise<T>;\n\n /**\n * What the column becomes, when the stored form is not the property's own type.\n *\n * Defaults to the property's own type, so nothing changes unless you say it does. A\n * library that always produces text — a cipher, a compressor — sets this once, and the\n * caller who uses that library never writes it.\n */\n stores?: SchemaTypes;\n\n /**\n * Whether a filter on this property can still run in the database.\n *\n * Defaults to `none`, which rejects the filter rather than returning wrong rows. Set\n * `equality` only when `to` is deterministic.\n */\n comparable?: 'equality' | 'none';\n};\n\nexport type SchemaId = Branded<number, \"SchemaId\">;\nexport type CollectionName = Branded<string, \"CollectionName\">;\n\nexport type SchemaModifiers = \"default\" | \"deserialize\" |\n \"identity\" | \"key\" |\n \"nullable\" | \"optional\" |\n \"readonly\" | \"serialize\" |\n \"unmapped\" | \"computed\" |\n \"distinct\" | \"searchable\";\n\n/**\n * What a tagged property infers to.\n *\n * `tag()` is metadata and must not change a type, but `SchemaTag<T>` carries the same `T` as\n * whatever it wrapped without carrying which class that was. For a string `T` is already\n * `string`; for an object `T` is the map of child schemas, which only the `SchemaObject`\n * branch below knows how to unwrap. Falling through to the generic `SchemaBase` branch\n * therefore handed the raw map back, so `s.object({ key: s.string() }).tag('x')` typed\n * `key` as `SchemaString` instead of `string` — everything ran, and only the types lied.\n *\n * An array is distinguishable because `SchemaArray`'s parameter is the ELEMENT schema, so a\n * tagged array arrives here as a `SchemaBase` rather than a plain map.\n */\ntype InferTagged<C> = ResolveWrapped<C>;\n\n/**\n * What a wrapping modifier's inner type resolves to.\n *\n * `SchemaOptional`, `SchemaNullable` and `SchemaTag` all carry the same `C` as whatever they\n * wrapped, without carrying which class that was, so each has to work out what it is holding.\n * Three shapes are possible:\n *\n * - an already-resolved value (`string` from `s.string()`, a file reference from `s.file()`)\n * - an ELEMENT schema, which is what `SchemaArray` parameterises on\n * - a map of child schemas, which is what `SchemaObject` parameterises on\n *\n * Getting this wrong is silent. The map branch applied to an already-resolved object walks\n * its keys and infers `never` for each, so `s.file().optional()` typed as\n * `{ key: never, size: never, ... }` — which no value can satisfy and no test would catch at\n * runtime.\n */\ntype ResolveWrapped<C> =\n C extends string | number | boolean | Date | FileReferenceValue ? C :\n C extends VectorValue ? C :\n C extends SchemaBase<any, any> ? InferPrimitive<C>[] :\n { [K in keyof C]: InferPrimitive<C[K]> };\n\ntype InferPrimitive<T> =\n T extends SchemaOptional<infer C, infer __> ? ResolveWrapped<C> :\n T extends SchemaTag<infer C, infer __> ? InferTagged<C> :\n // Before the generic `SchemaBase` branch below, which would see `X = number[]` and map\n // the element through `InferPrimitive<number>` — no branch matches a bare `number`, so a\n // vector would type as `never[]`: assignable from nothing, and invisible at runtime.\n T extends SchemaVector<infer __, infer ___> ? VectorValue :\n T extends SchemaArray<infer Y, infer __> ? InferPrimitive<Y>[]\n : T extends SchemaObject<infer Obj, infer _> ?\n { [K in keyof Obj]: InferPrimitive<Obj[K]> } : // Process nested objects\n T extends SchemaFunction<infer F, infer __> ? F : T extends SchemaBase<infer X, infer _> ?\n X extends Array<infer A> ? InferPrimitive<A>[] : X : // Extract the primitive type\n never;\n\nexport type InferType<T> = T extends CompiledSchema<infer R> ? InferCompiledSchema<R> : T extends {} ? InferCompiledSchema<T> : T;\nexport type InferCreateType<T> = T extends CompiledSchema<infer R> ? InferCompiledCreateSchema<R> : T extends {} ? InferCompiledCreateSchema<T> : unknown;\nexport type InferMappedType<T> = T extends SchemaBase<infer K, infer __> ? InferType<K> : InferCompiledSchema<T>;\nexport type InferRoot<T> = T extends CompiledSchema<infer R> ? R : never;\n\ntype HasModifier<T, K extends keyof T, M extends SchemaModifiers> =\n T[K] extends SchemaBase<any, infer Mods> ?\n M extends Mods ? true : false :\n false;\n\ntype IsPlainProperty<T, K extends keyof T> =\n [\n HasModifier<T, K, \"readonly\">,\n HasModifier<T, K, \"optional\">,\n HasModifier<T, K, \"nullable\">\n ] extends [\n false,\n false,\n false\n ] ? true : false;\n\ntype IsCreateExcluded<T, K extends keyof T> =\n [\n HasModifier<T, K, \"identity\">,\n HasModifier<T, K, \"computed\">,\n HasModifier<T, K, \"unmapped\">\n ] extends [\n false,\n false,\n false\n ] ? false : true;\n\ntype IsCreateOptional<T, K extends keyof T> =\n [\n HasModifier<T, K, \"optional\">,\n HasModifier<T, K, \"default\">\n ] extends [\n false,\n false\n ] ? false : true;\n\ntype IsCreateNullable<T, K extends keyof T> =\n HasModifier<T, K, \"nullable\"> extends true ? true : false;\n\n/**\n * What a property ACCEPTS on the way in, which is not always what it gives back.\n *\n * Only a file differs today: you assign content and read a reference. Matching on the read\n * type rather than on `SchemaFile` itself is deliberate — it keeps working through every\n * modifier. `s.file().optional()` is a `SchemaOptional`, `s.file().tag('x')` is a\n * `SchemaTag`, and neither carries the original class, so a check against the class alone\n * would silently stop accepting content the moment anyone added a modifier.\n *\n * Assignability is required in BOTH directions, and the tuple wrappers are load-bearing.\n * One-way `extends` matches `never` — which is assignable to everything — so a generic\n * property over `Record<string, unknown>` resolved to file content and broke the Dexie\n * plugin's types. It also matched any object that merely happens to have these five fields\n * plus more. Mutual assignability admits the reference shape and nothing else, and the\n * tuples stop the conditional distributing over a union.\n */\ntype InferWritePrimitive<T> =\n [InferPrimitive<T>] extends [FileReferenceValue]\n ? [FileReferenceValue] extends [InferPrimitive<T>] ? FileContentValue : InferPrimitive<T>\n : InferPrimitive<T>;\n\ntype InferCreateProperty<T, K extends keyof T> =\n IsCreateNullable<T, K> extends true ? null | InferWritePrimitive<T[K]> : InferWritePrimitive<T[K]>;\n\ntype InferCompiledSchema<T> = CoalesceEmpty<{\n [K in keyof T as IsPlainProperty<T, K> extends true ? K : never]: InferPrimitive<T[K]>\n}, {\n readonly [K in keyof T as HasModifier<T, K, \"readonly\"> extends true ? K : never]: InferPrimitive<T[K]>\n }, {\n [K in keyof T as HasModifier<T, K, \"optional\"> extends true ? K : never]?: InferPrimitive<T[K]>\n }, {\n [K in keyof T as HasModifier<T, K, \"nullable\"> extends true ? K : never]: null | InferPrimitive<T[K]>\n}>;\n\ntype InferCompiledCreateSchema<T> = {\n [K in keyof T as IsCreateExcluded<T, K> extends true ? never\n : IsCreateOptional<T, K> extends true ? K : never]?: InferCreateProperty<T, K>\n} & {\n [K in keyof T as IsCreateExcluded<T, K> extends true ? never\n : IsCreateOptional<T, K> extends true ? never : K]: InferCreateProperty<T, K>\n};\n\ntype IsEmptyObject<T> = keyof T extends never ? true : false;\ntype CoalesceEmpty<T1 extends {}, T2 extends {}, T3 extends {}, T4 extends {}> = (IsEmptyObject<T1> extends true ? {} : T1) & (IsEmptyObject<T2> extends true ? {} : T2) & (IsEmptyObject<T3> extends true ? {} : T3) & (IsEmptyObject<T4> extends true ? {} : T4);\n","export const isDate = (data: unknown): data is Date => {\n if (data == null) {\n return false;\n }\n\n if (typeof data !== \"object\") {\n return false;\n }\n\n return data instanceof Date;\n}","export const toMap = <T extends {}>(data: T[], keySelector: (item: T) => T[keyof T] | string) => {\n\n const result = new Map<T[keyof T] | string, T>();\n\n for (let i = 0; i < data.length; i++) {\n const item = data[i];\n const key = keySelector(item);\n result.set(key, item);\n }\n\n return result;\n}\n","export const cast = <TIn, TOut>(item: TIn) => {\n return item as unknown as TOut;\n}\n\nexport function clone<T extends {}>(data: T): T {\n return JSON.parse(JSON.stringify(data)) as T;\n}","export const isNodeRuntime = () => typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null;","import { BulkPersistResult, BulkPersistChanges } from \"../collections\";\nimport { DbPluginBulkPersistEvent } from \"../plugins\";\n\nexport const resolveBulkPersistChanges = (event: DbPluginBulkPersistEvent, result: BulkPersistResult, bulkPersistChanges: BulkPersistChanges) => {\n // make sure we swap the adds here, that way we can make sure other persist events\n // don't take their additions and try to change subsequent calls\n for (const [schemaId, changes] of event.operation) {\n\n const schemmaBulkPersistResult = result.get(schemaId);\n const schemaBulkPersistChanges = bulkPersistChanges.resolve(schemaId);\n\n // Set the original removes\n schemaBulkPersistChanges.removes = changes.removes;\n\n // Set the original updates\n schemaBulkPersistChanges.updates = changes.updates;\n\n // Take the adds from the result and set them to be persisted\n // in the replicated plugins because the id's are set in the \n // memory data store\n schemaBulkPersistChanges.adds = schemmaBulkPersistResult.adds;\n }\n}","import { QueryOptionsCollection } from \"../plugins/query\";\n\nexport const combineQueryOptionsCollections = <T>(...collections: QueryOptionsCollection<T>[]) => {\n const result = new QueryOptionsCollection<T>();\n\n for (let i = 0, length = collections.length; i < length; i++) {\n const collection = collections[i];\n\n // Add scoped items first\n collection.forEach(item => {\n result.add(item.name, item.value);\n });\n }\n\n return result;\n}","import { InferCreateType, InferType, SchemaId } from \"../schema\";\nimport { DbPluginBulkPersistEvent, EntityUpdateInfo } from \"../plugins\";\n\ntype DbEvent = {\n type: \"add\",\n data: InferCreateType<unknown>;\n} | {\n type: \"update\",\n data: EntityUpdateInfo<unknown>;\n} | {\n type: \"remove\",\n data: InferType<unknown>;\n}\n\nexport const toEventArray = (event: DbPluginBulkPersistEvent): [SchemaId, DbEvent][] => {\n\n const result: [SchemaId, DbEvent][] = [];\n for (const [schemaId, changes] of event.operation) {\n\n if (changes.hasItems === false) {\n continue;\n }\n\n if (changes.adds.length > 0) {\n result.push(...changes.adds.map(add => {\n return [schemaId as SchemaId, { data: { ...add }, type: \"add\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.updates.length > 0) {\n result.push(...changes.updates.map(update => {\n return [schemaId as SchemaId, { data: { ...update }, type: \"update\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.removes.length > 0) {\n result.push(...changes.removes.map(remove => {\n return [schemaId as SchemaId, { data: { ...remove }, type: \"remove\" }] as [SchemaId, DbEvent];\n }));\n }\n }\n\n return result\n}","export const noop = (..._args: any[]) => { };","export const unsafeCast = <T>(value: unknown): T => {\n return value as T\n}","export * from './arrays';\nexport * from './strings';\nexport * from './dates';\nexport * from './objects';\nexport * from './runtime';\nexport * from './uuid';\nexport * from './replication';\nexport * from './types';\nexport * from './queryOptionsCollection';\nexport * from './dbPluginEventUtils';\nexport * from './functions';\nexport * from './unsafeCast';\nexport * from './logger';","/**\n * Levelled logging, resolved once.\n *\n * Three things about the previous implementation drove this shape:\n *\n * - **There was no way to turn logging off.** `globalThis.__ROUTIER_DEBUG__` was only ever\n * compared against `true`, so setting it to `false` did nothing — while\n * `docs/how-to/debug-logging.md` documented exactly that as the way to force logging off.\n * A documented switch that silently does nothing is worse than no switch.\n * - **`NODE_ENV === 'test'` enabled it.** Every Jest run therefore logged, because Jest always\n * sets `NODE_ENV=test`. Measured on the S7 stress scenario, which drives ~2,000 saves through\n * a plugin that logs three lines per query: 12.4s with logging, ~6s without. Test runners also\n * capture console output by snapshotting a stack trace per call, so the cost is far above what\n * writing to a terminal would suggest — and the output buries whatever the failure was.\n * - **It was all-or-nothing, and re-resolved per call.** An error could not be kept while debug\n * was dropped, and every one of the ~97 call sites re-read `globalThis` and `process.env`.\n *\n * Levels are compared numerically against a value cached at module load. Measured against a\n * no-op console at 200k calls: an enabled call costs ~70ns, a call rejected by the gate ~3ns.\n * Building the arguments the call site passes in accounts for ~0.2ns of that 3ns, which is why\n * this keeps the ordinary `logger.debug(msg, payload)` signature instead of taking a thunk —\n * a lazy API would recover 0.3% of an enabled call's cost and would have to change every call\n * site to do it.\n */\n\n/** Ordered from most severe to most verbose. `silent` discards everything. */\nexport const LOG_LEVELS = ['silent', 'error', 'warn', 'info', 'debug'] as const;\n\nexport type LogLevel = (typeof LOG_LEVELS)[number];\n\n/** Numeric rank, so a gate is one integer comparison. */\nconst RANK: Record<LogLevel, number> = {\n silent: 0,\n error: 1,\n warn: 2,\n info: 3,\n debug: 4,\n};\n\nconst isLogLevel = (value: unknown): value is LogLevel =>\n typeof value === 'string' && (LOG_LEVELS as readonly string[]).includes(value);\n\n/**\n * Resolves the configured level, in precedence order.\n *\n * Ordered most specific first: an explicit level beats a boolean flag, a boolean flag beats an\n * environment variable, and an environment variable beats an inference from `NODE_ENV`. Anything\n * unrecognised is ignored rather than treated as an error — a typo'd level should not take down\n * an application, and `silent` is the safe direction to fall back to.\n */\nconst resolveLevel = (): LogLevel => {\n if (typeof globalThis !== 'undefined') {\n const g = globalThis as { __ROUTIER_LOG_LEVEL__?: unknown; __ROUTIER_DEBUG__?: unknown };\n\n if (isLogLevel(g.__ROUTIER_LOG_LEVEL__)) {\n return g.__ROUTIER_LOG_LEVEL__;\n }\n\n // Both directions honoured. `=== false` used to fall through to the NODE_ENV checks\n // below and re-enable the logging it was asked to suppress.\n if (g.__ROUTIER_DEBUG__ === true) return 'debug';\n if (g.__ROUTIER_DEBUG__ === false) return 'silent';\n }\n\n // There is deliberately no `import.meta.env` branch, although the documentation used to\n // promise one. It could never work: this package is bundled with rspack, which replaces\n // `import.meta` with `undefined`, so the check would read the *library's* build-time\n // environment rather than the application's — and referencing `import.meta` at all is a parse\n // error under a CommonJS build target, which is how the test suite loads this file. Vite and\n // similar apps set `__ROUTIER_LOG_LEVEL__` or `__ROUTIER_DEBUG__` from their own\n // `import.meta.env`, which is what the docs now describe.\n if (typeof process !== 'undefined' && process.env != null) {\n if (isLogLevel(process.env.ROUTIER_LOG_LEVEL)) {\n return process.env.ROUTIER_LOG_LEVEL as LogLevel;\n }\n\n const debug = process.env.DEBUG;\n if (debug === 'routier' || debug === '*') return 'debug';\n\n const env = process.env.NODE_ENV?.toLowerCase();\n\n // `test` is deliberately absent. It used to be here, which meant no test suite anywhere\n // could run Routier quietly. Opt in with DEBUG=routier or ROUTIER_LOG_LEVEL when a test\n // needs the output.\n if (env === 'dev' || env === 'development') return 'debug';\n }\n\n return 'silent';\n};\n\nlet level: LogLevel = resolveLevel();\nlet rank = RANK[level];\n\n/**\n * Overrides the level for the rest of the process.\n *\n * The configuration above is read once, at import, which is what makes the gate cheap — but it\n * also means an application that decides its verbosity after startup, or a test that wants to\n * assert on output, has no way in. This is that way in.\n */\nexport const setLogLevel = (next: LogLevel): void => {\n if (isLogLevel(next) === false) {\n throw new Error(`Unknown log level \"${next}\". Expected one of: ${LOG_LEVELS.join(', ')}`);\n }\n\n level = next;\n rank = RANK[next];\n};\n\nexport const getLogLevel = (): LogLevel => level;\n\n/** Re-reads the environment. For tests that change it after this module was imported. */\nexport const resetLogLevel = (): void => {\n level = resolveLevel();\n rank = RANK[level];\n};\n\n/**\n * Whether a message at this level would be emitted.\n *\n * For the rare call site whose *arguments* are expensive to build — a serialization, a deep\n * clone, a join over a large collection. An ordinary payload object is not worth guarding; see\n * the measurement in the header.\n */\nexport const isLogLevelEnabled = (at: LogLevel): boolean => rank >= RANK[at];\n\ntype ConsoleMethod = 'log' | 'info' | 'warn' | 'error' | 'debug' | 'table';\n\nconst emit = (at: LogLevel, method: ConsoleMethod, args: unknown[]) => {\n if (rank < RANK[at]) {\n return;\n }\n\n // Resolved at call time rather than captured once: test harnesses and browser devtools both\n // replace console methods after modules have loaded, and a captured reference would keep\n // writing past the replacement.\n (console[method] as (...a: unknown[]) => void)(...args);\n};\n\nexport const logger = {\n /** General-purpose output. Carried at `info`, since `log` names a console method, not a level. */\n log: (...args: unknown[]): void => emit('info', 'log', args),\n info: (...args: unknown[]): void => emit('info', 'info', args),\n warn: (...args: unknown[]): void => emit('warn', 'warn', args),\n error: (...args: unknown[]): void => emit('error', 'error', args),\n debug: (...args: unknown[]): void => emit('debug', 'debug', args),\n /** Diagnostic tabular output; verbose by nature, so it sits at `debug`. */\n table: (...args: unknown[]): void => emit('debug', 'table', args),\n};\n","export const hash = (value: string, seed: number = 0) => {\n // From Stack Overflow\n // https://stackoverflow.com/a/52171480/3329760\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\n for (let i = 0, ch: number; i < value.length; i++) {\n ch = value.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}\n\n/**\n * Fast string hash optimized for comparisons.\n * Uses djb2 algorithm - very fast and good distribution for short to medium strings.\n * Same input always produces same output (deterministic).\n * \n * @param value - The string to hash\n * @param seed - Optional seed value (default: 5381)\n * @returns A positive 32-bit integer hash value\n * \n * @example\n * ```ts\n * fastHash(\"test\") === fastHash(\"test\") // true\n * fastHash(\"test\") !== fastHash(\"test2\") // true\n * ```\n */\nexport const fastHash = (value: string, seed: number = 5381): number => {\n let hash = seed;\n for (let i = 0; i < value.length; i++) {\n hash = ((hash << 5) + hash) + value.charCodeAt(i);\n }\n return hash >>> 0; // Convert to unsigned 32-bit integer\n}\n\n/**\n * Converts any value to a readable string representation.\n * Handles primitives, objects, arrays, classes, dates, errors, and functions.\n * Supports depth limiting to prevent infinite recursion on circular references.\n * \n * @param obj - The value to stringify\n * @param maxDepth - Maximum depth for nested objects (default: 3)\n * @param currentDepth - Current recursion depth (default: 0)\n * @returns String representation of the value\n * \n * @example\n * ```ts\n * stringifyObject({ name: \"test\", count: 5 }) // '{ name: \"test\", count: 5 }'\n * stringifyObject([1, 2, 3]) // '[1, 2, 3]'\n * stringifyObject(new Date()) // 'Date(2024-01-01T00:00:00.000Z)'\n * ```\n */\nexport function stringifyObject(obj: unknown, maxDepth: number = 3, currentDepth: number = 0): string {\n if (obj === null) return 'null';\n if (obj === undefined) return 'undefined';\n\n const type = typeof obj;\n\n switch (type) {\n case 'string':\n return `\"${obj}\"`;\n case 'number':\n case 'boolean':\n return String(obj);\n case 'function':\n return `[Function: ${getFunctionName(obj as Function)}]`;\n case 'object':\n if (currentDepth >= maxDepth) {\n return '[Max Depth Reached]';\n }\n return stringifyObjectValue(obj, maxDepth, currentDepth);\n default:\n return `[${type}]`;\n }\n}\n\nfunction getFunctionName(fn: Function): string {\n const name = fn.name;\n return name || 'anonymous';\n}\n\nfunction getObjectProperties(obj: any): Record<string, any> {\n const properties: Record<string, any> = {};\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) {\n properties[key] = obj[key];\n }\n }\n\n return properties;\n}\n\nfunction stringifyObjectValue(obj: any, maxDepth: number, currentDepth: number): string {\n if (obj === null) return 'null';\n\n if (obj instanceof Date) {\n return `Date(${obj.toISOString()})`;\n }\n\n if (obj instanceof Error) {\n return `Error(${obj.message})`;\n }\n\n if (obj instanceof RegExp) {\n return obj.toString();\n }\n\n if (Array.isArray(obj)) {\n return stringifyArray(obj, maxDepth, currentDepth);\n }\n\n if (obj.constructor && obj.constructor.name !== 'Object') {\n return stringifyClassInstance(obj, maxDepth, currentDepth);\n }\n\n return stringifyPlainObject(obj, maxDepth, currentDepth);\n}\n\nfunction stringifyArray(arr: any[], maxDepth: number, currentDepth: number): string {\n if (arr.length === 0) return '[]';\n\n const items = arr.slice(0, 5).map(item =>\n stringifyObject(item, maxDepth, currentDepth + 1)\n );\n\n const suffix = arr.length > 5 ? `... (+${arr.length - 5} more)` : '';\n return `[${items.join(', ')}${suffix}]`;\n}\n\nfunction stringifyClassInstance(obj: any, maxDepth: number, currentDepth: number): string {\n const className = obj.constructor.name;\n const properties = getObjectProperties(obj);\n\n if (Object.keys(properties).length === 0) {\n return `${className} {}`;\n }\n\n const props = Object.entries(properties)\n .slice(0, 5)\n .map(([key, value]) => {\n const isPrimitive = value === null || value === undefined ||\n (typeof value !== 'object' && typeof value !== 'function');\n const depth = isPrimitive ? currentDepth : currentDepth + 1;\n return `${key}: ${stringifyObject(value, maxDepth, depth)}`;\n });\n\n const suffix = Object.keys(properties).length > 5 ?\n `... (+${Object.keys(properties).length - 5} more)` : '';\n\n return `${className} { ${props.join(', ')}${suffix} }`;\n}\n\nfunction stringifyPlainObject(obj: any, maxDepth: number, currentDepth: number): string {\n const properties = getObjectProperties(obj);\n\n if (Object.keys(properties).length === 0) {\n return '{}';\n }\n\n const props = Object.entries(properties)\n .slice(0, 5)\n .map(([key, value]) => {\n const isPrimitive = value === null || value === undefined ||\n (typeof value !== 'object' && typeof value !== 'function');\n const depth = isPrimitive ? currentDepth : currentDepth + 1;\n return `${key}: ${stringifyObject(value, maxDepth, depth)}`;\n });\n\n const suffix = Object.keys(properties).length > 5 ?\n `... (+${Object.keys(properties).length - 5} more)` : '';\n\n return `{ ${props.join(', ')}${suffix} }`;\n}","export const uuid = (length: number = 16): string => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charLength = chars.length;\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.random() * charLength | 0];\n }\n return result;\n}\n\nconst HEX_CHARS = '0123456789abcdef';\nconst UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\nconst hasCrypto =\n typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n\nconst hasRandomUUID =\n typeof crypto !== 'undefined' && typeof crypto.randomUUID === 'function';\n\nexport const uuidv4 = (): string => {\n if (hasRandomUUID) {\n return crypto.randomUUID();\n }\n\n return uuidv4Fallback();\n};\n\nconst uuidv4Fallback = (): string => {\n let randomBytes: Uint8Array | null = null;\n if (hasCrypto) {\n randomBytes = crypto.getRandomValues(new Uint8Array(16));\n }\n\n let byteIndex = 0;\n let uuid = '';\n\n for (let i = 0; i < UUID_TEMPLATE.length; i++) {\n const c = UUID_TEMPLATE[i];\n if (c === '-') {\n uuid += '-';\n continue;\n }\n\n let r: number;\n if (hasCrypto && randomBytes) {\n // Each byte gives two hex digits (nibbles)\n r =\n (i % 2 === 0\n ? randomBytes[byteIndex] >> 4\n : randomBytes[byteIndex++] & 0x0f);\n } else {\n r = Math.floor(Math.random() * 16);\n }\n\n if (c === 'x') {\n uuid += HEX_CHARS[r];\n } else if (c === 'y') {\n // Variant bits: 8, 9, A, or B\n uuid += HEX_CHARS[(r & 0x3) | 0x8];\n } else if (c === '4') {\n uuid += '4';\n }\n }\n\n return uuid;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","export * from './assertions';\nexport * from './codegen';\nexport * from './collections';\nexport * from './errors';\nexport * from './expressions';\nexport * from './performance';\nexport * from './pipeline';\nexport * from './plugins';\nexport * from './results';\nexport * from './schema';\nexport * from './types';\nexport * from './utilities';\nexport * from './capabilities';"],"names":["EXPRESSION_TYPES","isDate","assertDate","data","TypeError","assertIsNotNull","message","assertIsArray","Array","assertString","assertInstanceOf","value","Instance","assertIsNumber","isObjectWithType","isExpression","isOperatorExpression","isComparatorExpression","isPropertyExpression","isValueExpression","isEmptyExpression","isNotParsableExpression","Capability","Set","obj","descriptor","key","name","info","propertyName","parent","path","instance","onDiscover","explore","visited","i","item","allKeys","Object","isCallable","PerformanceTracker","Map","operationId","methodPath","startTime","performance","timing","endTime","duration","timeToNextCall","undefined","milliseconds","currentTime","operationStartTime","uuid","CallTraceManager","Error","methodPaths","stringifyObject","logger","PerformanceCapability","options","meta","originalMethod","args","String","isNewOperation","callTrace","depth","formattedCallTrace","indent","Math","childMethodKey","metrics","formattedDuration","childDurations","totalChildTime","sum","d","formattedTotalChildTime","overhead","formattedOverhead","currentTrace","parentPath","rootChildDurations","parentMethodKey","parentChildDurations","TracingCapability","console","Block","parentIndent","w","lines","block","split","result","found","x","line","foundIndex","text","ContainerBlock","condition","builder","IfBuilder","raw","RawBuilder","FunctionBuilder","FunctionFactoryBuilder","declaration","VariableBuilder","variableName","AssignmentBuilder","ObjectBuilder","SlotBlock","accessor","ArrayBuilder","StringBuilder","type","and","AndBuilder","objectBuilder","functionName","stringBuilder","arrayBuilder","lastLine","isNestedContent","sectionName","params","body","parameterNames","parameterValues","Function","r","signature","CodeBuilder","TagCollection","BulkPersistResult","schemaId","SchemaPersistResult","count","BulkPersistChanges","SchemaPersistChanges","ReadonlySchemaCollection","callbackfn","thisArg","Symbol","collectionName","SchemaCollection","schema","tag","keys","length","tags","IdSet","ids","other","SchemaTypes","Result","uuidv4","MemoryDataCollection","property","nextId","currentIdForProperty","id","items","idProperties","j","l","done","OptimisticConcurrencyError","conflicts","error","PluginDestroyedError","reason","SchemaError","innerErrorMessage","UNRESOLVED","applyTransformer","transformer","operand","expression","row","equals","left","right","strict","Date","compare","comparator","asComparable","a","b","comparable","evaluateComparator","evaluate","toPredicate","toStrictPredicate","Expression","OperatorExpression","ComparatorExpression","ValueExpression","PropertyExpression","ERROR_MESSAGES","JSON","parseUnknown","ParamDependentParseError","converters","v","Boolean","Number","MULTI_CHARACTER_PUNCTUATION","SINGLE_CHARACTER_PUNCTUATION","STRING_ESCAPES","isIdentifierStart","char","isIdentifierPart","isDigit","isHexDigit","decodeCodeEscape","source","backslashIndex","kind","start","end","parseInt","digits","tokenize","tokens","quote","escaped","decoded","nextChar","radixPrefix","signLength","multi","TokenStream","offset","token","COMPARATOR_METHODS","TRANSFORM_METHODS","COMPARISON_OPERATORS","SWAPPED_COMPARATORS","ParamReferenceExpression","resolveParamPath","paramsName","resolvePairedValue","pairedProperty","applyConverter","ExpressionParser","stream","entityName","trailing","operatorToken","numberToken","elements","element","array","method","argument","root","locale","segment","paramPath","resolved","pathString","operator","comparedToFalse","swapped","target","isStringMatch","bindExpression","bound","clone","resolveFunctionShape","stringifiedFunction","hasParams","functionHead","parametersEnd","arrowIndex","destructured","inner","templateCache","WeakMap","MAX_CACHED_TEMPLATES_PER_SCHEMA","getCachedTemplate","setCachedTemplate","entry","bySource","combineExpressions","expressions","parseFragment","rootName","parser","toExpression","fn","warn","cached","template","structurallyDependsOnParams","shape","valueToJson","valueFromJson","EmptyExpression","NotParsableExpression","json","child","node","rebuilt","getProperties","properties","traverse","expr","forEach","callback","measurements","now","measure","delta","TrampolinePipeline","initialData","index","currentData","isRunning","finalStepSentinel","createStepRevised","idx","processor","syncCallbackResult","calledSync","nextStep","trampoline","step","currentStep","trampolineError","map","previous","WorkPipeline","work","SyncronousQueue","unitOfWork","TranslatedArrayValue","isTransformed","TranslatedGroupValue","group","len","TranslatedSingleValue","DataTranslator","option","query","cosineDistance","Infinity","dot","leftMagnitude","rightMagnitude","nearestBy","rows","vector","select","mismatched","scored","stored","QueryOptionsCollection","Query","enableChangeTrackingOverride","max","min","PluginEventResult","toEntityShape","readJoinKey","reference","current","isMatchableKey","applyInnerOptions","innerOptions","filtered","filter","selector","hashJoin","outerRows","innerRows","outerKey","innerKey","isLeft","buckets","bucket","tuples","outer","matches","matchLength","DEFAULT_SEMI_JOIN_KEY_THRESHOLD","distinctJoinKeys","threshold","read","semiJoinFilter","values","loadJoinInnerSide","event","outerKeys","joinOption","innerSchema","innerEvent","joinInPlugin","before","at","outerEvent","outerResult","innerResult","executeJoin","e","JsonTranslator","innerSide","response","field","resolvedValue","keyValue","_","direction","y","needsDateConversion","mapOption","sort","best","toVector","parsed","SqlTranslator","pushedDown","column","TupleTranslator","tuple","__","MEMORY_EXECUTION_EXPLANATIONS","EXECUTED_QUERIES_UNSUPPORTED","DATABASE_STEP_DESCRIPTION","MEMORY_STEP_DESCRIPTION","UNNARROWED_READ_DESCRIPTION","detailOf","explainedOptionsOf","explainedOptionOf","detail","explained","summarize","steps","reasons","database","memory","counts","causes","toExecutionSteps","explainQuery","context","executionSteps","withExecutedQueries","explanation","executedQueries","attached","OPTION_LABEL_WIDTH","WRAP_WIDTH","wrap","word","COMPARATOR_SYMBOLS","describeValue","describeExpression","symbol","describeOption","fields","formatStep","executed","formatExplanation","collection","summary","stepCount","QueryOrdering","SENDABLE","splitSendableOptions","sendable","local","stopped","keyPath","serializeQueryOptions","serialized","join","deserializeQueryOptions","resolveSchema","scopeFor","scope","propertyOf","serializeBulkPersist","changes","schemas","schemaChanges","update","deserializeBulkPersist","request","serializePersistResult","schemaResult","deserializePersistResult","collectionsIn","change","names","walk","createRequestHandler","plugin","authorize","allowDestroy","byName","failed","scopeExpressionFor","action","declared","verdict","queryOptions","Promise","resolve","permitted","ConcurrencyDbPlugin","augmentedEvent","schemaIds","versions","add","entity","expected","deltaCarriesColumns","removed","conflicted","record","version","augment","Proxy","receiver","Reflect","synthetic","view","getKeyEqualityValue","EphemeralDataPlugin","databaseName","bulkPersistResult","staged","pipeline","readResult","concurrency","undo","revert","adds","updates","removes","prior","applyError","saveNext","saveResult","resaveNext","k","innerCollection","cloneRecord","keyColumn","narrowing","hasRenamedProperties","operation","orderedOptions","o","leadingFilterCount","leadingFilters","filterCount","cloned","kept","joinResult","translator","DEFAULT_ATTEMPTS","defaultDelay","attempt","RetryDbPlugin","isLastAttempt","delay","setTimeout","CacheDbPlugin","parts","structuredClone","snapshot","oldest","prefix","touched","DEFAULT_MAX_BATCH_SIZE","BatchingDbPlugin","forward","batch","settled","next","groups","claimed","overlaps","advance","merged","isPartial","mine","run","mapValue","filterValue","sortValue","nearestValue","joinValue","sortedItems","after","destination","nextExecutionTarget","nextExecutionReason","nextIndex","memoryQueryOptionsCollection","databaseQueryOptionsCollection","sortedItem","transformationOptions","iterator","BaseResult","reject","toPromise","SchemaBase","literals","SchemaDistinct","SchemaIdentity","SchemaNullable","SchemaOptional","SchemaSearchable","SchemaDeserialize","deserializer","SchemaDefault","injected","SchemaSerialize","serializer","SchemaFrom","SchemaReadonly","defaultValue","SchemaIndex","indexes","SchemaArray","SchemaTag","SchemaBoolean","SchemaDate","SchemaFunction","SchemaTransform","underlying","transform","SchemaForeignKey","relatingSchema","SchemaKey","SchemaTracked","SchemaComputed","SUPPORTED_DESERIALIZATION_TYPES","PropertyInfo","level","chain","precedingProp","assignmentType","propertyChain","hasRoot","prop","fromPath","children","pathArray","SlotPath","pathLike","up","countWordOccurance","wl","tl","c","code","isWordCharCode","enforceWordBoundaries","cc","leftOk","rightOk","NotApplicableHandler","handler","PropertyInfoHandler","p","parentPathArray","pathSoFar","slot","valueExpression","parentSelectPath","resultSelectorPath","ifSlot","selectorPath","sourcePath","destinationPath","ifBlock","base","entitySelectorPath","slotPath","parentSlotPath","childEntityPathSelector","enriched","enrichedSlot","occurences","parameters","EnrichmentNullableObjectHandler","nestedSlotPath","entityPath","enrichedPath","ifsSlot","parentBuilder","enrichedRoot","EnrichmentObjectHandler","EnrichmentObjectIdentityHandler","EnrichmentPrimitiveIdentityHandler","enrichedAssignmentPath","EnrichmentPrimitiveHandler","EnrichmentFunctionHandler","factory","parameter","declarationsSlot","defaultFunctionWithParameters","EnrichmentDefaultValueHandler","checkPath","assignmentPath","renderDefaultLiteral","EnrichmentDefaultFunctionHandler","defaultFunction","EnrichmentComputedValueHandler","ARRAY_VALUED_TYPES","isArrayValued","PRIMITIVE_ELEMENT_TYPES","hasPrimitiveElements","elementType","EnrichmentArrayHandler","EnrichmentHandlerBuilder","MergeDefaultFunctionHandler","defaultFunctionParameters","defaultIf","MergeObjectHandler","MergePrimitiveHandler","MergeComputedValueHandler","MergeDefaultValueHandler","MergeFunctionHandler","MergeArrayHandler","MergeHandlerBuilder","PrepareIdentityHandler","PrepareKeyHandler","PrepareValueHandler","PrepareObjectHandler","nestedObjectBuilder","PrepareComputedValueHandler","PrepareFunctionHandler","PrepareHandlerBuilder","StripObjectHandler","StripValueHandler","StripKeyHandler","StripIdentityHandler","StripFunctionHandler","StripComputedHandler","StripHandlerBuilder","CloneArrayHandler","useFromPropertyName","resultAssignmentPath","copyExpression","nullSafeCopy","CloneDateHandler","CloneObjectHandler","CloneValueHandler","CloneHandlerBuilder","CompareArrayHandler","leftCompare","rightCompare","CompareComputedHandler","CompareDateHandler","CompareFunctionHandler","CompareObjectHandler","CompareValueHandler","CompareHandlerBuilder","DeserializeObjectHandler","DeserializeValueHandler","DeserializeDateHandler","entityAssignmentPath","assignment","ifAssignment","rootPath","DeserializeComputedValueHandler","DeserializeFunctionHandler","DeserializeDeserializerHandler","assignmentBuilder","DeserializeArrayHandler","DeserializeHandlerBuilder","HashTypeValueHandler","HashTypeHandlerBuilder","IdSelectorValueHandler","IdSelectorHandlerBuilder","HashKeyHandler","HashValueHandler","HashDateHandler","HashIdentityHandler","HashFunctionHandler","HashComputedValueHandler","HashArrayHandler","HashObjectHandler","HashFileHandler","HashTransformHandler","HashHandlerBuilder","EnableChangeTrackingObjectHandler","assignmentSlot","childSelectorPath","childAssignmentPath","EnableChangeTrackingArrayHandler","EnableChangeTrackingPrimitiveValueHandler","EnableChangeTrackingHandlerBuilder","FreezePrimitiveValueHandler","FreezeObjectHandler","FreezeArrayHandler","FreezeHandlerBuilder","SerializeDateHandler","dateExpr","dateExprNested","SerializeObjectHandler","childPath","SerializeValueHandler","SerializeSerializerHandler","SerializeFunctionHandler","SerializeComputedHandler","SerializeArrayHandler","SerializeHandlerBuilder","registry","getChannelKey","getChannelRegistry","channel","SchemaChannel","channelKey","SchemaChannelSender","SchemaChannelReceiver","unreference","maybeUnref","BroadcastChannel","stampedChanges","subscription","listener","SubscriptionListener","SchemaSubscription","signal","regisry","preprocessedChanges","timestamp","postProcessedChanges","CompareIdsKeyHandler","CompareIdsHandlerBuilder","s","createPrimitiveConverter","jsonType","_context","jsonSchema","dateConverter","_property","objectConverter","required","childSchema","convertArrayItems","innerType","schemaBase","tempProperty","itemSchema","vectorConverter","arrayConverter","computedConverter","routierMeta","defaultConverter","converterRegistry","applyNullable","applyRoutierMetadata","propertyInfoToJsonSchema","useOutputType","converter","compiledSchemaToJsonSchema","compiledSchema","propertySchema","createStandardJsonSchemaProps","rehydrateSchemaFromJsonString","jsonString","rehydrateSchemaFromJsonSchema","SyntaxError","finalCollectionName","schemaDefinition","computedProperties","propName","propSchema","isRequired","routierPropMeta","routierPropName","schemaBuilder","convertJsonSchemaPropertyToRoutier","isKey","computedDefs","computedProp","recreatedFn","functionSource","arrowMatch","paramsStr","functionBody","t","objectProps","objectSchema","itemsSchema","extractTypeInfo","allowedTypes","SetComplexHandler","SetHandlerBuilder","hash","HashType","assertPropertyHandled","generatorName","createChangeTracker","DIRTY_ENTITY_MARKER","CHANGES_ENTITY_KEY","ORIGINAL_ENTITY_KEY","PAUSED_ENTITY_KEY","TRACKING_KEY","PROXY_MARKER","proxyHandler","indexableEntity","originalValue","resolvedParent","resolvedPath","isDirty","SchemaDefinition","fnArgs","instanceObj","propertyInstance","previousParent","propertyInfo","childPrimitivePropertyInfo","recursiveCallback","metadata","propertyMap","enrichmentHandlerBuilder","mergeHandlerFactory","prepareHandlerBuilder","stripHandlerBuilder","cloneHandlerBuilder","compareHandlerBuilder","deserializeHandlerBuilder","hashTypeHandlerBuilder","idSelectorHandlerBuilder","hashHandlerBuilder","enableChangeTrackingHandlerBuilder","freezeHandlerBuilder","serializeHandlerBuilder","compareIdsHandlerBuilder","setHandlerBuilder","enricher","merge","prepare","strip","deserialize","hashTypeHandler","idSelectorHandler","hashHandler","enableChangeTrackingHandler","freezeHandler","serializeHandler","compareIdsHandler","setHandlerHanlder","changeTrackingCodeBuilder","freezeCodeBuilder","enricherCodeBuilder","enricherFunctionRoot","enricherFunctionBody","preprocessCodeBuilder","postprocessCodeBuilder","setCodeBuilder","mergeCodeBuilder","mergeFunctionRoot","mergeFunctionBody","pauseFunctionBody","unpauseFunctionBody","prepareCodeBuilder","stripCodeBuilder","cloneCodeBuilder","compareCodeBuilder","compareIdsCodeBuilder","deserializeCodeBuilder","serializeCodeBuilder","idSelectorCodeBuilder","hashTypeCodeBuilder","hashCodeBuilder","hashCodeBuilderIfBlock","allPropertyNamesAndPaths","hashType","hasIdentities","hasIdentityKeys","enrichParams","mergeParams","enrichGenerator","mergeGenerator","postProcessGenerator","postProcessParams","getIdsFunction","getHashTypeFunction","prepareFunction","cloneFunction","storageCloneFunction","cloneStorageFunction","storageCloneCodeBuilder","isDeclared","skipDeclared","storageClone","deserializeFunction","serializeFunction","compareFunction","stripFunction","hashFunction","enableChangeTrackingFunction","freezeFunction","compareIdsFunction","preprocessFunction","setFunction","enricherFactoryFunction","postProcessFactoryFunction","mergeFactoryFunction","postProcessFunction","enricherFunction","mergeFunction","idPropertyNames","getId","getProperty","deserializePartial","deserialized","indexName","connections","indexedProperties","compiledSchemaWithMetadata","SchemaNumber","SchemaObject","SchemaFile","SchemaString","SchemaVector","dimensions","string","optionsOrLiteral","rest","toMap","keySelector","cast","isNodeRuntime","process","resolveBulkPersistChanges","bulkPersistChanges","schemmaBulkPersistResult","schemaBulkPersistChanges","combineQueryOptionsCollections","collections","toEventArray","remove","noop","_args","unsafeCast","LOG_LEVELS","RANK","isLogLevel","resolveLevel","globalThis","g","debug","env","rank","setLogLevel","getLogLevel","resetLogLevel","isLogLevelEnabled","emit","seed","h1","h2","ch","fastHash","maxDepth","currentDepth","getFunctionName","stringifyObjectValue","getObjectProperties","RegExp","stringifyArray","stringifyClassInstance","stringifyPlainObject","arr","suffix","className","props","isPrimitive","chars","charLength","HEX_CHARS","UUID_TEMPLATE","hasCrypto","crypto","hasRandomUUID","uuidv4Fallback","randomBytes","Uint8Array","byteIndex"],"mappings":";;;;;;;;;;;;;;;;;;;AAA4D;AAEtB;AAE/B,SAASE,WAAWC,IAAa;IACpC,IAAIF,8CAAMA,CAACE,UAAU,OAAO;QACxB,MAAM,IAAIC,UAAU;IACxB;AACJ;AAEO,SAASC,gBAAmBF,IAA0B,EAAEG,OAAiC;IAC5F,IAAIH,QAAQ,MAAM;QACd,IAAIG,WAAW,MAAM;YACjB,MAAM,IAAIF,UAAU;QACxB;QAEA,IAAI,OAAOE,YAAY,UAAU;YAC7B,MAAM,IAAIF,UAAUE;QACxB;QAEA,MAAM,IAAIF,UAAUE;IACxB;AACJ;AAEO,SAASC,c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