@dxos/echo-solid 0.8.4-main.bc674ce → 0.8.4-main.c85a9c8dae

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/useObject.ts", "../../../src/useQuery.ts", "../../../src/useSchema.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type MaybeAccessor, access } from '@solid-primitives/utils';\nimport { type Accessor, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { Obj, Ref } from '@dxos/echo';\nimport { AtomObj } from '@dxos/echo-atom';\nimport { type Registry, useRegistry } from '@dxos/effect-atom-solid';\n\nexport interface ObjectUpdateCallback<T> {\n (update: (obj: Obj.Mutable<T>) => void): void;\n (update: (obj: Obj.Mutable<T>) => Obj.Mutable<T>): void;\n}\n\nexport interface ObjectPropUpdateCallback<T> {\n (update: (value: Obj.Mutable<T>) => void): void;\n (update: (value: Obj.Mutable<T>) => Obj.Mutable<T>): void;\n (newValue: T): void;\n}\n\n/**\n * Helper type to conditionally include undefined in return type only if input includes undefined.\n * Only adds undefined if T includes undefined AND R doesn't already include undefined.\n */\ntype ConditionalUndefined<T, R> = [T] extends [Exclude<T, undefined>]\n ? R // T doesn't include undefined, return R as-is\n : [R] extends [Exclude<R, undefined>]\n ? R | undefined // T includes undefined but R doesn't, add undefined\n : R; // Both T and R include undefined, return R as-is (no double undefined)\n\n/**\n * Subscribe to a Ref's target object.\n * Automatically dereferences the ref and handles async loading.\n * Returns undefined if the ref hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T>(ref: MaybeAccessor<Ref.Ref<T>>): [Accessor<T | undefined>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to a Ref's target object that may be undefined.\n * Returns undefined if the ref is undefined or hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be undefined/reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T>(\n ref: MaybeAccessor<Ref.Ref<T> | undefined>,\n): [Accessor<T | undefined>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to an entire Echo object.\n * Returns the current object value accessor and an update callback.\n *\n * @param obj - The Echo object to subscribe to (can be reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown>(\n obj: MaybeAccessor<T>,\n): [Accessor<ConditionalUndefined<T, T>>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to an entire Echo object that may be undefined.\n * Returns undefined if the object is undefined.\n *\n * @param obj - The Echo object to subscribe to (can be undefined/reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown>(\n obj: MaybeAccessor<T | undefined>,\n): [Accessor<ConditionalUndefined<T, T>>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to a specific property of an Echo object.\n * Returns the current property value accessor and an update callback.\n *\n * @param obj - The Echo object to subscribe to (can be reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown, K extends keyof T>(\n obj: MaybeAccessor<T>,\n property: K,\n): [Accessor<T[K]>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to a specific property of an Echo object that may be undefined.\n * Returns undefined if the object is undefined.\n *\n * @param obj - The Echo object to subscribe to (can be undefined/reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown, K extends keyof T>(\n obj: MaybeAccessor<T | undefined>,\n property: K,\n): [Accessor<T[K] | undefined>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to a specific property of a Ref's target object.\n * Automatically dereferences the ref and handles async loading.\n * Returns undefined if the ref hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T, K extends keyof T>(\n ref: MaybeAccessor<Ref.Ref<T>>,\n property: K,\n): [Accessor<T[K] | undefined>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to a specific property of a Ref's target object that may be undefined.\n * Returns undefined if the ref is undefined or hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be undefined/reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T, K extends keyof T>(\n ref: MaybeAccessor<Ref.Ref<T> | undefined>,\n property: K,\n): [Accessor<T[K] | undefined>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to an Echo object or Ref (entire object or specific property).\n * Returns the current value accessor and an update callback.\n *\n * @param objOrRef - The Echo object or Ref to subscribe to (can be reactive)\n * @param property - Optional property key to subscribe to a specific property\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown, K extends keyof T>(\n objOrRef: MaybeAccessor<T | Ref.Ref<T> | undefined>,\n property?: K,\n): [Accessor<any>, ObjectUpdateCallback<T> | ObjectPropUpdateCallback<T[K]>] {\n const registry = useRegistry();\n\n // Memoize the resolved input to track changes.\n const resolvedInput = createMemo(() => access(objOrRef));\n\n // Determine if input is a ref.\n const isRef = createMemo(() => Ref.isRef(resolvedInput()));\n\n // Get the live object for the callback (refs need to dereference).\n const liveObj = createMemo(() => {\n const input = resolvedInput();\n return isRef() ? (input as Ref.Ref<T>)?.target : (input as T | undefined);\n });\n\n // Create a stable callback that handles both object and property updates.\n const callback = (updateOrValue: unknown | ((obj: unknown) => unknown)) => {\n // Get current target for refs (may have loaded since render).\n const obj = isRef() ? (resolvedInput() as Ref.Ref<T>)?.target : liveObj();\n if (!obj) {\n return;\n }\n\n Obj.change(obj, (o: any) => {\n if (typeof updateOrValue === 'function') {\n const returnValue = (updateOrValue as (obj: unknown) => unknown)(property !== undefined ? o[property] : o);\n if (returnValue !== undefined) {\n if (property === undefined) {\n throw new Error('Cannot re-assign the entire object');\n }\n o[property] = returnValue;\n }\n } else {\n if (property === undefined) {\n throw new Error('Cannot re-assign the entire object');\n }\n o[property] = updateOrValue;\n }\n });\n };\n\n if (property !== undefined) {\n // For property subscriptions on refs, we subscribe to trigger re-render on load.\n useObjectValue(registry, objOrRef);\n return [useObjectProperty(registry, liveObj, property), callback as ObjectPropUpdateCallback<T[K]>];\n }\n return [useObjectValue(registry, objOrRef), callback as ObjectUpdateCallback<T>];\n}\n\n/**\n * Internal function for subscribing to an Echo object or Ref.\n * AtomObj.make handles both objects and refs, returning snapshots.\n */\nfunction useObjectValue<T extends Obj.Unknown>(\n registry: Registry.Registry,\n objOrRef: MaybeAccessor<T | Ref.Ref<T> | undefined>,\n): Accessor<T | undefined> {\n // Memoize the resolved input to track changes.\n const resolvedInput = createMemo(() => access(objOrRef));\n\n // Initialize with the current value (if available).\n const initialInput = resolvedInput();\n const initialValue = initialInput ? registry.get(AtomObj.make(initialInput)) : undefined;\n const [value, setValue] = createSignal<T | undefined>(initialValue as T | undefined);\n\n // Subscribe to atom updates.\n createEffect(() => {\n const input = resolvedInput();\n\n if (!input) {\n setValue(() => undefined);\n return;\n }\n\n const atom = AtomObj.make(input);\n const currentValue = registry.get(atom);\n setValue(() => currentValue as unknown as T);\n\n const unsubscribe = registry.subscribe(\n atom,\n () => {\n setValue(() => registry.get(atom) as unknown as T);\n },\n { immediate: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return value;\n}\n\n/**\n * Internal function for subscribing to a specific property of an Echo object.\n */\nfunction useObjectProperty<T extends Obj.Unknown, K extends keyof T>(\n registry: Registry.Registry,\n obj: Accessor<T | undefined>,\n property: K,\n): Accessor<T[K] | undefined> {\n // Initialize with the current value (if available).\n const initialObj = obj();\n const initialValue = initialObj ? registry.get(AtomObj.makeProperty(initialObj, property)) : undefined;\n const [value, setValue] = createSignal<T[K] | undefined>(initialValue);\n\n // Subscribe to atom updates.\n createEffect(() => {\n const currentObj = obj();\n\n if (!currentObj) {\n setValue(() => undefined);\n return;\n }\n\n const atom = AtomObj.makeProperty(currentObj, property);\n const currentValue = registry.get(atom);\n setValue(() => currentValue);\n\n const unsubscribe = registry.subscribe(\n atom,\n () => {\n setValue(() => registry.get(atom) as T[K]);\n },\n { immediate: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return value;\n}\n\n/**\n * Subscribe to multiple Refs' target objects.\n * Automatically dereferences each ref and handles async loading.\n * Returns an accessor to an array of loaded snapshots (filtering out undefined values).\n *\n * This hook is useful for aggregate computations like counts or filtering\n * across multiple refs without using .target directly.\n *\n * @param refs - Array of Refs to dereference and subscribe to (can be reactive)\n * @returns Accessor to array of loaded target snapshots (excludes unloaded refs)\n */\nexport const useObjects = <T extends Obj.Unknown>(refs: MaybeAccessor<readonly Ref.Ref<T>[]>): Accessor<T[]> => {\n // Track version to trigger re-renders when any ref or target changes.\n const [version, setVersion] = createSignal(0);\n\n // Memoize the refs array to track changes.\n const resolvedRefs = createMemo(() => access(refs));\n\n // Subscribe to all refs and their targets.\n createEffect(() => {\n const currentRefs = resolvedRefs();\n const targetUnsubscribes = new Map<string, () => void>();\n\n // Function to trigger re-render.\n const triggerUpdate = () => {\n setVersion((v) => v + 1);\n };\n\n // Function to set up subscription for a target.\n const subscribeToTarget = (ref: Ref.Ref<T>) => {\n const target = ref.target;\n if (target) {\n const key = ref.dxn.toString();\n if (!targetUnsubscribes.has(key)) {\n targetUnsubscribes.set(key, Obj.subscribe(target, triggerUpdate));\n }\n }\n };\n\n // Try to load all refs and subscribe to targets.\n for (const ref of currentRefs) {\n // Subscribe to existing target if available.\n subscribeToTarget(ref);\n\n // Trigger async load if not already loaded.\n if (!ref.target) {\n void ref\n .load()\n .then(() => {\n subscribeToTarget(ref);\n triggerUpdate();\n })\n .catch(() => {\n // Ignore load errors.\n });\n }\n }\n\n onCleanup(() => {\n targetUnsubscribes.forEach((u) => u());\n });\n });\n\n // Compute current snapshots by reading each ref's target.\n return createMemo(() => {\n // Depend on version to re-compute when targets change.\n version();\n\n const currentRefs = resolvedRefs();\n const snapshots: T[] = [];\n for (const ref of currentRefs) {\n const target = ref.target;\n if (target !== undefined) {\n snapshots.push(target as T);\n }\n }\n return snapshots;\n });\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Accessor, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { type Database, type Entity, Filter, Query } from '@dxos/echo';\n\nconst EMPTY_ARRAY: never[] = [];\n\ntype MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Create a reactive query subscription.\n * Accepts either values or accessors for resource and query/filter.\n *\n * @param resource - The database or queryable resource (can be reactive)\n * @param queryOrFilter - The query or filter to apply (can be reactive)\n * @returns An accessor that returns the current query results\n */\nexport const useQuery = <T extends Entity.Any = Entity.Any>(\n resource: MaybeAccessor<Database.Queryable | undefined>,\n queryOrFilter: MaybeAccessor<Query.Any | Filter.Any>,\n): Accessor<T[]> => {\n // Derive the normalized query from the input\n const query = createMemo(() => {\n const resolved = typeof queryOrFilter === 'function' ? queryOrFilter() : queryOrFilter;\n return Filter.is(resolved) ? Query.select(resolved) : resolved;\n });\n\n // Derive the query result object reactively\n const queryResult = createMemo(() => {\n const q = query();\n const resolvedResource = typeof resource === 'function' ? resource() : resource;\n return resolvedResource?.query(q);\n });\n\n // Store the current results in a signal\n const [objects, setObjects] = createSignal<T[]>(EMPTY_ARRAY as T[]);\n\n // Subscribe to query result changes\n createEffect(() => {\n const result = queryResult();\n if (!result) {\n // Keep previous value during transitions to prevent flickering\n return;\n }\n\n // Subscribe with immediate fire to get initial results\n const unsubscribe = result.subscribe(\n () => {\n setObjects(() => result.results as T[]);\n },\n { fire: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return objects;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Accessor, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { type Database, type Type } from '@dxos/echo';\n\ntype MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Subscribe to and retrieve schema changes from a database's schema registry.\n * Accepts either values or accessors for db and typename.\n *\n * @param db - The database instance (can be reactive)\n * @param typename - The schema typename to query (can be reactive)\n * @returns An accessor that returns the current schema or undefined\n */\nexport const useSchema = <T extends Type.Entity.Any = Type.Entity.Any>(\n db?: MaybeAccessor<Database.Database | undefined>,\n typename?: MaybeAccessor<string | undefined>,\n): Accessor<T | undefined> => {\n // Derive the schema query reactively\n const query = createMemo(() => {\n const resolvedDb = typeof db === 'function' ? db() : db;\n const resolvedTypename = typeof typename === 'function' ? typename() : typename;\n if (!resolvedTypename || !resolvedDb) {\n return undefined;\n }\n return resolvedDb.schemaRegistry.query({ typename: resolvedTypename, location: ['database', 'runtime'] });\n });\n\n // Store the current schema in a signal\n const [schema, setSchema] = createSignal<T | undefined>(undefined);\n\n // Subscribe to query changes\n createEffect(() => {\n const q = query();\n if (!q) {\n // Keep previous value during transitions to prevent flickering\n return;\n }\n\n // Subscribe to updates with immediate fire to get initial result and track changes\n // The subscription will automatically start the reactive query\n const unsubscribe = q.subscribe(\n () => {\n // Access results inside the callback to ensure query is running\n const results = q.results;\n setSchema(() => results[0] as T | undefined);\n },\n { fire: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return schema;\n};\n"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type MaybeAccessor, access } from '@solid-primitives/utils';\nimport { type Accessor, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { Obj, Ref } from '@dxos/echo';\nimport { AtomObj } from '@dxos/echo-atom';\nimport { type Registry, useRegistry } from '@dxos/effect-atom-solid';\n\nexport interface ObjectUpdateCallback<T> {\n (update: (obj: Obj.Mutable<T>) => void): void;\n (update: (obj: Obj.Mutable<T>) => Obj.Mutable<T>): void;\n}\n\nexport interface ObjectPropUpdateCallback<T> {\n (update: (value: Obj.Mutable<T>) => void): void;\n (update: (value: Obj.Mutable<T>) => Obj.Mutable<T>): void;\n (newValue: T): void;\n}\n\n/**\n * Helper type to conditionally include undefined in return type only if input includes undefined.\n * Only adds undefined if T includes undefined AND R doesn't already include undefined.\n */\ntype ConditionalUndefined<T, R> = [T] extends [Exclude<T, undefined>]\n ? R // T doesn't include undefined, return R as-is\n : [R] extends [Exclude<R, undefined>]\n ? R | undefined // T includes undefined but R doesn't, add undefined\n : R; // Both T and R include undefined, return R as-is (no double undefined)\n\n/**\n * Subscribe to a Ref's target object.\n * Automatically dereferences the ref and handles async loading.\n * Returns undefined if the ref hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T>(ref: MaybeAccessor<Ref.Ref<T>>): [Accessor<T | undefined>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to a Ref's target object that may be undefined.\n * Returns undefined if the ref is undefined or hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be undefined/reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T>(\n ref: MaybeAccessor<Ref.Ref<T> | undefined>,\n): [Accessor<T | undefined>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to an entire Echo object.\n * Returns the current object value accessor and an update callback.\n *\n * @param obj - The Echo object to subscribe to (can be reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown>(\n obj: MaybeAccessor<T>,\n): [Accessor<ConditionalUndefined<T, T>>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to an entire Echo object that may be undefined.\n * Returns undefined if the object is undefined.\n *\n * @param obj - The Echo object to subscribe to (can be undefined/reactive)\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown>(\n obj: MaybeAccessor<T | undefined>,\n): [Accessor<ConditionalUndefined<T, T>>, ObjectUpdateCallback<T>];\n\n/**\n * Subscribe to a specific property of an Echo object.\n * Returns the current property value accessor and an update callback.\n *\n * @param obj - The Echo object to subscribe to (can be reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown, K extends keyof T>(\n obj: MaybeAccessor<T>,\n property: K,\n): [Accessor<T[K]>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to a specific property of an Echo object that may be undefined.\n * Returns undefined if the object is undefined.\n *\n * @param obj - The Echo object to subscribe to (can be undefined/reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown, K extends keyof T>(\n obj: MaybeAccessor<T | undefined>,\n property: K,\n): [Accessor<T[K] | undefined>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to a specific property of a Ref's target object.\n * Automatically dereferences the ref and handles async loading.\n * Returns undefined if the ref hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T, K extends keyof T>(\n ref: MaybeAccessor<Ref.Ref<T>>,\n property: K,\n): [Accessor<T[K] | undefined>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to a specific property of a Ref's target object that may be undefined.\n * Returns undefined if the ref is undefined or hasn't loaded yet.\n *\n * @param ref - The Ref to dereference and subscribe to (can be undefined/reactive)\n * @param property - Property key to subscribe to\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T, K extends keyof T>(\n ref: MaybeAccessor<Ref.Ref<T> | undefined>,\n property: K,\n): [Accessor<T[K] | undefined>, ObjectPropUpdateCallback<T[K]>];\n\n/**\n * Subscribe to an Echo object or Ref (entire object or specific property).\n * Returns the current value accessor and an update callback.\n *\n * @param objOrRef - The Echo object or Ref to subscribe to (can be reactive)\n * @param property - Optional property key to subscribe to a specific property\n * @returns A tuple of [accessor, updateCallback]\n */\nexport function useObject<T extends Obj.Unknown, K extends keyof T>(\n objOrRef: MaybeAccessor<T | Ref.Ref<T> | undefined>,\n property?: K,\n): [Accessor<any>, ObjectUpdateCallback<T> | ObjectPropUpdateCallback<T[K]>] {\n const registry = useRegistry();\n\n // Memoize the resolved input to track changes.\n const resolvedInput = createMemo(() => access(objOrRef));\n\n // Determine if input is a ref.\n const isRef = createMemo(() => Ref.isRef(resolvedInput()));\n\n // Get the live object for the callback (refs need to dereference).\n const liveObj = createMemo(() => {\n const input = resolvedInput();\n return isRef() ? (input as Ref.Ref<T>)?.target : (input as T | undefined);\n });\n\n // Create a stable callback that handles both object and property updates.\n const callback = (updateOrValue: unknown | ((obj: unknown) => unknown)) => {\n // Get current target for refs (may have loaded since render).\n const obj = isRef() ? (resolvedInput() as Ref.Ref<T>)?.target : liveObj();\n if (!obj) {\n return;\n }\n\n Obj.change(obj, (o: any) => {\n if (typeof updateOrValue === 'function') {\n const returnValue = (updateOrValue as (obj: unknown) => unknown)(property !== undefined ? o[property] : o);\n if (returnValue !== undefined) {\n if (property === undefined) {\n throw new Error('Cannot re-assign the entire object');\n }\n o[property] = returnValue;\n }\n } else {\n if (property === undefined) {\n throw new Error('Cannot re-assign the entire object');\n }\n o[property] = updateOrValue;\n }\n });\n };\n\n if (property !== undefined) {\n // For property subscriptions on refs, we subscribe to trigger re-render on load.\n useObjectValue(registry, objOrRef);\n return [useObjectProperty(registry, liveObj, property), callback as ObjectPropUpdateCallback<T[K]>];\n }\n return [useObjectValue(registry, objOrRef), callback as ObjectUpdateCallback<T>];\n}\n\n/**\n * Internal function for subscribing to an Echo object or Ref.\n * AtomObj.make handles both objects and refs, returning snapshots.\n */\nfunction useObjectValue<T extends Obj.Unknown>(\n registry: Registry.Registry,\n objOrRef: MaybeAccessor<T | Ref.Ref<T> | undefined>,\n): Accessor<T | undefined> {\n // Memoize the resolved input to track changes.\n const resolvedInput = createMemo(() => access(objOrRef));\n\n // Initialize with the current value (if available).\n const initialInput = resolvedInput();\n const initialValue = initialInput ? registry.get(AtomObj.make(initialInput)) : undefined;\n const [value, setValue] = createSignal<T | undefined>(initialValue as T | undefined);\n\n // Subscribe to atom updates.\n createEffect(() => {\n const input = resolvedInput();\n\n if (!input) {\n setValue(() => undefined);\n return;\n }\n\n const atom = AtomObj.make(input);\n const currentValue = registry.get(atom);\n setValue(() => currentValue as unknown as T);\n\n const unsubscribe = registry.subscribe(\n atom,\n () => {\n setValue(() => registry.get(atom) as unknown as T);\n },\n { immediate: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return value;\n}\n\n/**\n * Internal function for subscribing to a specific property of an Echo object.\n */\nfunction useObjectProperty<T extends Obj.Unknown, K extends keyof T>(\n registry: Registry.Registry,\n obj: Accessor<T | undefined>,\n property: K,\n): Accessor<T[K] | undefined> {\n // Initialize with the current value (if available).\n const initialObj = obj();\n const initialValue = initialObj ? registry.get(AtomObj.makeProperty(initialObj, property)) : undefined;\n const [value, setValue] = createSignal<T[K] | undefined>(initialValue);\n\n // Subscribe to atom updates.\n createEffect(() => {\n const currentObj = obj();\n\n if (!currentObj) {\n setValue(() => undefined);\n return;\n }\n\n const atom = AtomObj.makeProperty(currentObj, property);\n const currentValue = registry.get(atom);\n setValue(() => currentValue);\n\n const unsubscribe = registry.subscribe(\n atom,\n () => {\n setValue(() => registry.get(atom) as T[K]);\n },\n { immediate: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return value;\n}\n\n/**\n * Subscribe to multiple Refs' target objects.\n * Automatically dereferences each ref and handles async loading.\n * Returns an accessor to an array of loaded snapshots (filtering out undefined values).\n *\n * This hook is useful for aggregate computations like counts or filtering\n * across multiple refs without using .target directly.\n *\n * @param refs - Array of Refs to dereference and subscribe to (can be reactive)\n * @returns Accessor to array of loaded target snapshots (excludes unloaded refs)\n */\nexport const useObjects = <T extends Obj.Unknown>(refs: MaybeAccessor<readonly Ref.Ref<T>[]>): Accessor<T[]> => {\n // Track version to trigger re-renders when any ref or target changes.\n const [version, setVersion] = createSignal(0);\n\n // Memoize the refs array to track changes.\n const resolvedRefs = createMemo(() => access(refs));\n\n // Subscribe to all refs and their targets.\n createEffect(() => {\n const currentRefs = resolvedRefs();\n const targetUnsubscribes = new Map<string, () => void>();\n\n // Function to trigger re-render.\n const triggerUpdate = () => {\n setVersion((v) => v + 1);\n };\n\n // Function to set up subscription for a target.\n const subscribeToTarget = (ref: Ref.Ref<T>) => {\n const target = ref.target;\n if (target) {\n const key = ref.dxn.toString();\n if (!targetUnsubscribes.has(key)) {\n targetUnsubscribes.set(key, Obj.subscribe(target, triggerUpdate));\n }\n }\n };\n\n // Try to load all refs and subscribe to targets.\n for (const ref of currentRefs) {\n // Subscribe to existing target if available.\n subscribeToTarget(ref);\n\n // Trigger async load if not already loaded.\n if (!ref.target) {\n void ref\n .load()\n .then(() => {\n subscribeToTarget(ref);\n triggerUpdate();\n })\n .catch(() => {\n // Ignore load errors.\n });\n }\n }\n\n onCleanup(() => {\n targetUnsubscribes.forEach((u) => u());\n });\n });\n\n // Compute current snapshots by reading each ref's target.\n return createMemo(() => {\n // Depend on version to re-compute when targets change.\n version();\n\n const currentRefs = resolvedRefs();\n const snapshots: T[] = [];\n for (const ref of currentRefs) {\n const target = ref.target;\n if (target !== undefined) {\n snapshots.push(target as T);\n }\n }\n return snapshots;\n });\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Accessor, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { type Database, type Entity, Filter, Query } from '@dxos/echo';\n\nconst EMPTY_ARRAY: never[] = [];\n\ntype MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Create a reactive query subscription.\n * Accepts either values or accessors for resource and query/filter.\n *\n * @param resource - The database or queryable resource (can be reactive)\n * @param queryOrFilter - The query or filter to apply (can be reactive)\n * @returns An accessor that returns the current query results\n */\nexport const useQuery = <T extends Entity.Any = Entity.Any>(\n resource: MaybeAccessor<Database.Queryable | undefined>,\n queryOrFilter: MaybeAccessor<Query.Any | Filter.Any>,\n): Accessor<T[]> => {\n // Derive the normalized query from the input\n const query = createMemo(() => {\n const resolved = typeof queryOrFilter === 'function' ? queryOrFilter() : queryOrFilter;\n return Filter.is(resolved) ? Query.select(resolved) : resolved;\n });\n\n // Derive the query result object reactively\n const queryResult = createMemo(() => {\n const q = query();\n const resolvedResource = typeof resource === 'function' ? resource() : resource;\n return resolvedResource?.query(q);\n });\n\n // Store the current results in a signal\n const [objects, setObjects] = createSignal<T[]>(EMPTY_ARRAY as T[]);\n\n // Subscribe to query result changes\n createEffect(() => {\n const result = queryResult();\n if (!result) {\n // Keep previous value during transitions to prevent flickering\n return;\n }\n\n // Subscribe with immediate fire to get initial results\n const unsubscribe = result.subscribe(\n () => {\n setObjects(() => result.results as T[]);\n },\n { fire: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return objects;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Accessor, createEffect, createMemo, createSignal, onCleanup } from 'solid-js';\n\nimport { type Database, type Type } from '@dxos/echo';\n\ntype MaybeAccessor<T> = T | Accessor<T>;\n\n/**\n * Subscribe to and retrieve schema changes from a database's schema registry.\n * Accepts either values or accessors for db and typename.\n *\n * @param db - The database instance (can be reactive)\n * @param typename - The schema typename to query (can be reactive)\n * @returns An accessor that returns the current schema or undefined\n */\nexport const useSchema = <T extends Type.AnyEntity = Type.AnyEntity>(\n db?: MaybeAccessor<Database.Database | undefined>,\n typename?: MaybeAccessor<string | undefined>,\n): Accessor<T | undefined> => {\n // Derive the schema query reactively\n const query = createMemo(() => {\n const resolvedDb = typeof db === 'function' ? db() : db;\n const resolvedTypename = typeof typename === 'function' ? typename() : typename;\n if (!resolvedTypename || !resolvedDb) {\n return undefined;\n }\n return resolvedDb.schemaRegistry.query({ typename: resolvedTypename, location: ['database', 'runtime'] });\n });\n\n // Store the current schema in a signal\n const [schema, setSchema] = createSignal<T | undefined>(undefined);\n\n // Subscribe to query changes\n createEffect(() => {\n const q = query();\n if (!q) {\n // Keep previous value during transitions to prevent flickering\n return;\n }\n\n // Subscribe to updates with immediate fire to get initial result and track changes\n // The subscription will automatically start the reactive query\n const unsubscribe = q.subscribe(\n () => {\n // Access results inside the callback to ensure query is running\n const results = q.results;\n setSchema(() => results[0] as T | undefined);\n },\n { fire: true },\n );\n\n onCleanup(unsubscribe);\n });\n\n return schema;\n};\n"],
5
5
  "mappings": ";AAIA,SAA6BA,cAAc;AAC3C,SAAwBC,cAAcC,YAAYC,cAAcC,iBAAiB;AAEjF,SAASC,KAAKC,WAAW;AACzB,SAASC,eAAe;AACxB,SAAwBC,mBAAmB;AA+HpC,SAASC,UACdC,UACAC,UAAY;AAEZ,QAAMC,WAAWC,YAAAA;AAGjB,QAAMC,gBAAgBC,WAAW,MAAMC,OAAON,QAAAA,CAAAA;AAG9C,QAAMO,QAAQF,WAAW,MAAMG,IAAID,MAAMH,cAAAA,CAAAA,CAAAA;AAGzC,QAAMK,UAAUJ,WAAW,MAAA;AACzB,UAAMK,QAAQN,cAAAA;AACd,WAAOG,MAAAA,IAAWG,OAAsBC,SAAUD;EACpD,CAAA;AAGA,QAAME,WAAW,CAACC,kBAAAA;AAEhB,UAAMC,MAAMP,MAAAA,IAAWH,cAAAA,GAAgCO,SAASF,QAAAA;AAChE,QAAI,CAACK,KAAK;AACR;IACF;AAEAC,QAAIC,OAAOF,KAAK,CAACG,MAAAA;AACf,UAAI,OAAOJ,kBAAkB,YAAY;AACvC,cAAMK,cAAeL,cAA4CZ,aAAakB,SAAYF,EAAEhB,QAAAA,IAAYgB,CAAAA;AACxG,YAAIC,gBAAgBC,QAAW;AAC7B,cAAIlB,aAAakB,QAAW;AAC1B,kBAAM,IAAIC,MAAM,oCAAA;UAClB;AACAH,YAAEhB,QAAAA,IAAYiB;QAChB;MACF,OAAO;AACL,YAAIjB,aAAakB,QAAW;AAC1B,gBAAM,IAAIC,MAAM,oCAAA;QAClB;AACAH,UAAEhB,QAAAA,IAAYY;MAChB;IACF,CAAA;EACF;AAEA,MAAIZ,aAAakB,QAAW;AAE1BE,mBAAenB,UAAUF,QAAAA;AACzB,WAAO;MA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T;AACA,WAAOF,WAAWG,eAAeL,MAAM;MAAED,UAAUI;MAAkBG,UAAU;QAAC;QAAY;;IAAW,CAAA;EACzG,CAAA;AAGA,QAAM,CAACC,QAAQC,SAAAA,IAAaC,cAA4BL,MAAAA;AAGxDM,EAAAA,cAAa,MAAA;AACX,UAAMC,IAAIX,MAAAA;AACV,QAAI,CAACW,GAAG;AAEN;IACF;AAIA,UAAMC,cAAcD,EAAEE,UACpB,MAAA;AAEE,YAAMC,UAAUH,EAAEG;AAClBN,gBAAU,MAAMM,QAAQ,CAAA,CAAE;IAC5B,GACA;MAAEC,MAAM;IAAK,CAAA;AAGfC,IAAAA,WAAUJ,WAAAA;EACZ,CAAA;AAEA,SAAOL;AACT;",
6
6
  "names": ["access", "createEffect", "createMemo", "createSignal", "onCleanup", "Obj", "Ref", "AtomObj", "useRegistry", "useObject", "objOrRef", "property", "registry", "useRegistry", "resolvedInput", "createMemo", "access", "isRef", "Ref", "liveObj", "input", "target", "callback", "updateOrValue", "obj", "Obj", "change", "o", "returnValue", "undefined", "Error", "useObjectValue", "useObjectProperty", "initialInput", "initialValue", "get", "AtomObj", "make", "value", "setValue", "createSignal", "createEffect", "atom", "currentValue", "unsubscribe", "subscribe", "immediate", "onCleanup", "initialObj", "makeProperty", "currentObj", "useObjects", "refs", "version", "setVersion", "resolvedRefs", "currentRefs", "targetUnsubscribes", "Map", "triggerUpdate", "v", "subscribeToTarget", "ref", "key", "dxn", "toString", "has", "set", "load", "then", "catch", "forEach", "u", "snapshots", "push", "createEffect", "createMemo", "createSignal", "onCleanup", "Filter", "Query", "EMPTY_ARRAY", "useQuery", "resource", "queryOrFilter", "query", "createMemo", "resolved", "Filter", "is", "Query", "select", "queryResult", "q", "resolvedResource", "objects", "setObjects", "createSignal", "createEffect", "result", "unsubscribe", "subscribe", "results", "fire", "onCleanup", "createEffect", "createMemo", "createSignal", "onCleanup", "useSchema", "db", "typename", "query", "createMemo", "resolvedDb", "resolvedTypename", "undefined", "schemaRegistry", "location", "schema", "setSchema", "createSignal", "createEffect", "q", "unsubscribe", "subscribe", "results", "fire", "onCleanup"]
7
7
  }
