@dra2020/baseclient 1.0.10 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/package.json +16 -15
  2. package/LICENSE +0 -21
  3. package/README.md +0 -26
  4. package/dist/all/all.d.ts +0 -20
  5. package/dist/baseclient.js +0 -10103
  6. package/dist/baseclient.js.map +0 -1
  7. package/dist/context/all.d.ts +0 -1
  8. package/dist/context/context.d.ts +0 -13
  9. package/dist/filterexpr/all.d.ts +0 -1
  10. package/dist/filterexpr/filterexpr.d.ts +0 -67
  11. package/dist/fsm/all.d.ts +0 -1
  12. package/dist/fsm/fsm.d.ts +0 -119
  13. package/dist/geo/all.d.ts +0 -2
  14. package/dist/geo/geo.d.ts +0 -67
  15. package/dist/geo/vfeature.d.ts +0 -4
  16. package/dist/logabstract/all.d.ts +0 -1
  17. package/dist/logabstract/log.d.ts +0 -26
  18. package/dist/logclient/all.d.ts +0 -1
  19. package/dist/logclient/log.d.ts +0 -6
  20. package/dist/ot-editutil/all.d.ts +0 -2
  21. package/dist/ot-editutil/oteditutil.d.ts +0 -14
  22. package/dist/ot-editutil/otmaputil.d.ts +0 -21
  23. package/dist/ot-js/all.d.ts +0 -9
  24. package/dist/ot-js/otarray.d.ts +0 -111
  25. package/dist/ot-js/otclientengine.d.ts +0 -38
  26. package/dist/ot-js/otcomposite.d.ts +0 -37
  27. package/dist/ot-js/otcounter.d.ts +0 -17
  28. package/dist/ot-js/otengine.d.ts +0 -22
  29. package/dist/ot-js/otmap.d.ts +0 -19
  30. package/dist/ot-js/otserverengine.d.ts +0 -38
  31. package/dist/ot-js/otsession.d.ts +0 -113
  32. package/dist/ot-js/ottypes.d.ts +0 -29
  33. package/dist/poly/all.d.ts +0 -15
  34. package/dist/poly/blend.d.ts +0 -1
  35. package/dist/poly/boundbox.d.ts +0 -16
  36. package/dist/poly/cartesian.d.ts +0 -5
  37. package/dist/poly/graham-scan.d.ts +0 -8
  38. package/dist/poly/hash.d.ts +0 -1
  39. package/dist/poly/matrix.d.ts +0 -24
  40. package/dist/poly/minbound.d.ts +0 -1
  41. package/dist/poly/poly.d.ts +0 -52
  42. package/dist/poly/polybin.d.ts +0 -5
  43. package/dist/poly/polylabel.d.ts +0 -7
  44. package/dist/poly/polypack.d.ts +0 -30
  45. package/dist/poly/polyround.d.ts +0 -1
  46. package/dist/poly/polysimplify.d.ts +0 -1
  47. package/dist/poly/quad.d.ts +0 -48
  48. package/dist/poly/selfintersect.d.ts +0 -1
  49. package/dist/poly/shamos.d.ts +0 -1
  50. package/dist/poly/simplify.d.ts +0 -2
  51. package/dist/poly/topo.d.ts +0 -46
  52. package/dist/poly/union.d.ts +0 -49
  53. package/dist/util/all.d.ts +0 -5
  54. package/dist/util/bintrie.d.ts +0 -93
  55. package/dist/util/countedhash.d.ts +0 -19
  56. package/dist/util/gradient.d.ts +0 -15
  57. package/dist/util/indexedarray.d.ts +0 -15
  58. package/dist/util/util.d.ts +0 -68
  59. package/docs/context.md +0 -2
  60. package/docs/filterexpr.md +0 -22
  61. package/docs/fsm.md +0 -243
  62. package/docs/logabstract.md +0 -2
  63. package/docs/logclient.md +0 -2
  64. package/docs/ot-editutil.md +0 -2
  65. package/docs/ot-js.md +0 -95
  66. package/docs/poly.md +0 -103
  67. package/docs/util.md +0 -2
  68. package/lib/all/all.ts +0 -21
  69. package/lib/context/all.ts +0 -1
  70. package/lib/context/context.ts +0 -82
  71. package/lib/filterexpr/all.ts +0 -1
  72. package/lib/filterexpr/filterexpr.ts +0 -699
  73. package/lib/fsm/all.ts +0 -1
  74. package/lib/fsm/fsm.ts +0 -559
  75. package/lib/geo/all.ts +0 -2
  76. package/lib/geo/geo.ts +0 -452
  77. package/lib/geo/vfeature.ts +0 -34
  78. package/lib/logabstract/all.ts +0 -1
  79. package/lib/logabstract/log.ts +0 -55
  80. package/lib/logclient/all.ts +0 -1
  81. package/lib/logclient/log.ts +0 -105
  82. package/lib/ot-editutil/all.ts +0 -2
  83. package/lib/ot-editutil/oteditutil.ts +0 -180
  84. package/lib/ot-editutil/otmaputil.ts +0 -209
  85. package/lib/ot-js/all.ts +0 -9
  86. package/lib/ot-js/otarray.ts +0 -1168
  87. package/lib/ot-js/otclientengine.ts +0 -327
  88. package/lib/ot-js/otcomposite.ts +0 -247
  89. package/lib/ot-js/otcounter.ts +0 -145
  90. package/lib/ot-js/otengine.ts +0 -71
  91. package/lib/ot-js/otmap.ts +0 -144
  92. package/lib/ot-js/otserverengine.ts +0 -329
  93. package/lib/ot-js/otsession.ts +0 -201
  94. package/lib/ot-js/ottypes.ts +0 -98
  95. package/lib/poly/all.ts +0 -15
  96. package/lib/poly/blend.ts +0 -27
  97. package/lib/poly/boundbox.ts +0 -102
  98. package/lib/poly/cartesian.ts +0 -130
  99. package/lib/poly/graham-scan.ts +0 -401
  100. package/lib/poly/hash.ts +0 -15
  101. package/lib/poly/matrix.ts +0 -309
  102. package/lib/poly/minbound.ts +0 -211
  103. package/lib/poly/poly.ts +0 -767
  104. package/lib/poly/polybin.ts +0 -218
  105. package/lib/poly/polylabel.ts +0 -204
  106. package/lib/poly/polypack.ts +0 -458
  107. package/lib/poly/polyround.ts +0 -30
  108. package/lib/poly/polysimplify.ts +0 -24
  109. package/lib/poly/quad.ts +0 -272
  110. package/lib/poly/selfintersect.ts +0 -87
  111. package/lib/poly/shamos.ts +0 -297
  112. package/lib/poly/simplify.ts +0 -119
  113. package/lib/poly/topo.ts +0 -499
  114. package/lib/poly/union.ts +0 -388
  115. package/lib/util/all.ts +0 -5
  116. package/lib/util/bintrie.ts +0 -603
  117. package/lib/util/countedhash.ts +0 -83
  118. package/lib/util/gradient.ts +0 -108
  119. package/lib/util/indexedarray.ts +0 -80
  120. package/lib/util/util.ts +0 -695
