New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@kizahasi/flocon-core

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kizahasi/flocon-core - npm Package Compare versions

Comparing version 0.1.0-alpha.9 to 0.1.0-alpha.10

dist/internal/ot/room/board/v1.d.ts

16

dist/index.d.ts

@@ -10,10 +10,10 @@ export { CharacterAction, CharacterActionElement, characterAction as tomlToCharacterAction, isValidVarToml, toCharacterOperation as characterActionToOperation, variable as tomlToVariables, } from './internal/flocommand';

export { State as PieceState, UpOperation as PieceUpOperation, DownOperation as PieceDownOperation, apply as applyPiece, diff as pieceDiff, toUpOperation as toPieceUpOperation, } from './internal/ot/piece/v1';
export { State as BoardState, UpOperation as BoardUpOperation, DownOperation as BoardDownOperation, apply as applyBoard, diff as boardDiff, toUpOperation as toBoardUpOperation, } from './internal/ot/room/participant/board/v1';
export { State as CharacterState, UpOperation as CharacterUpOperation, DownOperation as CharacterDownOperation, apply as applyCharacter, diff as characterDiff, toUpOperation as toCharacterUpOperation, } from './internal/ot/room/participant/character/v1';
export { State as BoolParamState, UpOperation as BoolParamUpOperation, DownOperation as BoolParamCharacterDownOperation, } from './internal/ot/room/participant/character/boolParam/v1';
export { State as NumParamState, UpOperation as NumParamUpOperation, DownOperation as NumParamCharacterDownOperation, } from './internal/ot/room/participant/character/numParam/v1';
export { State as StrParamState, UpOperation as StrParamUpOperation, DownOperation as StrParamCharacterDownOperation, apply as applyStrParamCharacter, diff as strParamcharacterDiff, toUpOperation as toCharacterStrParamUpOperation, } from './internal/ot/room/participant/character/strParam/v1';
export { State as MyNumberValueState, UpOperation as MyNumberValuePieceUpOperation, DownOperation as MyNumberValueDownOperation, apply as applyMyNumberValue, diff as myNumberValueDiff, toUpOperation as toMyNumberValueUpOperation, } from './internal/ot/room/participant/myNumberValue/v1';
export { decode as decodeMyNumberValue, parse as parseMyNumberValue, exact as exactMyNumberValue, } from './internal/ot/room/participant/myNumberValue/converter';
export { ofOperation as toMyNumberValueLog, Main as MyNumberValueLog, updateType, createType, deleteType, } from './internal/ot/room/participant/myNumberValue/log-v1';
export { State as BoardState, UpOperation as BoardUpOperation, DownOperation as BoardDownOperation, apply as applyBoard, diff as boardDiff, toUpOperation as toBoardUpOperation, } from './internal/ot/room/board/v1';
export { State as CharacterState, UpOperation as CharacterUpOperation, DownOperation as CharacterDownOperation, apply as applyCharacter, diff as characterDiff, toUpOperation as toCharacterUpOperation, } from './internal/ot/room/character/v1';
export { State as BoolParamState, UpOperation as BoolParamUpOperation, DownOperation as BoolParamCharacterDownOperation, } from './internal/ot/room/character/boolParam/v1';
export { State as NumParamState, UpOperation as NumParamUpOperation, DownOperation as NumParamCharacterDownOperation, } from './internal/ot/room/character/numParam/v1';
export { State as StrParamState, UpOperation as StrParamUpOperation, DownOperation as StrParamCharacterDownOperation, apply as applyStrParamCharacter, diff as strParamcharacterDiff, toUpOperation as toCharacterStrParamUpOperation, } from './internal/ot/room/character/strParam/v1';
export { State as MyNumberValueState, UpOperation as MyNumberValuePieceUpOperation, DownOperation as MyNumberValueDownOperation, apply as applyMyNumberValue, diff as myNumberValueDiff, toUpOperation as toMyNumberValueUpOperation, } from './internal/ot/room/myNumberValue/v1';
export { decode as decodeMyNumberValue, parse as parseMyNumberValue, exact as exactMyNumberValue, } from './internal/ot/room/myNumberValue/converter';
export { ofOperation as toMyNumberValueLog, Main as MyNumberValueLog, updateType, createType, deleteType, } from './internal/ot/room/myNumberValue/log-v1';
export { isIdRecord } from './internal/ot/room/util/record';

@@ -20,0 +20,0 @@ export { replace, update, RecordDownOperationElement, RecordTwoWayOperationElement, RecordUpOperationElement, } from './internal/ot/room/util/recordOperationElement';

import * as t from 'io-ts';
import { LocalDate as TomlLocalDate, LocalDateTime as TomlLocalDateTime, LocalTime as TomlLocalTime, OffsetDateTime as TomlOffsetDateTime } from '@ltd/j-toml';
import * as Character from './ot/room/participant/character/v1';
import * as Character from './ot/room/character/v1';
import { Result } from '@kizahasi/result';

