import * as Schema from 'effect/Schema'; import { EID, URI } from '@dxos/keys'; /** * Filter by object type and properties. * * Clauses are combined using logical AND. */ declare const FilterObject_: Schema.Struct<{ type: Schema.Literal<["object"]>; typename: Schema.Union<[Schema.Schema, typeof Schema.Null]>; id: Schema.optional>; /** * Filter by property. * Must not include object ID. */ props: Schema.Record$, Schema.suspend>; /** * Objects that have any of the given foreign keys. */ foreignKeys: Schema.optional>>; /** * Match objects whose meta `key` equals this fully-qualified registry key (FQN format). */ metaKey: Schema.optional; /** * Semver range matched against the object's meta `version`. * Only consulted when {@link metaKey} is set. Objects with no `version` do not satisfy a version-constrained filter. */ metaVersion: Schema.optional; }>; export interface FilterObject extends Schema.Schema.Type { } export declare const FilterObject: Schema.Schema; /** * Compare. */ declare const FilterCompare_: Schema.Struct<{ type: Schema.Literal<["compare"]>; operator: Schema.Literal<["eq", "neq", "gt", "gte", "lt", "lte"]>; value: typeof Schema.Unknown; }>; export interface FilterCompare extends Schema.Schema.Type { } export declare const FilterCompare: Schema.Schema; /** * In. */ declare const FilterIn_: Schema.Struct<{ type: Schema.Literal<["in"]>; values: Schema.Array$; }>; export interface FilterIn extends Schema.Schema.Type { } export declare const FilterIn: Schema.Schema; /** * Contains. */ declare const FilterContains_: Schema.Struct<{ type: Schema.Literal<["contains"]>; value: typeof Schema.Any; }>; export interface FilterContains extends Schema.Schema.Type { } /** * Predicate for an array property to contain the provided value. * Nested objects are matched using strict structural matching. */ export declare const FilterContains: Schema.Schema; /** * Filters objects that have certain tag. */ declare const FilterTag_: Schema.Struct<{ type: Schema.Literal<["tag"]>; tag: typeof Schema.String; }>; export interface FilterTag extends Schema.Schema.Type { } export declare const FilterTag: Schema.Schema; /** * Range. */ declare const FilterRange_: Schema.Struct<{ type: Schema.Literal<["range"]>; from: typeof Schema.Any; to: typeof Schema.Any; }>; export interface FilterRange extends Schema.Schema.Type { } export declare const FilterRange: Schema.Schema; /** * Filter by system timestamp (createdAt / updatedAt). * Timestamps are unix milliseconds stored in the object meta index. */ declare const FilterTimestamp_: Schema.Struct<{ type: Schema.Literal<["timestamp"]>; field: Schema.Literal<["createdAt", "updatedAt"]>; operator: Schema.Literal<["gt", "gte", "lt", "lte"]>; value: typeof Schema.Number; }>; export interface FilterTimestamp extends Schema.Schema.Type { } export declare const FilterTimestamp: Schema.Schema; /** * Text search. */ declare const FilterTextSearch_: Schema.Struct<{ type: Schema.Literal<["text-search"]>; text: typeof Schema.String; searchKind: Schema.optional>; }>; export interface FilterTextSearch extends Schema.Schema.Type { } export declare const FilterTextSearch: Schema.Schema; /** * Not. */ declare const FilterNot_: Schema.Struct<{ type: Schema.Literal<["not"]>; filter: Schema.suspend; }>; export interface FilterNot extends Schema.Schema.Type { } export declare const FilterNot: Schema.Schema; /** * And. */ declare const FilterAnd_: Schema.Struct<{ type: Schema.Literal<["and"]>; filters: Schema.Array$>; }>; export interface FilterAnd extends Schema.Schema.Type { } export declare const FilterAnd: Schema.Schema; /** * Or. */ declare const FilterOr_: Schema.Struct<{ type: Schema.Literal<["or"]>; filters: Schema.Array$>; }>; export interface FilterOr extends Schema.Schema.Type { } export declare const FilterOr: Schema.Schema; /** * Filter objects that are children of the specified parents. * With transitive=true (default), matches grandchildren and beyond. */ declare const FilterChildOf_: Schema.Struct<{ type: Schema.Literal<["child-of"]>; /** Parent DXNs to match children of. */ parents: Schema.Array$>; /** Whether to match transitively (grandchildren, etc.). Defaults to true. */ transitive: typeof Schema.Boolean; }>; export interface FilterChildOf extends Schema.Schema.Type { } export declare const FilterChildOf: Schema.Schema; /** * Union of filters. */ export declare const Filter: Schema.Union<[Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema]>; export type Filter = Schema.Schema.Type; /** * Query objects by type, id, and/or predicates. */ declare const QuerySelectClause_: Schema.Struct<{ type: Schema.Literal<["select"]>; filter: Schema.suspend; }>; export interface QuerySelectClause extends Schema.Schema.Type { } export declare const QuerySelectClause: Schema.Schema; /** * Filter objects from selection. */ declare const QueryFilterClause_: Schema.Struct<{ type: Schema.Literal<["filter"]>; selection: Schema.suspend; filter: Schema.suspend; }>; export interface QueryFilterClause extends Schema.Schema.Type { } export declare const QueryFilterClause: Schema.Schema; /** * Traverse references from an anchor object. */ declare const QueryReferenceTraversalClause_: Schema.Struct<{ type: Schema.Literal<["reference-traversal"]>; anchor: Schema.suspend; property: typeof Schema.String; }>; export interface QueryReferenceTraversalClause extends Schema.Schema.Type { } export declare const QueryReferenceTraversalClause: Schema.Schema; /** * Traverse incoming references to an anchor object. */ declare const QueryIncomingReferencesClause_: Schema.Struct<{ type: Schema.Literal<["incoming-references"]>; anchor: Schema.suspend; /** * Property path where the reference is located. * If null, matches references from any property. */ property: Schema.NullOr; typename: Schema.Union<[Schema.Schema, typeof Schema.Null]>; }>; export interface QueryIncomingReferencesClause extends Schema.Schema.Type { } export declare const QueryIncomingReferencesClause: Schema.Schema; /** * Traverse relations connecting to an anchor object. */ declare const QueryRelationClause_: Schema.Struct<{ type: Schema.Literal<["relation"]>; anchor: Schema.suspend; /** * outgoing: anchor is the source of the relation. * incoming: anchor is the target of the relation. * both: anchor is either the source or target of the relation. */ direction: Schema.Literal<["outgoing", "incoming", "both"]>; filter: Schema.optional>; }>; export interface QueryRelationClause extends Schema.Schema.Type { } export declare const QueryRelationClause: Schema.Schema; /** * Traverse into the source or target of a relation. */ declare const QueryRelationTraversalClause_: Schema.Struct<{ type: Schema.Literal<["relation-traversal"]>; anchor: Schema.suspend; direction: Schema.Literal<["source", "target", "both"]>; }>; export interface QueryRelationTraversalClause extends Schema.Schema.Type { } export declare const QueryRelationTraversalClause: Schema.Schema; /** * Traverse parent-child hierarchy. */ declare const QueryHierarchyTraversalClause_: Schema.Struct<{ type: Schema.Literal<["hierarchy-traversal"]>; anchor: Schema.suspend; /** * to-parent: traverse from child to parent. * to-children: traverse from parent to children. */ direction: Schema.Literal<["to-parent", "to-children"]>; }>; export interface QueryHierarchyTraversalClause extends Schema.Schema.Type { } export declare const QueryHierarchyTraversalClause: Schema.Schema; /** * Union of multiple queries. */ declare const QueryUnionClause_: Schema.Struct<{ type: Schema.Literal<["union"]>; queries: Schema.Array$>; }>; export interface QueryUnionClause extends Schema.Schema.Type { } export declare const QueryUnionClause: Schema.Schema; /** * Set difference of two queries. */ declare const QuerySetDifferenceClause_: Schema.Struct<{ type: Schema.Literal<["set-difference"]>; source: Schema.suspend; exclude: Schema.suspend; }>; export interface QuerySetDifferenceClause extends Schema.Schema.Type { } export declare const QuerySetDifferenceClause: Schema.Schema; export declare const OrderDirection: Schema.Literal<["asc", "desc"]>; export type OrderDirection = Schema.Schema.Type; declare const Order_: Schema.Union<[Schema.Struct<{ kind: Schema.Literal<["natural"]>; }>, Schema.Struct<{ kind: Schema.Literal<["property"]>; property: typeof Schema.String; direction: Schema.Literal<["asc", "desc"]>; }>, Schema.Struct<{ kind: Schema.Literal<["rank"]>; direction: Schema.Literal<["asc", "desc"]>; }>, Schema.Struct<{ kind: Schema.Literal<["timestamp"]>; field: Schema.Literal<["createdAt", "updatedAt"]>; direction: Schema.Literal<["asc", "desc"]>; }>]>; export type Order = Schema.Schema.Type; export declare const Order: Schema.Schema; /** * Order the query results. * Left-to-right the orders dominate. */ declare const QueryOrderClause_: Schema.Struct<{ type: Schema.Literal<["order"]>; query: Schema.suspend; order: Schema.Array$>; }>; export interface QueryOrderClause extends Schema.Schema.Type { } export declare const QueryOrderClause: Schema.Schema; /** * Add options to a query. */ declare const QueryOptionsClause_: Schema.Struct<{ type: Schema.Literal<["options"]>; query: Schema.suspend; options: Schema.suspend<{ readonly deleted?: "exclude" | "include" | "only" | undefined; readonly debugLabel?: string | undefined; }, { readonly debugLabel?: string | undefined; readonly deleted?: "exclude" | "include" | "only" | undefined; }, never>; }>; export interface QueryOptionsClause extends Schema.Schema.Type { } export declare const QueryOptionsClause: Schema.Schema; /** * Limit the number of results. */ declare const QueryLimitClause_: Schema.Struct<{ type: Schema.Literal<["limit"]>; query: Schema.suspend; limit: typeof Schema.Number; }>; export interface QueryLimitClause extends Schema.Schema.Type { } export declare const QueryLimitClause: Schema.Schema; export declare const QueryFromClause_: Schema.Struct<{ type: Schema.Literal<["from"]>; query: Schema.suspend; from: Schema.Union<[Schema.TaggedStruct<"scope", { scopes: Schema.Array$>; }>, Schema.TaggedStruct<"query", { query: Schema.suspend; }>]>; }>; export interface QueryFromClause extends Schema.Schema.Type { } export declare const QueryFromClause: Schema.Schema; declare const Query_: Schema.Union<[Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema, Schema.Schema]>; export type Query = Schema.Schema.Type; export declare const Query: Schema.Schema; export declare const QueryOptions: Schema.Struct<{ /** * Nested select statements will use this option to filter deleted objects. */ deleted: Schema.optional>; /** * Diagnostics-only label for logs / tooling (not used by execution semantics). */ debugLabel: Schema.optional; }>; export interface QueryOptions extends Schema.Schema.Type { } /** * Selects from a space (automerge documents). * When `spaceId` is omitted, targets the owning space — i.e. the space of whichever * database executes the query. This lets callers reference "this space" without * having to look up its id. * When `includeAllFeeds` is true, also selects from all feeds belonging to that space. */ export declare const SpaceScope: Schema.TaggedStruct<"space", { spaceId: Schema.optional; includeAllFeeds: Schema.optional; }>; export interface SpaceScope extends Schema.Schema.Type { } /** * Selects from a specific feed (by its underlying queue DXN). */ export declare const FeedScope: Schema.TaggedStruct<"feed", { feedUri: typeof Schema.String; }>; export interface FeedScope extends Schema.Schema.Type { } /** * Selects from a code-shipped object registry. * * - `'local'` — the in-process registry attached to the hypergraph. * - `'remote'` — a future remote registry service (not yet implemented). * * To include both, add two separate `RegistryScope` entries to the `scopes` array. */ export declare const RegistryScope: Schema.TaggedStruct<"registry", { location: Schema.Literal<["local", "remote"]>; }>; export interface RegistryScope extends Schema.Schema.Type { } /** * Specifies the scope of the data to query from. * A `from` clause may carry multiple scopes; results are unioned across them. */ export declare const Scope: Schema.Union<[Schema.TaggedStruct<"space", { spaceId: Schema.optional; includeAllFeeds: Schema.optional; }>, Schema.TaggedStruct<"feed", { feedUri: typeof Schema.String; }>, Schema.TaggedStruct<"registry", { location: Schema.Literal<["local", "remote"]>; }>]>; export type Scope = Schema.Schema.Type; export declare const visit: (query: Query, visitor: (node: Query) => void) => void; /** * Recursively transforms a query tree bottom-up. * The mapper receives each node with its children already transformed. */ export declare const map: (query: Query, mapper: (node: Query) => Query) => Query; export declare const fold: (query: Query, reducer: (node: Query) => T) => T[]; export {}; //# sourceMappingURL=ast.d.ts.map