sharedTypes

package
v0.0.0-...-1d800d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LaTeX    = Compiler("latex")
	LuaLaTeX = Compiler("lualatex")
	PDFLaTeX = Compiler("pdflatex")
	XeLaTeX  = Compiler("xelatex")
)
View Source
const (
	StandardCompileGroup = CompileGroup("standard")
	PriorityCompileGroup = CompileGroup("priority")
)
View Source
const (
	Bootstrap                       = EditorEventMessage("bootstrap")
	BroadcastDocMeta                = EditorEventMessage("broadcastDocMeta")
	ClientTrackingBatch             = EditorEventMessage("clientTracking.batch")
	ClientTrackingUpdated           = EditorEventMessage("clientTracking.clientUpdated")
	CompilerUpdated                 = EditorEventMessage("compilerUpdated")
	ConnectionRejected              = EditorEventMessage("connectionRejected")
	ForceDisconnect                 = EditorEventMessage("forceDisconnect")
	ImageNameUpdated                = EditorEventMessage("imageNameUpdated")
	NewChatMessage                  = EditorEventMessage("new-chat-message")
	OtUpdateApplied                 = EditorEventMessage("otUpdateApplied")
	OtUpdateError                   = EditorEventMessage("otUpdateError")
	ProjectEditableUpdated          = EditorEventMessage("projectEditableUpdated")
	ProjectMembershipChanged        = EditorEventMessage("project:membership:changed")
	ProjectNameUpdated              = EditorEventMessage("projectNameUpdated")
	ProjectPublicAccessLevelChanged = EditorEventMessage("project:publicAccessLevel:changed")
	ReceiveEntityMove               = EditorEventMessage("receiveEntityMove")
	ReceiveEntityRename             = EditorEventMessage("receiveEntityRename")
	ReceiveNewDoc                   = EditorEventMessage("receiveNewDoc")
	ReceiveNewFile                  = EditorEventMessage("receiveNewFile")
	ReceiveNewFolder                = EditorEventMessage("receiveNewFolder")
	RemoveEntity                    = EditorEventMessage("removeEntity")
	RootDocUpdated                  = EditorEventMessage("rootDocUpdated")
	SpellCheckLanguageUpdated       = EditorEventMessage("spellCheckLanguageUpdated")
)
View Source
const (
	MaxDocLength = 2 * 1024 * 1024
	// MaxDocSizeBytes allows for 4 bytes per unicode character.
	MaxDocSizeBytes = 4 * MaxDocLength
)
View Source
const AllZeroUUID = "00000000-0000-0000-0000-000000000000"
View Source
const MaxComputeTimeout = ComputeTimeout(10 * time.Minute)

Variables

View Source
var (
	ValidRootDocExtensions = []FileType{
		"tex",
		"rtex",
		"ltex",
	}
	ValidTextExtensions = []FileType{
		"asy",
		"bbx",
		"bib",
		"bibtex",
		"bst",
		"cbx",
		"clo",
		"cls",
		"def",
		"dtx",
		"editorconfig",
		"gitignore",
		"gv",
		"ins",
		"ist",
		"latex",
		"latexmkrc",
		"lbx",
		"lco",
		"ldf",
		"lua",
		"m",
		"md",
		"mf",
		"mtx",
		"rmd",
		"rtex",
		"sty",
		"tex",
		"tikz",
		"txt",
		"yaml",
		"yml",
	}
)

NOTE: When updating ValidRootDocExtensions, update project.Manager too.

View Source
var (
	ErrDocIsTooLarge       = &errors.ValidationError{Msg: "doc is too large"}
	ErrDocHasNullChar      = &errors.ValidationError{Msg: "doc has null char"}
	ErrDocHasSurrogateChar = &errors.ValidationError{Msg: "doc has surrogate char"}
)
View Source
var ErrInvalidUUID = &errors.ValidationError{Msg: "invalid uuid"}

Functions

This section is empty.

Types

type AppliedDocumentUpdate

type AppliedDocumentUpdate struct {
	DocId   UUID                      `json:"doc"`
	Meta    AppliedDocumentUpdateMeta `json:"meta"`
	Op      Op                        `json:"op"`
	Version Version                   `json:"v"`
}

type AppliedDocumentUpdateMeta

type AppliedDocumentUpdateMeta struct {
	Source PublicId `json:"source"`
	Type   string   `json:"type,omitempty"`
}

type AppliedOpsErrorMeta

type AppliedOpsErrorMeta struct {
	Error errors.JavaScriptError `json:"error"`
	DocId UUID                   `json:"docId"`
}

