@verdant-web/common 1.15.3-next.0 → 1.15.3

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 (151) hide show
  1. package/dist/cjs/EventSubscriber.d.ts +17 -17
  2. package/dist/cjs/EventSubscriber.js +66 -66
  3. package/dist/cjs/baseline.d.ts +5 -5
  4. package/dist/cjs/baseline.js +2 -2
  5. package/dist/cjs/batching.d.ts +42 -42
  6. package/dist/cjs/batching.js +91 -91
  7. package/dist/cjs/files.d.ts +19 -19
  8. package/dist/cjs/files.js +18 -18
  9. package/dist/cjs/index.d.ts +19 -19
  10. package/dist/cjs/index.js +41 -41
  11. package/dist/cjs/indexes.d.ts +17 -17
  12. package/dist/cjs/indexes.js +142 -142
  13. package/dist/cjs/indexes.test.d.ts +1 -1
  14. package/dist/cjs/indexes.test.js +127 -127
  15. package/dist/cjs/migration.d.ts +172 -172
  16. package/dist/cjs/migration.js +301 -301
  17. package/dist/cjs/oids.d.ts +100 -100
  18. package/dist/cjs/oids.js +457 -457
  19. package/dist/cjs/oids.test.d.ts +1 -1
  20. package/dist/cjs/oids.test.js +348 -348
  21. package/dist/cjs/operation.d.ts +139 -139
  22. package/dist/cjs/operation.js +545 -545
  23. package/dist/cjs/operation.test.d.ts +1 -1
  24. package/dist/cjs/operation.test.js +529 -529
  25. package/dist/cjs/patch.d.ts +26 -26
  26. package/dist/cjs/patch.js +226 -226
  27. package/dist/cjs/presence.d.ts +27 -27
  28. package/dist/cjs/presence.js +2 -2
  29. package/dist/cjs/protocol.d.ts +145 -145
  30. package/dist/cjs/protocol.js +3 -3
  31. package/dist/cjs/refs.d.ts +7 -7
  32. package/dist/cjs/refs.js +29 -29
  33. package/dist/cjs/replica.d.ts +28 -28
  34. package/dist/cjs/replica.js +28 -28
  35. package/dist/cjs/schema/defaults.test.d.ts +1 -1
  36. package/dist/cjs/schema/defaults.test.js +20 -20
  37. package/dist/cjs/schema/fields.d.ts +9 -9
  38. package/dist/cjs/schema/fields.js +144 -144
  39. package/dist/cjs/schema/index.d.ts +8 -8
  40. package/dist/cjs/schema/index.js +51 -51
  41. package/dist/cjs/schema/indexFilters.d.ts +6 -6
  42. package/dist/cjs/schema/indexFilters.js +30 -30
  43. package/dist/cjs/schema/types/collection.d.ts +23 -23
  44. package/dist/cjs/schema/types/collection.js +2 -2
  45. package/dist/cjs/schema/types/compounds.d.ts +11 -11
  46. package/dist/cjs/schema/types/compounds.js +2 -2
  47. package/dist/cjs/schema/types/fields.d.ts +75 -75
  48. package/dist/cjs/schema/types/fields.js +2 -2
  49. package/dist/cjs/schema/types/filters.d.ts +29 -29
  50. package/dist/cjs/schema/types/filters.js +2 -2
  51. package/dist/cjs/schema/types/shapes.d.ts +21 -21
  52. package/dist/cjs/schema/types/shapes.js +2 -2
  53. package/dist/cjs/schema/types/synthetics.d.ts +37 -37
  54. package/dist/cjs/schema/types/synthetics.js +2 -2
  55. package/dist/cjs/schema/types.d.ts +18 -18
  56. package/dist/cjs/schema/types.js +22 -22
  57. package/dist/cjs/schema/validation.d.ts +3 -3
  58. package/dist/cjs/schema/validation.js +86 -86
  59. package/dist/cjs/timestamp.d.ts +50 -50
  60. package/dist/cjs/timestamp.js +251 -251
  61. package/dist/cjs/timestamp.test.d.ts +1 -1
  62. package/dist/cjs/timestamp.test.js +104 -104
  63. package/dist/cjs/undo.d.ts +3 -3
  64. package/dist/cjs/undo.js +198 -198
  65. package/dist/cjs/utils.d.ts +20 -20
  66. package/dist/cjs/utils.js +145 -145
  67. package/dist/cjs/utils.test.d.ts +1 -1
  68. package/dist/cjs/utils.test.js +36 -36
  69. package/dist/esm/EventSubscriber.d.ts +17 -17
  70. package/dist/esm/EventSubscriber.js +62 -62
  71. package/dist/esm/baseline.d.ts +5 -5
  72. package/dist/esm/baseline.js +1 -1
  73. package/dist/esm/batching.d.ts +42 -42
  74. package/dist/esm/batching.js +86 -86
  75. package/dist/esm/files.d.ts +19 -19
  76. package/dist/esm/files.js +12 -12
  77. package/dist/esm/index.d.ts +19 -19
  78. package/dist/esm/index.js +16 -16
  79. package/dist/esm/indexes.d.ts +17 -17
  80. package/dist/esm/indexes.js +130 -130
  81. package/dist/esm/indexes.test.d.ts +1 -1
  82. package/dist/esm/indexes.test.js +125 -125
  83. package/dist/esm/migration.d.ts +172 -172
  84. package/dist/esm/migration.js +294 -294
  85. package/dist/esm/oids.d.ts +100 -100
  86. package/dist/esm/oids.js +422 -422
  87. package/dist/esm/oids.test.d.ts +1 -1
  88. package/dist/esm/oids.test.js +346 -346
  89. package/dist/esm/operation.d.ts +139 -139
  90. package/dist/esm/operation.js +530 -530
  91. package/dist/esm/operation.test.d.ts +1 -1
  92. package/dist/esm/operation.test.js +527 -527
  93. package/dist/esm/patch.d.ts +26 -26
  94. package/dist/esm/patch.js +222 -222
  95. package/dist/esm/presence.d.ts +27 -27
  96. package/dist/esm/presence.js +1 -1
  97. package/dist/esm/protocol.d.ts +145 -145
  98. package/dist/esm/protocol.js +2 -2
  99. package/dist/esm/refs.d.ts +7 -7
  100. package/dist/esm/refs.js +22 -22
  101. package/dist/esm/replica.d.ts +28 -28
  102. package/dist/esm/replica.js +25 -25
  103. package/dist/esm/schema/defaults.test.d.ts +1 -1
  104. package/dist/esm/schema/defaults.test.js +18 -18
  105. package/dist/esm/schema/fields.d.ts +9 -9
  106. package/dist/esm/schema/fields.js +133 -133
  107. package/dist/esm/schema/index.d.ts +8 -8
  108. package/dist/esm/schema/index.js +32 -32
  109. package/dist/esm/schema/indexFilters.d.ts +6 -6
  110. package/dist/esm/schema/indexFilters.js +22 -22
  111. package/dist/esm/schema/types/collection.d.ts +23 -23
  112. package/dist/esm/schema/types/collection.js +1 -1
  113. package/dist/esm/schema/types/compounds.d.ts +11 -11
  114. package/dist/esm/schema/types/compounds.js +1 -1
  115. package/dist/esm/schema/types/fields.d.ts +75 -75
  116. package/dist/esm/schema/types/fields.js +1 -1
  117. package/dist/esm/schema/types/filters.d.ts +29 -29
  118. package/dist/esm/schema/types/filters.js +1 -1
  119. package/dist/esm/schema/types/shapes.d.ts +21 -21
  120. package/dist/esm/schema/types/shapes.js +1 -1
  121. package/dist/esm/schema/types/synthetics.d.ts +37 -37
  122. package/dist/esm/schema/types/synthetics.js +1 -1
  123. package/dist/esm/schema/types.d.ts +18 -18
  124. package/dist/esm/schema/types.js +6 -6
  125. package/dist/esm/schema/validation.d.ts +3 -3
  126. package/dist/esm/schema/validation.js +81 -81
  127. package/dist/esm/timestamp.d.ts +50 -50
  128. package/dist/esm/timestamp.js +234 -234
  129. package/dist/esm/timestamp.test.d.ts +1 -1
  130. package/dist/esm/timestamp.test.js +102 -102
  131. package/dist/esm/undo.d.ts +3 -3
  132. package/dist/esm/undo.js +194 -194
  133. package/dist/esm/utils.d.ts +20 -20
  134. package/dist/esm/utils.js +127 -127
  135. package/dist/esm/utils.test.d.ts +1 -1
  136. package/dist/esm/utils.test.js +34 -34
  137. package/dist/tsconfig-cjs.tsbuildinfo +1 -1
  138. package/dist/tsconfig.tsbuildinfo +1 -1
  139. package/package.json +1 -1
  140. package/dist/cjs/files.test.d.ts +0 -1
  141. package/dist/cjs/files.test.js +0 -81
  142. package/dist/cjs/files.test.js.map +0 -1
  143. package/dist/cjs/schema/defaults.d.ts +0 -4
  144. package/dist/cjs/schema/defaults.js +0 -72
  145. package/dist/cjs/schema/defaults.js.map +0 -1
  146. package/dist/esm/files.test.d.ts +0 -1
  147. package/dist/esm/files.test.js +0 -79
  148. package/dist/esm/files.test.js.map +0 -1
  149. package/dist/esm/schema/defaults.d.ts +0 -4
  150. package/dist/esm/schema/defaults.js +0 -66
  151. package/dist/esm/schema/defaults.js.map +0 -1
