effector-storage 6.1.0 → 7.0.0

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 (94) hide show
  1. package/README.md +7 -40
  2. package/async-storage/index.cjs.map +1 -1
  3. package/async-storage/index.d.cts +24 -0
  4. package/async-storage/index.d.ts +14 -18
  5. package/async-storage/index.js.flow +6 -5
  6. package/async-storage/index.js.map +1 -1
  7. package/async-storage/package.json +15 -2
  8. package/broadcast/index.cjs.map +1 -1
  9. package/broadcast/index.d.cts +94 -0
  10. package/broadcast/index.d.ts +63 -85
  11. package/broadcast/index.js.flow +23 -25
  12. package/broadcast/index.js.map +1 -1
  13. package/broadcast/package.json +15 -2
  14. package/core/index.cjs +1 -1
  15. package/core/index.cjs.map +1 -1
  16. package/core/index.d.cts +77 -0
  17. package/core/index.d.ts +53 -66
  18. package/core/index.js +1 -1
  19. package/core/index.js.flow +14 -14
  20. package/core/index.js.map +1 -1
  21. package/core/package.json +15 -2
  22. package/index.d.cts +97 -0
  23. package/index.d.ts +68 -99
  24. package/index.js.flow +27 -28
  25. package/local/index.d.cts +99 -0
  26. package/local/index.d.ts +67 -90
  27. package/local/index.js.flow +25 -27
  28. package/local/package.json +15 -2
  29. package/log/index.cjs.map +1 -1
  30. package/log/index.d.cts +19 -0
  31. package/log/index.d.ts +11 -11
  32. package/log/index.js.flow +6 -5
  33. package/log/index.js.map +1 -1
  34. package/log/package.json +15 -2
  35. package/memory/index.d.cts +95 -0
  36. package/memory/index.d.ts +63 -82
  37. package/memory/index.js.flow +23 -25
  38. package/memory/package.json +15 -2
  39. package/nil/index.cjs.map +1 -1
  40. package/nil/index.d.cts +18 -0
  41. package/nil/index.d.ts +10 -10
  42. package/nil/index.js.flow +6 -5
  43. package/nil/index.js.map +1 -1
  44. package/nil/package.json +15 -2
  45. package/package.json +101 -57
  46. package/query/index.cjs.map +1 -1
  47. package/query/index.d.cts +108 -0
  48. package/query/index.d.ts +75 -104
  49. package/query/index.js.flow +30 -28
  50. package/query/index.js.map +1 -1
  51. package/query/package.json +15 -2
  52. package/session/index.d.cts +99 -0
  53. package/session/index.d.ts +67 -90
  54. package/session/index.js.flow +25 -27
  55. package/session/package.json +15 -2
  56. package/storage/index.cjs.map +1 -1
  57. package/storage/index.d.cts +23 -0
  58. package/storage/index.d.ts +15 -22
  59. package/storage/index.js.flow +7 -6
  60. package/storage/index.js.map +1 -1
  61. package/storage/package.json +15 -2
  62. package/tools/index.cjs.map +1 -1
  63. package/tools/{index.cjs.d.ts → index.d.cts} +33 -58
  64. package/tools/index.d.ts +33 -58
  65. package/tools/index.js.flow +13 -10
  66. package/tools/index.js.map +1 -1
  67. package/tools/package.json +15 -2
  68. package/async-storage/index.cjs.d.ts +0 -28
  69. package/broadcast/index.cjs.d.ts +0 -116
  70. package/core/index.cjs.d.ts +0 -90
  71. package/index.cjs.d.ts +0 -128
  72. package/local/index.cjs.d.ts +0 -122
  73. package/log/index.cjs.d.ts +0 -19
  74. package/memory/index.cjs.d.ts +0 -114
  75. package/nil/index.cjs.d.ts +0 -18
  76. package/query/index.cjs.d.ts +0 -137
  77. package/rn/async/index.cjs +0 -2
  78. package/rn/async/index.cjs.d.ts +0 -120
  79. package/rn/async/index.cjs.map +0 -1
  80. package/rn/async/index.d.ts +0 -120
  81. package/rn/async/index.js +0 -2
  82. package/rn/async/index.js.flow +0 -135
  83. package/rn/async/index.js.map +0 -1
  84. package/rn/async/package.json +0 -8
  85. package/rn/encrypted/index.cjs +0 -2
  86. package/rn/encrypted/index.cjs.d.ts +0 -120
  87. package/rn/encrypted/index.cjs.map +0 -1
  88. package/rn/encrypted/index.d.ts +0 -120
  89. package/rn/encrypted/index.js +0 -2
  90. package/rn/encrypted/index.js.flow +0 -137
  91. package/rn/encrypted/index.js.map +0 -1
  92. package/rn/encrypted/package.json +0 -8
  93. package/session/index.cjs.d.ts +0 -122
  94. package/storage/index.cjs.d.ts +0 -30