type CompileGroup

type CompileGroup string

func (CompileGroup) Validate

func (c CompileGroup) Validate() error

type Compiler

type Compiler string

func (Compiler) LaTeXmkFlag

func (c Compiler) LaTeXmkFlag() string

func (Compiler) Validate

func (c Compiler) Validate() error

type Component

type Component struct {
	Deletion  Snippet `json:"d,omitempty"`
	Insertion Snippet `json:"i,omitempty"`
	Position  int     `json:"p"`
}

func (Component) IsDeletion

func (c Component) IsDeletion() bool

func (Component) IsInsertion

func (c Component) IsInsertion() bool

func (Component) IsNoOp

func (c Component) IsNoOp() bool

func (Component) Validate

func (c Component) Validate() error

type ComputeTimeout

type ComputeTimeout time.Duration

func (ComputeTimeout) String

func (t ComputeTimeout) String() string

func (ComputeTimeout) Validate

func (t ComputeTimeout) Validate() error

type DirEntry

type DirEntry interface {
	Dir() DirName
	IsDir() bool
	String() string
}

type DirName

type DirName string

func (DirName) Dir

func (d DirName) Dir() DirName

func (DirName) Filename

func (d DirName) Filename() Filename

func (DirName) IsDir

func (d DirName) IsDir() bool

func (DirName) Join

func (d DirName) Join(f Filename) PathName

func (DirName) JoinDir

func (d DirName) JoinDir(f Filename) DirName

func (DirName) JoinPath

func (d DirName) JoinPath(p PathName) PathName

func (DirName) String

func (d DirName) String() string

func (DirName) Validate

func (d DirName) Validate() error

type DocumentUpdate

type DocumentUpdate struct {
	DocId       UUID               `json:"doc"`
	Dup         bool               `json:"dup,omitempty"`
	DupIfSource DupIfSource        `json:"dupIfSource,omitempty"`
	Hash        Hash               `json:"hash,omitempty"`
	Meta        DocumentUpdateMeta `json:"meta"`
	Op          Op                 `json:"op"`
	Version     Version            `json:"v"`
}

func (*DocumentUpdate) CheckVersion

func (d *DocumentUpdate) CheckVersion(current Version) error

func (*DocumentUpdate) Validate

func (d *DocumentUpdate) Validate() error

type DocumentUpdateAck

type DocumentUpdateAck struct {
	DocId   UUID    `json:"doc"`
	Version Version `json:"v"`
}

func (*DocumentUpdateAck) MarshalJSON

func (d *DocumentUpdateAck) MarshalJSON() ([]byte, error)

type DocumentUpdateMeta

type DocumentUpdateMeta struct {
	IngestionTime time.Time `json:"ingestion_time,omitempty"`
	Source        PublicId  `json:"source"`
	Type          string    `json:"type,omitempty"`
	Timestamp     Timestamp `json:"ts,omitempty"`
	UserId        UUID      `json:"user_id,omitempty"`
}

func (*DocumentUpdateMeta) Validate

func (d *DocumentUpdateMeta) Validate() error

type DupIfSource

type DupIfSource []PublicId

func (DupIfSource) Contains

func (d DupIfSource) Contains(id PublicId) bool

type EditorEvent

type EditorEvent struct {
	/* "h" is a virtual field indicating the length of Payload */
	Payload     json.RawMessage    `json:"payload"`
	RoomId      UUID               `json:"room_id"`
	Message     EditorEventMessage `json:"message"`
	ProcessedBy string             `json:"processedBy,omitempty"`
	Source      PublicId           `json:"source,omitempty"`
}

func (*EditorEvent) FastUnmarshalJSON

func (e *EditorEvent) FastUnmarshalJSON(p []byte) error

func (*EditorEvent) MarshalJSON

func (e *EditorEvent) MarshalJSON() ([]byte, error)

func (*EditorEvent) Validate

func (e *EditorEvent) Validate() error

type EditorEventMessage

type EditorEventMessage string

func (*EditorEventMessage) UnmarshalJSON

func (e *EditorEventMessage) UnmarshalJSON(p []byte) error

type Email

type Email string

func (Email) Host

func (e Email) Host() string

func (Email) LocalPart

func (e Email) LocalPart() string

func (Email) Normalize

func (e Email) Normalize() Email

func (Email) ReversedHostname

func (e Email) ReversedHostname() ReversedHostname

func (Email) Validate

func (e Email) Validate() error

type FileType

type FileType string

func (FileType) ValidForDoc