@@ -1,145 +1,145 @@
1
- import { DocumentBaseline } from './baseline.js';
2
- import { Operation } from './operation.js';
3
- import { UserInfo } from './presence.js';
4
- export declare type HeartbeatMessage = {
5
- type: 'heartbeat';
6
- timestamp: string;
7
- replicaId: string;
8
- };
9
- export declare type HeartbeatResponseMessage = {
10
- type: 'heartbeat-response';
11
- };
12
- /**
13
- * Used by clients to indicate they have
14
- * successfully applied all operations from the
15
- * server up to this one. Uses the nonce from the
16
- * operation rebroadcast message as the ack.
17
- */
18
- export declare type AckMessage = {
19
- type: 'ack';
20
- replicaId: string;
21
- timestamp?: string;
22
- nonce?: string;
23
- };
24
- export declare type OperationMessage = {
25
- type: 'op';
26
- replicaId: string;
27
- operations: Operation[];
28
- timestamp: string;
29
- };
30
- export declare type OperationRebroadcastMessage = {
31
- type: 'op-re';
32
- operations: Operation[];
33
- baselines: DocumentBaseline[];
34
- replicaId: string;
35
- globalAckTimestamp: string | undefined;
36
- ackThisNonce?: string;
37
- };
38
- export declare type SyncMessage = {
39
- type: 'sync';
40
- /** This client's replica ID */
41
- replicaId: string;
42
- /** the logical time this message was sent */
43
- timestamp: string;
44
- /** Any new operations created since the requested time */
45
- operations: Operation[];
46
- /** Any new baselines created since the requested time */
47
- baselines: DocumentBaseline[];
48
- /** the schema version known by this client */
49
- schemaVersion: number;
50
- /**
51
- * the client may have lost its local data, in which
52
- * case it may set this flag to be treated as a new client
53
- * and receive a full baseline
54
- */
55
- resyncAll?: boolean;
56
- /**
57
- * timestamp of when the replica changes began. null means
58
- * full changeset from start of time
59
- */
60
- since: string | null;
61
- };
62
- export declare type SyncResponseMessage = {
63
- type: 'sync-resp';
64
- operations: Operation[];
65
- baselines: DocumentBaseline[];
66
- /**
67
- * If this flag is set, the client should discard local data
68
- * and reset to incoming data only. Used when a client requested
69
- * resyncAll in its sync message, or for clients which have been
70
- * offline for too long. When specified true, provideChangesSince
71
- * should be ignored.
72
- */
73
- overwriteLocalData: boolean;
74
- /**
75
- * Update client on the global ack
76
- */
77
- globalAckTimestamp: string | undefined;
78
- /**
79
- * A map of connected clients' presences values
80
- */
81
- peerPresence: Record<string, UserInfo<any, any>>;
82
- /**
83
- * The timestamp sent in the original sync message -
84
- * this confirms the server has received the client's
85
- * state up to this point. Subsequent syncs should not
86
- * include operations or baselines older than this timestamp.
87
- */
88
- ackedTimestamp: string;
89
- /**
90
- * The client should respond with a sync-ack containing
91
- * this nonce to confirm it has received this message if
92
- * it is not undefined
93
- */
94
- ackThisNonce?: string;
95
- };
96
- /** @deprecated use ack */
97
- export declare type SyncAckMessage = {
98
- type: 'sync-ack';
99
- /** The client's replica ID */
100
- replicaId: string;
101
- /** the logical time this message was sent */
102
- timestamp: string;
103
- /** the nonce sent in the sync-resp message */
104
- nonce: string;
105
- };
106
- export declare type PresenceUpdateMessage = {
107
- type: 'presence-update';
108
- /** The client's replica ID */
109
- replicaId: string;
110
- /** new presence value */
111
- presence: any;
112
- };
113
- export declare type PresenceChangedMessage = {
114
- type: 'presence-changed';
115
- /** The client's replica ID */
116
- replicaId: string;
117
- userInfo: UserInfo<any, any>;
118
- };
119
- /**
120
- * This is only emitted when all of a user's replicas
121
- * go offline.
122
- */
123
- export declare type PresenceOfflineMessage = {
124
- type: 'presence-offline';
125
- userId: string;
126
- /** The last replicaID seen by the server before the user was offline */
127
- replicaId: string;
128
- };
129
- export declare type GlobalAckMessage = {
130
- type: 'global-ack';
131
- timestamp: string;
132
- };
133
- export declare type ForbiddenMessage = {
134
- type: 'forbidden';
135
- };
136
- export declare type ServerAckMessage = {
137
- type: 'server-ack';
138
- timestamp: string;
139
- };
140
- export declare type ServerNeedSinceMessage = {
141
- type: 'need-since';
142
- since: string | null;
143
- };
144
- export declare type ClientMessage = HeartbeatMessage | SyncMessage | OperationMessage | AckMessage | SyncAckMessage | PresenceUpdateMessage;
145
- export declare type ServerMessage = HeartbeatResponseMessage | SyncResponseMessage | OperationRebroadcastMessage | PresenceChangedMessage | PresenceOfflineMessage | GlobalAckMessage | ForbiddenMessage | ServerAckMessage | ServerNeedSinceMessage;
1
+ import { DocumentBaseline } from './baseline.js';
2
+ import { Operation } from './operation.js';
3
+ import { UserInfo } from './presence.js';
4
+ export declare type HeartbeatMessage = {
5
+ type: 'heartbeat';
6
+ timestamp: string;
7
+ replicaId: string;
8
+ };
9
+ export declare type HeartbeatResponseMessage = {
10
+ type: 'heartbeat-response';
11
+ };
12
+ /**
13
+ * Used by clients to indicate they have
14
+ * successfully applied all operations from the
15
+ * server up to this one. Uses the nonce from the
16
+ * operation rebroadcast message as the ack.
17
+ */
18
+ export declare type AckMessage = {
19
+ type: 'ack';
20
+ replicaId: string;
21
+ timestamp?: string;
22
+ nonce?: string;
23
+ };
24
+ export declare type OperationMessage = {
25
+ type: 'op';
26
+ replicaId: string;
27
+ operations: Operation[];
28
+ timestamp: string;
29
+ };
30
+ export declare type OperationRebroadcastMessage = {
31
+ type: 'op-re';
32
+ operations: Operation[];
33
+ baselines: DocumentBaseline[];
34
+ replicaId: string;
35
+ globalAckTimestamp: string | undefined;
36
+ ackThisNonce?: string;
37
+ };
38
+ export declare type SyncMessage = {
39
+ type: 'sync';
40
+ /** This client's replica ID */
41
+ replicaId: string;
42
+ /** the logical time this message was sent */
43
+ timestamp: string;
44
+ /** Any new operations created since the requested time */
45
+ operations: Operation[];
46
+ /** Any new baselines created since the requested time */
47
+ baselines: DocumentBaseline[];
48
+ /** the schema version known by this client */
49
+ schemaVersion: number;
50
+ /**
51
+ * the client may have lost its local data, in which
52
+ * case it may set this flag to be treated as a new client
53
+ * and receive a full baseline
54
+ */
55
+ resyncAll?: boolean;
56
+ /**
57
+ * timestamp of when the replica changes began. null means
58
+ * full changeset from start of time
59
+ */
60
+ since: string | null;
61
+ };
62
+ export declare type SyncResponseMessage = {
63
+ type: 'sync-resp';
64
+ operations: Operation[];
65
+ baselines: DocumentBaseline[];
66
+ /**
67
+ * If this flag is set, the client should discard local data
68
+ * and reset to incoming data only. Used when a client requested
69
+ * resyncAll in its sync message, or for clients which have been
70
+ * offline for too long. When specified true, provideChangesSince
71
+ * should be ignored.
72
+ */
73
+ overwriteLocalData: boolean;
74
+ /**
75
+ * Update client on the global ack
76
+ */
77
+ globalAckTimestamp: string | undefined;
78
+ /**
79
+ * A map of connected clients' presences values
80
+ */
81
+ peerPresence: Record<string, UserInfo<any, any>>;
82
+ /**
83
+ * The timestamp sent in the original sync message -
84
+ * this confirms the server has received the client's
85
+ * state up to this point. Subsequent syncs should not
86
+ * include operations or baselines older than this timestamp.
87
+ */
88
+ ackedTimestamp: string;
89
+ /**
90
+ * The client should respond with a sync-ack containing
91
+ * this nonce to confirm it has received this message if
92
+ * it is not undefined
93
+ */
94
+ ackThisNonce?: string;
95
+ };
96
+ /** @deprecated use ack */
97
+ export declare type SyncAckMessage = {
98
+ type: 'sync-ack';
99
+ /** The client's replica ID */
100
+ replicaId: string;
101
+ /** the logical time this message was sent */
102
+ timestamp: string;
103
+ /** the nonce sent in the sync-resp message */
104
+ nonce: string;
105
+ };
106
+ export declare type PresenceUpdateMessage = {
107
+ type: 'presence-update';
108
+ /** The client's replica ID */
109
+ replicaId: string;
110
+ /** new presence value */
111
+ presence: any;
112
+ };
113
+ export declare type PresenceChangedMessage = {
114
+ type: 'presence-changed';
115
+ /** The client's replica ID */
116
+ replicaId: string;
117
+ userInfo: UserInfo<any, any>;
118
+ };
119
+ /**
120
+ * This is only emitted when all of a user's replicas
121
+ * go offline.
122
+ */
123
+ export declare type PresenceOfflineMessage = {
124
+ type: 'presence-offline';
125
+ userId: string;
126
+ /** The last replicaID seen by the server before the user was offline */
127
+ replicaId: string;
128
+ };
129
+ export declare type GlobalAckMessage = {
130
+ type: 'global-ack';
131
+ timestamp: string;
132
+ };
133
+ export declare type ForbiddenMessage = {
134
+ type: 'forbidden';
135
+ };
136
+ export declare type ServerAckMessage = {
137
+ type: 'server-ack';
138
+ timestamp: string;
139
+ };
140
+ export declare type ServerNeedSinceMessage = {
141
+ type: 'need-since';
142
+ since: string | null;
143
+ };
144
+ export declare type ClientMessage = HeartbeatMessage | SyncMessage | OperationMessage | AckMessage | SyncAckMessage | PresenceUpdateMessage;
145
+ export declare type ServerMessage = HeartbeatResponseMessage | SyncResponseMessage | OperationRebroadcastMessage | PresenceChangedMessage | PresenceOfflineMessage | GlobalAckMessage | ForbiddenMessage | ServerAckMessage | ServerNeedSinceMessage;
@@ -1,3 +1,3 @@
1
- // client ID, and therefore library ID, is inferred
2
- export {};
1
+ // client ID, and therefore library ID, is inferred
2
+ export {};
3
3
  //# sourceMappingURL=protocol.js.map
