atom.io 0.31.1 → 0.32.1

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 (162) hide show
  1. package/data/dist/index.d.ts +3 -154
  2. package/data/dist/index.js +11 -559
  3. package/data/src/index.ts +0 -2
  4. package/data/src/struct-family.ts +1 -1
  5. package/data/src/struct.ts +1 -2
  6. package/dist/chunk-3PQTWLQQ.js +83 -0
  7. package/dist/chunk-3ZFTRSNG.js +523 -0
  8. package/dist/chunk-4LWKCEW3.js +14 -0
  9. package/dist/chunk-KVI5OBF2.js +153 -0
  10. package/dist/{chunk-Y5MBNTVU.js → chunk-UQEYZ3OI.js} +1814 -721
  11. package/dist/chunk-UYYKOGZQ.js +1034 -0
  12. package/dist/chunk-VRJP2PCU.js +631 -0
  13. package/dist/chunk-X7SD2NXU.js +108 -0
  14. package/dist/index.d.ts +137 -12
  15. package/dist/index.js +1 -228
  16. package/eslint-plugin/dist/index.d.ts +1 -30
  17. package/eslint-plugin/dist/index.js +3 -149
  18. package/eslint-plugin/src/index.ts +0 -1
  19. package/eslint-plugin/src/rules/explicit-state-types.ts +1 -0
  20. package/eslint-plugin/src/rules/index.ts +0 -1
  21. package/eslint-plugin/src/rules/synchronous-selector-dependencies.ts +1 -0
  22. package/eslint-plugin/src/walk.ts +1 -0
  23. package/internal/dist/index.d.ts +129 -58
  24. package/internal/dist/index.js +1 -1
  25. package/internal/src/atom/create-regular-atom.ts +3 -3
  26. package/internal/src/atom/dispose-atom.ts +4 -13
  27. package/internal/src/atom/is-default.ts +3 -3
  28. package/internal/src/caching.ts +5 -5
  29. package/internal/src/capitalize.ts +3 -0
  30. package/internal/src/families/create-readonly-selector-family.ts +5 -6
  31. package/internal/src/families/create-writable-selector-family.ts +1 -4
  32. package/internal/src/families/dispose-from-store.ts +3 -13
  33. package/internal/src/get-state/get-from-store.ts +2 -2
  34. package/internal/src/get-state/read-or-compute-value.ts +1 -1
  35. package/internal/src/index.ts +2 -0
  36. package/internal/src/install-into-store.ts +1 -1
  37. package/internal/src/join/edit-relations-in-store.ts +32 -0
  38. package/internal/src/join/find-relations-in-store.ts +124 -0
  39. package/internal/src/join/get-internal-relations-from-store.ts +14 -0
  40. package/internal/src/join/get-join.ts +31 -0
  41. package/internal/src/join/index.ts +5 -0
  42. package/{data/src/join.ts → internal/src/join/join-internal.ts} +21 -430
  43. package/internal/src/junction.ts +7 -4
  44. package/internal/src/keys.ts +7 -7
  45. package/internal/src/mutable/create-mutable-atom-family.ts +1 -1
  46. package/internal/src/mutable/create-mutable-atom.ts +3 -3
  47. package/internal/src/mutable/get-json-token.ts +1 -1
  48. package/internal/src/mutable/tracker-family.ts +19 -17
  49. package/internal/src/mutable/tracker.ts +8 -8
  50. package/internal/src/pretty-print.ts +1 -1
  51. package/internal/src/selector/create-readonly-selector.ts +3 -7
  52. package/internal/src/selector/create-writable-selector.ts +4 -4
  53. package/internal/src/selector/dispose-selector.ts +20 -11
  54. package/internal/src/selector/get-selector-dependency-keys.ts +1 -1
  55. package/internal/src/selector/register-selector.ts +6 -9
  56. package/internal/src/selector/trace-selector-atoms.ts +2 -2
  57. package/internal/src/set-state/copy-mutable-if-needed.ts +1 -1
  58. package/internal/src/set-state/emit-update.ts +4 -2
  59. package/internal/src/set-state/evict-downstream.ts +1 -1
  60. package/internal/src/set-state/set-atom-or-selector.ts +1 -1
  61. package/internal/src/set-state/set-atom.ts +10 -10
  62. package/internal/src/set-state/set-into-store.ts +2 -2
  63. package/internal/src/set-state/stow-update.ts +1 -1
  64. package/internal/src/store/store.ts +1 -1
  65. package/internal/src/store/withdraw.ts +22 -22
  66. package/internal/src/subscribe/recall-state.ts +1 -1
  67. package/internal/src/subscribe/subscribe-in-store.ts +3 -3
  68. package/internal/src/subscribe/subscribe-to-root-atoms.ts +3 -3
  69. package/internal/src/subscribe/subscribe-to-state.ts +5 -5
  70. package/internal/src/subscribe/subscribe-to-timeline.ts +3 -3
  71. package/internal/src/subscribe/subscribe-to-transaction.ts +3 -3
  72. package/internal/src/timeline/create-timeline.ts +19 -38
  73. package/internal/src/timeline/time-travel.ts +2 -1
  74. package/internal/src/transaction/act-upon-store.ts +2 -2
  75. package/internal/src/transaction/apply-transaction.ts +5 -5
  76. package/internal/src/transaction/assign-transaction-to-continuity.ts +1 -1
  77. package/internal/src/transaction/build-transaction.ts +5 -8
  78. package/internal/src/transaction/create-transaction.ts +3 -3
  79. package/internal/src/transaction/get-epoch-number.ts +3 -3
  80. package/internal/src/transaction/set-epoch-number.ts +2 -2
  81. package/introspection/dist/index.js +2 -620
  82. package/json/dist/index.d.ts +2 -2
  83. package/json/dist/index.js +1 -80
  84. package/json/src/select-json-family.ts +3 -14
  85. package/package.json +31 -49
  86. package/react/dist/index.js +2 -82
  87. package/react/src/use-o.ts +1 -1
  88. package/react/src/use-tl.ts +2 -2
  89. package/react-devtools/dist/index.css +16 -14
  90. package/react-devtools/dist/index.js +31 -18
  91. package/react-devtools/src/Updates.tsx +12 -0
  92. package/react-devtools/src/devtools.scss +16 -14
  93. package/react-devtools/src/json-editor/editors-by-type/utilities/cast-to-json.ts +2 -1
  94. package/realtime/dist/index.d.ts +1 -2
  95. package/realtime/dist/index.js +2 -107
  96. package/realtime/src/realtime-continuity.ts +3 -2
  97. package/realtime/src/shared-room-store.ts +1 -2
  98. package/realtime-client/dist/index.d.ts +9 -9
  99. package/realtime-client/dist/index.js +3 -509
  100. package/realtime-client/src/continuity/register-and-attempt-confirmed-update.ts +3 -3
  101. package/realtime-client/src/continuity/use-conceal-state.ts +1 -1
  102. package/realtime-client/src/pull-atom-family-member.ts +2 -2
  103. package/realtime-client/src/pull-atom.ts +2 -2
  104. package/realtime-client/src/pull-mutable-atom-family-member.ts +2 -2
  105. package/realtime-client/src/pull-mutable-atom.ts +2 -2
  106. package/realtime-client/src/pull-selector-family-member.ts +4 -4
  107. package/realtime-client/src/pull-selector.ts +4 -4
  108. package/realtime-client/src/push-state.ts +5 -10
  109. package/realtime-client/src/server-action.ts +4 -4
  110. package/realtime-client/src/sync-continuity.ts +6 -6
  111. package/realtime-react/dist/index.js +5 -154
  112. package/realtime-react/src/use-pull-atom-family-member.ts +1 -1
  113. package/realtime-react/src/use-pull-atom.ts +1 -1
  114. package/realtime-react/src/use-pull-mutable-atom.ts +1 -1
  115. package/realtime-react/src/use-pull-mutable-family-member.ts +1 -1
  116. package/realtime-react/src/use-pull-selector-family-member.ts +1 -1
  117. package/realtime-react/src/use-pull-selector.ts +1 -1
  118. package/realtime-react/src/use-push.ts +1 -1
  119. package/realtime-react/src/use-server-action.ts +2 -2
  120. package/realtime-react/src/use-sync-continuity.ts +1 -1
  121. package/realtime-server/dist/index.d.ts +2 -4
  122. package/realtime-server/dist/index.js +3 -1001
  123. package/realtime-server/src/continuity/prepare-to-serve-transaction-request.ts +1 -1
  124. package/realtime-server/src/continuity/prepare-to-sync-realtime-continuity.ts +3 -3
  125. package/realtime-server/src/continuity/subscribe-to-continuity-actions.ts +2 -2
  126. package/realtime-server/src/continuity/subscribe-to-continuity-perpectives.ts +2 -2
  127. package/realtime-server/src/ipc-sockets/child-socket.ts +2 -0
  128. package/realtime-server/src/realtime-action-receiver.ts +1 -1
  129. package/realtime-server/src/realtime-family-provider.ts +2 -2
  130. package/realtime-server/src/realtime-mutable-family-provider.ts +2 -2
  131. package/realtime-server/src/realtime-mutable-provider.ts +2 -2
  132. package/realtime-server/src/realtime-server-stores/server-room-external-actions.ts +2 -1
  133. package/realtime-server/src/realtime-server-stores/server-room-external-store.ts +1 -1
  134. package/realtime-server/src/realtime-server-stores/server-sync-store.ts +10 -2
  135. package/realtime-server/src/realtime-server-stores/server-user-store.ts +1 -2
  136. package/realtime-server/src/realtime-state-provider.ts +2 -2
  137. package/realtime-testing/dist/index.js +20 -22
  138. package/realtime-testing/src/setup-realtime-test.tsx +2 -1
  139. package/src/index.ts +4 -0
  140. package/src/join.ts +218 -0
  141. package/src/silo.ts +4 -4
  142. package/src/timeline.ts +1 -1
  143. package/src/transaction.ts +4 -8
  144. package/transceivers/set-rtx/dist/index.d.ts +4 -3
  145. package/transceivers/set-rtx/dist/index.js +1 -215
  146. package/transceivers/set-rtx/src/set-rtx.ts +4 -7
  147. package/web/dist/index.js +1 -15
  148. package/data/src/until.ts +0 -15
  149. package/ephemeral/dist/index.d.ts +0 -67
  150. package/ephemeral/dist/index.js +0 -9
  151. package/ephemeral/package.json +0 -13
  152. package/ephemeral/src/index.ts +0 -1
  153. package/eslint-plugin/src/rules/lifespan.ts +0 -203
  154. package/immortal/dist/index.d.ts +0 -12
  155. package/immortal/dist/index.js +0 -9
  156. package/immortal/package.json +0 -13
  157. package/immortal/src/index.ts +0 -1
  158. package/immortal/src/seek-state.ts +0 -60
  159. package/react-devtools/src/json-editor/assets/Untitled-1.ai +2 -1436
  160. package/react-devtools/src/json-editor/assets/data-vis.ai +1 -1548
  161. package/react-devtools/src/json-editor/comp/json-editor-sketches.ai +5 -1449
  162. /package/{ephemeral/src → src}/find-state.ts +0 -0
