effect 4.0.0-beta.40 → 4.0.0-beta.42
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.
- package/dist/BigDecimal.d.ts +36 -0
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +52 -0
- package/dist/BigDecimal.js.map +1 -1
- package/dist/Effect.d.ts +20 -63
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +24 -65
- package/dist/Effect.js.map +1 -1
- package/dist/Layer.js +1 -1
- package/dist/Layer.js.map +1 -1
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +19 -7
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +3 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +12 -3
- package/dist/Number.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +16 -14
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/ServiceMap.d.ts +14 -26
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +6 -5
- package/dist/ServiceMap.js.map +1 -1
- package/dist/TxChunk.d.ts +39 -39
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +3 -3
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +9 -9
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +2 -2
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +59 -59
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +8 -8
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +35 -35
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +7 -7
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +23 -23
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +4 -4
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +14 -14
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +12 -12
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +33 -33
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +29 -44
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +10 -33
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +14 -37
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +36 -42
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +16 -25
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +8 -8
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +10 -10
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +14 -14
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +5 -5
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.js +6 -6
- package/dist/internal/effect.js +3 -0
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schema/representation.js +28 -0
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +31 -2
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +68 -6
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +88 -11
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +3 -0
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +1 -1
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +12 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +18 -0
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +21 -1
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +6 -3
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +1 -0
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +4 -2
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +13 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +23 -0
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +22 -7
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +24 -20
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +3 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +10 -4
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/http/index.d.ts +2 -2
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +2 -2
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +1 -3
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +1 -0
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +1 -0
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +43 -26
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +1 -1
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +1 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +5 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +13 -0
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/package.json +1 -1
- package/src/BigDecimal.ts +54 -0
- package/src/Effect.ts +25 -75
- package/src/Layer.ts +1 -1
- package/src/ManagedRuntime.ts +33 -20
- package/src/MutableList.ts +3 -0
- package/src/Number.ts +13 -3
- package/src/SchemaRepresentation.ts +8 -6
- package/src/ServiceMap.ts +16 -31
- package/src/TxChunk.ts +53 -62
- package/src/TxDeferred.ts +14 -17
- package/src/TxHashMap.ts +91 -101
- package/src/TxHashSet.ts +68 -70
- package/src/TxPriorityQueue.ts +34 -38
- package/src/TxPubSub.ts +30 -32
- package/src/TxQueue.ts +70 -84
- package/src/TxReentrantLock.ts +30 -54
- package/src/TxRef.ts +53 -65
- package/src/TxSemaphore.ts +23 -24
- package/src/TxSubscriptionRef.ts +25 -27
- package/src/index.ts +6 -6
- package/src/internal/effect.ts +3 -0
- package/src/internal/schema/representation.ts +28 -0
- package/src/unstable/ai/Chat.ts +79 -18
- package/src/unstable/ai/LanguageModel.ts +182 -66
- package/src/unstable/ai/OpenAiStructuredOutput.ts +3 -0
- package/src/unstable/cli/Prompt.ts +3 -1
- package/src/unstable/cli/internal/command.ts +16 -1
- package/src/unstable/cluster/ClusterSchema.ts +29 -1
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +22 -3
- package/src/unstable/cluster/Entity.ts +1 -0
- package/src/unstable/cluster/Message.ts +22 -10
- package/src/unstable/cluster/MessageStorage.ts +37 -6
- package/src/unstable/cluster/Sharding.ts +31 -23
- package/src/unstable/cluster/SqlMessageStorage.ts +6 -1
- package/src/unstable/cluster/internal/entityManager.ts +14 -5
- package/src/unstable/http/index.ts +2 -2
- package/src/unstable/httpapi/HttpApiSchema.ts +1 -1
- package/src/unstable/httpapi/OpenApi.ts +1 -0
- package/src/unstable/rpc/Rpc.ts +1 -0
- package/src/unstable/rpc/RpcClient.ts +45 -33
- package/src/unstable/socket/Socket.ts +1 -1
- package/src/unstable/workflow/Activity.ts +23 -0
package/dist/TxRef.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Accessed values are tracked by the transaction in order to detect conflicts and in order to
|
|
5
5
|
* track changes, a transaction will retry whenever a conflict is detected or whenever the
|
|
6
|
-
* transaction explicitely calls to `Effect.
|
|
6
|
+
* transaction explicitely calls to `Effect.txRetry` and any of the accessed TxRef values
|
|
7
7
|
* change.
|
|
8
8
|
*
|
|
9
9
|
* @since 4.0.0
|
|
@@ -23,28 +23,21 @@ const TypeId = "~effect/transactions/TxRef";
|
|
|
23
23
|
*
|
|
24
24
|
* const program = Effect.gen(function*() {
|
|
25
25
|
* // Create a transactional reference with initial value
|
|
26
|
-
* const counter = yield*
|
|
27
|
-
* const name = yield*
|
|
26
|
+
* const counter = yield* TxRef.make(0)
|
|
27
|
+
* const name = yield* TxRef.make("Alice")
|
|
28
28
|
*
|
|
29
29
|
* // Use in transactions
|
|
30
|
-
* yield* Effect.
|
|
30
|
+
* yield* Effect.tx(Effect.gen(function*() {
|
|
31
31
|
* yield* TxRef.set(counter, 42)
|
|
32
32
|
* yield* TxRef.set(name, "Bob")
|
|
33
33
|
* }))
|
|
34
34
|
*
|
|
35
|
-
* console.log(yield*
|
|
36
|
-
* console.log(yield*
|
|
35
|
+
* console.log(yield* TxRef.get(counter)) // 42
|
|
36
|
+
* console.log(yield* TxRef.get(name)) // "Bob"
|
|
37
37
|
* })
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
|
-
export const make = initial => Effect.
|
|
41
|
-
const ref = makeUnsafe(initial);
|
|
42
|
-
state.journal.set(ref, {
|
|
43
|
-
version: ref.version,
|
|
44
|
-
value: ref.value
|
|
45
|
-
});
|
|
46
|
-
return ref;
|
|
47
|
-
}));
|
|
40
|
+
export const make = initial => Effect.sync(() => makeUnsafe(initial));
|
|
48
41
|
/**
|
|
49
42
|
* Creates a new `TxRef` with the specified initial value.
|
|
50
43
|
*
|
|
@@ -85,16 +78,14 @@ export const makeUnsafe = initial => ({
|
|
|
85
78
|
* const counter = yield* TxRef.make(0)
|
|
86
79
|
*
|
|
87
80
|
* // Modify and return both old and new value
|
|
88
|
-
* const result = yield*
|
|
89
|
-
* TxRef.modify(counter, (current) => [current * 2, current + 1])
|
|
90
|
-
* )
|
|
81
|
+
* const result = yield* TxRef.modify(counter, (current) => [current * 2, current + 1])
|
|
91
82
|
*
|
|
92
83
|
* console.log(result) // 0 (the return value: current * 2)
|
|
93
|
-
* console.log(yield*
|
|
84
|
+
* console.log(yield* TxRef.get(counter)) // 1 (the new value: current + 1)
|
|
94
85
|
* })
|
|
95
86
|
* ```
|
|
96
87
|
*/
|
|
97
|
-
export const modify = /*#__PURE__*/dual(2, (self, f) => Effect.
|
|
88
|
+
export const modify = /*#__PURE__*/dual(2, (self, f) => Effect.Transaction.asEffect().pipe(Effect.flatMap(state => Effect.sync(() => {
|
|
98
89
|
if (!state.journal.has(self)) {
|
|
99
90
|
state.journal.set(self, {
|
|
100
91
|
version: self.version,
|
|
@@ -105,7 +96,7 @@ export const modify = /*#__PURE__*/dual(2, (self, f) => Effect.withTxState(state
|
|
|
105
96
|
const [returnValue, next] = f(current.value);
|
|
106
97
|
current.value = next;
|
|
107
98
|
return returnValue;
|
|
108
|
-
})));
|
|
99
|
+
})), Effect.tx));
|
|
109
100
|
/**
|
|
110
101
|
* Updates the value of the `TxRef` using the provided function.
|
|
111
102
|
*
|
|
@@ -119,11 +110,11 @@ export const modify = /*#__PURE__*/dual(2, (self, f) => Effect.withTxState(state
|
|
|
119
110
|
* const counter = yield* TxRef.make(10)
|
|
120
111
|
*
|
|
121
112
|
* // Update the value using a function
|
|
122
|
-
* yield* Effect.
|
|
113
|
+
* yield* Effect.tx(
|
|
123
114
|
* TxRef.update(counter, (current) => current * 2)
|
|
124
115
|
* )
|
|
125
116
|
*
|
|
126
|
-
* console.log(yield*
|
|
117
|
+
* console.log(yield* TxRef.get(counter)) // 20
|
|
127
118
|
* })
|
|
128
119
|
* ```
|
|
129
120
|
*/
|
|
@@ -141,7 +132,7 @@ export const update = /*#__PURE__*/dual(2, (self, f) => modify(self, current =>
|
|
|
141
132
|
* const counter = yield* TxRef.make(42)
|
|
142
133
|
*
|
|
143
134
|
* // Read the value within a transaction
|
|
144
|
-
* const value = yield* Effect.
|
|
135
|
+
* const value = yield* Effect.tx(
|
|
145
136
|
* TxRef.get(counter)
|
|
146
137
|
* )
|
|
147
138
|
*
|
|
@@ -163,11 +154,11 @@ export const get = self => modify(self, current => [current, current]);
|
|
|
163
154
|
* const counter = yield* TxRef.make(0)
|
|
164
155
|
*
|
|
165
156
|
* // Set a new value within a transaction
|
|
166
|
-
* yield* Effect.
|
|
157
|
+
* yield* Effect.tx(
|
|
167
158
|
* TxRef.set(counter, 100)
|
|
168
159
|
* )
|
|
169
160
|
*
|
|
170
|
-
* console.log(yield*
|
|
161
|
+
* console.log(yield* TxRef.get(counter)) // 100
|
|
171
162
|
* })
|
|
172
163
|
* ```
|
|
173
164
|
*/
|
package/dist/TxRef.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxRef.js","names":["Effect","dual","pipeArguments","TypeId","make","initial","
|
|
1
|
+
{"version":3,"file":"TxRef.js","names":["Effect","dual","pipeArguments","TypeId","make","initial","sync","makeUnsafe","pending","Map","pipe","arguments","version","value","modify","self","f","Transaction","asEffect","flatMap","state","journal","has","set","current","get","returnValue","next","tx","update"],"sources":["../src/TxRef.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;AAUA,OAAO,KAAKA,MAAM,MAAM,aAAa;AACrC,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,aAAa,QAAQ,eAAe;AAI7C,MAAMC,MAAM,GAAG,4BAA4B;AAuC3C;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,OAAO,MAAMC,IAAI,GAAOC,OAAU,IAAKL,MAAM,CAACM,IAAI,CAAC,MAAMC,UAAU,CAACF,OAAO,CAAC,CAAC;AAE7E;;;;;;;;;;;;;;;;;;AAkBA,OAAO,MAAME,UAAU,GAAOF,OAAU,KAAgB;EACtD,CAACF,MAAM,GAAGA,MAAM;EAChBK,OAAO,EAAE,IAAIC,GAAG,EAAE;EAClBC,IAAIA,CAAA;IACF,OAAOR,aAAa,CAAC,IAAI,EAAES,SAAS,CAAC;EACvC,CAAC;EACDC,OAAO,EAAE,CAAC;EACVC,KAAK,EAAER;CACR,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;AAoBA,OAAO,MAAMS,MAAM,gBA2Cfb,IAAI,CAAC,CAAC,EAAE,CACVc,IAAc,EACdC,CAAgD,KAEhDhB,MAAM,CAACiB,WAAW,CAACC,QAAQ,EAAE,CAACR,IAAI,CAChCV,MAAM,CAACmB,OAAO,CAAEC,KAAK,IACnBpB,MAAM,CAACM,IAAI,CAAC,MAAK;EACf,IAAI,CAACc,KAAK,CAACC,OAAO,CAACC,GAAG,CAACP,IAAI,CAAC,EAAE;IAC5BK,KAAK,CAACC,OAAO,CAACE,GAAG,CAACR,IAAI,EAAE;MAAEH,OAAO,EAAEG,IAAI,CAACH,OAAO;MAAEC,KAAK,EAAEE,IAAI,CAACF;IAAK,CAAE,CAAC;EACvE;EACA,MAAMW,OAAO,GAAGJ,KAAK,CAACC,OAAO,CAACI,GAAG,CAACV,IAAI,CAAE;EACxC,MAAM,CAACW,WAAW,EAAEC,IAAI,CAAC,GAAGX,CAAC,CAACQ,OAAO,CAACX,KAAK,CAAC;EAC5CW,OAAO,CAACX,KAAK,GAAGc,IAAI;EACpB,OAAOD,WAAW;AACpB,CAAC,CAAC,CACH,EACD1B,MAAM,CAAC4B,EAAE,CACV,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,MAAM,gBA6Cf5B,IAAI,CAAC,CAAC,EAAE,CACVc,IAAc,EACdC,CAAoB,KACIF,MAAM,CAACC,IAAI,EAAGS,OAAO,IAAK,CAAC,KAAK,CAAC,EAAER,CAAC,CAACQ,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMC,GAAG,GAAOV,IAAc,IAAuBD,MAAM,CAACC,IAAI,EAAGS,OAAO,IAAK,CAACA,OAAO,EAAEA,OAAO,CAAC,CAAC;AAEzG;;;;;;;;;;;;;;;;;;;;;AAqBA,OAAO,MAAMD,GAAG,gBA6CZtB,IAAI,CAAC,CAAC,EAAE,CACVc,IAAc,EACdF,KAAQ,KACgBgB,MAAM,CAACd,IAAI,EAAE,MAAMF,KAAK,CAAC,CAAC","ignoreList":[]}
|
package/dist/TxSemaphore.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export interface TxSemaphore extends Inspectable, Pipeable {
|
|
|
71
71
|
* @since 4.0.0
|
|
72
72
|
* @category constructors
|
|
73
73
|
*/
|
|
74
|
-
export declare const make: (permits: number) => Effect.Effect<TxSemaphore
|
|
74
|
+
export declare const make: (permits: number) => Effect.Effect<TxSemaphore>;
|
|
75
75
|
/**
|
|
76
76
|
* Gets the current number of available permits in the semaphore.
|
|
77
77
|
*
|
|
@@ -102,7 +102,7 @@ export declare const make: (permits: number) => Effect.Effect<TxSemaphore, never
|
|
|
102
102
|
* @since 4.0.0
|
|
103
103
|
* @category combinators
|
|
104
104
|
*/
|
|
105
|
-
export declare const available: (self: TxSemaphore) => Effect.Effect<number
|
|
105
|
+
export declare const available: (self: TxSemaphore) => Effect.Effect<number>;
|
|
106
106
|
/**
|
|
107
107
|
* Gets the maximum capacity (total permits) of the semaphore.
|
|
108
108
|
*
|
|
@@ -160,7 +160,7 @@ export declare const capacity: (self: TxSemaphore) => Effect.Effect<number>;
|
|
|
160
160
|
* @since 4.0.0
|
|
161
161
|
* @category combinators
|
|
162
162
|
*/
|
|
163
|
-
export declare const acquire: (self: TxSemaphore) => Effect.Effect<void
|
|
163
|
+
export declare const acquire: (self: TxSemaphore) => Effect.Effect<void>;
|
|
164
164
|
/**
|
|
165
165
|
* Acquires the specified number of permits from the semaphore. If not enough
|
|
166
166
|
* permits are available, the effect will block until they become available.
|
|
@@ -188,7 +188,7 @@ export declare const acquire: (self: TxSemaphore) => Effect.Effect<void, never,
|
|
|
188
188
|
* @since 4.0.0
|
|
189
189
|
* @category combinators
|
|
190
190
|
*/
|
|
191
|
-
export declare const acquireN: (self: TxSemaphore, n: number) => Effect.Effect<void
|
|
191
|
+
export declare const acquireN: (self: TxSemaphore, n: number) => Effect.Effect<void>;
|
|
192
192
|
/**
|
|
193
193
|
* Tries to acquire a single permit from the semaphore without blocking.
|
|
194
194
|
* Returns true if successful, false if no permits are available.
|
|
@@ -216,7 +216,7 @@ export declare const acquireN: (self: TxSemaphore, n: number) => Effect.Effect<v
|
|
|
216
216
|
* @since 4.0.0
|
|
217
217
|
* @category combinators
|
|
218
218
|
*/
|
|
219
|
-
export declare const tryAcquire: (self: TxSemaphore) => Effect.Effect<boolean
|
|
219
|
+
export declare const tryAcquire: (self: TxSemaphore) => Effect.Effect<boolean>;
|
|
220
220
|
/**
|
|
221
221
|
* Tries to acquire the specified number of permits from the semaphore without blocking.
|
|
222
222
|
* Returns true if successful, false if not enough permits are available.
|
|
@@ -245,7 +245,7 @@ export declare const tryAcquire: (self: TxSemaphore) => Effect.Effect<boolean, n
|
|
|
245
245
|
* @since 4.0.0
|
|
246
246
|
* @category combinators
|
|
247
247
|
*/
|
|
248
|
-
export declare const tryAcquireN: (self: TxSemaphore, n: number) => Effect.Effect<boolean
|
|
248
|
+
export declare const tryAcquireN: (self: TxSemaphore, n: number) => Effect.Effect<boolean>;
|
|
249
249
|
/**
|
|
250
250
|
* Releases a single permit back to the semaphore, making it available for acquisition.
|
|
251
251
|
*
|
|
@@ -274,7 +274,7 @@ export declare const tryAcquireN: (self: TxSemaphore, n: number) => Effect.Effec
|
|
|
274
274
|
* @since 4.0.0
|
|
275
275
|
* @category combinators
|
|
276
276
|
*/
|
|
277
|
-
export declare const release: (self: TxSemaphore) => Effect.Effect<void
|
|
277
|
+
export declare const release: (self: TxSemaphore) => Effect.Effect<void>;
|
|
278
278
|
/**
|
|
279
279
|
* Releases the specified number of permits back to the semaphore.
|
|
280
280
|
*
|
|
@@ -304,7 +304,7 @@ export declare const release: (self: TxSemaphore) => Effect.Effect<void, never,
|
|
|
304
304
|
* @since 4.0.0
|
|
305
305
|
* @category combinators
|
|
306
306
|
*/
|
|
307
|
-
export declare const releaseN: (self: TxSemaphore, n: number) => Effect.Effect<void
|
|
307
|
+
export declare const releaseN: (self: TxSemaphore, n: number) => Effect.Effect<void>;
|
|
308
308
|
/**
|
|
309
309
|
* Executes an effect with a single permit from the semaphore. The permit is
|
|
310
310
|
* automatically acquired before execution and released afterwards, even if the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxSemaphore.d.ts","sourceRoot":"","sources":["../src/TxSemaphore.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,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W,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAiBxF,CAAA;AAET;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,WAAW,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAIxF,CAAA;AAEH;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,aAAa,GAAI,GAAG,OAAO,KAAG,CAAC,IAAI,WAAqC,CAAA"}
|
package/dist/TxSemaphore.js
CHANGED
|
@@ -64,7 +64,7 @@ export const make = permits => Effect.gen(function* () {
|
|
|
64
64
|
}
|
|
65
65
|
const permitsRef = yield* TxRef.make(permits);
|
|
66
66
|
return makeTxSemaphore(permitsRef, permits);
|
|
67
|
-
});
|
|
67
|
+
}).pipe(Effect.tx);
|
|
68
68
|
/**
|
|
69
69
|
* Gets the current number of available permits in the semaphore.
|
|
70
70
|
*
|
|
@@ -156,10 +156,10 @@ export const capacity = self => Effect.succeed(self.capacity);
|
|
|
156
156
|
export const acquire = self => Effect.gen(function* () {
|
|
157
157
|
const permits = yield* TxRef.get(self.permitsRef);
|
|
158
158
|
if (permits <= 0) {
|
|
159
|
-
return yield* Effect.
|
|
159
|
+
return yield* Effect.txRetry;
|
|
160
160
|
}
|
|
161
161
|
yield* TxRef.set(self.permitsRef, permits - 1);
|
|
162
|
-
});
|
|
162
|
+
}).pipe(Effect.tx);
|
|
163
163
|
/**
|
|
164
164
|
* Acquires the specified number of permits from the semaphore. If not enough
|
|
165
165
|
* permits are available, the effect will block until they become available.
|
|
@@ -194,10 +194,10 @@ export const acquireN = (self, n) => {
|
|
|
194
194
|
return Effect.gen(function* () {
|
|
195
195
|
const permits = yield* TxRef.get(self.permitsRef);
|
|
196
196
|
if (permits < n) {
|
|
197
|
-
return yield* Effect.
|
|
197
|
+
return yield* Effect.txRetry;
|
|
198
198
|
}
|
|
199
199
|
yield* TxRef.set(self.permitsRef, permits - n);
|
|
200
|
-
});
|
|
200
|
+
}).pipe(Effect.tx);
|
|
201
201
|
};
|
|
202
202
|
/**
|
|
203
203
|
* Tries to acquire a single permit from the semaphore without blocking.
|
|
@@ -379,10 +379,10 @@ export const releaseN = (self, n) => {
|
|
|
379
379
|
export const withPermit = (...args) => {
|
|
380
380
|
if (args.length === 1) {
|
|
381
381
|
const [self] = args;
|
|
382
|
-
return effect => Effect.acquireUseRelease(
|
|
382
|
+
return effect => Effect.acquireUseRelease(acquire(self), () => effect, () => release(self));
|
|
383
383
|
}
|
|
384
384
|
const [self, effect] = args;
|
|
385
|
-
return Effect.acquireUseRelease(
|
|
385
|
+
return Effect.acquireUseRelease(acquire(self), () => effect, () => release(self));
|
|
386
386
|
};
|
|
387
387
|
/**
|
|
388
388
|
* Executes an effect with the specified number of permits from the semaphore.
|
|
@@ -426,10 +426,10 @@ export const withPermit = (...args) => {
|
|
|
426
426
|
export const withPermits = (...args) => {
|
|
427
427
|
if (args.length === 2) {
|
|
428
428
|
const [self, n] = args;
|
|
429
|
-
return effect => Effect.acquireUseRelease(
|
|
429
|
+
return effect => Effect.acquireUseRelease(acquireN(self, n), () => effect, () => releaseN(self, n));
|
|
430
430
|
}
|
|
431
431
|
const [self, n, effect] = args;
|
|
432
|
-
return Effect.acquireUseRelease(
|
|
432
|
+
return Effect.acquireUseRelease(acquireN(self, n), () => effect, () => releaseN(self, n));
|
|
433
433
|
};
|
|
434
434
|
/**
|
|
435
435
|
* Acquires a single permit from the semaphore in a scoped manner. The permit
|
|
@@ -470,7 +470,7 @@ export const withPermits = (...args) => {
|
|
|
470
470
|
* @since 4.0.0
|
|
471
471
|
* @category combinators
|
|
472
472
|
*/
|
|
473
|
-
export const withPermitScoped = self => Effect.acquireRelease(
|
|
473
|
+
export const withPermitScoped = self => Effect.acquireRelease(acquire(self), () => release(self));
|
|
474
474
|
/**
|
|
475
475
|
* Determines if the provided value is a TxSemaphore.
|
|
476
476
|
*
|
package/dist/TxSemaphore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxSemaphore.js","names":["Effect","NodeInspectSymbol","toJson","pipeArguments","hasProperty","TxRef","TypeId","TxSemaphoreProto","toJSON","_id","capacity","pipe","arguments","makeTxSemaphore","permitsRef","self","Object","create","make","permits","gen","die","Error","available","get","succeed","acquire","
|
|
1
|
+
{"version":3,"file":"TxSemaphore.js","names":["Effect","NodeInspectSymbol","toJson","pipeArguments","hasProperty","TxRef","TypeId","TxSemaphoreProto","toJSON","_id","capacity","pipe","arguments","makeTxSemaphore","permitsRef","self","Object","create","make","permits","gen","die","Error","tx","available","get","succeed","acquire","txRetry","set","acquireN","n","tryAcquire","modify","tryAcquireN","release","update","releaseN","newPermits","withPermit","args","length","effect","acquireUseRelease","withPermits","withPermitScoped","acquireRelease","isTxSemaphore","u"],"sources":["../src/TxSemaphore.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA,OAAO,KAAKA,MAAM,MAAM,aAAa;AAErC,SAASC,iBAAiB,EAAEC,MAAM,QAAQ,kBAAkB;AAE5D,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,OAAO,KAAKC,KAAK,MAAM,YAAY;AAEnC,MAAMC,MAAM,GAAG,kCAAkC;AAqCjD,MAAMC,gBAAgB,GAAiE;EACrF,CAACN,iBAAiB,IAAC;IACjB,OAAOC,MAAM,CAAC,IAAI,CAAC;EACrB,CAAC;EACDM,MAAMA,CAAA;IACJ,OAAO;MACLC,GAAG,EAAE,aAAa;MAClBC,QAAQ,EAAE,IAAI,CAACA;KAChB;EACH,CAAC;EACDC,IAAIA,CAAA;IACF,OAAOR,aAAa,CAAC,IAAI,EAAES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nB,OAAO,CAACZ,IAAI,CAAC,EACb,MAAMoB,OAAO,CAACpB,IAAI,CAAC,CACpB;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,OAAO,MAAMgC,aAAa,GAAIC,CAAU,IAAuB5C,WAAW,CAAC4C,CAAC,EAAE1C,MAAM,CAAC","ignoreList":[]}
|
|
@@ -60,7 +60,7 @@ export interface TxSubscriptionRef<in out A> extends Inspectable, Pipeable {
|
|
|
60
60
|
* @since 4.0.0
|
|
61
61
|
* @category constructors
|
|
62
62
|
*/
|
|
63
|
-
export declare const make: <A>(value: A) => Effect.Effect<TxSubscriptionRef<A
|
|
63
|
+
export declare const make: <A>(value: A) => Effect.Effect<TxSubscriptionRef<A>>;
|
|
64
64
|
/**
|
|
65
65
|
* Reads the current value of the TxSubscriptionRef.
|
|
66
66
|
*
|
|
@@ -78,7 +78,7 @@ export declare const make: <A>(value: A) => Effect.Effect<TxSubscriptionRef<A>,
|
|
|
78
78
|
* @since 4.0.0
|
|
79
79
|
* @category getters
|
|
80
80
|
*/
|
|
81
|
-
export declare const get: <A>(self: TxSubscriptionRef<A>) => Effect.Effect<A
|
|
81
|
+
export declare const get: <A>(self: TxSubscriptionRef<A>) => Effect.Effect<A>;
|
|
82
82
|
/**
|
|
83
83
|
* Modifies the value of the TxSubscriptionRef using a function that returns both a
|
|
84
84
|
* result and the new value. The new value is published to all subscribers atomically.
|
|
@@ -118,7 +118,7 @@ export declare const modify: {
|
|
|
118
118
|
* @since 4.0.0
|
|
119
119
|
* @category mutations
|
|
120
120
|
*/
|
|
121
|
-
<A, B>(f: (current: A) => [returnValue: B, newValue: A]): (self: TxSubscriptionRef<A>) => Effect.Effect<B
|
|
121
|
+
<A, B>(f: (current: A) => [returnValue: B, newValue: A]): (self: TxSubscriptionRef<A>) => Effect.Effect<B>;
|
|
122
122
|
/**
|
|
123
123
|
* Modifies the value of the TxSubscriptionRef using a function that returns both a
|
|
124
124
|
* result and the new value. The new value is published to all subscribers atomically.
|
|
@@ -138,7 +138,7 @@ export declare const modify: {
|
|
|
138
138
|
* @since 4.0.0
|
|
139
139
|
* @category mutations
|
|
140
140
|
*/
|
|
141
|
-
<A, B>(self: TxSubscriptionRef<A>, f: (current: A) => [returnValue: B, newValue: A]): Effect.Effect<B
|
|
141
|
+
<A, B>(self: TxSubscriptionRef<A>, f: (current: A) => [returnValue: B, newValue: A]): Effect.Effect<B>;
|
|
142
142
|
};
|
|
143
143
|
/**
|
|
144
144
|
* Sets the value of the TxSubscriptionRef and publishes the new value to all subscribers.
|
|
@@ -175,7 +175,7 @@ export declare const set: {
|
|
|
175
175
|
* @since 4.0.0
|
|
176
176
|
* @category mutations
|
|
177
177
|
*/
|
|
178
|
-
<A>(value: A): (self: TxSubscriptionRef<A>) => Effect.Effect<void
|
|
178
|
+
<A>(value: A): (self: TxSubscriptionRef<A>) => Effect.Effect<void>;
|
|
179
179
|
/**
|
|
180
180
|
* Sets the value of the TxSubscriptionRef and publishes the new value to all subscribers.
|
|
181
181
|
*
|
|
@@ -193,7 +193,7 @@ export declare const set: {
|
|
|
193
193
|
* @since 4.0.0
|
|
194
194
|
* @category mutations
|
|
195
195
|
*/
|
|
196
|
-
<A>(self: TxSubscriptionRef<A>, value: A): Effect.Effect<void
|
|
196
|
+
<A>(self: TxSubscriptionRef<A>, value: A): Effect.Effect<void>;
|
|
197
197
|
};
|
|
198
198
|
/**
|
|
199
199
|
* Updates the value of the TxSubscriptionRef using a function and publishes the new
|
|
@@ -232,7 +232,7 @@ export declare const update: {
|
|
|
232
232
|
* @since 4.0.0
|
|
233
233
|
* @category mutations
|
|
234
234
|
*/
|
|
235
|
-
<A>(f: (current: A) => A): (self: TxSubscriptionRef<A>) => Effect.Effect<void
|
|
235
|
+
<A>(f: (current: A) => A): (self: TxSubscriptionRef<A>) => Effect.Effect<void>;
|
|
236
236
|
/**
|
|
237
237
|
* Updates the value of the TxSubscriptionRef using a function and publishes the new
|
|
238
238
|
* value to all subscribers.
|
|
@@ -251,7 +251,7 @@ export declare const update: {
|
|
|
251
251
|
* @since 4.0.0
|
|
252
252
|
* @category mutations
|
|
253
253
|
*/
|
|
254
|
-
<A>(self: TxSubscriptionRef<A>, f: (current: A) => A): Effect.Effect<void
|
|
254
|
+
<A>(self: TxSubscriptionRef<A>, f: (current: A) => A): Effect.Effect<void>;
|
|
255
255
|
};
|
|
256
256
|
/**
|
|
257
257
|
* Gets the current value and sets a new value atomically. Publishes the new value
|
|
@@ -292,7 +292,7 @@ export declare const getAndSet: {
|
|
|
292
292
|
* @since 4.0.0
|
|
293
293
|
* @category mutations
|
|
294
294
|
*/
|
|
295
|
-
<A>(value: A): (self: TxSubscriptionRef<A>) => Effect.Effect<A
|
|
295
|
+
<A>(value: A): (self: TxSubscriptionRef<A>) => Effect.Effect<A>;
|
|
296
296
|
/**
|
|
297
297
|
* Gets the current value and sets a new value atomically. Publishes the new value
|
|
298
298
|
* to all subscribers.
|
|
@@ -312,7 +312,7 @@ export declare const getAndSet: {
|
|
|
312
312
|
* @since 4.0.0
|
|
313
313
|
* @category mutations
|
|
314
314
|
*/
|
|
315
|
-
<A>(self: TxSubscriptionRef<A>, value: A): Effect.Effect<A
|
|
315
|
+
<A>(self: TxSubscriptionRef<A>, value: A): Effect.Effect<A>;
|
|
316
316
|
};
|
|
317
317
|
/**
|
|
318
318
|
* Gets the current value and updates it using a function atomically. Publishes
|
|
@@ -353,7 +353,7 @@ export declare const getAndUpdate: {
|
|
|
353
353
|
* @since 4.0.0
|
|
354
354
|
* @category mutations
|
|
355
355
|
*/
|
|
356
|
-
<A>(f: (current: A) => A): (self: TxSubscriptionRef<A>) => Effect.Effect<A
|
|
356
|
+
<A>(f: (current: A) => A): (self: TxSubscriptionRef<A>) => Effect.Effect<A>;
|
|
357
357
|
/**
|
|
358
358
|
* Gets the current value and updates it using a function atomically. Publishes
|
|
359
359
|
* the new value to all subscribers.
|
|
@@ -373,7 +373,7 @@ export declare const getAndUpdate: {
|
|
|
373
373
|
* @since 4.0.0
|
|
374
374
|
* @category mutations
|
|
375
375
|
*/
|
|
376
|
-
<A>(self: TxSubscriptionRef<A>, f: (current: A) => A): Effect.Effect<A
|
|
376
|
+
<A>(self: TxSubscriptionRef<A>, f: (current: A) => A): Effect.Effect<A>;
|
|
377
377
|
};
|
|
378
378
|
/**
|
|
379
379
|
* Updates the value using a function and returns the new value. Publishes the
|
|
@@ -412,7 +412,7 @@ export declare const updateAndGet: {
|
|
|
412
412
|
* @since 4.0.0
|
|
413
413
|
* @category mutations
|
|
414
414
|
*/
|
|
415
|
-
<A>(f: (current: A) => A): (self: TxSubscriptionRef<A>) => Effect.Effect<A
|
|
415
|
+
<A>(f: (current: A) => A): (self: TxSubscriptionRef<A>) => Effect.Effect<A>;
|
|
416
416
|
/**
|
|
417
417
|
* Updates the value using a function and returns the new value. Publishes the
|
|
418
418
|
* new value to all subscribers.
|
|
@@ -431,7 +431,7 @@ export declare const updateAndGet: {
|
|
|
431
431
|
* @since 4.0.0
|
|
432
432
|
* @category mutations
|
|
433
433
|
*/
|
|
434
|
-
<A>(self: TxSubscriptionRef<A>, f: (current: A) => A): Effect.Effect<A
|
|
434
|
+
<A>(self: TxSubscriptionRef<A>, f: (current: A) => A): Effect.Effect<A>;
|
|
435
435
|
};
|
|
436
436
|
/**
|
|
437
437
|
* Subscribes to all changes of the TxSubscriptionRef. Returns a scoped TxDequeue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxSubscriptionRef.d.ts","sourceRoot":"","sources":["../src/TxSubscriptionRef.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAG7C,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,OA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(Effect.tx);
|
|
62
62
|
// =============================================================================
|
|
63
63
|
// Getters
|
|
64
64
|
// =============================================================================
|
|
@@ -108,7 +108,7 @@ export const modify = /*#__PURE__*/dual(2, (self, f) => Effect.gen(function* ()
|
|
|
108
108
|
yield* TxRef.set(self.ref, newValue);
|
|
109
109
|
yield* TxPubSub.publish(self.pubsub, newValue);
|
|
110
110
|
return returnValue;
|
|
111
|
-
}));
|
|
111
|
+
}).pipe(Effect.tx));
|
|
112
112
|
/**
|
|
113
113
|
* Sets the value of the TxSubscriptionRef and publishes the new value to all subscribers.
|
|
114
114
|
*
|
|
@@ -239,12 +239,12 @@ export const updateAndGet = /*#__PURE__*/dual(2, (self, f) => modify(self, curre
|
|
|
239
239
|
* @since 4.0.0
|
|
240
240
|
* @category subscriptions
|
|
241
241
|
*/
|
|
242
|
-
export const changes = self => Effect.acquireRelease(Effect.
|
|
242
|
+
export const changes = self => Effect.acquireRelease(Effect.tx(Effect.gen(function* () {
|
|
243
243
|
const sub = yield* TxPubSub.acquireSubscriber(self.pubsub);
|
|
244
244
|
const current = yield* TxRef.get(self.ref);
|
|
245
245
|
yield* TxQueue.offer(sub, current);
|
|
246
246
|
return sub;
|
|
247
|
-
})), queue => Effect.
|
|
247
|
+
})), queue => Effect.tx(TxPubSub.releaseSubscriber(self.pubsub, queue)));
|
|
248
248
|
/**
|
|
249
249
|
* Returns a Stream of all changes to the TxSubscriptionRef, starting with the
|
|
250
250
|
* current value followed by every subsequent update.
|
|
@@ -268,7 +268,7 @@ export const changes = self => Effect.acquireRelease(Effect.transaction(Effect.g
|
|
|
268
268
|
* @since 4.0.0
|
|
269
269
|
* @category subscriptions
|
|
270
270
|
*/
|
|
271
|
-
export const changesStream = self => Stream.unwrap(Effect.map(changes(self), sub => Stream.fromEffectRepeat(Effect.
|
|
271
|
+
export const changesStream = self => Stream.unwrap(Effect.map(changes(self), sub => Stream.fromEffectRepeat(Effect.tx(TxQueue.take(sub)))));
|
|
272
272
|
// =============================================================================
|
|
273
273
|
// Guards
|
|
274
274
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TxSubscriptionRef.js","names":["Effect","dual","NodeInspectSymbol","toJson","pipeArguments","hasProperty","Stream","TxPubSub","TxQueue","TxRef","TypeId","TxSubscriptionRefProto","toJSON","_id","toString","pipe","arguments","make","value","gen","ref","pubsub","unbounded","self","Object","create","get","modify","f","current","returnValue","newValue","set","publish","update","getAndSet","getAndUpdate","updateAndGet","changes","acquireRelease","
|
|
1
|
+
{"version":3,"file":"TxSubscriptionRef.js","names":["Effect","dual","NodeInspectSymbol","toJson","pipeArguments","hasProperty","Stream","TxPubSub","TxQueue","TxRef","TypeId","TxSubscriptionRefProto","toJSON","_id","toString","pipe","arguments","make","value","gen","ref","pubsub","unbounded","self","Object","create","tx","get","modify","f","current","returnValue","newValue","set","publish","update","getAndSet","getAndUpdate","updateAndGet","changes","acquireRelease","sub","acquireSubscriber","offer","queue","releaseSubscriber","changesStream","unwrap","map","fromEffectRepeat","take","isTxSubscriptionRef","u"],"sources":["../src/TxSubscriptionRef.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;AAMA,OAAO,KAAKA,MAAM,MAAM,aAAa;AACrC,SAASC,IAAI,QAAQ,eAAe;AAEpC,SAASC,iBAAiB,EAAEC,MAAM,QAAQ,kBAAkB;AAE5D,SAASC,aAAa,QAAQ,eAAe;AAC7C,SAASC,WAAW,QAAQ,gBAAgB;AAE5C,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAO,KAAKC,QAAQ,MAAM,eAAe;AACzC,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,OAAO,KAAKC,KAAK,MAAM,YAAY;AAEnC,MAAMC,MAAM,GAAG,wCAAwC;AAuCvD,MAAMC,sBAAsB,GAAmE;EAC7F,CAACT,iBAAiB,IAAC;IACjB,OAAOC,MAAM,CAAC,IAAI,CAAC;EACrB,CAAC;EACDS,MAAMA,CAAA;IACJ,OAAO;MAAE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ict equality (`===`) → {@link strictEqual}
|
|
1058
1058
|
* - Combining multiple equivalences (AND logic) → {@link combine}, {@link combineAll}
|
|
1059
1059
|
* - Transforming input before comparison → {@link mapInput}
|
|
1060
|
-
* - Creating equivalences for structured types → {@link Struct}, {@link Tuple}, {@link
|
|
1060
|
+
* - Creating equivalences for structured types → {@link Struct}, {@link Tuple}, {@link Array_}, {@link Record}
|
|
1061
1061
|
*
|
|
1062
1062
|
* ## Gotchas
|
|
1063
1063
|
*
|
|
@@ -1085,7 +1085,7 @@ export * as Equal from "./Equal.ts";
|
|
|
1085
1085
|
* ## See also
|
|
1086
1086
|
*
|
|
1087
1087
|
* - {@link Equal} - For structural equality (can convert to Equivalence)
|
|
1088
|
-
* - {@link
|
|
1088
|
+
* - {@link Array_.dedupeWith} - Remove duplicates using an equivalence
|
|
1089
1089
|
* - {@link Chunk} - Collections that use equivalences for operations
|
|
1090
1090
|
*
|
|
1091
1091
|
* @since 2.0.0
|
|
@@ -3172,7 +3172,7 @@ export * as Scheduler from "./Scheduler.ts";
|
|
|
3172
3172
|
*
|
|
3173
3173
|
* - Define a struct: {@link Struct}
|
|
3174
3174
|
* - Define a union: {@link Union}, {@link TaggedUnion}, {@link Literals}
|
|
3175
|
-
* - Define an array: {@link
|
|
3175
|
+
* - Define an array: {@link ArraySchema}, {@link NonEmptyArray}
|
|
3176
3176
|
* - Define a record: {@link Record}
|
|
3177
3177
|
* - Define a tuple: {@link Tuple}, {@link TupleWithRest}
|
|
3178
3178
|
* - Validate unknown data synchronously: {@link decodeUnknownSync}
|
|
@@ -3915,7 +3915,7 @@ export * as Tuple from "./Tuple.ts";
|
|
|
3915
3915
|
*
|
|
3916
3916
|
* Accessed values are tracked by the transaction in order to detect conflicts and to track changes.
|
|
3917
3917
|
* A transaction will retry whenever a conflict is detected or whenever the transaction explicitly
|
|
3918
|
-
* calls `Effect.
|
|
3918
|
+
* calls `Effect.txRetry` and any of the accessed TxChunk values change.
|
|
3919
3919
|
*
|
|
3920
3920
|
* @since 4.0.0
|
|
3921
3921
|
*/
|
|
@@ -3959,7 +3959,7 @@ export * as TxPubSub from "./TxPubSub.ts";
|
|
|
3959
3959
|
*
|
|
3960
3960
|
* Accessed values are tracked by the transaction in order to detect conflicts and to track changes.
|
|
3961
3961
|
* A transaction will retry whenever a conflict is detected or whenever the transaction explicitly
|
|
3962
|
-
* calls `Effect.
|
|
3962
|
+
* calls `Effect.txRetry` and any of the accessed TxQueue values change.
|
|
3963
3963
|
*
|
|
3964
3964
|
* @since 4.0.0
|
|
3965
3965
|
*/
|
|
@@ -3978,7 +3978,7 @@ export * as TxReentrantLock from "./TxReentrantLock.ts";
|
|
|
3978
3978
|
*
|
|
3979
3979
|
* Accessed values are tracked by the transaction in order to detect conflicts and in order to
|
|
3980
3980
|
* track changes, a transaction will retry whenever a conflict is detected or whenever the
|
|
3981
|
-
* transaction explicitely calls to `Effect.
|
|
3981
|
+
* transaction explicitely calls to `Effect.txRetry` and any of the accessed TxRef values
|
|
3982
3982
|
* change.
|
|
3983
3983
|
*
|
|
3984
3984
|
* @since 4.0.0
|
package/dist/index.js
CHANGED
|
@@ -1058,7 +1058,7 @@ export * as Equal from "./Equal.js";
|
|
|
1058
1058
|
* - Using strict equality (`===`) → {@link strictEqual}
|
|
1059
1059
|
* - Combining multiple equivalences (AND logic) → {@link combine}, {@link combineAll}
|
|
1060
1060
|
* - Transforming input before comparison → {@link mapInput}
|
|
1061
|
-
* - Creating equivalences for structured types → {@link Struct}, {@link Tuple}, {@link
|
|
1061
|
+
* - Creating equivalences for structured types → {@link Struct}, {@link Tuple}, {@link Array_}, {@link Record}
|
|
1062
1062
|
*
|
|
1063
1063
|
* ## Gotchas
|
|
1064
1064
|
*
|
|
@@ -1086,7 +1086,7 @@ export * as Equal from "./Equal.js";
|
|
|
1086
1086
|
* ## See also
|
|
1087
1087
|
*
|
|
1088
1088
|
* - {@link Equal} - For structural equality (can convert to Equivalence)
|
|
1089
|
-
* - {@link
|
|
1089
|
+
* - {@link Array_.dedupeWith} - Remove duplicates using an equivalence
|
|
1090
1090
|
* - {@link Chunk} - Collections that use equivalences for operations
|
|
1091
1091
|
*
|
|
1092
1092
|
* @since 2.0.0
|
|
@@ -3173,7 +3173,7 @@ export * as Scheduler from "./Scheduler.js";
|
|
|
3173
3173
|
*
|
|
3174
3174
|
* - Define a struct: {@link Struct}
|
|
3175
3175
|
* - Define a union: {@link Union}, {@link TaggedUnion}, {@link Literals}
|
|
3176
|
-
* - Define an array: {@link
|
|
3176
|
+
* - Define an array: {@link ArraySchema}, {@link NonEmptyArray}
|
|
3177
3177
|
* - Define a record: {@link Record}
|
|
3178
3178
|
* - Define a tuple: {@link Tuple}, {@link TupleWithRest}
|
|
3179
3179
|
* - Validate unknown data synchronously: {@link decodeUnknownSync}
|
|
@@ -3916,7 +3916,7 @@ export * as Tuple from "./Tuple.js";
|
|
|
3916
3916
|
*
|
|
3917
3917
|
* Accessed values are tracked by the transaction in order to detect conflicts and to track changes.
|
|
3918
3918
|
* A transaction will retry whenever a conflict is detected or whenever the transaction explicitly
|
|
3919
|
-
* calls `Effect.
|
|
3919
|
+
* calls `Effect.txRetry` and any of the accessed TxChunk values change.
|
|
3920
3920
|
*
|
|
3921
3921
|
* @since 4.0.0
|
|
3922
3922
|
*/
|
|
@@ -3960,7 +3960,7 @@ export * as TxPubSub from "./TxPubSub.js";
|
|
|
3960
3960
|
*
|
|
3961
3961
|
* Accessed values are tracked by the transaction in order to detect conflicts and to track changes.
|
|
3962
3962
|
* A transaction will retry whenever a conflict is detected or whenever the transaction explicitly
|
|
3963
|
-
* calls `Effect.
|
|
3963
|
+
* calls `Effect.txRetry` and any of the accessed TxQueue values change.
|
|
3964
3964
|
*
|
|
3965
3965
|
* @since 4.0.0
|
|
3966
3966
|
*/
|
|
@@ -3979,7 +3979,7 @@ export * as TxReentrantLock from "./TxReentrantLock.js";
|
|
|
3979
3979
|
*
|
|
3980
3980
|
* Accessed values are tracked by the transaction in order to detect conflicts and in order to
|
|
3981
3981
|
* track changes, a transaction will retry whenever a conflict is detected or whenever the
|
|
3982
|
-
* transaction explicitely calls to `Effect.
|
|
3982
|
+
* transaction explicitely calls to `Effect.txRetry` and any of the accessed TxRef values
|
|
3983
3983
|
* change.
|
|
3984
3984
|
*
|
|
3985
3985
|
* @since 4.0.0
|