@@ -1,68 +0,0 @@
1
- export declare type DateString = string;
2
- export declare function Now(): DateString;
3
- export declare class Elapsed {
4
- tStart: any;
5
- tDur: any;
6
- constructor(bStart?: boolean);
7
- start(): void;
8
- end(): void;
9
- ms(): number;
10
- nano(): number;
11
- }
12
- export declare class MultiTimer {
13
- _overall: Elapsed;
14
- _segment: Elapsed;
15
- _msAggregate: number;
16
- constructor(bStart?: boolean);
17
- start(): void;
18
- end(): number;
19
- segstart(): void;
20
- segend(): number;
21
- get overall(): number;
22
- get aggregate(): number;
23
- }
24
- export declare class Deadline {
25
- msDelta: number;
26
- elapsed: Elapsed;
27
- constructor(msDelta: number);
28
- start(): void;
29
- done(): boolean;
30
- }
31
- export declare function createGuid(): string;
32
- export declare function sizeof(a: any): number;
33
- export declare function depthof(a: any): number;
34
- export declare function isEmpty(o: any): boolean;
35
- export declare function countKeys(o: any): number;
36
- export declare function nthProperty(o: any, n?: number): any;
37
- export declare function nthKey(o: any, n?: number): any;
38
- export declare function partialEqual(o: any, subset: any): boolean;
39
- export interface EqOptions {
40
- omitKey?: {
41
- [key: string]: boolean;
42
- };
43
- unorderedArrays?: boolean;
44
- emptyStringIsNull: boolean;
45
- }
46
- export declare function deepEqual(o1: any, o2: any, options?: EqOptions): boolean;
47
- export declare function prettyDate(d: Date): string;
48
- export declare function relativeDate(d: Date): string;
49
- export declare function recentDate(d: Date): string;
50
- export declare function textToHtml(sText: string): string;
51
- export declare function shallowCopy(src: any): any;
52
- export declare function shallowAssign(o1: any, o2: any): any;
53
- export declare function shallowDelete(o1: any, o2: any): any;
54
- export declare function shallowAssignImmutable(o1: any, o2: any): any;
55
- export declare function shallowEqual(o1: any, o2: any): boolean;
56
- export declare function deepCopy(src: any): any;
57
- export declare function deepAccum(accum: any, o: any): any;
58
- export declare function precisionRound(n: number, p: number): number;
59
- export declare function percentString(num: number, den: number, precision?: number): string;
60
- export declare function hash(s: string): number;
61
- export declare function hashObject(o: any): number;
62
- export declare function toHex(n: number): string;
63
- export declare function toRGBA(color: string, alpha: number): string;
64
- export declare function toRGBAIntensity(color: string, intensity: number, alpha: number): string;
65
- export declare function distance(x0: number, y0: number, x1: number, y1: number): number;
66
- export declare function deg2rad(num: number): number;
67
- export declare function rad2deg(num: number): number;
68
- export declare function wrapLon(lon: number): number;
package/docs/context.md DELETED
@@ -1,2 +0,0 @@
1
- # context
2
- Define environmental context for program execution.
@@ -1,22 +0,0 @@
1
- # filterexpr
2
- Simple utility class for applying a user-provided filtering expression against an object.
3
-
4
- ## FilterExpr
5
-
6
- Optionally initialize with expression to test against.
7
- Or call `set(expr: string)` to set the expression.
8
- The function `test(o: any)` will test the object against the expression.
9
-
10
- ## Expression syntax
11
-
12
- The simplest expression is just a string of text. If any field in the object contains the string, the pattern matches.
13
- All comparisons are case-insensitive.
14
-
15
- A quoted string can be used to hide special characters. Single or double quotes are allowed.
16
-
17
- Expressions can be combined with `not`, `and`, and `or`. Precedence is in that order.
18
-
19
- Expressions can be surrounded by parens to force a precedence interpretation.
20
-
21
- A field name can be specified to limit the comparison to a specific field. An example is `state: ma`. Field names are case-insensitive.
22
- Field name is lowest precedence, so `state: ma or tx` would constrain both strings to the `state` property.
package/docs/fsm.md DELETED
@@ -1,243 +0,0 @@
1
- # fsm
2
- Library for managing the execution of a linked tree of finite state machines.
3
-
4
- # Overview
5
-
6
- The `Fsm` library and class serves as the base class for chainable finite state machines.
7
-
8
- The library improves management of asynchronous work in several ways over more primitive syntactic approaches
9
- like plain callbacks, async/await, promises or async libraries. These include:
10
-
11
- - The state of your computation is managed as an explicit set of objects rather than
12
- an opaque mixture of callbacks and closures.
13
-
14
- - It is easy to model a computation that proceeds through multiple intermediate states rather
15
- than simply "in-process" or "done".
16
-
17
- - Computations (objects) can be built as a tree of dependent computations, effectively acting as a
18
- data-flow model, a natural way of describing many computations.
19
-
20
- - The mechanism integrates well with existing mechanisms like callbacks and promises.
21
-
22
- - A state machine more directly models how the computation is proceeding rather than syntactic models
23
- like async/await that explicitly try to hide the real control flow.
24
-
25
- - Requiring a class definition to represent the computation tends to facilitate reuse of the
26
- asynchronous logic rather than having callbacks sprinkled through the code base.
27
-
28
- A potential disadvantage of the FSM mechanism is that requiring a new subclass tends
29
- to have a heavier syntactic weight than
30
- mechanisms like simple callbacks.
31
- For some, this is an advantage in not trivializing the additional
32
- state complexity that an outstanding asynchronous computation represents for the application.
33
-
34
- The normal usage is to sub-class the Fsm base class and override the `tick` function to walk the
35
- state machine through its states.
36
-
37
- Each machine begins in the FSM_STARTING state.
38
- The `tick` function on the class gets scheduled to be called (asynchronously) initially after
39
- construction and then explicitly whenever
40
- the state changes (by a call to the class function `setState`).
41
-
42
- A subclass overrides the `tick` function to run the machine through its state transitions.
43
-
44
- Additionally, a finite state machine can `waitOn` another state machine.
45
- When that machine is marked complete (either `FSM_DONE` or `FSM_ERROR`),
46
- any machines waiting on that state machine get scheduled to have their `tick` function called as well.
47
-
48
- A machine is `ready` when all `Fsm`'s it is waiting on have been marked complete.
49
-
50
- The `tick` function of a dependent state machine is called whenever any machine it is waiting on completes,
51
- but normally the `tick` function only performs activity when the machine is `ready`.
52
-
53
- Most usage involves the `tick` function first testing if it is `ready` before doing any activity,
54
- although a usage that wanted to take action whenever any waitedOn dependent completes might omit that test
55
- (e.g. to race multiple asynchronous operations and use whichever result completes first or
56
- immediately complete if any one of several outstanding dependents fail).
57
-
58
- For example, this is typical usage:
59
-
60
- ```javascript
61
- tick(): void
62
- {
63
- if (this.ready)
64
- {
65
- // all dependents are complete, take action now
66
- }
67
- }
68
- ```
69
-
70
- Of course, a state machine can go from `ready` to not `ready` as many times as necessary simply by waiting on
71
- some new `Fsm` within its `tick` function.
72
-
73
- Normally a Fsm-based class does not fire off any activity until the first time its `tick` function is called (rather than
74
- in the constructor).
75
-
76
- So,
77
-
78
- ```javascript
79
- constructor(env: Environment)
80
- {
81
- super(env);
82
- // Don't do any real work here.
83
- }
84
-
85
- tick(): void
86
- {
87
- if (this.ready)
88
- {
89
- switch (this.state)
90
- {
91
- case FSM_STARTING:
92
- // Kick off activity here
93
- break;
94
- }
95
- }
96
- }
97
- ```
98
-
99
- That is not a requirement but increases flexibility by allowing clients to construct the Fsm and
100
- then add dependents it must wait on before any activity is kicked off.
101
-
102
- The infrastructure only cares about the starting state FSM_STARTING and the completion states `FSM_ERROR` and `FSM_DONE`.
103
- Any other state values can
104
- be used internally to a state machine to manage walking through different active states prior to completion.
105
- For convenenience, the names `FSM_CUSTOM1` through `FSM_CUSTOM9` are predefined and internal states can use these
106
- values (typically assigned to something semantically meaningful) however they wish.
107
-
108
- The state `FSM_PENDING` has no special meaning but is defined for convenience since many state machines go through
109
- a single intermediate state (`FSM_STARTING` to `FSM_PENDING` to `FSM_DONE`).
110
-
111
- Callbacks can be integrated easily by having the callback set the `Fsm` state, which allows either completion
112
- notification to any other waiting state machines or the next step in the current state machine to be executed.
113
-
114
- ```javascript
115
- tick(): void
116
- {
117
- if (this.ready)
118
- {
119
- switch (this.state)
120
- {
121
- case FSM_STARTING:
122
- asyncAPIWithCallback((err: any, result: any) => {
123
- if (err)
124
- this.setState(FSM_ERROR);
125
- else
126
- this.setState(FSM_DONE);
127
- });
128
- break;
129
- }
130
- }
131
- }
132
- ```
133
-
134
- or
135
-
136
- ```javascript
137
- tick(): void
138
- {
139
- if (this.ready)
140
- {
141
- switch (this.state)
142
- {
143
- case FSM_STARTING:
144
- asyncAPIWithCallback((err: any, result: any) => {
145
- if (err)
146
- this.setState(FSM_ERROR);
147
- else
148
- this.setState(FSM_PENDING);
149
- });
150
- break;
151
-
152
- case FSM_PENDING:
153
- // Do more stuff here now that callback has completed.
154
- break;
155
- }
156
- }
157
- }
158
- ```
159
-
160
-
161
- ### isDependentError
162
-
163
- When an `Fsm` that is being waited on completes with an error, any waiting `Fsm`'s get the `isDependentError` flag set
164
- and of course get a chance to run their `tick` function (since the dependent `Fsm` has completed).
165
-
166
- They can decide if the semantics of the relationship then requires them to propagate, consume or otherwise handle the
167
- error. No other error propagation happens automatically.
168
- So:
169
-
170
- ```javascript
171
- tick(): void
172
- {
173
- if (this.ready && this.isDependentError)
174
- this.setState(FSM_ERROR);
175
- else if (this.ready)
176
- {
177
- // Normal code here
178
- }
179
- }
180
- ```
181
-
182
- would explicitly immediately propagate a dependent error.
183
-
184
- Note that the check above to test whether the state machine is `ready` before `isDependentError` is to ensure you do not
185
- loop continuously resetting the state to FSM_ERROR on each `tick` invocation.
186
-
187
- ### Reuse
188
-
189
- An `Fsm` can be reused and transition from `ready` to not `ready` or `done` to not `done`.
190
-
191
-
192
- ### Cancellation
193
-
194
- There is no explicit cancellation mechanism.
195
-
196
- By convention, a sub-class should override the `end` member function to allow external cancellation or completion.
197
- By default this function sets the `Fsm` to `FSM_DONE` but can optionally take the `FSM_ERROR` state
198
- to indicate error.
199
-
200
- Whether calling `end` or setting the state explicitly to `FSM_DONE` or `FSM_ERROR` from external to
201
- the state machine makes semantic sense depends on the specific properties and semantics of the computation.
202
-
203
- ### FsmOnDone
204
-
205
- A simple utility class `FsmOnDone` provides a way of integrating a callback with an Fsm-based infrastructor.
206
-
207
- The FsmOnDone class will wait till the `Fsm` passed to the constructor completes and then call the provided
208
- callback, passing the completed Fsm as the argument.
209
-
210
- ```javascript
211
- let fsm = new FsmOnDone(env, fsmWait, (fsmWait: Fsm) => {
212
- /* do stuff with fsmWait since it is now complete */
213
- });
214
- ```
215
-
216
- ### FsmSleep
217
-
218
- `FsmSleep` is a simple utility class that creates a dependency that is marked done after
219
- the number of milliseconds passed to the constructor.
220
-
221
- So:
222
-
223
- ```javascript
224
- fsm.waitOn(new FsmSleep(env, 1000));
225
- ```
226
-
227
- will result in the object `fsm` having a dependency that will complete in 1000ms.
228
-
229
- ### FsmLoop
230
-
231
- `FsmLoop` is a simple utility class to run an asynchronous process in a loop at some maximum rate.
232
- It waits for the `Fsm` passed in to complete, then uses `FsmSleep` to wait until the specified
233
- minimum interval is complete (starting when the `Fsm` started executing)and restarts the `Fsm`.
234
- It is required that the `Fsm` properly handles going from the `FSM_DONE` state back to `FSM_STARTING`.
235
-
236
- ### FsmArray
237
-
238
- `FsmArray` is a simple utility class that provides a mechanism for waiting for a stream of
239
- objects to appear in an array and consuming them, repeatedly.
240
- It will be marked `done` when any content is made available in the array (through the member `a`)
241
- by calling `push` or `concat`.
242
- When the content is consumed, it should be removed with `splice` or `reset`.
243
- At this point, the `Fsm` will be placed back in the `starting` state and can be waited on again.
@@ -1,2 +0,0 @@
1
- # logabstract
2
- Abstract interface for logging.
package/docs/logclient.md DELETED
@@ -1,2 +0,0 @@
1
- # logclient
2
- Client-side implementation of logging abstraction.
@@ -1,2 +0,0 @@
1
- # ot-editutil
2
- Utility library for Operational Transform implementation.
package/docs/ot-js.md DELETED
@@ -1,95 +0,0 @@
1
- # ot-js
2
- This is a JavaScript version of a basic OT library that implements OT for strings, basic arrays and maps (dictionaries).
3
- It presumes the approach used in Google Wave where a basic resource implements the key actions of "transform" and
4
- "compose". Clients serialize through a central server (which transforms as necessary when the client changes were not
5
- based off the tip). Clients receive the edit stream from the server and transform as necessary to update their local state.
6
- As with Google Wave, this presumes only a single edit action is outstanding at each client (local edits are composed and
7
- queued up until the outstanding action is acknowledged by the server).
8
-
9
- This library also provides a general framework for extending to other data types, although requires that these data types
10
- be well-known to the server and the client.
11
-
12
- This code serves as the basis for both the server and the client implementation of OT (there is an example implementation
13
- of both at dra2020/ot-js-server).
14
-
15
- The basic structure is that a set of client interacts with the server to establish a composite resource made up of
16
- named strings, arrays and maps that represent the shared client state. Clients submit "edits" to these resources and
17
- the server mediates these, applying the basic OT algorithm to transform incoming events and the dispatch them to all
18
- the clients.
19
-
20
- The key types are described below.
21
-
22
- ## IOTResource (ottypes.ts)
23
-
24
- This TypeScript interface defines the core functions necessary to implement OT for a new resource type.
25
- The key function is "transform" which implements the core OT algorithm for this type. Note it takes a second boolean argument,
26
- "bPrior" which indicates whether the argument will be applied prior to this one in the canonical server ordering.
27
- This can be used to disambiguate situations that are otherwise ambiguous (e.g. classically, which action gets precedence
28
- when two insertions occur at the same location). (Is the final canonical result "ab" or "ba"?)
29
-
30
- The other key function with some complexity is "compose" which composes two operations into a new single operation
31
- that achieves the same final effect. This is key to actually implementing the overall system as well as for efficiency.
32
-
33
- Each resource defines an "edits" array which is composed of generic JavaScript objects suitable for serialization. This
34
- array is passed "as is" as the definition of the operation that needs to be performed.
35
-
36
- Each resource has a "name" which is used to support a composite collection of resources accessed by name.
37
-
38
- Each resource has an "underlyingType" which defines the mechanism by which the appropriate resource class is instantiated
39
- at the client and the server. The mechanism is extensible but requires that these be "well known" and pre-shared
40
- between client and server.
41
-
42
- ## OTResourceBase (ottypes.ts)
43
-
44
- This class implements the IOTResource interface and provides some additional useful utility functions. All new types should
45
- extend from this class.
46
-
47
- ## OTCompositeResource (otcomposite.ts)
48
-
49
- OTCompositeResource provides the mechanism for grouping a set of resources together, referenced by name. The client/server
50
- engine implementation assume OTCompositeResource is the base resource shared between instances.
51
-
52
- ## OTArrayLikeResource (otarray.ts)
53
-
54
- OTArrayLikeResource is the base class for array-like data types that support insert, delete, retain, cursor and set. This
55
- class is further subclassed to support strings and generic arrays. This implements the guts of the hard OT algorithm for
56
- strings.
57
-
58
- ## OTStringResource (otarray.ts)
59
-
60
- Implements a shared string (e.g. for editing plain text).
61
-
62
- ## OTArrayResource (otarray.ts)
63
-
64
- Implements a shared array. The content of any specific entry in the array can be any serializable JSON object, although
65
- the update to the object must be effectively atomic - there is no internal semantics around updating the value.
66
-
67
- ## OTMapResource (otmap.ts)
68
-
69
- Implements a basic associative array with set and delete operations. Like OTArrayResource, the base data type can be any
70
- serializable object but is always updated atomically.
71
-
72
- ## OTCounterResource (otcounter.ts)
73
-
74
- Implements a basic associative array with add and delete operations. The values associated with the keys are integer counters
75
- and the "add" operation increments (or decrements) the underlying value. Obviously this composes and transforms trivially.
76
-
77
- ## OTClientEngine (otclientengine.ts)
78
-
79
- Implements the core client semantics of the OT process, as implemented in Google Wave. The core functions here are "addLocal"
80
- which adds a local change to the local state and prepares it for sending to the server and "addRemote" which receives
81
- an event from the server applies it to the local state. That event might be a response to sending up a local event.
82
-
83
- The function "getPending" indicates when a pending event is available for send.
84
-
85
- The client engine implements the required core semantics for the Google Wave OT implementation (which requires that any
86
- local changes are queued locally while there is an outstanding request to the server). This logic here is a bit tricky so the
87
- implementation here is critical to getting OT right.
88
-
89
-
90
- ## OTServerEngine (otserverengine.ts)
91
-
92
- Implements the server processing (through the core function "addServer") for implementing the client-server OT algorithm.
93
- The core model here is that the client can submit an event against an old state of the server as long as the server can
94
- appropriately transform the event in order to apply it to the local state. This requires maintaining some ongoing log
95
- of all states and events.
package/docs/poly.md DELETED
@@ -1,103 +0,0 @@
1
- # poly
2
- Small utility library of convenient polygon functions used for geojson project.
3
-
4
- These library functions all take either a GeoJSON polygon or multipolygon feature
5
- or take a bare set of points (in the same basic format as either the GeoJSON
6
- polygon). Look to the reference but basically, a polygon is an array whose first
7
- member is the outer ring and subsequent members are the internal holes.
8
-
9
- A multipolygon is just an array of polygons.
10
-
11
- A ring is an array of points. The array should be at least 4 points long and the
12
- first and last points should be equal.
13
-
14
- A point is an array of lon, lat (that is, x, y).
15
-
16
- ### Earth Radius
17
- export declare const EARTH_RADIUS = 6371000;
18
-
19
- ### polyNormalize
20
- export declare function polyNormalize(poly: any): any;
21
-
22
- Used internally to normalize the input for subsequent processing. Exposed
23
- if you want to be consistent. The result is either null or the points
24
- array in multi-polygon format.
25
-
26
- ### polyArea
27
- export declare function polyArea(poly: any): number;
28
-
29
- Compute the area of the polygon in meters squared.
30
-
31
- ### polyPerimeter
32
- export declare function polyPerimeter(poly: any): number;
33
-
34
- Compute the perimeter of a polygon in meters.
35
-
36
- ### Circle class
37
- export declare class Circle {
38
- x: number;
39
- y: number;
40
- r: number;
41
- constructor(x: number, y: number, r: number);
42
- }
43
-
44
- Used for subsequent functions.
45
-
46
- ### polyToCircle
47
-
48
- export declare function polyToCircle(poly: any): Circle | null;
49
-
50
- Return smallest circle that encloses all points.
51
-
52
- ### polyToPolsbyPopperCircle
53
-
54
- export declare function polyToPolsbyPopperCircle(poly: any): Circle | null;
55
-
56
- Returns circle whose perimeter is equal to the perimeter of the bounding perimeter
57
- of the polygon.
58
-
59
- ### polyFromCircle
60
-
61
- export declare function polyFromCircle(c: Circle, nSegments?: number): any;
62
-
63
- Return a polygon (in normalized form) that approximates the circle provided.
64
- NSegments specifies the number of segments to use (must be at least 8).
65
-
66
- ### polyConvexHull
67
-
68
- export declare function polyConvexHull(poly: any): any;
69
-
70
- A.M. Andrew's monotone chain 2D convex hull algorithm.
71
-
72
- ### Compactness Description
73
- export interface CompactnessDescription {
74
- value: number;
75
- reock: number;
76
- polsby_popper: number;
77
- convex_hull: number;
78
- schwartzberg: number;
79
- }
80
-
81
- Type returned from polyCompactness function.
82
-
83
- ### polyCompactness
84
-
85
- export declare function polyCompactness(poly: any): CompactnessDescription;
86
-
87
- Compute the compactness of the polygon.
88
-
89
- ### PolyDescription
90
-
91
- export interface PolyDescription {
92
- npoly: number;
93
- nhole: number;
94
- npoint: number;
95
- }
96
-
97
- Type returned from polyDescribe.
98
-
99
- ### polyDescribe
100
-
101
- export declare function polyDescribe(poly: any): PolyDescription;
102
-
103
- Describe the given polygon.
package/docs/util.md DELETED
@@ -1,2 +0,0 @@
1
- # util
2
- A variety of simple utility functions for Javascript projects.
package/lib/all/all.ts DELETED
@@ -1,21 +0,0 @@
1
- // Client and Server
2
- import * as Util from '../util/all';
3
- export { Util };
4
- import * as Context from '../context/all';
5
- export { Context };
6
- import * as FSM from '../fsm/all';
7
- export { FSM };
8
- import * as Poly from '../poly/all';
9
- export { Poly };
10
- import * as LogAbstract from '../logabstract/all';
11
- export { LogAbstract };
12
- import * as LogClient from '../logclient/all';
13
- export { LogClient };
14
- import * as OT from '../ot-js/all';
15
- export { OT };
16
- import * as OTE from '../ot-editutil/all';
17
- export { OTE };
18
- import { FilterExpr } from '../filterexpr/all';
19
- export { FilterExpr }
20
- import * as G from '../geo/all';
21
- export { G };
@@ -1 +0,0 @@
1
- export * from './context';
@@ -1,82 +0,0 @@
1
- import * as Util from '../util/all';
2
-
3
- export type ContextValues = { [key: string]: any };
4
- export interface IContext
5
- {
6
- setDefaults: (o: ContextValues) => void
7
- setValues: (o: ContextValues) => void
8
- xvalue: (prop: string) => any
9
- xset: (prop: string) => boolean
10
- xflag: (prop: string) => boolean
11
- xnumber: (prop: string) => number
12
- xstring: (prop: string) => string
13
- }
14
-
15
- class Context implements IContext
16
- {
17
- private values: ContextValues;
18
- private defaults: ContextValues;
19
-
20
- constructor()
21
- {
22
- this.values = {};
23
- this.defaults = {};
24
- }
25
-
26
- setValues(o: ContextValues): void
27
- {
28
- this.values = Util.shallowAssignImmutable(this.values, o);
29
- }
30
-
31
- setDefaults(o: ContextValues): void
32
- {
33
- this.defaults = Util.shallowAssignImmutable(this.defaults, o);
34
- }
35
-
36
- xvalue(prop: string): any
37
- {
38
- let v: any = this.values[prop];
39
- if (v === undefined && process && process.env)
40
- v = process.env[prop.toUpperCase()];
41
- if (v === undefined)
42
- v = this.defaults[prop];
43
- return v;
44
- }
45
-
46
- xset(prop: string): boolean
47
- {
48
- let v: any = this.values[prop];
49
- if (v === undefined && process && process.env)
50
- v = process.env[prop.toUpperCase()];
51
- return v !== undefined;
52
- }
53
-
54
- xflag(prop: string): boolean
55
- {
56
- let v: any = this.xvalue(prop);
57
- if (v === undefined || v === null)
58
- return false;
59
- return Number(v) != 0;
60
- }
61
-
62
- xnumber(prop: string): number
63
- {
64
- let v: any = this.xvalue(prop);
65
- if (v === undefined || v === null)
66
- return 0;
67
- return Number(v);
68
- }
69
-
70
- xstring(prop: string): string
71
- {
72
- let v: any = this.xvalue(prop);
73
- if (v === undefined || v === null)
74
- return null;
75
- return String(v);
76
- }
77
- }
78
-
79
- export function create(): IContext
80
- {
81
- return new Context();
82
- }
@@ -1 +0,0 @@
1
- export * from './filterexpr';