@@ -5,0 +5,0 @@ declare type TomlDateTime = TomlLocalDate | TomlLocalDateTime | TomlLocalTime | TomlOffsetDateTime;

import * as t from 'io-ts';
import * as Board from './board/v1';
import * as Character from './character/v1';
import * as MyNumberValue from './myNumberValue/v1';
import { RecordTwoWayOperationElement } from '../util/recordOperationElement';
import { Apply, ClientTransform, Compose, Diff, RequestedBy, Restore, ServerTransform, ToClientOperationParams } from '../util/type';

@@ -18,99 +14,2 @@ import * as ReplaceOperation from '../util/replaceOperation';

role: t.UnionC<[t.UnionC<[t.LiteralC<"Player">, t.LiteralC<"Spectator">, t.LiteralC<"Master">]>, t.NullC, t.UndefinedC]>;
boards: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
backgroundImage: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
backgroundImageZoom: t.NumberC;
cellColumnCount: t.NumberC;
cellHeight: t.NumberC;
cellOffsetX: t.NumberC;
cellOffsetY: t.NumberC;
cellRowCount: t.NumberC;
cellWidth: t.NumberC;
name: t.StringC;
}>>;
characters: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
image: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
isPrivate: t.BooleanC;
memo: t.StringC;
name: t.StringC;
privateCommand: t.StringC;
privateVarToml: t.StringC;
tachieImage: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
boolParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.BooleanC, t.NullC, t.UndefinedC]>;
}>>;
numParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>>;
numMaxParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>>;
strParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.StringC;
}>>;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
privateCommands: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
value: t.StringC;
}>>;
tachieLocations: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
h: t.NumberC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
}>>;
myNumberValues: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.NumberC;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
}>>;
}>;

@@ -127,433 +26,2 @@ export declare type State = t.TypeOf<typeof state>;

}>;
boards: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
oldValue: t.TypeC<{
$version: t.LiteralC<1>;
backgroundImage: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
backgroundImageZoom: t.NumberC;
cellColumnCount: t.NumberC;
cellHeight: t.NumberC;
cellOffsetX: t.NumberC;
cellOffsetY: t.NumberC;
cellRowCount: t.NumberC;
cellWidth: t.NumberC;
name: t.StringC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
backgroundImage: t.TypeC<{
oldValue: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
}>;
backgroundImageZoom: t.TypeC<{
oldValue: t.NumberC;
}>;
cellColumnCount: t.TypeC<{
oldValue: t.NumberC;
}>;
cellHeight: t.TypeC<{
oldValue: t.NumberC;
}>;
cellOffsetX: t.TypeC<{
oldValue: t.NumberC;
}>;
cellOffsetY: t.TypeC<{
oldValue: t.NumberC;
}>;
cellRowCount: t.TypeC<{
oldValue: t.NumberC;
}>;
cellWidth: t.TypeC<{
oldValue: t.NumberC;
}>;
name: t.TypeC<{
oldValue: t.StringC;
}>;
}>]>;
}>]>>;
characters: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
oldValue: t.TypeC<{
$version: t.LiteralC<1>;
image: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
isPrivate: t.BooleanC;
memo: t.StringC;
name: t.StringC;
privateCommand: t.StringC;
privateVarToml: t.StringC;
tachieImage: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
boolParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.BooleanC, t.NullC, t.UndefinedC]>;
}>>;
numParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>>;
numMaxParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>>;
strParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.StringC;
}>>;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
privateCommands: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
value: t.StringC;
}>>;
tachieLocations: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
h: t.NumberC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
image: t.TypeC<{
oldValue: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
}>;
isPrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
memo: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.StringC;
}>]>>;
name: t.TypeC<{
oldValue: t.StringC;
}>;
privateCommand: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.StringC;
}>]>>;
privateVarToml: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.StringC;
}>]>>;
tachieImage: t.TypeC<{
oldValue: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
}>;
boolParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
value: t.TypeC<{
oldValue: t.UnionC<[t.BooleanC, t.NullC, t.UndefinedC]>;
}>;
}>]>>;
numParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
value: t.TypeC<{
oldValue: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>;
}>]>>;
numMaxParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
value: t.TypeC<{
oldValue: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>;
}>]>>;
strParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
value: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.StringC;
}>]>>;
}>]>>;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
oldValue: t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
cellH: t.TypeC<{
oldValue: t.NumberC;
}>;
cellW: t.TypeC<{
oldValue: t.NumberC;
}>;
cellX: t.TypeC<{
oldValue: t.NumberC;
}>;
cellY: t.TypeC<{
oldValue: t.NumberC;
}>;
h: t.TypeC<{
oldValue: t.NumberC;
}>;
isCellMode: t.TypeC<{
oldValue: t.BooleanC;
}>;
isPrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
w: t.TypeC<{
oldValue: t.NumberC;
}>;
x: t.TypeC<{
oldValue: t.NumberC;
}>;
y: t.TypeC<{
oldValue: t.NumberC;
}>;
}>]>;
}>]>>>;
privateCommands: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
oldValue: t.TypeC<{
$version: t.LiteralC<1>;
value: t.StringC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
value: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.StringC;
}>]>>;
}>]>;
}>]>>;
tachieLocations: t.RecordC<t.StringC, t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
oldValue: t.TypeC<{
$version: t.LiteralC<1>;
h: t.NumberC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
h: t.TypeC<{
oldValue: t.NumberC;
}>;
isPrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
w: t.TypeC<{
oldValue: t.NumberC;
}>;
x: t.TypeC<{
oldValue: t.NumberC;
}>;
y: t.TypeC<{
oldValue: t.NumberC;
}>;
}>]>;
}>]>>>;
}>]>;
}>]>>;
myNumberValues: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
oldValue: t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.NumberC;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
value: t.TypeC<{
oldValue: t.NumberC;
}>;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
oldValue: t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
cellH: t.TypeC<{
oldValue: t.NumberC;
}>;
cellW: t.TypeC<{
oldValue: t.NumberC;
}>;
cellX: t.TypeC<{
oldValue: t.NumberC;
}>;
cellY: t.TypeC<{
oldValue: t.NumberC;
}>;
h: t.TypeC<{
oldValue: t.NumberC;
}>;
isCellMode: t.TypeC<{
oldValue: t.BooleanC;
}>;
isPrivate: t.TypeC<{
oldValue: t.BooleanC;
}>;
w: t.TypeC<{
oldValue: t.NumberC;
}>;
x: t.TypeC<{
oldValue: t.NumberC;
}>;
y: t.TypeC<{
oldValue: t.NumberC;
}>;
}>]>;
}>]>>>;
}>]>;
}>]>>;
}>]>;