@@ -1,152 +1,11 @@
1
1
  import * as AtomIO from 'atom.io';
2
- import { ReadonlySelectorFamilyToken, SingularTypedKey, Hierarchy, CompoundTypedKey, MutableAtomFamilyToken, SetterToolkit, Anarchy, ReadonlySelectorToken } from 'atom.io';
3
- import { Store, JunctionSchemaBase, JunctionEntriesBase, Refinement, Molecule, Junction } from 'atom.io/internal';
4
- import { Canonical, stringified, Json } from 'atom.io/json';
5
- import { SetRTX, SetRTXJson } from 'atom.io/transceivers/set-rtx';
2
+ import { Store } from 'atom.io/internal';
3
+ import { Canonical, stringified } from 'atom.io/json';
6
4
 
7
5
  declare function dict<State, Key extends Canonical>(family: AtomIO.ReadonlySelectorFamilyToken<State, Key> | AtomIO.RegularAtomFamilyToken<State, Key> | AtomIO.WritableSelectorFamilyToken<State, Key>, index: AtomIO.ReadonlySelectorToken<Key[]> | AtomIO.RegularAtomToken<Key[]> | AtomIO.WritableSelectorToken<Key[]>, store?: Store): AtomIO.ReadonlySelectorToken<{
8
6
  [K in stringified<Key>]: State;
9
7
  }>;
