effector-storage 6.1.1 → 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,120 +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
- interface AsyncStorageConfig {
74
- serialize?: (value: any) => string
75
- deserialize?: (value: string) => any
76
- }
77
- interface ConfigStore<State, Err = Error>
78
- extends AsyncStorageConfig,
79
- ConfigStore$1<State, Err> {}
80
- interface ConfigSourceTarget<State, Err = Error>
81
- extends AsyncStorageConfig,
82
- ConfigSourceTarget$1<State, Err> {}
83
- interface Persist {
84
- <State, Err = Error>(config: ConfigSourceTarget<State, Err>): Subscription
85
- <State, Err = Error>(config: ConfigStore<State, Err>): Subscription
86
- }
87
- declare function async(config?: AsyncStorageConfig): StorageAdapter
88
- declare namespace async {
89
- var factory: true
90
- }
91
- /**
92
- * Creates custom partially applied `persist`
93
- * with predefined `AsyncStorage` adapter
94
- *
95
- * @deprecated use @effector-storage/react-native-async-storage instead
96
- */
97
- declare function createPersist(defaults?: ConfigPersist): Persist
98
- /**
99
- * Default partially applied `persist`
100
- *
101
- * @deprecated use @effector-storage/react-native-async-storage instead
102
- */
103
- declare const persist: Persist
104
-
105
- export {
106
- AsyncStorageConfig,
107
- ConfigPersist,
108
- ConfigSourceTarget,
109
- ConfigStore,
110
- Contract,
111
- Done,
112
- Fail,
113
- Finally,
114
- Persist,
115
- StorageAdapter,
116
- StorageAdapterFactory,
117
- async,
118
- createPersist,
119
- persist,
120
- }
package/rn/async/index.js DELETED
@@ -1,2 +0,0 @@
1
- import{persist as r}from"../../core/index.js";import{asyncStorage as t}from"../../async-storage/index.js";import o from"@react-native-async-storage/async-storage";function a(r){return t({storage:()=>o,...r})}function e(t){return o=>r({adapter:a,...t,...o})}a.factory=!0;var n=e();export{a as async,e as createPersist,n as persist};
2
- //# sourceMappingURL=index.js.map
@@ -1,135 +0,0 @@
1
- /**
2
- * Flowtype definitions for index
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
-
8
- import { Unit, Store, Event, Effect, Subscription } from 'effector'
9
- declare interface StorageAdapter {
10
- <State>(
11
- key: string,
12
- update: (raw?: any) => any
13
- ): {
14
- get(raw?: any, ctx?: any): State | Promise<State | void> | void,
15
- set(value: State, ctx?: any): void,
16
- ...
17
- };
18
- keyArea?: any;
19
- noop?: boolean;
20
- }
21
- declare interface StorageAdapterFactory<AdapterConfig> {
22
- (config?: AdapterConfig): StorageAdapter;
23
- factory: true;
24
- }
25
- declare type Contract<Data> =
26
- | ((raw: mixed) => boolean)
27
- | {
28
- isData: (raw: mixed) => boolean,
29
- getErrorMessages: (raw: mixed) => string[],
30
- ...
31
- }
32
- declare type Done<State> = {
33
- key: string,
34
- keyPrefix: string,
35
- operation: 'set' | 'get',
36
- value: State,
37
- ...
38
- }
39
- declare type Fail<Err> = {
40
- key: string,
41
- keyPrefix: string,
42
- operation: 'set' | 'get',
43
- error: Err,
44
- value?: any,
45
- ...
46
- }
47
- declare type Finally<State, Err> =
48
- | {
49
- ...Done<State>,
50
- ...{
51
- status: 'done',
52
- ...
53
- },
54
- }
55
- | {
56
- ...Fail<Err>,
57
- ...{
58
- status: 'fail',
59
- ...
60
- },
61
- }
62
- declare interface ConfigPersist$1 {
63
- pickup?: Unit<any>;
64
- context?: Unit<any>;
65
- keyPrefix?: string;
66
- contract?: Contract<any>;
67
- }
68
- declare interface ConfigCommon<State, Err = Error> {
69
- clock?: Unit<any>;
70
- done?: Unit<Done<State>>;
71
- fail?: Unit<Fail<Err>>;
72
- finally?: Unit<Finally<State, Err>>;
73
- pickup?: Unit<any>;
74
- context?: Unit<any>;
75
- key?: string;
76
- keyPrefix?: string;
77
- contract?: Contract<State | void>;
78
- }
79
- declare interface ConfigJustStore<State> {
80
- store: Store<State>;
81
- }
82
- declare interface ConfigJustSourceTarget<State> {
83
- source: Store<State> | Event<State> | Effect<State, any, any>;
84
- target: Store<State> | Event<State> | Effect<State, any, any>;
85
- }
86
- declare type ConfigStore$1<State, Err = Error> = { ... } & ConfigCommon<
87
- State,
88
- Err
89
- > &
90
- ConfigJustStore<State>
91
- declare type ConfigSourceTarget$1<State, Err = Error> = { ... } & ConfigCommon<
92
- State,
93
- Err
94
- > &
95
- ConfigJustSourceTarget<State>
96
- declare type ConfigPersist = { ... } & ConfigPersist$1
97
- declare interface AsyncStorageConfig {
98
- serialize?: (value: any) => string;
99
- deserialize?: (value: string) => any;
100
- }
101
- declare type ConfigStore<State, Err = Error> = { ... } & AsyncStorageConfig &
102
- ConfigStore$1<State, Err>
103
- declare type ConfigSourceTarget<State, Err = Error> = {
104
- ...
105
- } & AsyncStorageConfig &
106
- ConfigSourceTarget$1<State, Err>
107
- declare interface Persist {
108
- <State, Err>(config: ConfigSourceTarget<State, Err>): Subscription;
109
- <State, Err>(config: ConfigStore<State, Err>): Subscription;
110
- }
111
- declare var async: typeof npm$namespace$async
112
-
113
- declare var npm$namespace$async: {|
114
- (config?: AsyncStorageConfig): StorageAdapter,
115
- factory: typeof async$factory,
116
- |}
117
- declare var async$factory: true
118
- declare function createPersist(defaults?: ConfigPersist): Persist
119
- declare var persist: Persist
120
- declare export {
121
- AsyncStorageConfig,
122
- ConfigPersist,
123
- ConfigSourceTarget,
124
- ConfigStore,
125
- Contract,
126
- Done,
127
- Fail,
128
- Finally,
129
- Persist,
130
- StorageAdapter,
131
- StorageAdapterFactory,
132
- async,
133
- createPersist,
134
- persist,
135
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/rn/async/index.ts"],"sourcesContent":["import type { Subscription } from 'effector'\nimport type {\n ConfigPersist as BaseConfigPersist,\n ConfigStore as BaseConfigStore,\n ConfigSourceTarget as BaseConfigSourceTarget,\n StorageAdapter,\n} from '../../types'\nimport { persist as base } from '../../core'\nimport { asyncStorage } from '../../async-storage'\nimport AsyncStorage from '@react-native-async-storage/async-storage'\n\nexport type {\n Contract,\n Done,\n Fail,\n Finally,\n StorageAdapter,\n StorageAdapterFactory,\n} from '../../types'\n\nexport interface ConfigPersist extends BaseConfigPersist {}\n\nexport interface AsyncStorageConfig {\n serialize?: (value: any) => string\n deserialize?: (value: string) => any\n}\n\nexport interface ConfigStore<State, Err = Error>\n extends AsyncStorageConfig,\n BaseConfigStore<State, Err> {}\n\nexport interface ConfigSourceTarget<State, Err = Error>\n extends AsyncStorageConfig,\n BaseConfigSourceTarget<State, Err> {}\n\nexport interface Persist {\n <State, Err = Error>(config: ConfigSourceTarget<State, Err>): Subscription\n <State, Err = Error>(config: ConfigStore<State, Err>): Subscription\n}\n\n/**\n * Creates `AsyncStorage` adapter\n *\n * @deprecated use @effector-storage/react-native-async-storage instead\n */\nasync.factory = true as const\nexport function async(config?: AsyncStorageConfig): StorageAdapter {\n return asyncStorage({\n storage: () => AsyncStorage,\n ...config,\n })\n}\n\n/**\n * Creates custom partially applied `persist`\n * with predefined `AsyncStorage` adapter\n *\n * @deprecated use @effector-storage/react-native-async-storage instead\n */\nexport function createPersist(defaults?: ConfigPersist): Persist {\n return (config) =>\n base({\n adapter: async,\n ...defaults,\n ...config,\n })\n}\n\n/**\n * Default partially applied `persist`\n *\n * @deprecated use @effector-storage/react-native-async-storage instead\n */\nexport const persist = createPersist()\n"],"names":["async","config","asyncStorage","storage","AsyncStorage","createPersist","defaults","base","adapter","factory","persist"],"mappings":"mKA8CO,SAASA,EAAMC,GACpB,OAAOC,EAAa,CAClBC,QAASA,IAAMC,KACZH,GAEP,CAQO,SAASI,EAAcC,GAC5B,OAAQL,GACNM,EAAK,CACHC,QAASR,KACNM,KACAL,GAET,CArBAD,EAAMS,SAAU,EA4BHC,IAAAA,EAAUL"}
@@ -1,8 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": false,
4
- "main": "index.cjs",
5
- "module": "index.js",
6
- "react-native": "index.js",
7
- "types": "index.d.ts"
8
- }
@@ -1,2 +0,0 @@
1
- "use strict";var e=require("../../core/index.cjs"),r=require("../../async-storage/index.cjs"),t=require("react-native-encrypted-storage");function s(e){return r.asyncStorage({storage:()=>t,...e})}function a(r){return t=>e.persist({adapter:s,...r,...t})}s.factory=!0;var c=a();exports.createPersist=a,exports.encrypted=s,exports.persist=c;
2
- //# sourceMappingURL=index.cjs.map
@@ -1,120 +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
- interface EncryptedStorageConfig {
74
- serialize?: (value: any) => string
75
- deserialize?: (value: string) => any
76
- }
77
- interface ConfigStore<State, Err = Error>
78
- extends EncryptedStorageConfig,
79
- ConfigStore$1<State, Err> {}
80
- interface ConfigSourceTarget<State, Err = Error>
81
- extends EncryptedStorageConfig,
82
- ConfigSourceTarget$1<State, Err> {}
83
- interface Persist {
84
- <State, Err = Error>(config: ConfigSourceTarget<State, Err>): Subscription
85
- <State, Err = Error>(config: ConfigStore<State, Err>): Subscription
86
- }
87
- declare function encrypted(config?: EncryptedStorageConfig): StorageAdapter
88
- declare namespace encrypted {
89
- var factory: true
90
- }
91
- /**
92
- * Creates custom partially applied `persist`
93
- * with predefined `EncryptedStorage` adapter
94
- *
95
- * @deprecated use @effector-storage/react-native-encrypted-storage instead
96
- */
97
- declare function createPersist(defaults?: ConfigPersist): Persist
98
- /**
99
- * Default partially applied `persist`
100
- *
101
- * @deprecated use @effector-storage/react-native-encrypted-storage instead
102
- */
103
- declare const persist: Persist
104
-
105
- export {
106
- ConfigPersist,
107
- ConfigSourceTarget,
108
- ConfigStore,
109
- Contract,
110
- Done,
111
- EncryptedStorageConfig,
112
- Fail,
113
- Finally,
114
- Persist,
115
- StorageAdapter,
116
- StorageAdapterFactory,
117
- createPersist,
118
- encrypted,
119
- persist,
120
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/rn/encrypted/index.ts"],"sourcesContent":["import type { Subscription } from 'effector'\nimport type {\n ConfigPersist as BaseConfigPersist,\n ConfigStore as BaseConfigStore,\n ConfigSourceTarget as BaseConfigSourceTarget,\n StorageAdapter,\n} from '../../types'\nimport { persist as base } from '../../core'\nimport { asyncStorage } from '../../async-storage'\nimport EncryptedStorage from 'react-native-encrypted-storage'\n\nexport type {\n Contract,\n Done,\n Fail,\n Finally,\n StorageAdapter,\n StorageAdapterFactory,\n} from '../../types'\n\nexport interface ConfigPersist extends BaseConfigPersist {}\n\nexport interface EncryptedStorageConfig {\n serialize?: (value: any) => string\n deserialize?: (value: string) => any\n}\n\nexport interface ConfigStore<State, Err = Error>\n extends EncryptedStorageConfig,\n BaseConfigStore<State, Err> {}\n\nexport interface ConfigSourceTarget<State, Err = Error>\n extends EncryptedStorageConfig,\n BaseConfigSourceTarget<State, Err> {}\n\nexport interface Persist {\n <State, Err = Error>(config: ConfigSourceTarget<State, Err>): Subscription\n <State, Err = Error>(config: ConfigStore<State, Err>): Subscription\n}\n\n/**\n * Creates `EncryptedStorage` adapter\n *\n * @deprecated use @effector-storage/react-native-encrypted-storage instead\n */\nencrypted.factory = true as const\nexport function encrypted(config?: EncryptedStorageConfig): StorageAdapter {\n return asyncStorage({\n storage: () => EncryptedStorage,\n ...config,\n })\n}\n\n/**\n * Creates custom partially applied `persist`\n * with predefined `EncryptedStorage` adapter\n *\n * @deprecated use @effector-storage/react-native-encrypted-storage instead\n */\nexport function createPersist(defaults?: ConfigPersist): Persist {\n return (config) =>\n base({\n adapter: encrypted,\n ...defaults,\n ...config,\n })\n}\n\n/**\n * Default partially applied `persist`\n *\n * @deprecated use @effector-storage/react-native-encrypted-storage instead\n */\nexport const persist = createPersist()\n"],"names":["encrypted","config","asyncStorage","storage","EncryptedStorage","createPersist","defaults","base","adapter","factory","persist"],"mappings":"0IA8CO,SAASA,EAAUC,GACxB,OAAOC,eAAa,CAClBC,QAASA,IAAMC,KACZH,GAEP,CAQO,SAASI,EAAcC,GAC5B,OAAQL,GACNM,EAAAA,QAAK,CACHC,QAASR,KACNM,KACAL,GAET,CArBAD,EAAUS,SAAU,EA4BPC,IAAAA,EAAUL"}
@@ -1,120 +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
- interface EncryptedStorageConfig {
74
- serialize?: (value: any) => string
75
- deserialize?: (value: string) => any
76
- }
77
- interface ConfigStore<State, Err = Error>
78
- extends EncryptedStorageConfig,
79
- ConfigStore$1<State, Err> {}
80
- interface ConfigSourceTarget<State, Err = Error>
81
- extends EncryptedStorageConfig,
82
- ConfigSourceTarget$1<State, Err> {}
83
- interface Persist {
84
- <State, Err = Error>(config: ConfigSourceTarget<State, Err>): Subscription
85
- <State, Err = Error>(config: ConfigStore<State, Err>): Subscription
86
- }
87
- declare function encrypted(config?: EncryptedStorageConfig): StorageAdapter
88
- declare namespace encrypted {
89
- var factory: true
90
- }
91
- /**
92
- * Creates custom partially applied `persist`
93
- * with predefined `EncryptedStorage` adapter
94
- *
95
- * @deprecated use @effector-storage/react-native-encrypted-storage instead
96
- */
97
- declare function createPersist(defaults?: ConfigPersist): Persist
98
- /**
99
- * Default partially applied `persist`
100
- *
101
- * @deprecated use @effector-storage/react-native-encrypted-storage instead
102
- */
103
- declare const persist: Persist
104
-
105
- export {
106
- ConfigPersist,
107
- ConfigSourceTarget,
108
- ConfigStore,
109
- Contract,
110
- Done,
111
- EncryptedStorageConfig,
112
- Fail,
113
- Finally,
114
- Persist,
115
- StorageAdapter,
116
- StorageAdapterFactory,
117
- createPersist,
118
- encrypted,
119
- persist,
120
- }
@@ -1,2 +0,0 @@
1
- import{persist as r}from"../../core/index.js";import{asyncStorage as t}from"../../async-storage/index.js";import e from"react-native-encrypted-storage";function o(r){return t({storage:()=>e,...r})}function a(t){return e=>r({adapter:o,...t,...e})}o.factory=!0;var n=a();export{a as createPersist,o as encrypted,n as persist};
2
- //# sourceMappingURL=index.js.map
@@ -1,137 +0,0 @@
1
- /**
2
- * Flowtype definitions for index
3
- * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.21.0
5
- * @flow
6
- */
7
-
8
- import { Unit, Store, Event, Effect, Subscription } from 'effector'
9
- declare interface StorageAdapter {
10
- <State>(
11
- key: string,
12
- update: (raw?: any) => any
13
- ): {
14
- get(raw?: any, ctx?: any): State | Promise<State | void> | void,
15
- set(value: State, ctx?: any): void,
16
- ...
17
- };
18
- keyArea?: any;
19
- noop?: boolean;
20
- }
21
- declare interface StorageAdapterFactory<AdapterConfig> {
22
- (config?: AdapterConfig): StorageAdapter;
23
- factory: true;
24
- }
25
- declare type Contract<Data> =
26
- | ((raw: mixed) => boolean)
27
- | {
28
- isData: (raw: mixed) => boolean,
29
- getErrorMessages: (raw: mixed) => string[],
30
- ...
31
- }
32
- declare type Done<State> = {
33
- key: string,
34
- keyPrefix: string,
35
- operation: 'set' | 'get',
36
- value: State,
37
- ...
38
- }
39
- declare type Fail<Err> = {
40
- key: string,
41
- keyPrefix: string,
42
- operation: 'set' | 'get',
43
- error: Err,
44
- value?: any,
45
- ...
46
- }
47
- declare type Finally<State, Err> =
48
- | {
49
- ...Done<State>,
50
- ...{
51
- status: 'done',
52
- ...
53
- },
54
- }
55
- | {
56
- ...Fail<Err>,
57
- ...{
58
- status: 'fail',
59
- ...
60
- },
61
- }
62
- declare interface ConfigPersist$1 {
63
- pickup?: Unit<any>;
64
- context?: Unit<any>;
65
- keyPrefix?: string;
66
- contract?: Contract<any>;
67
- }
68
- declare interface ConfigCommon<State, Err = Error> {
69
- clock?: Unit<any>;
70
- done?: Unit<Done<State>>;
71
- fail?: Unit<Fail<Err>>;
72
- finally?: Unit<Finally<State, Err>>;
73
- pickup?: Unit<any>;
74
- context?: Unit<any>;
75
- key?: string;
76
- keyPrefix?: string;
77
- contract?: Contract<State | void>;
78
- }
79
- declare interface ConfigJustStore<State> {
80
- store: Store<State>;
81
- }
82
- declare interface ConfigJustSourceTarget<State> {
83
- source: Store<State> | Event<State> | Effect<State, any, any>;
84
- target: Store<State> | Event<State> | Effect<State, any, any>;
85
- }
86
- declare type ConfigStore$1<State, Err = Error> = { ... } & ConfigCommon<
87
- State,
88
- Err
89
- > &
90
- ConfigJustStore<State>
91
- declare type ConfigSourceTarget$1<State, Err = Error> = { ... } & ConfigCommon<
92
- State,
93
- Err
94
- > &
95
- ConfigJustSourceTarget<State>
96
- declare type ConfigPersist = { ... } & ConfigPersist$1
97
- declare interface EncryptedStorageConfig {
98
- serialize?: (value: any) => string;
99
- deserialize?: (value: string) => any;
100
- }
101
- declare type ConfigStore<State, Err = Error> = {
102
- ...
103
- } & EncryptedStorageConfig &
104
- ConfigStore$1<State, Err>
105
- declare type ConfigSourceTarget<State, Err = Error> = {
106
- ...
107
- } & EncryptedStorageConfig &
108
- ConfigSourceTarget$1<State, Err>
109
- declare interface Persist {
110
- <State, Err>(config: ConfigSourceTarget<State, Err>): Subscription;
111
- <State, Err>(config: ConfigStore<State, Err>): Subscription;
112
- }
113
- declare var encrypted: typeof npm$namespace$encrypted
114
-
115
- declare var npm$namespace$encrypted: {|
116
- (config?: EncryptedStorageConfig): StorageAdapter,
117
- factory: typeof encrypted$factory,
118
- |}
119
- declare var encrypted$factory: true
120
- declare function createPersist(defaults?: ConfigPersist): Persist
121
- declare var persist: Persist
122
- declare export {
123
- ConfigPersist,
124
- ConfigSourceTarget,
125
- ConfigStore,
126
- Contract,
127
- Done,
128
- EncryptedStorageConfig,
129
- Fail,
130
- Finally,
131
- Persist,
132
- StorageAdapter,
133
- StorageAdapterFactory,
134
- createPersist,
135
- encrypted,
136
- persist,
137
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/rn/encrypted/index.ts"],"sourcesContent":["import type { Subscription } from 'effector'\nimport type {\n ConfigPersist as BaseConfigPersist,\n ConfigStore as BaseConfigStore,\n ConfigSourceTarget as BaseConfigSourceTarget,\n StorageAdapter,\n} from '../../types'\nimport { persist as base } from '../../core'\nimport { asyncStorage } from '../../async-storage'\nimport EncryptedStorage from 'react-native-encrypted-storage'\n\nexport type {\n Contract,\n Done,\n Fail,\n Finally,\n StorageAdapter,\n StorageAdapterFactory,\n} from '../../types'\n\nexport interface ConfigPersist extends BaseConfigPersist {}\n\nexport interface EncryptedStorageConfig {\n serialize?: (value: any) => string\n deserialize?: (value: string) => any\n}\n\nexport interface ConfigStore<State, Err = Error>\n extends EncryptedStorageConfig,\n BaseConfigStore<State, Err> {}\n\nexport interface ConfigSourceTarget<State, Err = Error>\n extends EncryptedStorageConfig,\n BaseConfigSourceTarget<State, Err> {}\n\nexport interface Persist {\n <State, Err = Error>(config: ConfigSourceTarget<State, Err>): Subscription\n <State, Err = Error>(config: ConfigStore<State, Err>): Subscription\n}\n\n/**\n * Creates `EncryptedStorage` adapter\n *\n * @deprecated use @effector-storage/react-native-encrypted-storage instead\n */\nencrypted.factory = true as const\nexport function encrypted(config?: EncryptedStorageConfig): StorageAdapter {\n return asyncStorage({\n storage: () => EncryptedStorage,\n ...config,\n })\n}\n\n/**\n * Creates custom partially applied `persist`\n * with predefined `EncryptedStorage` adapter\n *\n * @deprecated use @effector-storage/react-native-encrypted-storage instead\n */\nexport function createPersist(defaults?: ConfigPersist): Persist {\n return (config) =>\n base({\n adapter: encrypted,\n ...defaults,\n ...config,\n })\n}\n\n/**\n * Default partially applied `persist`\n *\n * @deprecated use @effector-storage/react-native-encrypted-storage instead\n */\nexport const persist = createPersist()\n"],"names":["encrypted","config","asyncStorage","storage","EncryptedStorage","createPersist","defaults","base","adapter","factory","persist"],"mappings":"wJA8CO,SAASA,EAAUC,GACxB,OAAOC,EAAa,CAClBC,QAASA,IAAMC,KACZH,GAEP,CAQO,SAASI,EAAcC,GAC5B,OAAQL,GACNM,EAAK,CACHC,QAASR,KACNM,KACAL,GAET,CArBAD,EAAUS,SAAU,EA4BPC,IAAAA,EAAUL"}
@@ -1,8 +0,0 @@
1
- {
2
- "type": "module",
3
- "sideEffects": false,
4
- "main": "index.cjs",
5
- "module": "index.js",
6
- "react-native": "index.js",
7
- "types": "index.d.ts"
8
- }