@@ -570,433 +38,2 @@ export declare type DownOperation = t.TypeOf<typeof downOperation>;

}>;
boards: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
newValue: t.TypeC<{
$version: t.LiteralC<1>;
backgroundImage: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
backgroundImageZoom: t.NumberC;
cellColumnCount: t.NumberC;
cellHeight: t.NumberC;
cellOffsetX: t.NumberC;
cellOffsetY: t.NumberC;
cellRowCount: t.NumberC;
cellWidth: t.NumberC;
name: t.StringC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
backgroundImage: t.TypeC<{
newValue: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
}>;
backgroundImageZoom: t.TypeC<{
newValue: t.NumberC;
}>;
cellColumnCount: t.TypeC<{
newValue: t.NumberC;
}>;
cellHeight: t.TypeC<{
newValue: t.NumberC;
}>;
cellOffsetX: t.TypeC<{
newValue: t.NumberC;
}>;
cellOffsetY: t.TypeC<{
newValue: t.NumberC;
}>;
cellRowCount: t.TypeC<{
newValue: t.NumberC;
}>;
cellWidth: t.TypeC<{
newValue: t.NumberC;
}>;
name: t.TypeC<{
newValue: t.StringC;
}>;
}>]>;
}>]>>;
characters: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
newValue: t.TypeC<{
$version: t.LiteralC<1>;
image: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
isPrivate: t.BooleanC;
memo: t.StringC;
name: t.StringC;
privateCommand: t.StringC;
privateVarToml: t.StringC;
tachieImage: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
boolParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.BooleanC, t.NullC, t.UndefinedC]>;
}>>;
numParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>>;
numMaxParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>>;
strParams: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.StringC;
}>>;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
privateCommands: t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
value: t.StringC;
}>>;
tachieLocations: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
h: t.NumberC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
image: t.TypeC<{
newValue: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
}>;
isPrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
memo: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.StringC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.NumberC;
}>]>>;
name: t.TypeC<{
newValue: t.StringC;
}>;
privateCommand: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.StringC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.NumberC;
}>]>>;
privateVarToml: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.StringC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.NumberC;
}>]>>;
tachieImage: t.TypeC<{
newValue: t.UnionC<[t.TypeC<{
$version: t.LiteralC<1>;
path: t.StringC;
sourceType: t.UnionC<[t.LiteralC<"Default">, t.LiteralC<"FirebaseStorage">]>;
}>, t.NullC, t.UndefinedC]>;
}>;
boolParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
value: t.TypeC<{
newValue: t.UnionC<[t.BooleanC, t.NullC, t.UndefinedC]>;
}>;
}>]>>;
numParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
value: t.TypeC<{
newValue: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>;
}>]>>;
numMaxParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
value: t.TypeC<{
newValue: t.UnionC<[t.NumberC, t.NullC, t.UndefinedC]>;
}>;
}>]>>;
strParams: t.RecordC<t.StringC, t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
value: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.StringC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.NumberC;
}>]>>;
}>]>>;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
newValue: t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
cellH: t.TypeC<{
newValue: t.NumberC;
}>;
cellW: t.TypeC<{
newValue: t.NumberC;
}>;
cellX: t.TypeC<{
newValue: t.NumberC;
}>;
cellY: t.TypeC<{
newValue: t.NumberC;
}>;
h: t.TypeC<{
newValue: t.NumberC;
}>;
isCellMode: t.TypeC<{
newValue: t.BooleanC;
}>;
isPrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
w: t.TypeC<{
newValue: t.NumberC;
}>;
x: t.TypeC<{
newValue: t.NumberC;
}>;
y: t.TypeC<{
newValue: t.NumberC;
}>;
}>]>;
}>]>>>;
privateCommands: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
newValue: t.TypeC<{
$version: t.LiteralC<1>;
value: t.StringC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
value: t.ArrayC<t.UnionC<[t.TypeC<{
t: t.LiteralC<"r">;
r: t.NumberC;
}>, t.TypeC<{
t: t.LiteralC<"i">;
i: t.StringC;
}>, t.TypeC<{
t: t.LiteralC<"d">;
d: t.NumberC;
}>]>>;
}>]>;
}>]>>;
tachieLocations: t.RecordC<t.StringC, t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
newValue: t.TypeC<{
$version: t.LiteralC<1>;
h: t.NumberC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
h: t.TypeC<{
newValue: t.NumberC;
}>;
isPrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
w: t.TypeC<{
newValue: t.NumberC;
}>;
x: t.TypeC<{
newValue: t.NumberC;
}>;
y: t.TypeC<{
newValue: t.NumberC;
}>;
}>]>;
}>]>>>;
}>]>;
}>]>>;
myNumberValues: t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
newValue: t.TypeC<{
$version: t.LiteralC<1>;
isValuePrivate: t.BooleanC;
value: t.NumberC;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>>>;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
isValuePrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
value: t.TypeC<{
newValue: t.NumberC;
}>;
pieces: t.RecordC<t.StringC, t.RecordC<t.StringC, t.UnionC<[t.TypeC<{
type: t.LiteralC<"replace">;
replace: t.PartialC<{
newValue: t.TypeC<{
$version: t.LiteralC<1>;
cellH: t.NumberC;
cellW: t.NumberC;
cellX: t.NumberC;
cellY: t.NumberC;
h: t.NumberC;
isCellMode: t.BooleanC;
isPrivate: t.BooleanC;
w: t.NumberC;
x: t.NumberC;
y: t.NumberC;
}>;
}>;
}>, t.TypeC<{
type: t.LiteralC<"update">;
update: t.IntersectionC<[t.TypeC<{
$version: t.LiteralC<1>;
}>, t.PartialC<{
cellH: t.TypeC<{
newValue: t.NumberC;
}>;
cellW: t.TypeC<{
newValue: t.NumberC;
}>;
cellX: t.TypeC<{
newValue: t.NumberC;
}>;
cellY: t.TypeC<{
newValue: t.NumberC;
}>;
h: t.TypeC<{
newValue: t.NumberC;
}>;
isCellMode: t.TypeC<{
newValue: t.BooleanC;
}>;
isPrivate: t.TypeC<{
newValue: t.BooleanC;
}>;
w: t.TypeC<{
newValue: t.NumberC;
}>;
x: t.TypeC<{
newValue: t.NumberC;
}>;
y: t.TypeC<{
newValue: t.NumberC;
}>;
}>]>;
}>]>>>;
}>]>;
}>]>>;
}>]>;