10
8
 
11
- interface JoinOptions<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> extends JunctionSchemaBase<ASide, BSide>, Partial<JunctionEntriesBase<AType, BType, Content>> {
12
- readonly key: string;
13
- readonly cardinality: Cardinality;
14
- readonly isAType: Refinement<string, AType>;
15
- readonly isBType: Refinement<string, BType>;
16
- }
17
- type JoinStateFamilies<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
18
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
19
- AType,
20
- Content
21
- ] | null, BType>;
22
- } & {
23
- readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
24
- BType,
25
- Content
26
- ] | null, AType>;
27
- } : {}) & {
28
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
29
- } & {
30
- readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType | null, AType>;
31
- } : Cardinality extends `1:n` ? (Content extends Json.Object ? {
32
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
33
- AType,
34
- Content
35
- ] | null, BType>;
36
- } & {
37
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
38
- BType,
39
- Content
40
- ][], AType>;
41
- } : {}) & {
42
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType | null, BType>;
43
- } & {
44
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
45
- } : Cardinality extends `n:n` ? (Content extends Json.Object ? {
46
- readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<[
47
- AType,
48
- Content
49
- ][], BType>;
50
- } & {
51
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<[
52
- BType,
53
- Content
54
- ][], AType>;
55
- } : {}) & {
56
- readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorFamilyToken<AType[], BType>;
57
- } & {
58
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorFamilyToken<BType[], AType>;
59
- } : never;
60
- type JoinHierarchy<AType extends SingularTypedKey, BType extends SingularTypedKey> = Hierarchy<[
61
- {
62
- above: `root`;
63
- below: [AType, BType];
64
- },
65
- {
66
- above: [AType, BType];
67
- style: `all`;
68
- below: CompoundTypedKey<`content`, AType, BType>;
69
- }
70
- ]>;
71
- declare class Join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object | null = null, const ContentKey extends CompoundTypedKey<`content`, ASide, BSide> = CompoundTypedKey<`content`, ASide, BSide>> {
72
- private toolkit;
73
- options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>;
74
- defaultContent: Content | undefined;
75
- molecules: Map<string, Molecule<any>>;
76
- relations: Junction<ASide, AType, BSide, BType, Content>;
77
- states: JoinStateFamilies<ASide, AType, BSide, BType, Cardinality, Content>;
78
- core: {
79
- relatedKeysAtoms: MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
80
- };
81
- transact(toolkit: SetterToolkit, run: (join: Join<ASide, AType, BSide, BType, Cardinality, Content>) => void): void;
82
- store: Store;
83
- realm: Anarchy;
84
- [Symbol.dispose](): void;
85
- constructor(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content | undefined, store?: Store);
86
- }
87
- type JoinToken<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null = null> = {
88
- key: string;
89
- type: `join`;
90
- cardinality: Cardinality;
91
- a: ASide;
92
- b: BSide;
93
- __aType?: AType;
94
- __bType?: BType;
95
- __content?: Content;
96
- };
97
- declare function join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, null>, defaultContent?: undefined, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, null>;
98
- declare function join<const ASide extends string, const AType extends string, const BSide extends string, const BType extends string, const Cardinality extends `1:1` | `1:n` | `n:n`, const Content extends Json.Object>(options: JoinOptions<ASide, AType, BSide, BType, Cardinality, Content>, defaultContent: Content, store?: Store): JoinToken<ASide, AType, BSide, BType, Cardinality, Content>;
99
- declare function getJoin<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, store: Store): Join<ASide, AType, BSide, BType, Cardinality, Content>;
100
- type JoinStates<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null> = Cardinality extends `1:1` ? (Content extends Json.Object ? {
101
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
102
- AType,
103
- Content
104
- ] | null, BType>;
105
- } & {
106
- readonly [B in BSide as `${B}EntryOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
107
- BType,
108
- Content
109
- ] | null, AType>;
110
- } : {}) & {
111
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
112
- } & {
113
- readonly [B in BSide as `${B}KeyOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType | null, AType>;
114
- } : Cardinality extends `1:n` ? (Content extends Json.Object ? {
115
- readonly [A in ASide as `${A}EntryOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
116
- AType,
117
- Content
118
- ] | null, BType>;
119
- } & {
120
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
121
- BType,
122
- Content
123
- ][], AType>;
124
- } : {}) & {
125
- readonly [A in ASide as `${A}KeyOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType | null, BType>;
126
- } & {
127
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
128
- } : Cardinality extends `n:n` ? (Content extends Json.Object ? {
129
- readonly [A in ASide as `${A}EntriesOf${Capitalize<BSide>}`]: ReadonlySelectorToken<[
130
- AType,
131
- Content
132
- ][], BType>;
133
- } & {
134
- readonly [B in BSide as `${B}EntriesOf${Capitalize<ASide>}`]: ReadonlySelectorToken<[
135
- BType,
136
- Content
137
- ][], AType>;
138
- } : {}) & {
139
- readonly [A in ASide as `${A}KeysOf${Capitalize<BSide>}`]: ReadonlySelectorToken<AType[], BType>;
140
- } & {
141
- readonly [B in BSide as `${B}KeysOf${Capitalize<ASide>}`]: ReadonlySelectorToken<BType[], AType>;
142
- } : never;
143
- declare function findRelationsInStore<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, key: AType | BType, store: Store): JoinStates<ASide, AType, BSide, BType, Cardinality, Content>;
144
- declare function findRelations<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, key: AType | BType): JoinStates<ASide, AType, BSide, BType, Cardinality, Content>;
145
- declare function editRelationsInStore<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, change: (relations: Junction<ASide, AType, BSide, BType, Content>) => void, store: Store): void;
146
- declare function editRelations<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>, change: (relations: Junction<ASide, AType, BSide, BType, Content>) => void): void;
147
- declare function getInternalRelationsFromStore(token: JoinToken<any, any, any, any, any, any>, store: Store): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
148
- declare function getInternalRelations<ASide extends string, AType extends string, BSide extends string, BType extends string, Cardinality extends `1:1` | `1:n` | `n:n`, Content extends Json.Object | null>(token: JoinToken<ASide, AType, BSide, BType, Cardinality, Content>): MutableAtomFamilyToken<SetRTX<string>, SetRTXJson<string>, string>;
149
-
150
9
  declare function struct<Struct extends {
151
10
  [key: string]: unknown;
152
11
  }, Key extends string>(options: {
@@ -169,14 +28,4 @@ declare function structFamily<Struct extends object, Key extends string>(options
169
28
  AtomIO.ReadonlySelectorFamilyToken<Struct, string>
170
29
  ];
171
30
 
172
- type Loadable<T> = Promise<T> | T;
173
- type Fated<T, E extends Error = Error> = Loadable<E | T>;
174
- /**
175
- * Utility for handling loadable values
176
- * @param loadable Loadable value
177
- * @param fallback Fallback value until Loadable is resolved
178
- * @returns Fallback value if your loadable is a promise, otherwise the loadable's resolved value
179
- */
180
- declare function until<T>(loadable: Loadable<T>, fallback: T): T;
181
-
182
- export { type Fated, Join, type JoinHierarchy, type JoinOptions, type JoinStateFamilies, type JoinStates, type JoinToken, type Loadable, dict, editRelations, editRelationsInStore, findRelations, findRelationsInStore, getInternalRelations, getInternalRelationsFromStore, getJoin, join, struct, structFamily, until };
31
+ export { dict, struct, structFamily };