@@ -1,122 +0,0 @@
1
- import { Unit, Store, Event, Effect, Subscription } from 'effector'
2
-
3
- interface StorageAdapter {
4
- <State>(key: string, update: (raw?: any) => any): {
5
- get(raw?: any, ctx?: any): State | Promise<State | undefined> | undefined
6
- set(value: State, ctx?: any): void
7
- }
8
- keyArea?: any
9
- noop?: boolean
10
- }
11
- interface StorageAdapterFactory<AdapterConfig> {
12
- (config?: AdapterConfig): StorageAdapter
13
- factory: true
14
- }
15
- type Contract<Data> =
16
- | ((raw: unknown) => raw is Data)
17
- | {
18
- isData: (raw: unknown) => raw is Data
19
- getErrorMessages: (raw: unknown) => string[]
20
- }
21
- type Done<State> = {
22
- key: string
23
- keyPrefix: string
24
- operation: 'set' | 'get'
25
- value: State
26
- }
27
- type Fail<Err> = {
28
- key: string
29
- keyPrefix: string
30
- operation: 'set' | 'get'
31
- error: Err
32
- value?: any
33
- }
34
- type Finally<State, Err> =
35
- | (Done<State> & {
36
- status: 'done'
37
- })
38
- | (Fail<Err> & {
39
- status: 'fail'
40
- })
41
- interface ConfigPersist$1 {
42
- pickup?: Unit<any>
43
- context?: Unit<any>
44
- keyPrefix?: string
45
- contract?: Contract<any>
46
- }
47
- interface ConfigCommon<State, Err = Error> {
48
- clock?: Unit<any>
49
- done?: Unit<Done<State>>
50
- fail?: Unit<Fail<Err>>
51
- finally?: Unit<Finally<State, Err>>
52
- pickup?: Unit<any>
53
- context?: Unit<any>
54
- key?: string
55
- keyPrefix?: string
56
- contract?: Contract<State | undefined>
57
- }
58
- interface ConfigJustStore<State> {
59
- store: Store<State>
60
- }
61
- interface ConfigJustSourceTarget<State> {
62
- source: Store<State> | Event<State> | Effect<State, any, any>
63
- target: Store<State> | Event<State> | Effect<State, any, any>
64
- }
65
- interface ConfigStore$1<State, Err = Error>
66
- extends ConfigCommon<State, Err>,
67
- ConfigJustStore<State> {}
68
- interface ConfigSourceTarget$1<State, Err = Error>
69
- extends ConfigCommon<State, Err>,
70
- ConfigJustSourceTarget<State> {}
71
-
72
- interface ConfigPersist extends ConfigPersist$1 {
73
- sync?: boolean | 'force'
74
- timeout?: number
75
- }
76
- interface SessionStorageConfig {
77
- sync?: boolean | 'force'
78
- serialize?: (value: any) => string
79
- deserialize?: (value: string) => any
80
- timeout?: number
81
- def?: any
82
- }
83
- interface ConfigStore<State, Err = Error>
84
- extends SessionStorageConfig,
85
- ConfigStore$1<State, Err> {}
86
- interface ConfigSourceTarget<State, Err = Error>
87
- extends SessionStorageConfig,
88
- ConfigSourceTarget$1<State, Err> {}
89
- interface Persist {
90
- <State, Err = Error>(config: ConfigSourceTarget<State, Err>): Subscription
91
- <State, Err = Error>(config: ConfigStore<State, Err>): Subscription
92
- }
93
- declare function session(config?: SessionStorageConfig): StorageAdapter
94
- declare namespace session {
95
- var factory: true
96
- }
97
- /**
98
- * Creates custom partially applied `persist`
99
- * with predefined `sessionStorage` adapter
100
- */
101
- declare function createPersist(defaults?: ConfigPersist): Persist
102
- /**
103
- * Default partially applied `persist`
104
- */
105
- declare const persist: Persist
106
-
107
- export {
108
- ConfigPersist,
109
- ConfigSourceTarget,
110
- ConfigStore,
111
- Contract,
112
- Done,
113
- Fail,
114
- Finally,
115
- Persist,
116
- SessionStorageConfig,
117
- StorageAdapter,
118
- StorageAdapterFactory,
119
- createPersist,
120
- persist,
121
- session,
122
- }
@@ -1,30 +0,0 @@
1
- interface StorageAdapter {
2
- <State>(key: string, update: (raw?: any) => any): {
3
- get(raw?: any, ctx?: any): State | Promise<State | undefined> | undefined
4
- set(value: State, ctx?: any): void
5
- }
6
- keyArea?: any
7
- noop?: boolean
8
- }
9
-
10
- interface StorageConfig {
11
- storage: () => Storage
12
- sync?: boolean | 'force'
13
- serialize?: (value: any) => string
14
- deserialize?: (value: string) => any
15
- timeout?: number
16
- def?: any
17
- }
18
- declare function storage({
19
- storage,
20
- sync,
21
- serialize,
22
- deserialize,
23
- timeout,
24
- def,
25
- }: StorageConfig): StorageAdapter
26
- declare namespace storage {
27
- var factory: true
28
- }
29
-
30
- export { StorageConfig, storage }