@@ -1008,10 +45,7 @@ export declare type UpOperation = t.TypeOf<typeof upOperation>;

role?: ReplaceOperation.ReplaceValueTwoWayOperation<Maybe<ParticipantRole>>;
boards?: Record<string, RecordTwoWayOperationElement<Board.State, Board.TwoWayOperation>>;
characters?: Record<string, RecordTwoWayOperationElement<Character.State, Character.TwoWayOperation>>;
myNumberValues?: Record<string, RecordTwoWayOperationElement<MyNumberValue.State, MyNumberValue.TwoWayOperation>>;
};
export declare const toClientState: (createdByMe: boolean, activeBoardSecondKey: string | null | undefined) => (source: State) => State;
export declare const toClientState: (source: State) => State;
export declare const toDownOperation: (source: TwoWayOperation) => DownOperation;
export declare const toUpOperation: (source: TwoWayOperation) => UpOperation;
export declare const toClientOperation: (createdByMe: boolean, activeBoardSecondKey: string | null | undefined) => ({ prevState, nextState, diff, }: ToClientOperationParams<State, TwoWayOperation>) => UpOperation;
export declare const toClientOperation: ({ diff, }: ToClientOperationParams<State, TwoWayOperation>) => UpOperation;
export declare const apply: Apply<State, UpOperation | TwoWayOperation>;

@@ -1018,0 +52,0 @@ export declare const applyBack: Apply<State, DownOperation>;