@@ -1,7 +1,7 @@
1
- import { FileRef } from './files.js';
2
- import { ObjectRef } from './operation.js';
3
- export declare function isRef(obj: any): boolean;
4
- export declare function compareRefs(a: any, b: any): boolean;
5
- export declare type Ref = ObjectRef | FileRef;
6
- export declare function makeObjectRef(oid: string): ObjectRef;
7
- export declare function makeFileRef(oid: string): FileRef;
1
+ import { FileRef } from './files.js';
2
+ import { ObjectRef } from './operation.js';
3
+ export declare function isRef(obj: any): boolean;
4
+ export declare function compareRefs(a: any, b: any): boolean;
5
+ export declare type Ref = ObjectRef | FileRef;
6
+ export declare function makeObjectRef(oid: string): ObjectRef;
7
+ export declare function makeFileRef(oid: string): FileRef;
package/dist/esm/refs.js CHANGED
@@ -1,23 +1,23 @@
1
- import { isFileRef } from './files.js';
2
- import { isObjectRef } from './operation.js';
3
- export function isRef(obj) {
4
- return isObjectRef(obj) || isFileRef(obj);
5
- }
6
- export function compareRefs(a, b) {
7
- if (a === b)
8
- return true;
9
- if (!isRef(a) || !isRef(b))
10
- return false;
11
- if (a['@@type'] !== b['@@type'])
12
- return false;
13
- if (a.id !== b.id)
14
- return false;
15
- return true;
16
- }
17
- export function makeObjectRef(oid) {
18
- return { '@@type': 'ref', id: oid };
19
- }
20
- export function makeFileRef(oid) {
21
- return { '@@type': 'file', id: oid };
22
- }
1
+ import { isFileRef } from './files.js';
2
+ import { isObjectRef } from './operation.js';
3
+ export function isRef(obj) {
4
+ return isObjectRef(obj) || isFileRef(obj);
5
+ }
6
+ export function compareRefs(a, b) {
7
+ if (a === b)
8
+ return true;
9
+ if (!isRef(a) || !isRef(b))
10
+ return false;
11
+ if (a['@@type'] !== b['@@type'])
12
+ return false;
13
+ if (a.id !== b.id)
14
+ return false;
15
+ return true;
16
+ }
17
+ export function makeObjectRef(oid) {
18
+ return { '@@type': 'ref', id: oid };
19
+ }
20
+ export function makeFileRef(oid) {
21
+ return { '@@type': 'file', id: oid };
22
+ }
23
23
  //# sourceMappingURL=refs.js.map