func (t FileType) ValidForDoc() bool

func (FileType) ValidForRootDoc

func (t FileType) ValidForRootDoc() bool

type Filename

type Filename string

func (Filename) Basename

func (f Filename) Basename() string

func (Filename) Validate

func (f Filename) Validate() error

type Hash

type Hash string

func (Hash) CheckMatches

func (h Hash) CheckMatches(other Hash) error

type ImageName

type ImageName string

func (ImageName) CheckIsAllowed

func (i ImageName) CheckIsAllowed(allowedImages []ImageName) error

func (ImageName) Validate

func (i ImageName) Validate() error

func (ImageName) Year

func (i ImageName) Year() string

type Op

type Op []Component

func (Op) Validate

func (o Op) Validate() error

type PathName

type PathName string

func (PathName) Dir

func (p PathName) Dir() DirName

func (PathName) Filename

func (p PathName) Filename() Filename

func (PathName) IsDir

func (p PathName) IsDir() bool

func (PathName) String

func (p PathName) String() string

func (PathName) Type

func (p PathName) Type() FileType

func (PathName) Validate

func (p PathName) Validate() error

type PrivilegeLevel

type PrivilegeLevel string
const (
	PrivilegeLevelOwner        PrivilegeLevel = "owner"
	PrivilegeLevelReadAndWrite PrivilegeLevel = "readAndWrite"
	PrivilegeLevelReadOnly     PrivilegeLevel = "readOnly"
)

func (PrivilegeLevel) CheckIsAtLeast

func (l PrivilegeLevel) CheckIsAtLeast(other PrivilegeLevel) error

func (PrivilegeLevel) IsAtLeast

func (l PrivilegeLevel) IsAtLeast(other PrivilegeLevel) bool

func (PrivilegeLevel) IsHigherThan

func (l PrivilegeLevel) IsHigherThan(other PrivilegeLevel) bool

func (PrivilegeLevel) Validate

func (l PrivilegeLevel) Validate() error

type ProjectOptions

type ProjectOptions struct {
	CompileGroup CompileGroup   `json:"c"`
	ProjectId    UUID           `json:"p"`
	UserId       UUID           `json:"u"`
	Timeout      ComputeTimeout `json:"t"`
}

type PublicId

type PublicId string

func (PublicId) Validate

func (p PublicId) Validate() error

type ReversedHostname

type ReversedHostname string

type Snapshot

type Snapshot []rune

func (Snapshot) CheckSize

func (s Snapshot) CheckSize() error

func (Snapshot) Hash

func (s Snapshot) Hash() Hash

func (Snapshot) MarshalJSON

func (s Snapshot) MarshalJSON() ([]byte, error)

func (Snapshot) Slice

func (s Snapshot) Slice(start, end int) Snippet

func (*Snapshot) UnmarshalJSON

func (s *Snapshot) UnmarshalJSON(bytes []byte) error

func (Snapshot) Validate

func (s Snapshot) Validate() error

type Snippet

type Snippet []rune

func (Snippet) Equals

func (s Snippet) Equals(other Snippet) bool

func (Snippet) MarshalJSON

func (s Snippet) MarshalJSON() ([]byte, error)

func (*Snippet) UnmarshalJSON

func (s *Snippet) UnmarshalJSON(bytes []byte) error

type Timed

type Timed struct {
	// contains filtered or unexported fields
}

func (*Timed) Begin

func (t *Timed) Begin()

func (*Timed) End

func (t *Timed) End() *Timed

func (*Timed) MarshalJSON

func (t *Timed) MarshalJSON() ([]byte, error)

func (*Timed) SetBegin

func (t *Timed) SetBegin(t0 time.Time)

func (*Timed) Stage

func (t *Timed) Stage() string

func (*Timed) String

func (t *Timed) String() string

func (*Timed) UnmarshalJSON

func (t *Timed) UnmarshalJSON(bytes []byte) error

type Timestamp

type Timestamp int64

func (*Timestamp) ParseIfSet

func (t *Timestamp) ParseIfSet(s string) error

func (Timestamp) ToTime

func (t Timestamp) ToTime() time.Time

func (Timestamp) Validate

func (t Timestamp) Validate() error

type URL

type URL struct {
	url.URL
}

func ParseAndValidateURL

func ParseAndValidateURL(s string) (*URL, error)

func (*URL) FileNameFromPath

func (u *URL) FileNameFromPath() Filename

func (*URL) MarshalJSON

func (u *URL) MarshalJSON() ([]byte, error)

func (*URL) UnmarshalJSON