{
"version": "0.1.0-alpha.9",
"version": "0.1.0-alpha.10",
"license": "MIT",

@@ -4,0 +4,0 @@ "main": "dist/index.js",

@@ -85,3 +85,3 @@ export {

toUpOperation as toBoardUpOperation,
} from './internal/ot/room/participant/board/v1';
} from './internal/ot/room/board/v1';
export {

@@ -94,3 +94,3 @@ State as CharacterState,

toUpOperation as toCharacterUpOperation,
} from './internal/ot/room/participant/character/v1';
} from './internal/ot/room/character/v1';
export {

@@ -100,3 +100,3 @@ State as BoolParamState,

DownOperation as BoolParamCharacterDownOperation,
} from './internal/ot/room/participant/character/boolParam/v1';
} from './internal/ot/room/character/boolParam/v1';
export {

@@ -106,3 +106,3 @@ State as NumParamState,

DownOperation as NumParamCharacterDownOperation,
} from './internal/ot/room/participant/character/numParam/v1';
} from './internal/ot/room/character/numParam/v1';
export {

@@ -115,3 +115,3 @@ State as StrParamState,

toUpOperation as toCharacterStrParamUpOperation,
} from './internal/ot/room/participant/character/strParam/v1';
} from './internal/ot/room/character/strParam/v1';
export {

@@ -124,3 +124,3 @@ State as MyNumberValueState,

toUpOperation as toMyNumberValueUpOperation,
} from './internal/ot/room/participant/myNumberValue/v1';
} from './internal/ot/room/myNumberValue/v1';
export {

@@ -130,3 +130,3 @@ decode as decodeMyNumberValue,

exact as exactMyNumberValue,
} from './internal/ot/room/participant/myNumberValue/converter';
} from './internal/ot/room/myNumberValue/converter';
export {

@@ -138,3 +138,3 @@ ofOperation as toMyNumberValueLog,

deleteType,
} from './internal/ot/room/participant/myNumberValue/log-v1';
} from './internal/ot/room/myNumberValue/log-v1';
export { isIdRecord } from './internal/ot/room/util/record';

@@ -141,0 +141,0 @@ export {

@@ -16,3 +16,3 @@ /* eslint-disable @typescript-eslint/no-namespace */

} from './ot/filePath/v1';
import * as Character from './ot/room/participant/character/v1';
import * as Character from './ot/room/character/v1';
import { Result } from '@kizahasi/result';

@@ -19,0 +19,0 @@

@@ -14,1 +14,3 @@ # Operational Transformation library

composeDownOperationは、例えば { oldValue: undefined, newValue: 1 }, { oldValue:1, newValue: undefined } をcomposeしたときにこれはidになるべき(oldValueとnewValueのうち1つのみがnullishであるべき)だがidにできないという仕様があるため注意。composeUpOperationも同様。
board,character,myNumbervalueなどのfirst keyはuserUid(participantのfirst key)と等しい。これらをparticipantの子として持たせていない理由は、UndoやRedo処理をparticipantの削除などなしで行いやすくするため。
import * as t from 'io-ts';
import * as Board from './board/v1';
import * as Character from './character/v1';
import * as MyNumberValue from './myNumberValue/v1';
import {

@@ -50,5 +47,2 @@ recordDownOperationElementFactory,

role: maybe(participantRole),
boards: t.record(t.string, Board.state),
characters: t.record(t.string, Character.state),
myNumberValues: t.record(t.string, MyNumberValue.state),
});

@@ -61,20 +55,2 @@

role: t.type({ oldValue: maybe(participantRole) }),
boards: t.record(
t.string,
recordDownOperationElementFactory(Board.state, Board.downOperation)
),
characters: t.record(
t.string,
recordDownOperationElementFactory(
Character.state,
Character.downOperation
)
),
myNumberValues: t.record(
t.string,
recordDownOperationElementFactory(
MyNumberValue.state,
MyNumberValue.downOperation
)
),
});

@@ -87,17 +63,2 @@

role: t.type({ newValue: maybe(participantRole) }),
boards: t.record(
t.string,
recordUpOperationElementFactory(Board.state, Board.upOperation)
),
characters: t.record(
t.string,
recordUpOperationElementFactory(Character.state, Character.upOperation)
),
myNumberValues: t.record(
t.string,
recordUpOperationElementFactory(
MyNumberValue.state,
MyNumberValue.upOperation
)
),
});

@@ -112,183 +73,20 @@