@@ -1 +1 @@
1
- {"inputs":{"src/useObject.ts":{"bytes":28959,"imports":[{"path":"@solid-primitives/utils","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-atom","kind":"import-statement","external":true},{"path":"@dxos/effect-atom-solid","kind":"import-statement","external":true}],"format":"esm"},"src/useQuery.ts":{"bytes":5894,"imports":[{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/useSchema.ts":{"bytes":6018,"imports":[{"path":"solid-js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":638,"imports":[{"path":"src/useObject.ts","kind":"import-statement","original":"./useObject"},{"path":"src/useQuery.ts","kind":"import-statement","original":"./useQuery"},{"path":"src/useSchema.ts","kind":"import-statement","original":"./useSchema"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22399},"dist/lib/browser/index.mjs":{"imports":[{"path":"@solid-primitives/utils","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-atom","kind":"import-statement","external":true},{"path":"@dxos/effect-atom-solid","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true}],"exports":["useObject","useObjects","useQuery","useSchema"],"entryPoint":"src/index.ts","inputs":{"src/useObject.ts":{"bytesInOutput":4138},"src/index.ts":{"bytesInOutput":0},"src/useQuery.ts":{"bytesInOutput":986},"src/useSchema.ts":{"bytesInOutput":922}},"bytes":6205}}}
1
+ {"inputs":{"src/useObject.ts":{"bytes":28959,"imports":[{"path":"@solid-primitives/utils","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-atom","kind":"import-statement","external":true},{"path":"@dxos/effect-atom-solid","kind":"import-statement","external":true}],"format":"esm"},"src/useQuery.ts":{"bytes":5894,"imports":[{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true}],"format":"esm"},"src/useSchema.ts":{"bytes":6014,"imports":[{"path":"solid-js","kind":"import-statement","external":true}],"format":"esm"},"src/index.ts":{"bytes":638,"imports":[{"path":"src/useObject.ts","kind":"import-statement","original":"./useObject"},{"path":"src/useQuery.ts","kind":"import-statement","original":"./useQuery"},{"path":"src/useSchema.ts","kind":"import-statement","original":"./useSchema"}],"format":"esm"}},"outputs":{"dist/lib/neutral/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":22397},"dist/lib/neutral/index.mjs":{"imports":[{"path":"@solid-primitives/utils","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"@dxos/echo-atom","kind":"import-statement","external":true},{"path":"@dxos/effect-atom-solid","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true},{"path":"@dxos/echo","kind":"import-statement","external":true},{"path":"solid-js","kind":"import-statement","external":true}],"exports":["useObject","useObjects","useQuery","useSchema"],"entryPoint":"src/index.ts","inputs":{"src/useObject.ts":{"bytesInOutput":4138},"src/index.ts":{"bytesInOutput":0},"src/useQuery.ts":{"bytesInOutput":986},"src/useSchema.ts":{"bytesInOutput":922}},"bytes":6205}}}
@@ -9,6 +9,6 @@ type MaybeAccessor<T> = T | Accessor<T>;
9
9
  * @param typename - The schema typename to query (can be reactive)
