@tanstack/db
Version:
A reactive client store for building super fast apps on sync
40 lines (39 loc) • 1.4 kB
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const ROUTED_SCALAR_VALUE = /* @__PURE__ */ Symbol(`tanstack_db_routed_scalar_value`);
const INCLUDES_PUBLIC_KEY = /* @__PURE__ */ Symbol(`includesPublicKey`);
function attachRouteMetadataToResult(value, correlationKey, parentContext, publicKey) {
if (correlationKey === void 0 && parentContext === void 0 && publicKey === void 0) {
return value;
}
if (value != null && typeof value === `object`) {
return {
...value,
__correlationKey: correlationKey,
__parentContext: parentContext,
[INCLUDES_PUBLIC_KEY]: publicKey
};
}
return {
[ROUTED_SCALAR_VALUE]: value,
__correlationKey: correlationKey,
__parentContext: parentContext,
[INCLUDES_PUBLIC_KEY]: publicKey
};
}
function getRoutedScalarMetadata(value) {
if (value == null || typeof value !== `object` || !(ROUTED_SCALAR_VALUE in value)) {
return void 0;
}
const routed = value;
return {
value: routed[ROUTED_SCALAR_VALUE],
correlationKey: routed.__correlationKey,
parentContext: routed.__parentContext,
publicKey: routed[INCLUDES_PUBLIC_KEY]
};
}
exports.INCLUDES_PUBLIC_KEY = INCLUDES_PUBLIC_KEY;
exports.attachRouteMetadataToResult = attachRouteMetadataToResult;
exports.getRoutedScalarMetadata = getRoutedScalarMetadata;
//# sourceMappingURL=route-metadata.cjs.map