role?: ReplaceOperation.ReplaceValueTwoWayOperation<Maybe<ParticipantRole>>;
boards?: Record<
string,
RecordTwoWayOperationElement<Board.State, Board.TwoWayOperation>
>;
characters?: Record<
string,
RecordTwoWayOperationElement<Character.State, Character.TwoWayOperation>
>;
myNumberValues?: Record<
string,
RecordTwoWayOperationElement<
MyNumberValue.State,
MyNumberValue.TwoWayOperation
>
>;
};
export const toClientState = (
createdByMe: boolean,
activeBoardSecondKey: string | null | undefined
) => (source: State): State => {
return {
...source,
boards: RecordOperation.toClientState({
serverState: source.boards,
isPrivate: (state, key) => {
if (createdByMe) {
return false;
}
if (key === activeBoardSecondKey) {
return false;
}
return true;
},
toClientState: ({ state }) => Board.toClientState(state),
}),
characters: RecordOperation.toClientState({
serverState: source.characters,
isPrivate: state => !createdByMe && state.isPrivate,
toClientState: ({ state }) =>
Character.toClientState(createdByMe)(state),
}),
myNumberValues: RecordOperation.toClientState({
serverState: source.myNumberValues,
isPrivate: () => false,
toClientState: ({ state }) =>
MyNumberValue.toClientState(createdByMe)(state),
}),
};
export const toClientState = (source: State): State => {
return source;
};
export const toDownOperation = (source: TwoWayOperation): DownOperation => {
return {
...source,
boards:
source.boards == null
? undefined
: chooseRecord(source.boards, operation =>
mapRecordOperationElement({
source: operation,
mapReplace: x => x,
mapOperation: Board.toDownOperation,
})
),
characters:
source.characters == null
? undefined
: chooseRecord(source.characters, operation =>
mapRecordOperationElement({
source: operation,
mapReplace: x => x,
mapOperation: Character.toDownOperation,
})
),
myNumberValues:
source.myNumberValues == null
? undefined
: chooseRecord(source.myNumberValues, operation =>
mapRecordOperationElement({
source: operation,
mapReplace: x => x,
mapOperation: MyNumberValue.toDownOperation,
})
),
};
return source;
};
export const toUpOperation = (source: TwoWayOperation): UpOperation => {
return {
...source,
boards:
source.boards == null
? undefined
: chooseRecord(source.boards, operation =>
mapRecordOperationElement({
source: operation,
mapReplace: x => x,
mapOperation: Board.toUpOperation,
})
),
characters:
source.characters == null
? undefined
: chooseRecord(source.characters, operation =>
mapRecordOperationElement({
source: operation,
mapReplace: x => x,
mapOperation: Character.toUpOperation,
})
),
myNumberValues:
source.myNumberValues == null
? undefined
: chooseRecord(source.myNumberValues, operation =>
mapRecordOperationElement({
source: operation,
mapReplace: x => x,
mapOperation: MyNumberValue.toUpOperation,
})
),
};
return source;
};
export const toClientOperation = (
createdByMe: boolean,
activeBoardSecondKey: string | null | undefined
) => ({
prevState,
nextState,
export const toClientOperation = ({
diff,
}: ToClientOperationParams<State, TwoWayOperation>): UpOperation => {
return {
...diff,
boards:
diff.boards == null
? undefined
: RecordOperation.toClientOperation({
diff: diff.boards,
prevState: prevState.boards,
nextState: nextState.boards,
toClientState: ({ nextState }) =>
Board.toClientState(nextState),
toClientOperation: params =>
Board.toClientOperation(params),
isPrivate: (state, key) => {
if (createdByMe) {
return false;
}
if (key === activeBoardSecondKey) {
return false;
}
return true;
},
}),
characters:
diff.characters == null
? undefined
: RecordOperation.toClientOperation({
diff: diff.characters,
prevState: prevState.characters,
nextState: nextState.characters,
toClientState: ({ nextState }) =>
Character.toClientState(createdByMe)(nextState),
toClientOperation: params =>
Character.toClientOperation(createdByMe)(params),
isPrivate: () => false,
}),
myNumberValues:
diff.myNumberValues == null
? undefined
: RecordOperation.toClientOperation({
diff: diff.myNumberValues,
prevState: prevState.myNumberValues,
nextState: nextState.myNumberValues,
toClientState: ({ nextState }) =>
MyNumberValue.toClientState(createdByMe)(nextState),
toClientOperation: params =>
MyNumberValue.toClientOperation(createdByMe)(params),
isPrivate: () => false,
}),
};
return diff;
};

@@ -307,57 +105,2 @@

}
const boards = RecordOperation.apply<
Board.State,
Board.UpOperation | Board.TwoWayOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
prevState: state.boards,
operation: operation.boards,
innerApply: ({ prevState, operation: upOperation }) => {
return Board.apply({ state: prevState, operation: upOperation });
},
});
if (boards.isError) {
return boards;
}
result.boards = boards.value;
const characters = RecordOperation.apply<
Character.State,
Character.UpOperation | Character.TwoWayOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
prevState: state.characters,
operation: operation.characters,
innerApply: ({ prevState, operation: upOperation }) => {
return Character.apply({
state: prevState,
operation: upOperation,
});
},
});
if (characters.isError) {
return characters;
}
result.characters = characters.value;
const myNumberValues = RecordOperation.apply<
MyNumberValue.State,
MyNumberValue.UpOperation | MyNumberValue.TwoWayOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
prevState: state.myNumberValues,
operation: operation.myNumberValues,
innerApply: ({ prevState, operation: upOperation }) => {
return MyNumberValue.apply({
state: prevState,
operation: upOperation,
});
},
});
if (myNumberValues.isError) {
return myNumberValues;
}
result.myNumberValues = myNumberValues.value;
return Result.ok(result);

