valdres 1.0.0-beta.16 → 1.0.0-beta.17

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 (81) hide show
  1. package/dist/adapter-internals/v1.js +47 -0
  2. package/dist/chunk-24w014gs.js +5878 -0
  3. package/dist/index.js +572 -3799
  4. package/dist/types/adapter-internals/v1.d.ts +3 -0
  5. package/dist/types/atomFamily.d.ts +3 -3
  6. package/dist/types/errors/StoreDisposedError.d.ts +4 -0
  7. package/dist/types/globalStore.d.ts +1 -0
  8. package/dist/types/index.d.ts +6 -3
  9. package/dist/types/indexConstructor.d.ts +13 -3
  10. package/dist/types/lib/WeakSelectorCache.d.ts +36 -0
  11. package/dist/types/lib/WeakValueMap.d.ts +40 -0
  12. package/dist/types/lib/adapterTransaction.d.ts +10 -0
  13. package/dist/types/lib/architectureInstrumentation.d.ts +30 -0
  14. package/dist/types/lib/asyncDependencyTracking.d.ts +0 -2
  15. package/dist/types/lib/atomFamilyIndex.d.ts +17 -10
  16. package/dist/types/lib/commitErrors.d.ts +7 -0
  17. package/dist/types/lib/coordinateAsyncWrite.d.ts +11 -0
  18. package/dist/types/lib/createAtomFamily.d.ts +2 -2
  19. package/dist/types/lib/createGlobalAtomFamily.d.ts +2 -2
  20. package/dist/types/lib/disposeStoreData.d.ts +7 -0
  21. package/dist/types/lib/familyKey.d.ts +1 -1
  22. package/dist/types/lib/finishAtomSet.d.ts +9 -0
  23. package/dist/types/lib/getState.d.ts +1 -1
  24. package/dist/types/lib/getStoreData.d.ts +4 -0
  25. package/dist/types/lib/getStoreRuntime.d.ts +4 -0
  26. package/dist/types/lib/globalAtom.d.ts +2 -2
  27. package/dist/types/lib/globalAtomFanOut.d.ts +21 -0
  28. package/dist/types/lib/globalOnSetMarker.d.ts +3 -0
  29. package/dist/types/lib/inheritedDependencyBranches.d.ts +21 -0
  30. package/dist/types/lib/initSelector.d.ts +18 -4
  31. package/dist/types/lib/mountAtom.d.ts +10 -3
  32. package/dist/types/lib/namedStateIndex.d.ts +11 -0
  33. package/dist/types/lib/nativeAsyncSelectorError.d.ts +1 -0
  34. package/dist/types/lib/noteDependencyGraphChanged.d.ts +4 -0
  35. package/dist/types/lib/notifyChangeListeners.d.ts +23 -10
  36. package/dist/types/lib/onCommitEnd.d.ts +4 -1
  37. package/dist/types/lib/propagateUpdatedAtoms.d.ts +1 -1
  38. package/dist/types/lib/registerName.d.ts +1 -0
  39. package/dist/types/lib/setAtoms.d.ts +1 -1
  40. package/dist/types/lib/stateRevisions.d.ts +22 -0
  41. package/dist/types/lib/storeAdapter.d.ts +8 -0
  42. package/dist/types/lib/storeDataAccessToken.d.ts +2 -0
  43. package/dist/types/lib/storeLifecycle.d.ts +72 -0
  44. package/dist/types/lib/storeRuntimeKey.d.ts +2 -0
  45. package/dist/types/lib/stringifyFamilyArgs.d.ts +3 -1
  46. package/dist/types/lib/subscribe.d.ts +1 -2
  47. package/dist/types/lib/transaction.d.ts +55 -19
  48. package/dist/types/lib/unsetValue.d.ts +12 -11
  49. package/dist/types/lib/unsubscribe.d.ts +2 -2
  50. package/dist/types/lib/writeAtoms.d.ts +10 -11
  51. package/dist/types/selectorFamily.d.ts +2 -2
  52. package/dist/types/types/Atom.d.ts +1 -3
  53. package/dist/types/types/AtomFamily.d.ts +8 -1
  54. package/dist/types/types/AtomFamilyAtom.d.ts +1 -1
  55. package/dist/types/types/AtomFamilyOptions.d.ts +7 -0
  56. package/dist/types/types/AtomOnSet.d.ts +2 -2
  57. package/dist/types/types/AtomOptions.d.ts +5 -0
  58. package/dist/types/types/FamilyKey.d.ts +4 -3
  59. package/dist/types/types/GetValue.d.ts +1 -1
  60. package/dist/types/types/GlobalAtom.d.ts +0 -8
  61. package/dist/types/types/IndexOptions.d.ts +7 -0
  62. package/dist/types/types/InitializeCallback.d.ts +2 -3
  63. package/dist/types/types/InternalAtom.d.ts +6 -0
  64. package/dist/types/types/InternalGlobalAtom.d.ts +15 -0
  65. package/dist/types/types/Selector.d.ts +2 -0
  66. package/dist/types/types/SelectorFamily.d.ts +4 -0
  67. package/dist/types/types/SelectorFamilyOptions.d.ts +7 -0
  68. package/dist/types/types/SelectorOptions.d.ts +5 -0
  69. package/dist/types/types/Store.d.ts +19 -12
  70. package/dist/types/types/StoreChange.d.ts +9 -6
  71. package/dist/types/types/StoreChangeSource.d.ts +9 -7
  72. package/dist/types/types/StoreData.d.ts +79 -17
  73. package/dist/types/types/SubscribeFn.d.ts +4 -4
  74. package/dist/types/types/Transaction.d.ts +27 -0
  75. package/dist/types/types/TransactionFn.d.ts +5 -2
  76. package/dist/types/types/TransactionInterface.d.ts +3 -19
  77. package/dist/types/utils/dehydrate.d.ts +7 -7
  78. package/dist/types/utils/isGlobalAtom.d.ts +2 -2
  79. package/package.json +5 -1
  80. package/dist/types/lib/stableStringify.d.ts +0 -1
  81. package/dist/types/types/Family.d.ts +0 -3
@@ -0,0 +1,47 @@
1
+ import {
2
+ SelectorEvaluationError,
3
+ TransactionContext,
4
+ abortTransaction,
5
+ commitTransaction,
6
+ getStoreData
7
+ } from "../chunk-24w014gs.js";
8
+
9
+ // src/lib/adapterTransaction.ts
10
+ class Transaction extends TransactionContext {
11
+ constructor(store) {
12
+ super(getStoreData(store));
13
+ }
14
+ commit(source) {
15
+ commitTransaction(this, source);
16
+ }
17
+ abort() {
18
+ abortTransaction(this);
19
+ }
20
+ }
21
+ // src/lib/storeAdapter.ts
22
+ var storeAdapter = Object.freeze({
23
+ isBatching(store) {
24
+ return getStoreData(store).batchUpdates === true;
25
+ },
26
+ isEnumerable(store) {
27
+ return getStoreData(store).enumerable === true;
28
+ },
29
+ hasScope(store, scopeId) {
30
+ return getStoreData(store).scopes.has(scopeId);
31
+ },
32
+ hasScopePath(store, scopeIds) {
33
+ let data = getStoreData(store);
34
+ for (const scopeId of scopeIds) {
35
+ const scope = data.scopes.get(scopeId);
36
+ if (!scope)
37
+ return false;
38
+ data = scope;
39
+ }
40
+ return true;
41
+ }
42
+ });
43
+ export {
44
+ storeAdapter,
45
+ Transaction,
46
+ SelectorEvaluationError
47
+ };