dymokomi/luce-prism
Source of release 0.6.0
## Public Prism API. Implementation modules preserve independent dependencies.
import interop
import authoring.handle as handles
import evaluation.cache as caching
import evaluation.cache_api
import serialization.compression
import authoring.path_value
import file_access as file_io
import editor.settings
import editor.highlight as highlighting
import composition.event_log
import codecs.diagnostics
import codecs.custom as custom_codecs
import editor.projection
import surface.parser as surface_parser
import surface.writer as surface_writer
import logic.api as logic
import logic.atoms
import authoring.paths
import indexes.spatial
import indexes.vector as vectors
import indexes.full_text as text_search
import schema
import columnar
import query.query as querying
import query.predicates
import query.results
import rows
import query.aggregation
import query.groups as grouping
import query.field_index as indexing
import query.joins as joining
import codecs.api as codecs
import codecs.bundle
import evaluation.engine as evaluation
import geometry.transform as transforms
import geometry.affine
import scene
import composition.merge as merging
import composition.delta
import composition.moves
import composition.references
import types
import pattern as pattern_ops
import value
import document
import store as storing
import lookup as looking
import fs as listing
import storage
import path as path_ops
import serialization.encoding
pub type Document = document.Document
pub type ElementHandle = handles.ElementHandle
pub let element_handle_type = handles.element_handle_type
pub func edit(doc: interop.Reference[Document], path: str) -> interop.Reference[ElementHandle]!:
return try handles.edit(doc, path)
pub func define(doc: interop.Reference[Document], path: str, kind: str = "") -> interop.Reference[ElementHandle]!:
return try handles.define(doc, path, kind)
pub type EvalKey = caching.EvalKey
pub type ValueCache = cache_api.ValueCache
pub type DocumentCache = cache_api.DocumentCache
pub let value_cache_type = cache_api.value_cache_type
pub let document_cache_type = cache_api.document_cache_type
pub func compress(bytes: const u8[]) -> interop.Reference[storage.Blob]!:
return try storage.own_blob(try compression.compress_bytes(bytes))
pub func decompress(bytes: const u8[]) -> interop.Reference[storage.Blob]!:
return try storage.own_blob(try compression.decompress_bytes(bytes))
pub type Path = path_value.Path
pub let path_type = path_value.path_type
pub func valid_pattern(pattern: str) -> bool:
return pattern_ops.valid_pattern(pattern)
pub func pattern_prefix(pattern: str) -> str:
return pattern_ops.prefix(pattern)
pub func has_wildcard(pattern: str) -> bool:
return pattern_ops.has_wildcard(pattern)
pub type AppSettings = settings.AppSettings
pub let app_settings_type = settings.app_settings_type
pub type TokenClass = highlighting.TokenClass
pub type TokenSpan = highlighting.TokenSpan
pub type TokenSpans = highlighting.TokenSpans
pub let token_spans_type = highlighting.token_spans_type
pub func highlight_line(line: str, codec: codecs.Codec) -> interop.Reference[TokenSpans]!:
return try highlighting.highlight_line(line, codec)
pub func load(path: str, codec: codecs.Codec = codecs.Codec.auto) -> interop.Reference[Document]!:
return try file_io.load(path, codec)
pub func save(doc: interop.Reference[Document], path: str, codec: codecs.Codec = codecs.Codec.auto) -> !:
try file_io.save(doc, path, codec)
pub func write_durable(path: str, bytes: const u8[]) -> !:
try file_io.write(path, bytes)
pub type EventLog = event_log.EventLog
pub type Changes = event_log.Changes
pub let event_log_type = event_log.event_log_type
pub let changes_type = event_log.changes_type
pub type DecodeResult = diagnostics.DecodeResult
pub let decode_result_type = diagnostics.decode_result_type
pub type CodecAdapter = custom_codecs.CodecAdapter
pub let codec_adapter_type = custom_codecs.codec_adapter_type
pub type TextProjection = projection.TextProjection
pub let text_projection_type = projection.text_projection_type
pub func decode_diagnosed(bytes: const u8[], codec: codecs.Codec = codecs.Codec.auto) -> interop.Reference[DecodeResult]!:
return try diagnostics.decode_diagnosed(bytes, codec)
pub type Logic = logic.Logic
pub type Justification = logic.Justification
pub let logic_type = logic.logic_type
pub let justification_type = logic.justification_type
pub func conclude(doc: interop.Reference[Document], atom: interop.Reference[atoms.Atom]) -> atoms.ProofTag!:
return try logic.conclude(doc, atom)
pub func why(doc: interop.Reference[Document], atom: interop.Reference[atoms.Atom]) -> interop.Reference[Justification]!:
return try logic.why(doc, atom)
pub func derive(doc: interop.Reference[Document]) -> interop.Reference[Document]!:
return try logic.derive(doc)
pub func parse_surface(source: str) -> interop.Reference[Document]!:
return try document.own_document(try surface_parser.parse(source))
pub func serialize_surface(doc: interop.Reference[Document]) -> interop.Reference[storage.Blob]!:
return try storage.own_blob(try surface_writer.write((try doc.get()).view_data()))
pub type Atom = atoms.Atom
pub type Atoms = atoms.Atoms
pub type RuleKind = atoms.RuleKind
pub type ProofTag = atoms.ProofTag
pub let atom_type = atoms.atom_type
pub let atoms_type = atoms.atoms_type
pub type Paths = paths.Paths
pub let paths_type = paths.paths_type
pub type Moves = moves.Moves
pub let moves_type = moves.moves_type
pub func renames(base: interop.Reference[Document], target: interop.Reference[Document]) -> interop.Reference[Moves]!:
return try moves.renames(base, target)
pub type Vec3 = spatial.Vec3
pub type SpatialIndex = spatial.SpatialIndex
pub let spatial_index_type = spatial.spatial_index_type
pub type VectorIndex = vectors.VectorIndex
pub type Metric = vectors.Metric
pub let vector_index_type = vectors.vector_index_type
pub type TextIndex = text_search.TextIndex
pub let text_index_type = text_search.text_index_type
pub type Schema = schema.Schema
pub type Violations = schema.Violations
pub let schema_type = schema.schema_type
pub let violations_type = schema.violations_type
pub type ColumnTable = columnar.ColumnTable
pub type RowMask = columnar.RowMask
pub let column_table_type = columnar.column_table_type
pub let row_mask_type = columnar.row_mask_type
pub type Query = querying.Query
pub let query_type = querying.query_type
pub type Predicate = predicates.Predicate
pub type Comparison = predicates.Comparison
pub let predicate_type = predicates.predicate_type
pub type Selection = results.Selection
pub type Row = results.Row
pub type RowView = rows.RowView
pub let selection_type = results.selection_type
pub let row_type = results.row_type
pub type Aggregate = aggregation.Aggregate
pub type Groups = grouping.Groups
pub let groups_type = grouping.groups_type
pub type FieldIndex = indexing.FieldIndex
pub let field_index_type = indexing.field_index_type
pub type JoinType = joining.JoinType
pub type JoinResult = joining.JoinResult
pub let join_result_type = joining.join_result_type
pub func join_on(left: interop.Reference[Query], left_field: str, right: interop.Reference[Query], right_field: str, kind: JoinType = JoinType.inner) -> interop.Reference[JoinResult]!:
return try joining.join_on(left, left_field, right, right_field, kind)
pub func join_by_connection(doc: interop.Reference[Document], left: interop.Reference[Query], slot: str) -> interop.Reference[JoinResult]!:
return try joining.join_by_connection(doc, left, slot)
pub type Value = value.Value
pub type Blob = storage.Blob
pub type Encoding = types.Encoding
pub type DType = types.DType
pub type Interpolation = types.Interpolation
pub type HandleType = types.HandleType
pub type Codec = codecs.Codec
pub type Bundle = bundle.Bundle
pub let bundle_type = bundle.bundle_type
pub type NodeRegistry = evaluation.NodeRegistry
pub type Evaluator = evaluation.Evaluator
pub type BakeContext = evaluation.BakeContext
pub let registry_type = evaluation.registry_type
pub let evaluator_type = evaluation.evaluator_type
pub let bake_context_type = evaluation.bake_context_type
pub type Affine2 = affine.Affine2
pub type Vec2 = affine.Vec2
pub type Scene = scene.Scene
pub let scene_type = scene.scene_type
pub let document_type = document.document_type
pub let value_type = value.value_type
pub let blob_type = storage.blob_type
pub let invalid: ErrorCode = types.invalid
pub let limit_exceeded: ErrorCode = types.limit_exceeded
pub let missing: ErrorCode = types.missing
pub let unsupported: ErrorCode = types.unsupported
pub let closed: ErrorCode = types.closed
pub let conflict: ErrorCode = types.conflict
pub let busy: ErrorCode = types.busy
pub let timed_out: ErrorCode = types.timed_out
pub let format_version: u16 = types.format_version
pub type Store = storing.Store
pub type Session = storing.Session
pub type StoreStatistics = storing.Statistics
pub type Look = looking.Look
pub type LookKind = looking.LookKind
pub type Entries = listing.Entries
pub let store_type = storing.store_type
pub let session_type = storing.session_type
pub let look_type = looking.look_type
pub let entries_type = listing.entries_type
pub func valid_path(path: str) -> bool:
return path_ops.valid_path(path)
pub func element_path(path: str) -> str:
return path_ops.element_path(path)
pub func parent_path(path: str) -> str:
return path_ops.parent_path(path)
pub func path_name(path: str) -> str:
return path_ops.path_name(path)
pub func is_anonymous(name: str) -> bool:
return path_ops.anonymous(name)
pub func is_descendant(path: str, root: str) -> bool:
return path_ops.is_descendant(path, root)
pub func detect(bytes: const u8[]) -> Encoding:
return encoding.detect(bytes)
pub func matches(pattern: str, path: str) -> bool:
return pattern_ops.matches(pattern, path)
pub type ReferenceLibrary = references.ReferenceLibrary
pub let library_type = references.library_type
pub func compose_file(path: str) -> interop.Reference[Document]!:
return try references.compose_file(path)
pub func materialize_file(path: str) -> interop.Reference[Document]!:
return try references.compose_file(path)
pub type MergeResult = merging.MergeResult
pub type LayerStack = merging.LayerStack
pub type Layer = delta.Layer
pub let merge_type = merging.merge_type
pub let layer_stack_type = merging.layer_stack_type
pub let layer_type = delta.layer_type
pub func layer_from(source: interop.Reference[Document]) -> interop.Reference[Layer]!:
return try delta.own_layer(try delta.from_document((try source.get()).view_data()))
pub func make_layer() -> interop.Reference[Layer]!:
return try delta.own_layer(delta.Layer())
pub func layer_put_element(layer: interop.Reference[Layer], path: str, override: bool = false, deleted: bool = false) -> !:
try (try layer.get()).put(path, delta.Cell.element, "", delta.Op(deleted = deleted, override = override))
pub func layer_visible(base: interop.Reference[Document], layer: interop.Reference[Layer], path: str) -> bool!:
return delta.visible((try base.get()).view_data(), try layer.get(), none, path)
pub func layer_visible2(base: interop.Reference[Document], first: interop.Reference[Layer], second: interop.Reference[Layer], path: str) -> bool!:
return delta.visible((try base.get()).view_data(), try first.get(), try second.get(), path)
pub func layer_has_child(base: interop.Reference[Document], layer: interop.Reference[Layer], parent: str, child: str) -> bool!:
var kids = try delta.children((try base.get()).view_data(), try layer.get(), none, parent)
defer kids.close()
for path in kids.span():
if path == child:
return true
return false
pub func layer_has_child2(base: interop.Reference[Document], first: interop.Reference[Layer], second: interop.Reference[Layer], parent: str, child: str) -> bool!:
var kids = try delta.children((try base.get()).view_data(), try first.get(), try second.get(), parent)
defer kids.close()
for path in kids.span():
if path == child:
return true
return false
pub func layer_has_property(base: interop.Reference[Document], layer: interop.Reference[Layer], path: str, name: str) -> bool!:
return delta.has_property((try base.get()).view_data(), try layer.get(), none, path, name)
pub func merge(base: interop.Reference[Document], a: interop.Reference[Document], b: interop.Reference[Document]) -> interop.Reference[MergeResult]!:
return try merging.merge(base, a, b)
pub func decode(bytes: const u8[], codec: Codec = Codec.auto) -> interop.Reference[Document]!:
return try codecs.decode(bytes, codec)
pub func encode(doc: interop.Reference[Document], codec: Codec = Codec.prisma, compressed: bool = false) -> interop.Reference[Blob]!:
return try codecs.encode(doc, codec, compressed)
pub func codec_name(codec: Codec) -> str:
return codecs.codec_name(codec)
pub func codec_by_name(name: str) -> Codec?:
return codecs.codec_by_name(name)
pub func codec_for_path(path: str) -> Codec!:
return try codecs.codec_for_path(path)
pub func document_lens(doc: interop.Reference[Document]) -> Codec!:
return try codecs.document_lens(doc)
pub func set_document_lens(doc: interop.Reference[Document], codec: Codec) -> !:
try codecs.set_document_lens(doc, codec)
pub func compute(doc: interop.Reference[Document], time: f64 = 0.0) -> interop.Reference[Document]!:
return try evaluation.compute(doc, time)
pub func compute_slot(doc: interop.Reference[Document], slot: str, time: f64 = 0.0) -> interop.Reference[Value]!:
return try evaluation.compute_slot(doc, slot, time)
pub func local_matrix(doc: interop.Reference[Document], path: str, time: f64 = 0.0) -> Affine2!:
return try transforms.local_matrix(doc, path, time)
pub func world_matrix(doc: interop.Reference[Document], path: str, time: f64 = 0.0) -> Affine2!:
return try transforms.world_matrix(doc, path, time)
pub func is_visible(doc: interop.Reference[Document], path: str, time: f64 = 0.0) -> bool!:
return try transforms.is_visible(doc, path, time)