func (u *URL) UnmarshalJSON(bytes []byte) error

func (*URL) Validate

func (u *URL) Validate() error

func (URL) WithPath

func (u URL) WithPath(s string) *URL

func (URL) WithQuery

func (u URL) WithQuery(values url.Values) *URL

type UUID

type UUID [16]byte

func ParseUUID

func ParseUUID(s string) (UUID, error)

func (UUID) Append

func (u UUID) Append(b []byte) []byte

func (UUID) Concat

func (u UUID) Concat(c byte, other UUID) string

func (UUID) IsZero

func (u UUID) IsZero() bool

func (UUID) MarshalJSON

func (u UUID) MarshalJSON() ([]byte, error)

func (*UUID) Populate

func (u *UUID) Populate() error

func (UUID) SkipUnderlyingTypePlan

func (UUID) SkipUnderlyingTypePlan()

func (UUID) String

func (u UUID) String() string

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(b []byte) error

func (*UUID) UnmarshalText

func (u *UUID) UnmarshalText(src []byte) error

type UUIDBatch

type UUIDBatch struct {
	// contains filtered or unexported fields
}

func GenerateUUIDBulk

func GenerateUUIDBulk(n int) (*UUIDBatch, error)

func NewUUIDBatch

func NewUUIDBatch(n int) UUIDBatch

func (*UUIDBatch) Add

func (b *UUIDBatch) Add(id UUID)

func (*UUIDBatch) Cap

func (b *UUIDBatch) Cap() int

func (*UUIDBatch) Len

func (b *UUIDBatch) Len() int

func (*UUIDBatch) Next

func (b *UUIDBatch) Next() UUID

type UUIDCodec

type UUIDCodec struct{}

func (UUIDCodec) DecodeDatabaseSQLValue

func (c UUIDCodec) DecodeDatabaseSQLValue(_ *pgtype.Map, _ uint32, _ int16, _ []byte) (driver.Value, error)

func (UUIDCodec) DecodeValue

func (c UUIDCodec) DecodeValue(_ *pgtype.Map, _ uint32, _ int16, _ []byte) (any, error)

func (UUIDCodec) Encode

func (UUIDCodec) Encode(value any, buf []byte) ([]byte, error)

func (UUIDCodec) FormatSupported

func (UUIDCodec) FormatSupported(format int16) bool

func (UUIDCodec) PlanEncode

func (c UUIDCodec) PlanEncode(_ *pgtype.Map, _ uint32, _ int16, _ any) pgtype.EncodePlan

func (UUIDCodec) PlanScan

func (c UUIDCodec) PlanScan(_ *pgtype.Map, _ uint32, _ int16, _ any) pgtype.ScanPlan

func (UUIDCodec) PreferredFormat

func (UUIDCodec) PreferredFormat() int16

func (UUIDCodec) Scan

func (UUIDCodec) Scan(src []byte, dst any) error

type UUIDs

type UUIDs []UUID

func (UUIDs) SkipUnderlyingTypePlan

func (UUIDs) SkipUnderlyingTypePlan()

type UUIDsCodec

type UUIDsCodec struct{}

func (UUIDsCodec) DecodeDatabaseSQLValue

func (c UUIDsCodec) DecodeDatabaseSQLValue(_ *pgtype.Map, _ uint32, _ int16, _ []byte) (driver.Value, error)

func (UUIDsCodec) DecodeValue

func (c UUIDsCodec) DecodeValue(_ *pgtype.Map, _ uint32, _ int16, _ []byte) (any, error)

func (UUIDsCodec) Encode

func (UUIDsCodec) Encode(value any, buf []byte) ([]byte, error)

func (UUIDsCodec) FormatSupported

func (UUIDsCodec) FormatSupported(format int16) bool

func (UUIDsCodec) PlanEncode

func (c UUIDsCodec) PlanEncode(_ *pgtype.Map, _ uint32, _ int16, _ any) pgtype.EncodePlan

func (UUIDsCodec) PlanScan

func (c UUIDsCodec) PlanScan(_ *pgtype.Map, _ uint32, _ int16, _ any) pgtype.ScanPlan

func (UUIDsCodec) PreferredFormat

func (UUIDsCodec) PreferredFormat() int16

func (UUIDsCodec) Scan

func (UUIDsCodec) Scan(src []byte, dst any) error

type Version

type Version int64

func (Version) Equals

func (v Version) Equals(other Version) bool

func (*Version) ParseIfSet

func (v *Version) ParseIfSet(s string) error

func (Version) String

func (v Version) String() string

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL