{
  "version": 3,
  "sources": ["../../../src/Relation.ts"],
  "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { raise } from '@dxos/debug';\nimport type { ForeignKey } from '@dxos/echo-protocol';\nimport { SchemaEx } from '@dxos/effect';\nimport { assertArgument, invariant } from '@dxos/invariant';\nimport { EID, type EntityId, type URI, DXN } from '@dxos/keys';\nimport { assumeType } from '@dxos/util';\n\nimport type * as Database from './Database';\nimport * as Entity from './Entity';\nimport * as internal from './internal';\nimport * as entityInternal from './internal/Entity';\nimport * as objInternal from './internal/Obj';\nimport * as Obj from './Obj';\nimport type * as Ref from './Ref';\nimport type * as Tag from './Tag';\nimport * as Type from './Type';\n\nexport type Endpoints<Source, Target> = {\n  [Source]: Source;\n  [Target]: Target;\n};\n\n/**\n * Base type for all ECHO relations.\n * @private\n */\ninterface BaseRelation<Source, Target>\n  extends internal.AnyEntity, Endpoints<Source, Target>, Entity.OfKind<internal.EntityKind.Relation> {}\n\n/**\n * Relation with no known properties beyond id, kind, source, and target.\n * Use this when the relation's schema/properties are not known.\n *\n * NOTE: This is a TypeScript type only, not a schema.\n * To validate that a value is an ECHO relation, use `Relation.isRelation`.\n */\nexport interface Unknown extends BaseRelation<Obj.Unknown, Obj.Unknown> {}\n\n/**\n * Runtime Effect schema for any ECHO relation.\n * Use for validation, parsing, or as a reference target for collections.\n * A relation has `id`, source, and target fields plus any additional properties.\n *\n * NOTE: `Schema.is(Type.Relation)` does STRUCTURAL validation only (checks for `id` field).\n * Use `Relation.isRelation()` for proper ECHO instance type guards that check the KindId brand.\n *\n * @example\n * ```ts\n * // Structural type guard (accepts any object with id field)\n * if (Schema.is(Type.Relation)(unknownValue)) { ... }\n *\n * // ECHO instance type guard (checks KindId brand)\n * if (Relation.isRelation(unknownValue)) { ... }\n * ```\n */\n// TODO(dmaretskyi): Change ObjModule.Any to ObjModule.Unknown to have stricter types.\nexport const Unknown: internal.UnknownTypeSchema<Unknown, typeof Entity.Kind.Relation> = Schema.Struct({\n  id: Schema.String,\n}).pipe(\n  Schema.extend(Schema.Record({ key: Schema.String, value: Schema.Unknown })),\n  Schema.annotations({\n    [internal.TypeAnnotationId]: {\n      kind: Entity.Kind.Relation,\n      typename: 'org.dxos.schema.anyRelation',\n      version: '0.0.0',\n      sourceSchema: DXN.make(internal.ANY_OBJECT_TYPENAME, internal.ANY_OBJECT_VERSION),\n      targetSchema: DXN.make(internal.ANY_OBJECT_TYPENAME, internal.ANY_OBJECT_VERSION),\n    },\n  }),\n) as unknown as internal.UnknownTypeSchema<Unknown, typeof Entity.Kind.Relation>;\n\n/**\n * Relation type with specific source and target types.\n */\nexport type OfShape<Source extends Obj.Unknown, Target extends Obj.Unknown, Props> = BaseRelation<Source, Target> &\n  Props;\n\n/**\n * Base type for snapshot relations (has SnapshotKindId instead of KindId).\n */\ninterface BaseRelationSnapshot<Source, Target> extends internal.AnyEntity, Endpoints<Source, Target> {\n  readonly [Entity.SnapshotKindId]: internal.EntityKind.Relation;\n  readonly id: EntityId;\n}\n\n/**\n * JSON-encoded properties for relations.\n */\nexport interface BaseRelationJson {\n  id: string;\n  [internal.ATTR_RELATION_SOURCE]: string;\n  [internal.ATTR_RELATION_TARGET]: string;\n}\n\n/**\n * Immutable snapshot of an ECHO relation.\n * Branded with SnapshotKindId (not KindId).\n * Property values are frozen at the time the snapshot was created.\n * Returned by getSnapshot() and hooks.\n */\nexport type Snapshot<T extends Unknown = Unknown> = Omit<T, Entity.KindId> &\n  BaseRelationSnapshot<Obj.Unknown, Obj.Unknown>;\n\nexport const Source: unique symbol = entityInternal.RelationSourceId as any;\nexport type Source = typeof Source;\n\nexport const Target: unique symbol = entityInternal.RelationTargetId as any;\nexport type Target = typeof Target;\n\n/**\n * Get relation source type.\n */\nexport type SourceOf<A> = A extends Endpoints<infer S, infer _T> ? S : never;\n\n/**\n * Get relation target type.\n */\nexport type TargetOf<A> = A extends Endpoints<infer _S, infer T> ? T : never;\n\n/**\n * Internal props type for relation instance creation.\n */\ntype MakePropsInternal<T extends Endpoints<any, any>> = {\n  id?: EntityId;\n  [Meta]?: Partial<internal.EntityMeta>;\n  [Source]: T[Source];\n  [Target]: T[Target];\n} & Entity.Properties<T>;\n\n/**\n * Props type for relation creation with a given schema. Accepts a `Type.AnyRelation`\n * entity (created with `Type.makeRelation`) and derives the props shape via\n * `Type.InstanceType`. Object-kind entities are rejected at the type level —\n * use `Obj.MakeProps` for those.\n */\nexport type MakeProps<S extends Type.AnyRelation> = MakePropsInternal<Type.InstanceType<S>>;\n\n/**\n * Creates new relation.\n * @param schema - Relation schema.\n * @param props - Relation properties. Endpoints are passed as [Relation.Source] and [Relation.Target] keys.\n * @param meta - Relation metadata. (deprecated; use [Obj.Meta] instead)\n * @returns\n */\n// NOTE: Writing the definition this way (with generic over schema) makes typescript perfer to infer the type from the first param (this schema) rather than the second param (the props).\n// TODO(dmaretskyi): Move meta into props.\nexport const make = <T extends Type.AnyRelation>(\n  type: T,\n  props: NoInfer<MakeProps<T>>,\n): Type.InstanceType<T> & Entity.OfKind<typeof Entity.Kind.Relation> => {\n  const schema = Type.getSchema(type);\n  assertArgument(\n    internal.getTypeAnnotation(schema)?.kind === internal.EntityKind.Relation,\n    'schema',\n    'Expected a relation schema',\n  );\n  assertArgument(props[internal.ParentId] === undefined, 'props', 'Parent is not allowed for relations');\n\n  let meta: internal.EntityMeta | undefined = undefined;\n\n  if (props[internal.MetaId] != null) {\n    meta = props[internal.MetaId] as any;\n    delete props[internal.MetaId];\n  }\n\n  const sourceDXN = internal.getObjectEchoUri(props[Source]) ?? raise(new Error('Unresolved relation source'));\n  const targetDXN = internal.getObjectEchoUri(props[Target]) ?? raise(new Error('Unresolved relation target'));\n\n  (props as any)[internal.RelationSourceDXNId] = sourceDXN;\n  (props as any)[internal.RelationTargetDXNId] = targetDXN;\n\n  // Pass the type entity through as `typeSource` so the resulting instance\n  // carries a back-reference resolvable via `Relation.getType` / `Entity.getType`.\n  return internal.makeObject(schema as any, props as any, meta, type as any) as any;\n};\n\n/**\n * Test if a value is an instance of a given relation type.\n *\n * Mirrors `Obj.instanceOf` but only accepts `Type.AnyRelation` — use\n * `Obj.instanceOf` for objects and `Type.isType` for `Type.Type` entities.\n *\n * @example\n * ```ts\n * const isEmployedBy = Relation.instanceOf(EmployedBy);\n * if (isEmployedBy(relation)) {\n *   // relation is EmployedBy\n * }\n * ```\n */\nexport const instanceOf: {\n  <S extends Type.AnyRelation>(schema: S): (value: unknown) => value is Type.InstanceType<S>;\n  <S extends Type.AnyRelation>(schema: S, value: unknown): value is Type.InstanceType<S>;\n} = ((...args: [schema: Type.AnyRelation, value?: unknown]) => {\n  if (args.length === 1) {\n    return (entity: unknown) => internal.isInstanceOf(args[0], entity);\n  }\n  return internal.isInstanceOf(args[0], args[1]);\n}) as any;\n\n/**\n * Type guard for relations.\n * Returns true for both reactive relations and relation snapshots.\n */\nexport const isRelation = (value: unknown): value is Unknown => {\n  if (typeof value !== 'object' || value === null) {\n    return false;\n  }\n  if (internal.ATTR_RELATION_SOURCE in value || internal.ATTR_RELATION_TARGET in value) {\n    return true;\n  }\n\n  // Check for reactive relation (KindId) or snapshot (SnapshotKindId).\n  const kind = (value as any)[Entity.KindId] ?? (value as any)[Entity.SnapshotKindId];\n  return kind === internal.EntityKind.Relation;\n};\n\nexport const isSnapshot = (value: unknown): value is Snapshot => {\n  if (typeof value !== 'object' || value === null) {\n    return false;\n  }\n  return (value as any)[Entity.SnapshotKindId] === internal.EntityKind.Relation;\n};\n\n/**\n * @returns Relation source URI.\n * Accepts both reactive relations and snapshots.\n * @throws If the object is not a relation.\n */\nexport const getSourceURI = (value: Unknown | Snapshot): EID.EID => {\n  assertArgument(isRelation(value), 'Expected a relation');\n  assumeType<internal.InternalObjectProps>(value);\n  const uri = (value as internal.InternalObjectProps)[internal.RelationSourceDXNId];\n  invariant(EID.isEID(uri));\n  return uri;\n};\n\n/**\n * @returns Relation target URI.\n * Accepts both reactive relations and snapshots.\n * @throws If the object is not a relation.\n */\nexport const getTargetURI = (value: Unknown | Snapshot): EID.EID => {\n  assertArgument(isRelation(value), 'Expected a relation');\n  assumeType<internal.InternalObjectProps>(value);\n  const uri = (value as internal.InternalObjectProps)[internal.RelationTargetDXNId];\n  invariant(EID.isEID(uri));\n  return uri;\n};\n\n/**\n * @returns Relation source.\n * Accepts both reactive relations and snapshots.\n * @throws If the object is not a relation.\n */\nexport const getSource = <T extends Unknown | Snapshot>(relation: T): SourceOf<T> => {\n  assertArgument(isRelation(relation), 'Expected a relation');\n  assumeType<internal.InternalObjectProps>(relation);\n  const obj = (relation as internal.InternalObjectProps)[internal.RelationSourceId];\n  if (obj === undefined) {\n    throw new Error(`Relation source could not be resolved.`);\n  }\n  return obj as SourceOf<T>;\n};\n\n/**\n * @returns Relation target.\n * Accepts both reactive relations and snapshots.\n * @throws If the object is not a relation.\n */\nexport const getTarget = <T extends Unknown | Snapshot>(relation: T): TargetOf<T> => {\n  assertArgument(isRelation(relation), 'Expected a relation');\n  assumeType<internal.InternalObjectProps>(relation);\n  const obj = (relation as internal.InternalObjectProps)[internal.RelationTargetId];\n  if (obj === undefined) {\n    throw new Error(`Relation target could not be resolved.`);\n  }\n  return obj as TargetOf<T>;\n};\n\n//\n// Change\n//\n\n/**\n * Makes all properties mutable recursively.\n * Used to provide a mutable view of a relation within `Relation.update`.\n */\nexport type Mutable<T> = internal.Mutable<T>;\n\n/**\n * Perform mutations on an echo relation within a controlled context.\n *\n * All mutations within the callback are batched and trigger a single notification\n * when the callback completes. Direct mutations outside of `Relation.update` will throw\n * an error for echo relations.\n *\n * @param relation - The echo relation to mutate. Use `Obj.update` for objects.\n * @param callback - The callback that performs mutations on the relation.\n *\n * @example\n * ```ts\n * const worksFor = Relation.make(EmployedBy, {\n *   [Relation.Source]: person,\n *   [Relation.Target]: company,\n *   role: 'Engineer',\n * });\n *\n * // Mutate within Relation.update\n * Relation.update(worksFor, (obj) => {\n *   obj.role = 'Senior Engineer';\n * });\n * ```\n *\n * Note: Only accepts relations. Use `Obj.update` for objects.\n */\nexport const update = <T extends Unknown>(relation: T, callback: internal.ChangeCallback<T>): void => {\n  internal.change(relation, callback);\n};\n\n//\n// Snapshot\n//\n\n/**\n * Returns an immutable snapshot of a relation.\n * The snapshot is branded with SnapshotKindId instead of KindId,\n * making it distinguishable from the reactive relation at the type level.\n */\nexport const getSnapshot: <T extends Unknown>(rel: T) => Snapshot<T> = internal.getSnapshot as any;\n\n//\n// Subscribe\n//\n\n/**\n * Subscribe to relation updates.\n * The callback is called synchronously when the relation is modified.\n * Only accepts reactive relations (not snapshots).\n * @returns Unsubscribe function.\n */\nexport const subscribe = (rel: Unknown, callback: () => void): (() => void) => {\n  return internal.subscribe(rel, callback);\n};\n\n//\n// Property Access\n//\n\n/**\n * Get a deeply nested property from a relation.\n * Accepts both reactive relations and snapshots.\n */\nexport const getValue = (rel: Unknown | Snapshot, path: readonly (string | number)[]): any => {\n  return SchemaEx.getValue(rel, SchemaEx.createJsonPath(path));\n};\n\n/**\n * Set a deeply nested property on a relation.\n * Must be called within a `Relation.update` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const setValue: (rel: Mutable<Unknown>, path: readonly (string | number)[], value: any) => void =\n  internal.setValue as any;\n\n//\n// Type\n//\n\n/**\n * Get the canonical URI of the relation. Returns `URI.URI` — today always an EID,\n * but future entity kinds may surface other URI schemes; narrow with `EID.parse(uri)`\n * or `DXN.tryMake(uri)` at the point of use. Accepts both reactive relations and snapshots.\n *\n * @param options.prefer - Controls the URI form (see {@link internal.GetURIOptions}).\n */\nexport const getURI = (entity: Unknown | Snapshot, options?: internal.GetURIOptions): URI.URI =>\n  internal.getUri(entity, options);\n\n/**\n * @returns The DXN of the relation's type.\n */\nexport const getTypeURI: (obj: internal.AnyProperties) => URI.URI | undefined = internal.getTypeURI;\n\n/**\n * Get the type entity (`Type.AnyRelation`) the relation was created from.\n *\n * Returns `undefined` when the relation's type isn't registered in this\n * runtime (e.g. a freshly deserialized snapshot whose type entity hasn't been\n * wired up yet, or a relation loaded from storage before its schema is known).\n * To get the Effect Schema from the returned entity, use `Type.getSchema(...)`.\n */\nexport const getType = (relation: Unknown | Snapshot): Type.AnyRelation | undefined =>\n  internal.getType(relation) as Type.AnyRelation | undefined;\n\n/**\n * @returns The typename of the relation's type.\n * Accepts both reactive relations and snapshots.\n */\nexport const getTypename = (entity: Unknown | Snapshot): string | undefined => internal.getTypename(entity);\n\n//\n// Database\n//\n\n/**\n * Get the database the relation belongs to.\n * Accepts both reactive relations and snapshots.\n */\nexport const getDatabase = (entity: Unknown | Snapshot): Database.Database | undefined => internal.getDatabase(entity);\n\n//\n// Meta\n//\n\n/**\n * Property that accesses metadata for an entity.\n *\n * Alias for `Entity.Meta`.\n */\nexport const Meta = internal.MetaId;\n\n/**\n * Deeply read-only version of EntityMeta.\n */\nexport type ReadonlyMeta = internal.ReadonlyMeta;\n\n/**\n * Mutable meta type returned by `Relation.getMeta` inside a `Relation.update` callback.\n */\nexport type Meta = internal.Meta;\n\n/**\n * Get the metadata for a relation.\n * Returns mutable meta when passed a mutable relation (inside `Relation.update` callback).\n * Returns read-only meta when passed a regular relation or snapshot.\n */\n// TODO(wittjosiah): When passed a Snapshot, should return a snapshot of meta, not the live meta proxy.\nexport function getMeta(entity: Mutable<Unknown>): Meta;\nexport function getMeta(entity: Unknown | Snapshot): ReadonlyMeta;\nexport function getMeta(entity: Unknown | Snapshot | Mutable<Unknown>): Meta | ReadonlyMeta {\n  return internal.getMetaChecked(entity);\n}\n\n/**\n * @returns Foreign keys for the relation from the specified source.\n * Accepts both reactive relations and snapshots.\n */\nexport const getKeys = (entity: Unknown | Snapshot, source: string): ForeignKey[] => internal.getKeys(entity, source);\n\n/**\n * Delete all keys from the relation for the specified source.\n * Must be called within a `Relation.update` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const deleteKeys = (entity: Mutable<Unknown>, source: string): void => internal.deleteKeys(entity, source);\n\n/**\n * Add a tag to the relation.\n * Must be called within a `Relation.update` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const addTag = (entity: Mutable<Unknown>, tag: Ref.Ref<Tag.Tag>): void => internal.addTag(entity, tag);\n\n/**\n * Remove a tag from the relation.\n * Must be called within a `Relation.update` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const removeTag = (entity: Mutable<Unknown>, tag: Ref.Ref<Tag.Tag>): void => internal.removeTag(entity, tag);\n\n/**\n * Check if the relation is deleted.\n * Accepts both reactive relations and snapshots.\n */\nexport const isDeleted = (entity: Unknown | Snapshot): boolean => internal.isDeleted(entity);\n\n//\n// Annotations\n//\n\n/**\n * Get the label of the relation.\n * Accepts both reactive relations and snapshots.\n *\n * @param options.fallback `'typename'` returns the relation's typename when no\n *   label is set (e.g. `org.dxos.type.table`).\n */\nexport const getLabel = (entity: Unknown | Snapshot, options?: internal.GetLabelOptions): string | undefined =>\n  internal.getLabel(entity, options);\n\n/**\n * Set the label of the relation.\n * Must be called within a `Relation.update` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const setLabel = (entity: Mutable<Unknown>, label: string): void => internal.setLabel(entity, label);\n\n/**\n * Get the description of the relation.\n * Accepts both reactive relations and snapshots.\n */\nexport const getDescription = (entity: Unknown | Snapshot): string | undefined => internal.getDescription(entity);\n\n/**\n * Set the description of the relation.\n * Must be called within a `Relation.update` callback.\n *\n * NOTE: TypeScript's structural typing allows readonly objects to be passed to `Mutable<T>`\n * parameters, so there is no compile-time error. Enforcement is runtime-only.\n */\nexport const setDescription = (entity: Mutable<Unknown>, description: string): void =>\n  internal.setDescription(entity, description);\n\n//\n// JSON\n//\n\n/**\n * JSON representation of a relation.\n */\nexport type JSON = internal.ObjectJSON;\n\n/**\n * Converts relation to its JSON representation.\n * Accepts both reactive relations and snapshots.\n */\nexport const toJSON = (entity: Unknown | Snapshot): JSON => internal.objectToJSON(entity);\n\n//\n// Sorting\n//\n\n/**\n * Comparator function type for sorting relations.\n * Accepts both reactive relations and snapshots.\n */\nexport type Comparator = internal.Comparator<Unknown | Snapshot>;\n\nexport const sortByLabel: Comparator = internal.sortByLabel as Comparator;\nexport const sortByTypename: Comparator = internal.sortByTypename as Comparator;\nexport const sort = (...comparators: Comparator[]): Comparator => internal.sort(...comparators) as Comparator;\n\n//\n// Version\n//\n\nexport const VersionTypeId = internal.VersionTypeId;\nexport const isVersion = internal.isVersion;\n\n/**\n * Represent relation version.\n */\nexport type Version = internal.EntityVersion;\n\n/**\n * Returns the version of the relation.\n * Accepts both reactive relations and snapshots.\n */\nexport const version = (entity: Unknown | Snapshot): Version => internal.version(entity);\n\n//\n// Atoms\n//\n\nexport const atom = objInternal.makeRelation;\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;iBAAAA;EAAA,qBAAAC;EAAA,cAAAC;EAAA;oBAAAC;EAAA,mBAAAC;EAAA,sBAAAC;EAAA,eAAAC;EAAA,gBAAAC;EAAA;qBAAAC;EAAA;;;;iBAAAC;EAAA,kBAAAC;EAAA,mBAAAC;EAAA;;;mBAAAC;EAAA;;mBAAAC;EAAA;mBAAAC;EAAA,sBAAAC;EAAA,gBAAAC;EAAA,gBAAAC;EAAA,YAAAC;EAAA,mBAAAC;EAAA,sBAAAC;EAAA,iBAAAC;EAAA;;iBAAAC;;AAMA,YAAYC,YAAY;AAExB,SAASC,aAAa;AAEtB,SAASC,gBAAgB;AACzB,SAASC,gBAAgBC,i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YF,SAAA;;AA4BE,IAAA,SAAA,CAAA,UAAA,aAAA;AAEA,EAAA,OAAA,UAAA,QAAA;AACF;AAWA,IAAYE,eAAA;AAWV,IAAAC,aAAA,CAAA,KAAA,aAAA;AAEA,SAAA,UAAA,KAAA,QAAA;AACF;AASE,IAAA,WAAA,CAAA,KAAA,SAAA;AAEF,SAAA,SAAA,SAAA,KAAA,SAAA,eAAA,IAAA,CAAA;;AAWO,IAAAC,YAAA;;;;AAoCI,IAAAC,eAAA,CAAA,WAAA,YAAA,MAAA;AAUJ,IAAAC,eAAA,CAAA,WAAA,YAAA,MAAA;AA6BE7B,IAAAA,OAAS8B;AAClB,SAAA,QAAA,QAAA;AAEA,SAAA,eAAA,MAAA;;;;;;AAwCA,IAAcC,aAAA,CAAA,WAAA,UAAA,MAAA;;;;;AAgEP,IAAMC,SAAAA,CAAAA,WAAsCA,aAA6B,MAAA;AACzE,IAAMC,eAAWC;AAEtB,IAAAF,kBAAA;AACF,IAAUC,QAAA,IAAA,gBAAA,KAAA,GAAA,WAAA;AAWV,IAAAE,iBAAA;;AAOQ,IAAAvC,WAAA,CAAA,WAAA,QAAA,MAAA;;",
  "names": ["Unknown", "VersionTypeId", "addTag", "deleteKeys", "getDatabase", "getDescription", "getKeys", "getLabel", "getSnapshot", "getType", "getTypeURI", "getTypename", "isDeleted", "isVersion", "removeTag", "setDescription", "setLabel", "setValue", "sort", "sortByLabel", "sortByTypename", "subscribe", "version", "Schema", "raise", "SchemaEx", "assertArgument", "invariant", "EID", "DXN", "assumeType", "Schema", "Record", "key", "annotations", "TypeAnnotationId", "kind", "Kind", "typename", "version", "sourceSchema", "targetSchema", "assertArgument", "internal", "getTypeAnnotation", "ParentId", "undefined", "meta", "props", "MetaId", "sourceDXN", "getObjectEchoUri", "RelationSourceDXNId", "RelationTargetDXNId", "targetDXN", "entity", "isInstanceOf", "args", "value", "assumeType", "invariant", "EID", "isEID", "uri", "relation", "RelationSourceId", "obj", "RelationTargetId", "getSnapshot", "subscribe", "setValue", "getTypename", "getDatabase", "getMetaChecked", "isDeleted", "sortByTypename", "sort", "comparators", "VersionTypeId"]
}