@@ -1,28 +1,28 @@
1
- export interface ReplicaInfo {
2
- id: string;
3
- ackedLogicalTime: string | null;
4
- }
5
- /**
6
- * Different token types allow different replica client behaviors.
7
- * - Realtime: allows the client to subscribe to realtime events.
8
- * - Push: allows the client to push and pull data with HTTP, but not use realtime.
9
- * - PassivePush: allows the client to push and pull data with HTTP, but offline changes
10
- * will be discarded on reconnect.
11
- * - PassiveRealtime: allows the client to subscribe to realtime events, but offline changes
12
- * will be discarded on reconnect.
13
- * - ReadOnlyPull: the client may only pull changes using HTTP. It may not subscribe
14
- * to realtime events or push changes.
15
- * - ReadOnlyRealtime: the client may only subscribe to realtime events or pull from HTTP.
16
- * It may not push changes.
17
- *
18
- * Choosing the right token type can optimize client storage metrics significantly when
19
- * many replicas are connecting to a library.
20
- */
21
- export declare enum ReplicaType {
22
- Realtime = 0,
23
- Push = 1,
24
- PassiveRealtime = 2,
25
- PassivePush = 3,
26
- ReadOnlyPull = 4,
27
- ReadOnlyRealtime = 5
28
- }
1
+ export interface ReplicaInfo {
2
+ id: string;
3
+ ackedLogicalTime: string | null;
4
+ }
5
+ /**
6
+ * Different token types allow different replica client behaviors.
7
+ * - Realtime: allows the client to subscribe to realtime events.
8
+ * - Push: allows the client to push and pull data with HTTP, but not use realtime.
9
+ * - PassivePush: allows the client to push and pull data with HTTP, but offline changes
10
+ * will be discarded on reconnect.
11
+ * - PassiveRealtime: allows the client to subscribe to realtime events, but offline changes
12
+ * will be discarded on reconnect.
13
+ * - ReadOnlyPull: the client may only pull changes using HTTP. It may not subscribe
14
+ * to realtime events or push changes.
15
+ * - ReadOnlyRealtime: the client may only subscribe to realtime events or pull from HTTP.
16
+ * It may not push changes.
17
+ *
18
+ * Choosing the right token type can optimize client storage metrics significantly when
19
+ * many replicas are connecting to a library.
20
+ */
21
+ export declare enum ReplicaType {
22
+ Realtime = 0,
23
+ Push = 1,
24
+ PassiveRealtime = 2,
25
+ PassivePush = 3,
26
+ ReadOnlyPull = 4,
27
+ ReadOnlyRealtime = 5
28
+ }
@@ -1,26 +1,26 @@
1
- /**
2
- * Different token types allow different replica client behaviors.
3
- * - Realtime: allows the client to subscribe to realtime events.
4
- * - Push: allows the client to push and pull data with HTTP, but not use realtime.
5
- * - PassivePush: allows the client to push and pull data with HTTP, but offline changes
6
- * will be discarded on reconnect.
7
- * - PassiveRealtime: allows the client to subscribe to realtime events, but offline changes
8
- * will be discarded on reconnect.
9
- * - ReadOnlyPull: the client may only pull changes using HTTP. It may not subscribe
10
- * to realtime events or push changes.
11
- * - ReadOnlyRealtime: the client may only subscribe to realtime events or pull from HTTP.
12
- * It may not push changes.
13
- *
14
- * Choosing the right token type can optimize client storage metrics significantly when
15
- * many replicas are connecting to a library.
16
- */
17
- export var ReplicaType;
18
- (function (ReplicaType) {
19
- ReplicaType[ReplicaType["Realtime"] = 0] = "Realtime";
20
- ReplicaType[ReplicaType["Push"] = 1] = "Push";
21
- ReplicaType[ReplicaType["PassiveRealtime"] = 2] = "PassiveRealtime";
22
- ReplicaType[ReplicaType["PassivePush"] = 3] = "PassivePush";
23
- ReplicaType[ReplicaType["ReadOnlyPull"] = 4] = "ReadOnlyPull";
24
- ReplicaType[ReplicaType["ReadOnlyRealtime"] = 5] = "ReadOnlyRealtime";
25
- })(ReplicaType = ReplicaType || (ReplicaType = {}));
1
+ /**
2
+ * Different token types allow different replica client behaviors.
3
+ * - Realtime: allows the client to subscribe to realtime events.
4
+ * - Push: allows the client to push and pull data with HTTP, but not use realtime.
5
+ * - PassivePush: allows the client to push and pull data with HTTP, but offline changes
6
+ * will be discarded on reconnect.
7
+ * - PassiveRealtime: allows the client to subscribe to realtime events, but offline changes
8
+ * will be discarded on reconnect.
9
+ * - ReadOnlyPull: the client may only pull changes using HTTP. It may not subscribe
10
+ * to realtime events or push changes.
11
+ * - ReadOnlyRealtime: the client may only subscribe to realtime events or pull from HTTP.
12
+ * It may not push changes.
13
+ *
14
+ * Choosing the right token type can optimize client storage metrics significantly when
15
+ * many replicas are connecting to a library.
16
+ */
17
+ export var ReplicaType;
18
+ (function (ReplicaType) {
19
+ ReplicaType[ReplicaType["Realtime"] = 0] = "Realtime";
20
+ ReplicaType[ReplicaType["Push"] = 1] = "Push";
21
+ ReplicaType[ReplicaType["PassiveRealtime"] = 2] = "PassiveRealtime";
22
+ ReplicaType[ReplicaType["PassivePush"] = 3] = "PassivePush";
23
+ ReplicaType[ReplicaType["ReadOnlyPull"] = 4] = "ReadOnlyPull";
24
+ ReplicaType[ReplicaType["ReadOnlyRealtime"] = 5] = "ReadOnlyRealtime";
25
+ })(ReplicaType = ReplicaType || (ReplicaType = {}));
26
26
  //# sourceMappingURL=replica.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,19 +1,19 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { getFieldDefault } from './fields.js';
3
- import { assignOid, createOid, maybeGetOid } from '../oids.js';
4
- describe('getting field defaults', () => {
5
- it('does not apply the same oid from the previous application', () => {
6
- const field = {
7
- type: 'any',
8
- default: {
9
- id: '123',
10
- name: 'test',
11
- },
12
- };
13
- const first = getFieldDefault(field);
14
- assignOid(first, createOid('test', '1'));
15
- const second = getFieldDefault(field);
16
- expect(maybeGetOid(second)).toBe(undefined);
17
- });
18
- });
1
+ import { describe, expect, it } from 'vitest';
2
+ import { getFieldDefault } from './fields.js';
3
+ import { assignOid, createOid, maybeGetOid } from '../oids.js';
4
+ describe('getting field defaults', () => {
5
+ it('does not apply the same oid from the previous application', () => {
6
+ const field = {
7
+ type: 'any',
8
+ default: {
9
+ id: '123',
10
+ name: 'test',
11
+ },
12
+ };
13
+ const first = getFieldDefault(field);
14
+ assignOid(first, createOid('test', '1'));
15
+ const second = getFieldDefault(field);
16
+ expect(maybeGetOid(second)).toBe(undefined);
17
+ });
18
+ });
19
19
  //# sourceMappingURL=defaults.test.js.map
@@ -1,9 +1,9 @@
1
- import type { StorageFieldSchema, StorageCollectionSchema } from './types.js';
2
- export declare function isNullable(field: StorageFieldSchema): boolean | undefined;
3
- export declare function hasDefault(field: StorageFieldSchema | undefined): boolean;
4
- export declare function isIndexed(field: StorageFieldSchema): boolean | undefined;
5
- export declare function addFieldDefaults(collection: StorageCollectionSchema, value: any): any;
6
- export declare function traverseCollectionFieldsAndApplyDefaults(value: any, field: StorageFieldSchema): any;
7
- export declare function getFieldDefault(field: StorageFieldSchema): any;
8
- export declare function removeExtraProperties(collection: StorageCollectionSchema, value: any): any;
9
- export declare function traverseCollectionFieldsAndRemoveExtraProperties(value: any, field: StorageFieldSchema): void;
1
+ import type { StorageFieldSchema, StorageCollectionSchema } from './types.js';
2
+ export declare function isNullable(field: StorageFieldSchema): boolean | undefined;
3
+ export declare function hasDefault(field: StorageFieldSchema | undefined): boolean;
4
+ export declare function isIndexed(field: StorageFieldSchema): boolean | undefined;
5
+ export declare function addFieldDefaults(collection: StorageCollectionSchema, value: any): any;
6
+ export declare function traverseCollectionFieldsAndApplyDefaults(value: any, field: StorageFieldSchema): any;
7
+ export declare function getFieldDefault(field: StorageFieldSchema): any;
8
+ export declare function removeExtraProperties(collection: StorageCollectionSchema, value: any): any;
9
+ export declare function traverseCollectionFieldsAndRemoveExtraProperties(value: any, field: StorageFieldSchema): void;