tldraw/packages/store/api/api.json

5685 lines
177 KiB
JSON
Raw Normal View History

{
"metadata": {
"toolPackage": "@microsoft/api-extractor",
"toolVersion": "7.35.4",
"schemaVersion": 1011,
"oldestForwardsCompatibleVersion": 1001,
"tsdocConfig": {
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
"noStandardTags": true,
"tagDefinitions": [
{
"tagName": "@alpha",
"syntaxKind": "modifier"
},
{
"tagName": "@beta",
"syntaxKind": "modifier"
},
{
"tagName": "@defaultValue",
"syntaxKind": "block"
},
{
"tagName": "@decorator",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@deprecated",
"syntaxKind": "block"
},
{
"tagName": "@eventProperty",
"syntaxKind": "modifier"
},
{
"tagName": "@example",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@experimental",
"syntaxKind": "modifier"
},
{
"tagName": "@inheritDoc",
"syntaxKind": "inline"
},
{
"tagName": "@internal",
"syntaxKind": "modifier"
},
{
"tagName": "@label",
"syntaxKind": "inline"
},
{
"tagName": "@link",
"syntaxKind": "inline",
"allowMultiple": true
},
{
"tagName": "@override",
"syntaxKind": "modifier"
},
{
"tagName": "@packageDocumentation",
"syntaxKind": "modifier"
},
{
"tagName": "@param",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@privateRemarks",
"syntaxKind": "block"
},
{
"tagName": "@public",
"syntaxKind": "modifier"
},
{
"tagName": "@readonly",
"syntaxKind": "modifier"
},
{
"tagName": "@remarks",
"syntaxKind": "block"
},
{
"tagName": "@returns",
"syntaxKind": "block"
},
{
"tagName": "@sealed",
"syntaxKind": "modifier"
},
{
"tagName": "@see",
"syntaxKind": "block"
},
{
"tagName": "@throws",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@typeParam",
"syntaxKind": "block",
"allowMultiple": true
},
{
"tagName": "@virtual",
"syntaxKind": "modifier"
},
{
"tagName": "@betaDocumentation",
"syntaxKind": "modifier"
},
{
"tagName": "@internalRemarks",
"syntaxKind": "block"
},
{
"tagName": "@preapproved",
"syntaxKind": "modifier"
}
],
"supportForTags": {
"@alpha": true,
"@beta": true,
"@defaultValue": true,
"@decorator": true,
"@deprecated": true,
"@eventProperty": true,
"@example": true,
"@experimental": true,
"@inheritDoc": true,
"@internal": true,
"@label": true,
"@link": true,
"@override": true,
"@packageDocumentation": true,
"@param": true,
"@privateRemarks": true,
"@public": true,
"@readonly": true,
"@remarks": true,
"@returns": true,
"@sealed": true,
"@see": true,
"@throws": true,
"@typeParam": true,
"@virtual": true,
"@betaDocumentation": true,
"@internalRemarks": true,
"@preapproved": true
},
"reportUnsupportedHtmlElements": false
}
},
"kind": "Package",
"canonicalReference": "@tldraw/store!",
"docComment": "",
"name": "@tldraw/store",
"preserveMemberOrder": false,
"members": [
{
"kind": "EntryPoint",
"canonicalReference": "@tldraw/store!",
"name": "",
"preserveMemberOrder": false,
"members": [
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!AllRecords:type",
"docComment": "/**\n * Get the type of all records in a record store.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type AllRecords<T extends "
},
{
"kind": "Reference",
"text": "Store",
"canonicalReference": "@tldraw/store!Store:class"
},
{
"kind": "Content",
"text": "<any>"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Reference",
"text": "ExtractR",
"canonicalReference": "@tldraw/store!~ExtractR:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "ExtractRecordType",
"canonicalReference": "@tldraw/store!~ExtractRecordType:type"
},
{
"kind": "Content",
"text": "<T>>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/type-utils.ts",
"releaseTag": "Public",
"name": "AllRecords",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 4,
"endIndex": 8
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!assertIdType:function(1)",
"docComment": "/**\n * Assert whether an id correspond to a record type.\n *\n * @param id - The id to check.\n *\n * @param type - The type of the record.\n *\n * @example\n * ```ts\n * assertIdType(myId, \"shape\")\n * ```\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function assertIdType<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ">(id: "
},
{
"kind": "Content",
"text": "string | undefined"
},
{
"kind": "Content",
"text": ", type: "
},
{
"kind": "Reference",
"text": "RecordType",
"canonicalReference": "@tldraw/store!RecordType:class"
},
{
"kind": "Content",
"text": "<R, any>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "asserts "
},
{
"kind": "Reference",
"text": "id",
"canonicalReference": "@tldraw/store!~id"
},
{
"kind": "Content",
"text": " is "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/RecordType.ts",
"returnTypeTokenRange": {
"startIndex": 8,
"endIndex": 13
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "id",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "type",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "assertIdType"
},
{
"kind": "Interface",
"canonicalReference": "@tldraw/store!BaseRecord:interface",
"docComment": "/**\n * The base record that all records must extend.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface BaseRecord<TypeName extends "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ", Id extends "
},
{
"kind": "Reference",
"text": "RecordId",
"canonicalReference": "@tldraw/store!RecordId:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": "> "
}
],
"fileUrlPath": "packages/store/src/lib/BaseRecord.ts",
"releaseTag": "Public",
"typeParameters": [
{
"typeParameterName": "TypeName",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "Id",
"constraintTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "BaseRecord",
"preserveMemberOrder": false,
"members": [
{
"kind": "PropertySignature",
"canonicalReference": "@tldraw/store!BaseRecord#id:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly id: "
},
{
"kind": "Content",
"text": "Id"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "id",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "PropertySignature",
"canonicalReference": "@tldraw/store!BaseRecord#typeName:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly typeName: "
},
{
"kind": "Content",
"text": "TypeName"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "typeName",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
],
"extendsTokenRanges": []
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!CollectionDiff:type",
"docComment": "/**\n * A diff describing the changes to a collection.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type CollectionDiff<T> = "
},
{
"kind": "Content",
"text": "{\n added?: "
},
{
"kind": "Reference",
"text": "Set",
"canonicalReference": "!Set:interface"
},
{
"kind": "Content",
"text": "<T>;\n removed?: "
},
{
"kind": "Reference",
"text": "Set",
"canonicalReference": "!Set:interface"
},
{
"kind": "Content",
"text": "<T>;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "CollectionDiff",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 6
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!compareRecordVersions:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function compareRecordVersions(a: "
},
{
"kind": "Reference",
"text": "RecordVersion",
"canonicalReference": "@tldraw/store!RecordVersion:type"
},
{
"kind": "Content",
"text": ", b: "
},
{
"kind": "Reference",
"text": "RecordVersion",
"canonicalReference": "@tldraw/store!RecordVersion:type"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "-1 | 0 | 1"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "a",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "b",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"name": "compareRecordVersions"
},
{
"kind": "Variable",
"canonicalReference": "@tldraw/store!compareSchemas:var",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "compareSchemas: "
},
{
"kind": "Content",
"text": "(a: "
},
{
"kind": "Reference",
"text": "SerializedSchema",
"canonicalReference": "@tldraw/store!SerializedSchema:interface"
},
{
"kind": "Content",
"text": ", b: "
},
{
"kind": "Reference",
"text": "SerializedSchema",
"canonicalReference": "@tldraw/store!SerializedSchema:interface"
},
{
"kind": "Content",
"text": ") => -1 | 0 | 1"
}
],
"fileUrlPath": "packages/store/src/lib/compareSchemas.ts",
"isReadonly": true,
"releaseTag": "Public",
"name": "compareSchemas",
"variableTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!ComputedCache:type",
"docComment": "/**\n * A record store is a collection of records of different types.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type ComputedCache<Data, R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "{\n get(id: "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>): Data | undefined;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "ComputedCache",
"typeParameters": [
{
"typeParameterName": "Data",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 6
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!createRecordType:function(1)",
"docComment": "/**\n * Create a record type.\n *\n * @param typeName - The name of the type to create.\n *\n * @example\n * ```ts\n * const Book = createRecordType<Book>('book')\n * ```\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function createRecordType<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ">(typeName: "
},
{
"kind": "Content",
"text": "R['typeName']"
},
{
"kind": "Content",
"text": ", config: "
},
{
"kind": "Content",
"text": "{\n migrations?: "
},
{
"kind": "Reference",
"text": "Migrations",
"canonicalReference": "@tldraw/store!Migrations:interface"
},
{
"kind": "Content",
"text": ";\n validator?: "
},
{
"kind": "Reference",
"text": "StoreValidator",
"canonicalReference": "@tldraw/store!StoreValidator:type"
},
{
"kind": "Content",
"text": "<R>;\n scope: "
},
{
"kind": "Reference",
"text": "RecordScope",
"canonicalReference": "@tldraw/store!~RecordScope:type"
},
{
"kind": "Content",
"text": ";\n}"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "RecordType",
"canonicalReference": "@tldraw/store!RecordType:class"
},
{
"kind": "Content",
"text": "<R, keyof "
},
{
"kind": "Reference",
"text": "Omit",
"canonicalReference": "!Omit:type"
},
{
"kind": "Content",
"text": "<R, 'id' | 'typeName'>>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/RecordType.ts",
"returnTypeTokenRange": {
"startIndex": 13,
"endIndex": 17
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "typeName",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "config",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 12
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "createRecordType"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!defineMigrations:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function defineMigrations<FirstVersion extends "
},
{
"kind": "Reference",
"text": "EMPTY_SYMBOL",
"canonicalReference": "@tldraw/store!~EMPTY_SYMBOL:type"
},
{
"kind": "Content",
"text": " | number"
},
{
"kind": "Content",
"text": " = "
},
{
"kind": "Reference",
"text": "EMPTY_SYMBOL",
"canonicalReference": "@tldraw/store!~EMPTY_SYMBOL:type"
},
{
"kind": "Content",
"text": ", CurrentVersion extends "
},
{
"kind": "Reference",
"text": "EMPTY_SYMBOL",
"canonicalReference": "@tldraw/store!~EMPTY_SYMBOL:type"
},
{
"kind": "Content",
"text": " | "
},
{
"kind": "Reference",
"text": "Exclude",
"canonicalReference": "!Exclude:type"
},
{
"kind": "Content",
"text": "<number, 0>"
},
{
"kind": "Content",
"text": " = "
},
{
"kind": "Reference",
"text": "EMPTY_SYMBOL",
"canonicalReference": "@tldraw/store!~EMPTY_SYMBOL:type"
},
{
"kind": "Content",
"text": ">(opts: "
},
{
"kind": "Content",
"text": "{\n firstVersion?: CurrentVersion extends number ? FirstVersion : never;\n currentVersion?: CurrentVersion;\n migrators?: CurrentVersion extends number ? FirstVersion extends number ? CurrentVersion extends FirstVersion ? {\n [version in "
},
{
"kind": "Reference",
"text": "Exclude",
"canonicalReference": "!Exclude:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "Range",
"canonicalReference": "@tldraw/store!~Range_2:type"
},
{
"kind": "Content",
"text": "<1, CurrentVersion>, 0>]: "
},
{
"kind": "Reference",
"text": "Migration",
"canonicalReference": "@tldraw/store!Migration:type"
},
{
"kind": "Content",
"text": ";\n } : {\n [version in "
},
{
"kind": "Reference",
"text": "Exclude",
"canonicalReference": "!Exclude:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "Range",
"canonicalReference": "@tldraw/store!~Range_2:type"
},
{
"kind": "Content",
"text": "<FirstVersion, CurrentVersion>, FirstVersion>]: "
},
{
"kind": "Reference",
"text": "Migration",
"canonicalReference": "@tldraw/store!Migration:type"
},
{
"kind": "Content",
"text": ";\n } : {\n [version in "
},
{
"kind": "Reference",
"text": "Exclude",
"canonicalReference": "!Exclude:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "Range",
"canonicalReference": "@tldraw/store!~Range_2:type"
},
{
"kind": "Content",
"text": "<1, CurrentVersion>, 0>]: "
},
{
"kind": "Reference",
"text": "Migration",
"canonicalReference": "@tldraw/store!Migration:type"
},
{
"kind": "Content",
"text": ";\n } : never;\n subTypeKey?: string;\n subTypeMigrations?: "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<string, "
},
{
"kind": "Reference",
"text": "BaseMigrationsInfo",
"canonicalReference": "@tldraw/store!~BaseMigrationsInfo:interface"
},
{
"kind": "Content",
"text": ">;\n}"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "Migrations",
"canonicalReference": "@tldraw/store!Migrations:interface"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"returnTypeTokenRange": {
"startIndex": 37,
"endIndex": 38
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "opts",
"parameterTypeTokenRange": {
"startIndex": 13,
"endIndex": 36
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "FirstVersion",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"defaultTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
}
},
{
"typeParameterName": "CurrentVersion",
"constraintTokenRange": {
"startIndex": 6,
"endIndex": 10
},
"defaultTypeTokenRange": {
"startIndex": 11,
"endIndex": 12
}
}
],
"name": "defineMigrations"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!devFreeze:function(1)",
"docComment": "/**\n * Freeze an object when in development mode. Copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze\n *\n * @param object - The object to freeze.\n *\n * @returns The frozen object when in development mode, or else the object when in other modes.\n *\n * @example\n * ```ts\n * const frozen = devFreeze({ a: 1 })\n * ```\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function devFreeze<T>(object: "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "T"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/devFreeze.ts",
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "object",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "devFreeze"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!getRecordVersion:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function getRecordVersion(record: "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ", serializedSchema: "
},
{
"kind": "Reference",
"text": "SerializedSchema",
"canonicalReference": "@tldraw/store!SerializedSchema:interface"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "RecordVersion",
"canonicalReference": "@tldraw/store!RecordVersion:type"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "record",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "serializedSchema",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
}
],
"name": "getRecordVersion"
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!HistoryEntry:type",
"docComment": "/**\n * An entry containing changes that originated either by user actions or remote changes.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type HistoryEntry<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": " = "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "{\n changes: "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<R>;\n source: "
},
{
"kind": "Reference",
"text": "ChangeSource",
"canonicalReference": "@tldraw/store!~ChangeSource:type"
},
{
"kind": "Content",
"text": ";\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "HistoryEntry",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
}
],
"typeTokenRange": {
"startIndex": 5,
"endIndex": 10
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!IdOf:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type IdOf<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "R['id']"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/BaseRecord.ts",
"releaseTag": "Public",
"name": "IdOf",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!migrate:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function migrate<T>({ value, migrations, fromVersion, toVersion, }: "
},
{
"kind": "Content",
"text": "{\n value: unknown;\n migrations: "
},
{
"kind": "Reference",
"text": "Migrations",
"canonicalReference": "@tldraw/store!Migrations:interface"
},
{
"kind": "Content",
"text": ";\n fromVersion: number;\n toVersion: number;\n}"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "MigrationResult",
"canonicalReference": "@tldraw/store!MigrationResult:type"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"returnTypeTokenRange": {
"startIndex": 5,
"endIndex": 7
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "{ value, migrations, fromVersion, toVersion, }",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "migrate"
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!migrateRecord:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function migrateRecord<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ">({ record, migrations, fromVersion, toVersion, }: "
},
{
"kind": "Content",
"text": "{\n record: unknown;\n migrations: "
},
{
"kind": "Reference",
"text": "Migrations",
"canonicalReference": "@tldraw/store!Migrations:interface"
},
{
"kind": "Content",
"text": ";\n fromVersion: number;\n toVersion: number;\n}"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "MigrationResult",
"canonicalReference": "@tldraw/store!MigrationResult:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 9
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "{ record, migrations, fromVersion, toVersion, }",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 6
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "migrateRecord"
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!Migration:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type Migration<Before = "
},
{
"kind": "Content",
"text": "any"
},
{
"kind": "Content",
"text": ", After = "
},
{
"kind": "Content",
"text": "any"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "{\n up: (oldState: Before) => After;\n down: (newState: After) => Before;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"releaseTag": "Public",
"name": "Migration",
"typeParameters": [
{
"typeParameterName": "Before",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"typeParameterName": "After",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
}
],
"typeTokenRange": {
"startIndex": 5,
"endIndex": 6
}
},
{
"kind": "Enum",
"canonicalReference": "@tldraw/store!MigrationFailureReason:enum",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare enum MigrationFailureReason "
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"releaseTag": "Public",
"name": "MigrationFailureReason",
"preserveMemberOrder": false,
"members": [
{
"kind": "EnumMember",
"canonicalReference": "@tldraw/store!MigrationFailureReason.IncompatibleSubtype:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "IncompatibleSubtype = "
},
{
"kind": "Content",
"text": "\"incompatible-subtype\""
}
],
"initializerTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"name": "IncompatibleSubtype"
},
{
"kind": "EnumMember",
"canonicalReference": "@tldraw/store!MigrationFailureReason.MigrationError:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "MigrationError = "
},
{
"kind": "Content",
"text": "\"migration-error\""
}
],
"initializerTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"name": "MigrationError"
},
{
"kind": "EnumMember",
"canonicalReference": "@tldraw/store!MigrationFailureReason.TargetVersionTooNew:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "TargetVersionTooNew = "
},
{
"kind": "Content",
"text": "\"target-version-too-new\""
}
],
"initializerTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"name": "TargetVersionTooNew"
},
{
"kind": "EnumMember",
"canonicalReference": "@tldraw/store!MigrationFailureReason.TargetVersionTooOld:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "TargetVersionTooOld = "
},
{
"kind": "Content",
"text": "\"target-version-too-old\""
}
],
"initializerTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"name": "TargetVersionTooOld"
},
{
"kind": "EnumMember",
"canonicalReference": "@tldraw/store!MigrationFailureReason.UnknownType:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "UnknownType = "
},
{
"kind": "Content",
"text": "\"unknown-type\""
}
],
"initializerTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"name": "UnknownType"
},
{
"kind": "EnumMember",
"canonicalReference": "@tldraw/store!MigrationFailureReason.UnrecognizedSubtype:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "UnrecognizedSubtype = "
},
{
"kind": "Content",
"text": "\"unrecognized-subtype\""
}
],
"initializerTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"name": "UnrecognizedSubtype"
}
]
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!MigrationResult:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type MigrationResult<T> = "
},
{
"kind": "Content",
"text": "{\n type: 'error';\n reason: "
},
{
"kind": "Reference",
"text": "MigrationFailureReason",
"canonicalReference": "@tldraw/store!MigrationFailureReason:enum"
},
{
"kind": "Content",
"text": ";\n} | {\n type: 'success';\n value: T;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"releaseTag": "Public",
"name": "MigrationResult",
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 1,
"endIndex": 4
}
},
{
"kind": "Interface",
"canonicalReference": "@tldraw/store!Migrations:interface",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface Migrations extends "
},
{
"kind": "Reference",
"text": "BaseMigrationsInfo",
"canonicalReference": "@tldraw/store!~BaseMigrationsInfo:interface"
},
{
"kind": "Content",
"text": " "
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"releaseTag": "Public",
"name": "Migrations",
"preserveMemberOrder": false,
"members": [
{
"kind": "PropertySignature",
"canonicalReference": "@tldraw/store!Migrations#subTypeKey:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "subTypeKey?: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "subTypeKey",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "PropertySignature",
"canonicalReference": "@tldraw/store!Migrations#subTypeMigrations:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "subTypeMigrations?: "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<string, "
},
{
"kind": "Reference",
"text": "BaseMigrationsInfo",
"canonicalReference": "@tldraw/store!~BaseMigrationsInfo:interface"
},
{
"kind": "Content",
"text": ">"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "subTypeMigrations",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 5
}
}
],
"extendsTokenRanges": [
{
"startIndex": 1,
"endIndex": 2
}
]
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!RecordId:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type RecordId<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "string & {\n __type__: R;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/BaseRecord.ts",
"releaseTag": "Public",
"name": "RecordId",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!RecordsDiff:type",
"docComment": "/**\n * A diff describing the changes to a record.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type RecordsDiff<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "{\n added: "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>, R>;\n updated: "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>, [from: R, to: R]>;\n removed: "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>, R>;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "RecordsDiff",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 16
}
},
{
"kind": "Class",
"canonicalReference": "@tldraw/store!RecordType:class",
"docComment": "/**\n * A record type is a type that can be stored in a record store. It is created with `createRecordType`.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare class RecordType<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ", RequiredProperties extends "
},
{
"kind": "Content",
"text": "keyof "
},
{
"kind": "Reference",
"text": "Omit",
"canonicalReference": "!Omit:type"
},
{
"kind": "Content",
"text": "<R, 'id' | 'typeName'>"
},
{
"kind": "Content",
"text": "> "
}
],
"fileUrlPath": "packages/store/src/lib/RecordType.ts",
"releaseTag": "Public",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "RequiredProperties",
"constraintTokenRange": {
"startIndex": 3,
"endIndex": 6
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"isAbstract": false,
"name": "RecordType",
"preserveMemberOrder": false,
"members": [
{
"kind": "Constructor",
"canonicalReference": "@tldraw/store!RecordType:constructor(1)",
"docComment": "/**\n * Constructs a new instance of the `RecordType` class\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "constructor(\n typeName: "
},
{
"kind": "Content",
"text": "R['typeName']"
},
{
"kind": "Content",
"text": ", config: "
},
{
"kind": "Content",
"text": "{\n readonly createDefaultProperties: () => "
},
{
"kind": "Reference",
"text": "Exclude",
"canonicalReference": "!Exclude:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "OmitMeta",
"canonicalReference": "@tldraw/store!~OmitMeta:type"
},
{
"kind": "Content",
"text": "<R>, RequiredProperties>;\n readonly migrations: "
},
{
"kind": "Reference",
"text": "Migrations",
"canonicalReference": "@tldraw/store!Migrations:interface"
},
{
"kind": "Content",
"text": ";\n readonly validator?: {\n validate: (r: unknown) => R;\n } | "
},
{
"kind": "Reference",
"text": "StoreValidator",
"canonicalReference": "@tldraw/store!StoreValidator:type"
},
{
"kind": "Content",
"text": "<R>;\n readonly scope?: "
},
{
"kind": "Reference",
"text": "RecordScope",
"canonicalReference": "@tldraw/store!~RecordScope:type"
},
{
"kind": "Content",
"text": ";\n }"
},
{
"kind": "Content",
"text": ");"
}
],
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "typeName",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "config",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 14
},
"isOptional": false
}
]
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#clone:member(1)",
"docComment": "/**\n * Clone a record of this type.\n *\n * @param record - The record to clone.\n *\n * @returns The cloned record.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "clone(record: "
},
{
"kind": "Content",
"text": "R"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "R"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "record",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "clone"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#create:member(1)",
"docComment": "/**\n * Create a new record of this type.\n *\n * @param properties - The properties of the record.\n *\n * @returns The new record.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "create(properties: "
},
{
"kind": "Reference",
"text": "Pick",
"canonicalReference": "!Pick:type"
},
{
"kind": "Content",
"text": "<R, RequiredProperties> & "
},
{
"kind": "Reference",
"text": "Omit",
"canonicalReference": "!Omit:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "Partial",
"canonicalReference": "!Partial:type"
},
{
"kind": "Content",
"text": "<R>, RequiredProperties>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "R"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 8,
"endIndex": 9
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "properties",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 7
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "create"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#createCustomId:member(1)",
"docComment": "/**\n * Create a new ID for this record type based on the given ID.\n *\n * @deprecated\n *\n * - Use `createId` instead.\n *\n * @param id - The ID to base the new ID on.\n *\n * @returns The new ID.\n *\n * @example\n * ```ts\n * const id = recordType.createCustomId('myId')\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "createCustomId(id: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "id",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "createCustomId"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!RecordType#createDefaultProperties:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly createDefaultProperties: "
},
{
"kind": "Content",
"text": "() => "
},
{
"kind": "Reference",
"text": "Exclude",
"canonicalReference": "!Exclude:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "OmitMeta",
"canonicalReference": "@tldraw/store!~OmitMeta:type"
},
{
"kind": "Content",
"text": "<R>, RequiredProperties>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "createDefaultProperties",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#createId:member(1)",
"docComment": "/**\n * Create a new ID for this record type.\n *\n * @returns The new ID.\n *\n * @example\n * ```ts\n * const id = recordType.createId()\n * ```\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "createId(customUniquePart?: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "customUniquePart",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "createId"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#isId:member(1)",
"docComment": "/**\n * Check whether an id is an id of this type.\n *\n * @param id - The id to check.\n *\n * @returns Whether the id is an id of this type.\n *\n * @example\n * ```ts\n * const result = recordType.isIn('someId')\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "isId(id?: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "id",
"canonicalReference": "@tldraw/store!~id"
},
{
"kind": "Content",
"text": " is "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 7
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "id",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "isId"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!RecordType#isInstance:member",
"docComment": "/**\n * Check whether a record is an instance of this record type.\n *\n * @param record - The record to check.\n *\n * @returns Whether the record is an instance of this record type.\n *\n * @example\n * ```ts\n * const result = recordType.isInstance(someRecord)\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "isInstance: "
},
{
"kind": "Content",
"text": "(record?: "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ") => "
},
{
"kind": "Reference",
"text": "record",
"canonicalReference": "@tldraw/store!~record"
},
{
"kind": "Content",
"text": " is R"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "isInstance",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!RecordType#migrations:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly migrations: "
},
{
"kind": "Reference",
"text": "Migrations",
"canonicalReference": "@tldraw/store!Migrations:interface"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "migrations",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#parseId:member(1)",
"docComment": "/**\n * Takes an id like `user:123` and returns the part after the colon `123`\n *\n * @param id - The id\n *\n * @returns \n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "parseId(id: "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "id",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "parseId"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!RecordType#scope:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly scope: "
},
{
"kind": "Reference",
"text": "RecordScope",
"canonicalReference": "@tldraw/store!~RecordScope:type"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "scope",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!RecordType#typeName:member",
"docComment": "/**\n * The unique type associated with this record.\n *\n * @public @readonly\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly typeName: "
},
{
"kind": "Content",
"text": "R['typeName']"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "typeName",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#validate:member(1)",
"docComment": "/**\n * Check that the passed in record passes the validations for this type. Returns its input correctly typed if it does, but throws an error otherwise.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "validate(record: "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "R"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "record",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "validate"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!RecordType#validator:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly validator: "
},
{
"kind": "Content",
"text": "{\n validate: (r: unknown) => R;\n } | "
},
{
"kind": "Reference",
"text": "StoreValidator",
"canonicalReference": "@tldraw/store!StoreValidator:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "validator",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!RecordType#withDefaultProperties:member(1)",
"docComment": "/**\n * Create a new RecordType that has the same type name as this RecordType and includes the given default properties.\n *\n * @param fn - A function that returns the default properties of the new RecordType.\n *\n * @returns The new RecordType.\n *\n * @example\n * ```ts\n * const authorType = createRecordType('author', () => ({ living: true }))\n * const deadAuthorType = authorType.withDefaultProperties({ living: false })\n * ```\n *\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "withDefaultProperties<DefaultProps extends "
},
{
"kind": "Reference",
"text": "Omit",
"canonicalReference": "!Omit:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "Partial",
"canonicalReference": "!Partial:type"
},
{
"kind": "Content",
"text": "<R>, 'id' | 'typeName'>"
},
{
"kind": "Content",
"text": ">(createDefaultProperties: "
},
{
"kind": "Content",
"text": "() => DefaultProps"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "RecordType",
"canonicalReference": "@tldraw/store!RecordType:class"
},
{
"kind": "Content",
"text": "<R, "
},
{
"kind": "Reference",
"text": "Exclude",
"canonicalReference": "!Exclude:type"
},
{
"kind": "Content",
"text": "<RequiredProperties, keyof DefaultProps>>"
},
{
"kind": "Content",
"text": ";"
}
],
"typeParameters": [
{
"typeParameterName": "DefaultProps",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 5
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 8,
"endIndex": 12
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "createDefaultProperties",
"parameterTypeTokenRange": {
"startIndex": 6,
"endIndex": 7
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "withDefaultProperties"
}
],
"implementsTokenRanges": []
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!RecordVersion:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type RecordVersion = "
},
{
"kind": "Content",
"text": "{\n rootVersion: number;\n subTypeVersion?: number;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/migrate.ts",
"releaseTag": "Public",
"name": "RecordVersion",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!reverseRecordsDiff:function(1)",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function reverseRecordsDiff(diff: "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<any>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<any>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"returnTypeTokenRange": {
"startIndex": 4,
"endIndex": 6
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "diff",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
}
],
"name": "reverseRecordsDiff"
},
{
"kind": "Interface",
"canonicalReference": "@tldraw/store!SerializedSchema:interface",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export interface SerializedSchema "
}
],
"fileUrlPath": "packages/store/src/lib/StoreSchema.ts",
"releaseTag": "Public",
"name": "SerializedSchema",
"preserveMemberOrder": false,
"members": [
{
"kind": "PropertySignature",
"canonicalReference": "@tldraw/store!SerializedSchema#recordVersions:member",
"docComment": "/**\n * Record versions are the versions for each record type. e.g. adding a new field to a record\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "recordVersions: "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<string, {\n version: number;\n subTypeVersions: "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<string, number>;\n subTypeKey: string;\n } | {\n version: number;\n }>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "recordVersions",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 5
}
},
{
"kind": "PropertySignature",
"canonicalReference": "@tldraw/store!SerializedSchema#schemaVersion:member",
"docComment": "/**\n * Schema version is the version for this type you're looking at right now\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "schemaVersion: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "schemaVersion",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
},
{
"kind": "PropertySignature",
"canonicalReference": "@tldraw/store!SerializedSchema#storeVersion:member",
"docComment": "/**\n * Store version is the version for the structure of the store. e.g. higher level structure like removing or renaming a record type.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "storeVersion: "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "storeVersion",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
}
}
],
"extendsTokenRanges": []
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!SerializedStore:type",
"docComment": "/**\n * A serialized snapshot of the record store's values.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type SerializedStore<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Reference",
"text": "Record",
"canonicalReference": "!Record:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>, R>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "SerializedStore",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 7
}
},
{
"kind": "Function",
"canonicalReference": "@tldraw/store!squashRecordDiffs:function(1)",
"docComment": "/**\n * Squash a collection of diffs into a single diff.\n *\n * @param diffs - An array of diffs to squash.\n *\n * @returns A single diff that represents the squashed diffs.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare function squashRecordDiffs<T extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ">(diffs: "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<T>[]"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<T>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 8
},
"releaseTag": "Public",
"overloadIndex": 1,
"parameters": [
{
"parameterName": "diffs",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"isOptional": false
}
],
"typeParameters": [
{
"typeParameterName": "T",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"name": "squashRecordDiffs"
},
{
"kind": "Class",
"canonicalReference": "@tldraw/store!Store:class",
"docComment": "/**\n * A store of records.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare class Store<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": " = "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ", Props = "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": "> "
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
},
{
"typeParameterName": "Props",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
}
}
],
"isAbstract": false,
"name": "Store",
"preserveMemberOrder": false,
"members": [
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#_flushHistory:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "_flushHistory(): "
},
{
"kind": "Content",
"text": "void"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [],
"isOptional": false,
"isAbstract": false,
"name": "_flushHistory"
},
{
"kind": "Constructor",
"canonicalReference": "@tldraw/store!Store:constructor(1)",
"docComment": "/**\n * Constructs a new instance of the `Store` class\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "constructor(config: "
},
{
"kind": "Content",
"text": "{\n initialData?: "
},
{
"kind": "Reference",
"text": "SerializedStore",
"canonicalReference": "@tldraw/store!SerializedStore:type"
},
{
"kind": "Content",
"text": "<R>;\n schema: "
},
{
"kind": "Reference",
"text": "StoreSchema",
"canonicalReference": "@tldraw/store!StoreSchema:class"
},
{
"kind": "Content",
"text": "<R, Props>;\n props: Props;\n }"
},
{
"kind": "Content",
"text": ");"
}
],
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "config",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
},
"isOptional": false
}
]
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#allRecords:member",
"docComment": "/**\n * Get an array of all values in the store.\n *\n * @returns An array of all values in the store.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "allRecords: "
},
{
"kind": "Content",
"text": "() => R[]"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "allRecords",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#applyDiff:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "applyDiff(diff: "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ", runCallbacks?: "
},
{
"kind": "Content",
"text": "boolean"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "void"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 7
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "diff",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
},
{
"parameterName": "runCallbacks",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "applyDiff"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#clear:member",
"docComment": "/**\n * Removes all records from the store.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "clear: "
},
{
"kind": "Content",
"text": "() => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "clear",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#createComputedCache:member",
"docComment": "/**\n * Create a computed cache.\n *\n * @param name - The name of the derivation cache.\n *\n * @param derive - A function used to derive the value of the cache.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "createComputedCache: "
},
{
"kind": "Content",
"text": "<T, V extends R = R>(name: string, derive: (record: V) => T | undefined, isEqual?: ((a: V, b: V) => boolean) | undefined) => "
},
{
"kind": "Reference",
"text": "ComputedCache",
"canonicalReference": "@tldraw/store!ComputedCache:type"
},
{
"kind": "Content",
"text": "<T, V>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "createComputedCache",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#createSelectedComputedCache:member",
"docComment": "/**\n * Create a computed cache from a selector\n *\n * @param name - The name of the derivation cache.\n *\n * @param selector - A function that returns a subset of the original shape\n *\n * @param derive - A function used to derive the value of the cache.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "createSelectedComputedCache: "
},
{
"kind": "Content",
"text": "<T, J, V extends R = R>(name: string, selector: (record: V) => T | undefined, derive: (input: T) => J | undefined) => "
},
{
"kind": "Reference",
"text": "ComputedCache",
"canonicalReference": "@tldraw/store!ComputedCache:type"
},
{
"kind": "Content",
"text": "<J, V>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "createSelectedComputedCache",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#extractingChanges:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "extractingChanges(fn: "
},
{
"kind": "Content",
"text": "() => void"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "fn",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "extractingChanges"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#filterChangesByScope:member(1)",
"docComment": "/**\n * Filters out non-document changes from a diff. Returns null if there are no changes left.\n *\n * @param change - the records diff\n *\n * @returns \n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "filterChangesByScope(change: "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ", scope: "
},
{
"kind": "Reference",
"text": "RecordScope",
"canonicalReference": "@tldraw/store!~RecordScope:type"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "{\n added: { [K in "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>]: R; };\n updated: { [K_1 in "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>]: [from: R, to: R]; };\n removed: { [K in "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>]: R; };\n } | null"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 6,
"endIndex": 13
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "change",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
},
{
"parameterName": "scope",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "filterChangesByScope"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#get:member",
"docComment": "/**\n * Get the value of a store record by its id.\n *\n * @param id - The id of the record to get.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "get: "
},
{
"kind": "Content",
"text": "<K extends "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>>(id: K) => "
},
{
"kind": "Reference",
"text": "RecFromId",
"canonicalReference": "@tldraw/store!~RecFromId:type"
},
{
"kind": "Content",
"text": "<K> | undefined"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "get",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#getRecordType:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "getRecordType: "
},
{
"kind": "Content",
"text": "<T extends R>(record: R) => T"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "getRecordType",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#getSnapshot:member(1)",
"docComment": "/**\n * Get a serialized snapshot of the store and its schema.\n * ```ts\n * const snapshot = store.getSnapshot()\n * store.loadSnapshot(snapshot)\n * ```\n *\n * @param scope - The scope of records to serialize. Defaults to 'document'.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "getSnapshot(scope?: "
},
{
"kind": "Content",
"text": "'all' | "
},
{
"kind": "Reference",
"text": "RecordScope",
"canonicalReference": "@tldraw/store!~RecordScope:type"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "StoreSnapshot",
"canonicalReference": "@tldraw/store!StoreSnapshot:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 4,
"endIndex": 6
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "scope",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "getSnapshot"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#has:member",
"docComment": "/**\n * Get whether the record store has a id.\n *\n * @param id - The id of the record to check.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "has: "
},
{
"kind": "Content",
"text": "<K extends "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>>(id: K) => boolean"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "has",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#history:member",
"docComment": "/**\n * An atom containing the store's history.\n *\n * @public @readonly\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly history: "
},
{
"kind": "Reference",
"text": "Atom",
"canonicalReference": "@tldraw/state!Atom:interface"
},
{
"kind": "Content",
"text": "<number, "
},
{
"kind": "Reference",
"text": "RecordsDiff",
"canonicalReference": "@tldraw/store!RecordsDiff:type"
},
{
"kind": "Content",
"text": "<R>>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "history",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 5
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#id:member",
"docComment": "/**\n * The random id of the store.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly id: "
},
{
"kind": "Content",
"text": "string"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "id",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#listen:member",
"docComment": "/**\n * Add a new listener to the store.\n *\n * @param onHistory - The listener to call when the store updates.\n *\n * @param filters - Filters to apply to the listener.\n *\n * @returns A function to remove the listener.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "listen: "
},
{
"kind": "Content",
"text": "(onHistory: "
},
{
"kind": "Reference",
"text": "StoreListener",
"canonicalReference": "@tldraw/store!StoreListener:type"
},
{
"kind": "Content",
"text": "<R>, filters?: "
},
{
"kind": "Reference",
"text": "Partial",
"canonicalReference": "!Partial:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "StoreListenerFilters",
"canonicalReference": "@tldraw/store!~StoreListenerFilters:type"
},
{
"kind": "Content",
"text": ">) => () => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "listen",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 8
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#loadSnapshot:member(1)",
"docComment": "/**\n * Load a serialized snapshot.\n * ```ts\n * const snapshot = store.getSnapshot()\n * store.loadSnapshot(snapshot)\n * ```\n *\n * @param snapshot - The snapshot to load.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "loadSnapshot(snapshot: "
},
{
"kind": "Reference",
"text": "StoreSnapshot",
"canonicalReference": "@tldraw/store!StoreSnapshot:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "void"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "snapshot",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "loadSnapshot"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#mergeRemoteChanges:member",
"docComment": "/**\n * Merge changes from a remote source without triggering listeners.\n *\n * @param fn - A function that merges the external changes.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "mergeRemoteChanges: "
},
{
"kind": "Content",
"text": "(fn: () => void) => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "mergeRemoteChanges",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#migrateSnapshot:member(1)",
"docComment": "/**\n * Migrate a serialized snapshot of the store and its schema.\n * ```ts\n * const snapshot = store.getSnapshot()\n * store.migrateSnapshot(snapshot)\n * ```\n *\n * @param snapshot - The snapshot to load.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "migrateSnapshot(snapshot: "
},
{
"kind": "Reference",
"text": "StoreSnapshot",
"canonicalReference": "@tldraw/store!StoreSnapshot:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "StoreSnapshot",
"canonicalReference": "@tldraw/store!StoreSnapshot:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 4,
"endIndex": 6
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "snapshot",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "migrateSnapshot"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#onAfterChange:member",
"docComment": "/**\n * A callback fired after each record's change.\n *\n * @param prev - The previous value, if any.\n *\n * @param next - The next value.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "onAfterChange?: "
},
{
"kind": "Content",
"text": "(prev: R, next: R, source: 'remote' | 'user') => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "onAfterChange",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#onAfterCreate:member",
"docComment": "/**\n * A callback fired after a record is created. Use this to perform related updates to other records in the store.\n *\n * @param record - The record to be created\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "onAfterCreate?: "
},
{
"kind": "Content",
"text": "(record: R, source: 'remote' | 'user') => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "onAfterCreate",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#onAfterDelete:member",
"docComment": "/**\n * A callback fired after a record is deleted.\n *\n * @param prev - The record that will be deleted.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "onAfterDelete?: "
},
{
"kind": "Content",
"text": "(prev: R, source: 'remote' | 'user') => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "onAfterDelete",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#onBeforeChange:member",
"docComment": "/**\n * A callback before after each record's change.\n *\n * @param prev - The previous value, if any.\n *\n * @param next - The next value.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "onBeforeChange?: "
},
{
"kind": "Content",
"text": "(prev: R, next: R, source: 'remote' | 'user') => R"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "onBeforeChange",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#onBeforeCreate:member",
"docComment": "/**\n * A callback fired after each record's change.\n *\n * @param prev - The previous value, if any.\n *\n * @param next - The next value.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "onBeforeCreate?: "
},
{
"kind": "Content",
"text": "(next: R, source: 'remote' | 'user') => R"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "onBeforeCreate",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#onBeforeDelete:member",
"docComment": "/**\n * A callback fired before a record is deleted.\n *\n * @param prev - The record that will be deleted.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "onBeforeDelete?: "
},
{
"kind": "Content",
"text": "(prev: R, source: 'remote' | 'user') => false | void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": true,
"releaseTag": "Public",
"name": "onBeforeDelete",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#props:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly props: "
},
{
"kind": "Content",
"text": "Props"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "props",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#put:member",
"docComment": "/**\n * Add some records to the store. It's an error if they already exist.\n *\n * @param records - The records to add.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "put: "
},
{
"kind": "Content",
"text": "(records: R[], phaseOverride?: 'initialize') => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "put",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#query:member",
"docComment": "/**\n * A StoreQueries instance for this store.\n *\n * @public @readonly\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly query: "
},
{
"kind": "Reference",
"text": "StoreQueries",
"canonicalReference": "@tldraw/store!~StoreQueries:class"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "query",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#remove:member",
"docComment": "/**\n * Remove some records from the store via their ids.\n *\n * @param ids - The ids of the records to remove.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "remove: "
},
{
"kind": "Content",
"text": "(ids: "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>[]) => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "remove",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#schema:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly schema: "
},
{
"kind": "Reference",
"text": "StoreSchema",
"canonicalReference": "@tldraw/store!StoreSchema:class"
},
{
"kind": "Content",
"text": "<R, Props>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "schema",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#scopedTypes:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly scopedTypes: "
},
{
"kind": "Content",
"text": "{\n readonly [K in "
},
{
"kind": "Reference",
"text": "RecordScope",
"canonicalReference": "@tldraw/store!~RecordScope:type"
},
{
"kind": "Content",
"text": "]: "
},
{
"kind": "Reference",
"text": "ReadonlySet",
"canonicalReference": "!ReadonlySet:interface"
},
{
"kind": "Content",
"text": "<R['typeName']>;\n }"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "scopedTypes",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#serialize:member",
"docComment": "/**\n * Creates a JSON payload from the record store.\n *\n * @param scope - The scope of records to serialize. Defaults to 'document'.\n *\n * @returns The record store snapshot as a JSON payload.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "serialize: "
},
{
"kind": "Content",
"text": "(scope?: 'all' | "
},
{
"kind": "Reference",
"text": "RecordScope",
"canonicalReference": "@tldraw/store!~RecordScope:type"
},
{
"kind": "Content",
"text": ") => "
},
{
"kind": "Reference",
"text": "SerializedStore",
"canonicalReference": "@tldraw/store!SerializedStore:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "serialize",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#unsafeGetWithoutCapture:member",
"docComment": "/**\n * Get the value of a store record by its id without updating its epoch.\n *\n * @param id - The id of the record to get.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "unsafeGetWithoutCapture: "
},
{
"kind": "Content",
"text": "<K extends "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>>(id: K) => "
},
{
"kind": "Reference",
"text": "RecFromId",
"canonicalReference": "@tldraw/store!~RecFromId:type"
},
{
"kind": "Content",
"text": "<K> | undefined"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "unsafeGetWithoutCapture",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 6
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!Store#update:member",
"docComment": "/**\n * Update a record. To update multiple records at once, use the `update` method of the `TypedStore` class.\n *\n * @param id - The id of the record to update.\n *\n * @param updater - A function that updates the record.\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "update: "
},
{
"kind": "Content",
"text": "<K extends "
},
{
"kind": "Reference",
"text": "IdOf",
"canonicalReference": "@tldraw/store!IdOf:type"
},
{
"kind": "Content",
"text": "<R>>(id: K, updater: (record: "
},
{
"kind": "Reference",
"text": "RecFromId",
"canonicalReference": "@tldraw/store!~RecFromId:type"
},
{
"kind": "Content",
"text": "<K>) => "
},
{
"kind": "Reference",
"text": "RecFromId",
"canonicalReference": "@tldraw/store!~RecFromId:type"
},
{
"kind": "Content",
"text": "<K>) => void"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": false,
"isOptional": false,
"releaseTag": "Public",
"name": "update",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 8
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!Store#validate:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "validate(phase: "
},
{
"kind": "Content",
"text": "'createRecord' | 'initialize' | 'tests' | 'updateRecord'"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "void"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "phase",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "validate"
}
],
"implementsTokenRanges": []
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!StoreError:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type StoreError = "
},
{
"kind": "Content",
"text": "{\n error: "
},
{
"kind": "Reference",
"text": "Error",
"canonicalReference": "!Error:interface"
},
{
"kind": "Content",
"text": ";\n phase: 'createRecord' | 'initialize' | 'tests' | 'updateRecord';\n recordBefore?: unknown;\n recordAfter: unknown;\n isExistingValidationIssue: boolean;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "StoreError",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 4
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!StoreListener:type",
"docComment": "/**\n * A function that will be called when the history changes.\n *\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type StoreListener<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "(entry: "
},
{
"kind": "Reference",
"text": "HistoryEntry",
"canonicalReference": "@tldraw/store!HistoryEntry:type"
},
{
"kind": "Content",
"text": "<R>) => void"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "StoreListener",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 6
}
},
{
"kind": "Class",
"canonicalReference": "@tldraw/store!StoreSchema:class",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export declare class StoreSchema<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ", P = "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": "> "
}
],
"fileUrlPath": "packages/store/src/lib/StoreSchema.ts",
"releaseTag": "Public",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "P",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
}
],
"isAbstract": false,
"name": "StoreSchema",
"preserveMemberOrder": false,
"members": [
{
"kind": "Method",
"canonicalReference": "@tldraw/store!StoreSchema.create:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "static create<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ", P = "
},
{
"kind": "Content",
"text": "unknown"
},
{
"kind": "Content",
"text": ">(types: "
},
{
"kind": "Content",
"text": "{\n [TypeName in R['typeName']]: {\n createId: any;\n };\n }"
},
{
"kind": "Content",
"text": ", options?: "
},
{
"kind": "Reference",
"text": "StoreSchemaOptions",
"canonicalReference": "@tldraw/store!StoreSchemaOptions:type"
},
{
"kind": "Content",
"text": "<R, P>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "StoreSchema",
"canonicalReference": "@tldraw/store!StoreSchema:class"
},
{
"kind": "Content",
"text": "<R, P>"
},
{
"kind": "Content",
"text": ";"
}
],
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "P",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
}
],
"isStatic": true,
"returnTypeTokenRange": {
"startIndex": 10,
"endIndex": 12
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "types",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": false
},
{
"parameterName": "options",
"parameterTypeTokenRange": {
"startIndex": 7,
"endIndex": 9
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "create"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!StoreSchema#currentStoreVersion:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "get currentStoreVersion(): "
},
{
"kind": "Content",
"text": "number"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "currentStoreVersion",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!StoreSchema#migratePersistedRecord:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "migratePersistedRecord(record: "
},
{
"kind": "Content",
"text": "R"
},
{
"kind": "Content",
"text": ", persistedSchema: "
},
{
"kind": "Reference",
"text": "SerializedSchema",
"canonicalReference": "@tldraw/store!SerializedSchema:interface"
},
{
"kind": "Content",
"text": ", direction?: "
},
{
"kind": "Content",
"text": "'down' | 'up'"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "MigrationResult",
"canonicalReference": "@tldraw/store!MigrationResult:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 7,
"endIndex": 9
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "record",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"isOptional": false
},
{
"parameterName": "persistedSchema",
"parameterTypeTokenRange": {
"startIndex": 3,
"endIndex": 4
},
"isOptional": false
},
{
"parameterName": "direction",
"parameterTypeTokenRange": {
"startIndex": 5,
"endIndex": 6
},
"isOptional": true
}
],
"isOptional": false,
"isAbstract": false,
"name": "migratePersistedRecord"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!StoreSchema#migrateStoreSnapshot:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "migrateStoreSnapshot(snapshot: "
},
{
"kind": "Reference",
"text": "StoreSnapshot",
"canonicalReference": "@tldraw/store!StoreSnapshot:type"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Reference",
"text": "MigrationResult",
"canonicalReference": "@tldraw/store!MigrationResult:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "SerializedStore",
"canonicalReference": "@tldraw/store!SerializedStore:type"
},
{
"kind": "Content",
"text": "<R>>"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 4,
"endIndex": 8
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "snapshot",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "migrateStoreSnapshot"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!StoreSchema#serialize:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "serialize(): "
},
{
"kind": "Reference",
"text": "SerializedSchema",
"canonicalReference": "@tldraw/store!SerializedSchema:interface"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [],
"isOptional": false,
"isAbstract": false,
"name": "serialize"
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!StoreSchema#serializeEarliestVersion:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "serializeEarliestVersion(): "
},
{
"kind": "Reference",
"text": "SerializedSchema",
"canonicalReference": "@tldraw/store!SerializedSchema:interface"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [],
"isOptional": false,
"isAbstract": false,
"name": "serializeEarliestVersion"
},
{
"kind": "Property",
"canonicalReference": "@tldraw/store!StoreSchema#types:member",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "readonly types: "
},
{
"kind": "Content",
"text": "{\n [Record in R as Record['typeName']]: "
},
{
"kind": "Reference",
"text": "RecordType",
"canonicalReference": "@tldraw/store!RecordType:class"
},
{
"kind": "Content",
"text": "<R, any>;\n }"
},
{
"kind": "Content",
"text": ";"
}
],
"isReadonly": true,
"isOptional": false,
"releaseTag": "Public",
"name": "types",
"propertyTypeTokenRange": {
"startIndex": 1,
"endIndex": 4
},
"isStatic": false,
"isProtected": false,
"isAbstract": false
},
{
"kind": "Method",
"canonicalReference": "@tldraw/store!StoreSchema#validateRecord:member(1)",
"docComment": "",
"excerptTokens": [
{
"kind": "Content",
"text": "validateRecord(store: "
},
{
"kind": "Reference",
"text": "Store",
"canonicalReference": "@tldraw/store!Store:class"
},
{
"kind": "Content",
"text": "<R>"
},
{
"kind": "Content",
"text": ", record: "
},
{
"kind": "Content",
"text": "R"
},
{
"kind": "Content",
"text": ", phase: "
},
{
"kind": "Content",
"text": "'createRecord' | 'initialize' | 'tests' | 'updateRecord'"
},
{
"kind": "Content",
"text": ", recordBefore: "
},
{
"kind": "Content",
"text": "null | R"
},
{
"kind": "Content",
"text": "): "
},
{
"kind": "Content",
"text": "R"
},
{
"kind": "Content",
"text": ";"
}
],
"isStatic": false,
"returnTypeTokenRange": {
"startIndex": 10,
"endIndex": 11
},
"releaseTag": "Public",
"isProtected": false,
"overloadIndex": 1,
"parameters": [
{
"parameterName": "store",
"parameterTypeTokenRange": {
"startIndex": 1,
"endIndex": 3
},
"isOptional": false
},
{
"parameterName": "record",
"parameterTypeTokenRange": {
"startIndex": 4,
"endIndex": 5
},
"isOptional": false
},
{
"parameterName": "phase",
"parameterTypeTokenRange": {
"startIndex": 6,
"endIndex": 7
},
"isOptional": false
},
{
"parameterName": "recordBefore",
"parameterTypeTokenRange": {
"startIndex": 8,
"endIndex": 9
},
"isOptional": false
}
],
"isOptional": false,
"isAbstract": false,
"name": "validateRecord"
}
],
"implementsTokenRanges": []
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!StoreSchemaOptions:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type StoreSchemaOptions<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ", P> = "
},
{
"kind": "Content",
"text": "{\n snapshotMigrations?: "
},
{
"kind": "Reference",
"text": "Migrations",
"canonicalReference": "@tldraw/store!Migrations:interface"
},
{
"kind": "Content",
"text": ";\n onValidationFailure?: (data: {\n error: unknown;\n store: "
},
{
"kind": "Reference",
"text": "Store",
"canonicalReference": "@tldraw/store!Store:class"
},
{
"kind": "Content",
"text": "<R>;\n record: R;\n phase: 'createRecord' | 'initialize' | 'tests' | 'updateRecord';\n recordBefore: null | R;\n }) => R;\n createIntegrityChecker?: (store: "
},
{
"kind": "Reference",
"text": "Store",
"canonicalReference": "@tldraw/store!Store:class"
},
{
"kind": "Content",
"text": "<R, P>) => void;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/StoreSchema.ts",
"releaseTag": "Public",
"name": "StoreSchemaOptions",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
},
{
"typeParameterName": "P",
"constraintTokenRange": {
"startIndex": 0,
"endIndex": 0
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 10
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!StoreSnapshot:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type StoreSnapshot<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "{\n store: "
},
{
"kind": "Reference",
"text": "SerializedStore",
"canonicalReference": "@tldraw/store!SerializedStore:type"
},
{
"kind": "Content",
"text": "<R>;\n schema: "
},
{
"kind": "Reference",
"text": "SerializedSchema",
"canonicalReference": "@tldraw/store!SerializedSchema:interface"
},
{
"kind": "Content",
"text": ";\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "StoreSnapshot",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 8
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!StoreValidator:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type StoreValidator<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "{\n validate: (record: unknown) => R;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "StoreValidator",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 4
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!StoreValidators:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type StoreValidators<R extends "
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": "> = "
},
{
"kind": "Content",
"text": "{\n [K in R['typeName']]: "
},
{
"kind": "Reference",
"text": "StoreValidator",
"canonicalReference": "@tldraw/store!StoreValidator:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "Extract",
"canonicalReference": "!Extract:type"
},
{
"kind": "Content",
"text": "<R, {\n typeName: K;\n }>>;\n}"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/Store.ts",
"releaseTag": "Public",
"name": "StoreValidators",
"typeParameters": [
{
"typeParameterName": "R",
"constraintTokenRange": {
"startIndex": 1,
"endIndex": 2
},
"defaultTypeTokenRange": {
"startIndex": 0,
"endIndex": 0
}
}
],
"typeTokenRange": {
"startIndex": 3,
"endIndex": 8
}
},
{
"kind": "TypeAlias",
"canonicalReference": "@tldraw/store!UnknownRecord:type",
"docComment": "/**\n * @public\n */\n",
"excerptTokens": [
{
"kind": "Content",
"text": "export type UnknownRecord = "
},
{
"kind": "Reference",
"text": "BaseRecord",
"canonicalReference": "@tldraw/store!BaseRecord:interface"
},
{
"kind": "Content",
"text": "<string, "
},
{
"kind": "Reference",
"text": "RecordId",
"canonicalReference": "@tldraw/store!RecordId:type"
},
{
"kind": "Content",
"text": "<"
},
{
"kind": "Reference",
"text": "UnknownRecord",
"canonicalReference": "@tldraw/store!UnknownRecord:type"
},
{
"kind": "Content",
"text": ">>"
},
{
"kind": "Content",
"text": ";"
}
],
"fileUrlPath": "packages/store/src/lib/BaseRecord.ts",
"releaseTag": "Public",
"name": "UnknownRecord",
"typeTokenRange": {
"startIndex": 1,
"endIndex": 7
}
}
]
}
]
}