10
10
  * @returns An accessor that returns the current schema or undefined
11
11
  */
12
- export declare const useSchema: <T extends Type.Entity.Any = Type.Entity.Any>(db?: MaybeAccessor<Database.Database | undefined>, typename?: MaybeAccessor<string | undefined>) => Accessor<T | undefined>;
12
+ export declare const useSchema: <T extends Type.AnyEntity = Type.AnyEntity>(db?: MaybeAccessor<Database.Database | undefined>, typename?: MaybeAccessor<string | undefined>) => Accessor<T | undefined>;
13
13
  export {};
14
14
  //# sourceMappingURL=useSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSchema.d.ts","sourceRoot":"","sources":["../../../src/useSchema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAqD,MAAM,UAAU,CAAC;AAE5F,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEtD,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,EACnE,KAAK,aAAa,CAAC,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAC,EACjD,WAAW,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,KAC3C,QAAQ,CAAC,CAAC,GAAG,SAAS,CAqCxB,CAAC"}
1
+ {"version":3,"file":"useSchema.d.ts","sourceRoot":"","sources":["../../../src/useSchema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAqD,MAAM,UAAU,CAAC;AAE5F,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEtD,KAAK,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;AAExC;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,EACjE,KAAK,aAAa,CAAC,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAC,EACjD,WAAW,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,KAC3C,QAAQ,CAAC,CAAC,GAAG,SAAS,CAqCxB,CAAC"}