@@ -378,50 +121,2 @@ };

const boards = RecordOperation.applyBack<
Board.State,
Board.DownOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
nextState: state.boards,
operation: operation.boards,
innerApplyBack: ({ state, operation }) => {
return Board.applyBack({ state, operation });
},
});
if (boards.isError) {
return boards;
}
result.boards = boards.value;
const characters = RecordOperation.applyBack<
Character.State,
Character.DownOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
nextState: state.characters,
operation: operation.characters,
innerApplyBack: ({ state, operation }) => {
return Character.applyBack({ state, operation });
},
});
if (characters.isError) {
return characters;
}
result.characters = characters.value;
const myNumberValues = RecordOperation.applyBack<
MyNumberValue.State,
MyNumberValue.DownOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
nextState: state.myNumberValues,
operation: operation.myNumberValues,
innerApplyBack: ({ state, operation }) => {
return MyNumberValue.applyBack({ state, operation });
},
});
if (myNumberValues.isError) {
return myNumberValues;
}
result.myNumberValues = myNumberValues.value;
return Result.ok(result);

@@ -431,44 +126,2 @@ };

export const composeUpOperation: Compose<UpOperation> = ({ first, second }) => {
const boards = RecordOperation.composeUpOperation<
Board.State,
Board.UpOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.boards,
second: second.boards,
innerApply: params => Board.apply(params),
innerCompose: params => Board.composeUpOperation(params),
});
if (boards.isError) {
return boards;
}
const characters = RecordOperation.composeUpOperation<
Character.State,
Character.UpOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.characters,
second: second.characters,
innerApply: params => Character.apply(params),
innerCompose: params => Character.composeUpOperation(params),
});
if (characters.isError) {
return characters;
}
const myNumberValues = RecordOperation.composeUpOperation<
MyNumberValue.State,
MyNumberValue.UpOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.myNumberValues,
second: second.myNumberValues,
innerApply: params => MyNumberValue.apply(params),
innerCompose: params => MyNumberValue.composeUpOperation(params),
});
if (myNumberValues.isError) {
return myNumberValues;
}
const valueProps: UpOperation = {

@@ -484,5 +137,2 @@ $version: 1,

),
boards: boards.value,
characters: characters.value,
myNumberValues: myNumberValues.value,
};

@@ -496,44 +146,2 @@ return Result.ok(valueProps);

}) => {
const boards = RecordOperation.composeDownOperation<
Board.State,
Board.DownOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.boards,
second: second.boards,
innerApplyBack: params => Board.applyBack(params),
innerCompose: params => Board.composeDownOperation(params),
});
if (boards.isError) {
return boards;
}
const characters = RecordOperation.composeDownOperation<
Character.State,
Character.DownOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.characters,
second: second.characters,
innerApplyBack: params => Character.applyBack(params),
innerCompose: params => Character.composeDownOperation(params),
});
if (characters.isError) {
return characters;
}
const myNumberValues = RecordOperation.composeDownOperation<
MyNumberValue.State,
MyNumberValue.DownOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.myNumberValues,
second: second.myNumberValues,
innerApplyBack: params => MyNumberValue.applyBack(params),
innerCompose: params => MyNumberValue.composeDownOperation(params),
});
if (myNumberValues.isError) {
return myNumberValues;
}
const valueProps: DownOperation = {

@@ -549,5 +157,2 @@ $version: 1,

),
boards: boards.value,
characters: characters.value,
myNumberValues: myNumberValues.value,
};

@@ -565,43 +170,7 @@ return Result.ok(valueProps);

const boards = RecordOperation.restore({
nextState: nextState.boards,
downOperation: downOperation.boards,
innerDiff: params => Board.diff(params),
innerRestore: params => Board.restore(params),
});
if (boards.isError) {
return boards;
}
const characters = RecordOperation.restore({
nextState: nextState.characters,
downOperation: downOperation.characters,
innerDiff: params => Character.diff(params),
innerRestore: params => Character.restore(params),
});
if (characters.isError) {
return characters;
}
const myNumberValues = RecordOperation.restore({
nextState: nextState.myNumberValues,
downOperation: downOperation.myNumberValues,
innerDiff: params => MyNumberValue.diff(params),
innerRestore: params => MyNumberValue.restore(params),
});
if (myNumberValues.isError) {
return myNumberValues;
}
const prevState: State = {
...nextState,
boards: boards.value.prevState,
characters: characters.value.prevState,
myNumberValues: myNumberValues.value.prevState,
};
const twoWayOperation: TwoWayOperation = {
$version: 1,
boards: boards.value.twoWayOperation,
characters: characters.value.twoWayOperation,
myNumberValues: myNumberValues.value.twoWayOperation,
};

@@ -631,22 +200,4 @@

}) => {
const boards = RecordOperation.diff({
prevState: prevState.boards,
nextState: nextState.boards,
innerDiff: params => Board.diff(params),
});
const characters = RecordOperation.diff({
prevState: prevState.characters,
nextState: nextState.characters,
innerDiff: params => Character.diff(params),
});
const myNumberValues = RecordOperation.diff({
prevState: prevState.myNumberValues,
nextState: nextState.myNumberValues,
innerDiff: params => MyNumberValue.diff(params),
});
const result: TwoWayOperation = {
$version: 1,
boards,
characters,
myNumberValues,
};

@@ -679,90 +230,4 @@ if (prevState.name !== nextState.name) {

}) => {
const boards = RecordOperation.serverTransform({
first: serverOperation?.boards,
second: clientOperation.boards,
prevState: prevState.boards,
nextState: currentState.boards,
innerTransform: ({ first, second, prevState, nextState }) =>
Board.serverTransform({
prevState,
currentState: nextState,
serverOperation: first,
clientOperation: second,
}),
toServerState: state => state,
cancellationPolicy: {
cancelCreate: () =>
!RequestedBy.createdByMe({
requestedBy,
userUid: participantKey,
}),
cancelUpdate: ({ key }) =>
!RequestedBy.createdByMe({
requestedBy,
userUid: participantKey,
}) && key !== activeBoardSecondKey,
cancelRemove: () =>
!RequestedBy.createdByMe({
requestedBy,
userUid: participantKey,
}),
},
});
if (boards.isError) {
return boards;
}
const characters = RecordOperation.serverTransform({
first: serverOperation?.characters,
second: clientOperation.characters,
prevState: prevState.characters,
nextState: currentState.characters,
innerTransform: ({ first, second, prevState, nextState }) =>
Character.serverTransform(
RequestedBy.createdByMe({
requestedBy,
userUid: participantKey,
})
)({
prevState,
currentState: nextState,
serverOperation: first,
clientOperation: second,
}),
toServerState: state => state,
cancellationPolicy: {},
});
if (characters.isError) {
return characters;
}
const myNumberValues = RecordOperation.serverTransform({
first: serverOperation?.myNumberValues,
second: clientOperation.myNumberValues,
prevState: prevState.myNumberValues,
nextState: currentState.myNumberValues,
innerTransform: ({ first, second, prevState, nextState }) =>
MyNumberValue.serverTransform(
RequestedBy.createdByMe({
requestedBy,
userUid: participantKey,
})
)({
prevState,
currentState: nextState,
serverOperation: first,
clientOperation: second,
}),
toServerState: state => state,
cancellationPolicy: {},
});
if (myNumberValues.isError) {
return myNumberValues;
}
const twoWayOperation: TwoWayOperation = {
$version: 1,
boards: boards.value,
characters: characters.value,
myNumberValues: myNumberValues.value,
};

@@ -797,62 +262,2 @@

}) => {
const boards = RecordOperation.clientTransform<
Board.State,
Board.UpOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.boards,
second: second.boards,
innerTransform: params => Board.clientTransform(params),
innerDiff: params => {
const diff = Board.diff(params);
if (diff == null) {
return diff;
}
return Board.toUpOperation(diff);
},
});
if (boards.isError) {
return boards;
}
const characters = RecordOperation.clientTransform<
Character.State,
Character.UpOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.characters,
second: second.characters,
innerTransform: params => Character.clientTransform(params),
innerDiff: params => {
const diff = Character.diff(params);
if (diff == null) {
return diff;
}
return Character.toUpOperation(diff);
},
});
if (characters.isError) {
return characters;
}
const myNumberValues = RecordOperation.clientTransform<
MyNumberValue.State,
MyNumberValue.UpOperation,
string | ApplyError<PositiveInt> | ComposeAndTransformError
>({
first: first.myNumberValues,
second: second.myNumberValues,
innerTransform: params => MyNumberValue.clientTransform(params),
innerDiff: params => {
const diff = MyNumberValue.diff(params);
if (diff == null) {
return diff;
}
return MyNumberValue.toUpOperation(diff);
},
});
if (myNumberValues.isError) {
return myNumberValues;
}
const name = ReplaceOperation.clientTransform({

@@ -870,5 +275,2 @@ first: first.name,

$version: 1,
boards: boards.value.firstPrime,
characters: characters.value.firstPrime,
myNumberValues: myNumberValues.value.firstPrime,
name: name.firstPrime,

@@ -880,5 +282,2 @@ role: role.firstPrime,

$version: 1,
boards: boards.value.secondPrime,
characters: characters.value.secondPrime,
myNumberValues: myNumberValues.value.secondPrime,
name: name.secondPrime,

@@ -885,0 +284,0 @@ role: role.secondPrime,

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc